kcd-common-tools
Common build tools for projects by Kent C. Dodds
Init tasks
This still needs a little bit of work, but here's some stuff you may want to do when starting a project with kcd-common-tools:
Install dependencies:
npm i -D [email protected] webpack webpack-dev-server karma karma-chai karma-mocha istanbul isparta karma-chrome-launcher karma-firefox-launcher babel babel-core babel-loader node-libs-browser mocha chai with-package sinon uglify-loader lodash karma-webpack karma-sinon sinon isparta-loader ghooks eslint eslint-loader codecov.io babel-eslint angular-mocks angular
Copy files and create symlinks
Note, this happens as part of the installation of kcd-common-tools
ln -s node_modules/kcd-common-tools/shared/link/editorconfig .editorconfig && ln -s node_modules/kcd-common-tools/shared/link/eslintignore .eslintignore && ln -s node_modules/kcd-common-tools/shared/link/gitignore .gitignore && ln -s node_modules/kcd-common-tools/shared/link/npmignore .npmignore
cp node_modules/kcd-common-tools/shared/copy/* .
Create webpack & karma overrides
Overrides exist in the package.json
under the property kcdCommon
. They can either be overrides themselves or point
to a file which contains the overrides. Examples of overrides:
Directly in package.json
As file
Forms of Overrides
Overrides can take several forms. You can have it be an object that is deep merged with the defaults for all environments. You can also nest overrides based on environment and have the overrides apply only for a particular NODE_ENV. For example:
Also, if you put your overrides in a separate file, you can make your overrides be a function which returns the resulting configuration (you manage merging yourself in this case). For example:
var _ = ;moduleexports = webpackOverrides; { var newConfig = _; // modifications return newConfig;}
Create scripts
Here are some handy scripts you may want to have: