Skip to main content

Default Values

ยท 2 min read
Francisco Leonel Moreno Eraso

NPMโ€‹

In SetApp we focus on build the tools around technologies that we already use. One of them is NPM who is in charge of generate our package.json, so in a fresh machine with the default config, it would look like:

Default package.json

There is some config, like the description that is different between projects and because of that, it's taken care with our tool

Please Check the Docs ๐Ÿ™๐Ÿป

Please, check the Cli Commands documentation section for more info about this topic

On the other hand we have common info that we could be shared between projects, for some of them, like the License or the Version we have default values (ISC and 1.0.0). Other values like the Author are not even set.

info

This default behaviour could be changed! The following list of values could be set, and in fact, we recommend that!

Author Urlโ€‹

You could set your personal webpage

npm config set init-author-url="<URL>"

Licenseโ€‹

You could set a default license (current default value: ISC)

npm config set init-license="<LICENSE>"

Intial Versionโ€‹

You could set a default version (current default value: 1.0.0)

npm config set init-version="<VERSION>"

Author Emailโ€‹

You could set an author email to contact

npm config set init-author-email="<EMAIL>"

Author Nameโ€‹

You could set a default author name

npm config set init-author-name"<NAME>"

If we execute those commands the result will be a package.json similar to the next one:

Full package.json

READMEโ€‹

Not only that, other tools used in SetApp use these values, for example our README generator: readme-md-generator.

Beforeโ€‹

README

Afterโ€‹

README-FULL

Full Example Appโ€‹

Running a command similar to:

Example command

The README generated would look like:

Example README

Have in mind ๐Ÿ™๐Ÿป

More info will be added when we integrate with a Github repo, so the package.json and the README would have even more content