Oneezy
Oneezy

Reputation: 5023

How to configure/ customize the "bower init" and "npm init" options?

Whenever you write npm init or bower init inside your terminal, you're presented with a step-by-step walk through for initializing the package.json or bower.json files.


Default npm init and bower init configurations:

enter image description here


Customization?

It would be helpful to be able to customize this default configuration so you don't need to manually edit these files each time.

Upvotes: 0

Views: 831

Answers (2)

Andrew
Andrew

Reputation: 6514

I haven't looked into bower, but npm allows for some customization. The npm command npm config (see https://docs.npmjs.com/cli/config) allows hierarchical defaults for answers to questions in the npm init process. The --userconfig option can be used to specify config settings on a per-user basis. Some common examples include:

npm config set init.author.name "Guy Cool" --userconfig
npm config set init.author.email "[email protected]" --userconfig

Also, running npm init --yes will select defaults for all of the config settings that are set.

It appears that additional customization can also be done, although I haven't experimented with it. The official NPM website suggests creating an .npm-init.js file for more specific customizations (see the section labeled "customizing the init process").

The NPM package config can be used for setting up custom package.json files on a per-environment basis (see https://www.npmjs.com/package/config for more info).

Upvotes: 1

B. LORON
B. LORON

Reputation: 11

To change the version of your project, you can use:

npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease]
bower version versionNumber #To modify your bower.json

If you want to update both at the same time, you can use a gulp task.

Upvotes: 1

Related Questions