@cat-org/configs ·
Use to manage the multiple configs.
Install
yarn add @cat-org/configs --dev
Run command
Depend on the first argument, @cat-org/configs
will run the command, generate the config file and use the default option.
yarn configs babel
In this case, this will generate babel.config.js
and run babel src -d lib --verbose
.
You can also add other option to this command.
yarn configs babel -w
This command is equal to babel src -d lib --verbose -w
.
yarn configs exec custom-command argumentA argumentB --configs-files babel
This command will generate a babel
config when running your custom-command
. You can also use --configs-files babel,jest
to generate babel
and jest
at the same time.
Get the configs lint
yarn configs --info
Get the information about the config
By this option, you can get the detail of this config.
yarn configs babel --info
Download the packages from the config
yarn configs babel --install
In this case, this will run yarn install @babel/cli @babel/core @cat-org/babel-plugin-base --dev
.
Get help
yarn configs -h
Write config
This module use cosmiconfig to find the config file. The filename which is supported by cosmiconfig
can be used.
module.exports = {
// configsEnv is special key, this will give to the argument of the each config function
configsEnv: ['react'],
// overwrite the existing config by function
babel: config => { ... },
// overwrite the existing config by object
jest: {
config: config => { ... },
},
// add custom config, each field is optional
custom: {
aliase: 'babel', // run config with babel cli
getCli: () => 'path-to-cli', // cli path which is used to run the command
install: install => [ // install packages
...install,
'@cat-org/configs',
],
config: config => { // write the config
...config,
key: 'value',
},
ignore: ignore => [ // generate ignore file
...ignore,
'node_modules'
],
ignoreName: '.gitignore' // ignore filename
run: argv => [ // command to run
...argv,
'src',
'-d',
'lib',
],
env: { // run command with environment
NODE_ENV: 'development',
},
configFiles: { // link the config files. For example, `jest` need to run with `babel`, you need to add `babel: true`
eslint: true,
},
},
};