carbon-toolbox v1.0.0
Installation
This module is distributed via npm which is bundled with node and
should be installed as one of your project's devDependencies:
npm install --save-dev rendering-engine-toolboxUsage
This is a CLI and exposes a bin called toolbox-scripts. You'll find all available scripts in src/scripts.
Available scripts
To build the project run:
npm run buildTo inspect JS files of the project run:
npm run jsinspectTo check licence of the project run:
npm run licenceTo lint all JS files of project run:
npm run lintTo lint all style files run:
npm run stylelintTo run jest tests run:
npm run testTo start a storybook localy run:
npm run storybookBefore commit run :
npm run precommitOverriding Config
Unlike react-scripts, toolbox-scripts allows you to specify your own
configuration for things and have that plug directly into the way things work
with toolbox-scripts. There are various ways that it works, but basically if you
want to have your own config for something, just add the configuration and
toolbox-scripts will use that instead of it's own internal config. In addition,
toolbox-scripts exposes its configuration so you can use it and override only
the parts of the config you need to.
This can be a very helpful way to make editor integration work for tools like ESLint which require project-based ESLint configuration to be present to work.
So, if we were to do this for ESLint, you could create an .eslintrc with the
contents of:
{"extends": "./node_modules/rendering-engine-toolbox/eslint.js"}Or, for babel, a .babelrc with:
{"presets": ["rendering-engine-toolbox/babel"]}Or, for jest:
const {jest: jestConfig} = require('rendering-engine-toolbox/config')
module.exports = Object.assign(jestConfig, {
// your overrides here
// for test written in Typescript, add:
transform: {
'\\.(ts|tsx)$': '<rootDir>/node_modules/ts-jest/preprocessor.js',
},
})Note:
toolbox-scriptsintentionally does not merge things for you when you start configuring things to make it less magical and more straightforward. Extending can take place on your terms. I think this is actually a great way to do this.