Skip to content

One shared config to rule them all ➿📦

License

Notifications You must be signed in to change notification settings

keindev/standard-shared-config

Repository files navigation

Package logo

Build Status npm Standard Shared Config

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.

Install

npm install standard-shared-config

Usage

Create a shared configuration package

  • Create package.json with name, version and description.
  • 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 the package.json, see .sharedconfig.yml
  • snapshots.js - snapshots of config files from sharedDir
  • 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!

Use shared configuration

  • 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 in sharedDir, 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

API

Read the API documentation for more information.