Easy way to create and share your boilerplate configs. One shared config to rule them all:loop::package:
The configuration files is an important part of your project, and as such, you may want to share it with other projects or people. Shareable configs allow you to publish your configuration settings on npm and have others download and use it in their projects.
npm install standard-shared-config
- Create
package.json
withname
,version
anddescription
. - Create
.config
directory and copy all the configuration files you want to share. - Create
.sharedconfig.yml
- file containing schema and rules for your shared configuration and specify the usage parameters. - Run
shared-config build
After completing the command execution, you will get the following structure inside the outputDir
:
bin/[you shared config name from package]
scripts.js
- Script commands which will be added to thepackage.json
, see.sharedconfig.yml
snapshots.js
- snapshots of config files fromsharedDir
index.js
- will be called when your config is applied to copy config files to the project
Now publish your shared configuration package to NPM!
- install your shared configuration package
- add script with your shared configuration package name to
package.json
scripts for creating sharable configuration files. - override parts of config files in
sharedDir
, if needed (.config
by default) - override package scripts in
.sharedconfig.yml
insharedDir
, if needed (.config
by default)
{
"scripts": {
"prepare:config": "my-shared-config"
}
}
Do not forget to add the shared configuration files in the
.gitignore
, because you no longer need them in the repository
Read the API documentation for more information.