A personal boilerplate to create ReactJS dumb components quickly.
Install all the dependencies for the project.
npm install
Runs a development server at https://localhost:8080 and use Hot Module Replacement. To override the default host and port through env (HOST, PORT)
npm start
Runs a server to show the library demo at https://localhost:8080. To override the default host and port through env (HOST, PORT)
npm run demo
Using Karma as test runner, mocha as test library and chai as assertions library.
To run test once:
npm test
To run tests with watcher:
npm run test:tdd
To run both:
npm run test:all
Updates /dist and package.json with the new package version and create a version tag to Git
npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease]
Example:
npm version patch -m "Upgrade to %s for reasons"
Generate library bundles without minification
npm run dist:normal
Generate library bundles minificated
npm run dist:min
Generate both, minificated and normal, library bundles
npm run dist
Important: Change package.json info to you own and change Library config at webpack.config.babel.js:
const config = {
paths: {
dist: path.join(ROOT_PATH, 'dist'),
src: path.join(ROOT_PATH, 'src'),
demo: path.join(ROOT_PATH, 'demo'),
dev: path.join(ROOT_PATH, 'src/app.js'),
},
filename: pkg.name,
library: 'DumbComponent',
};
Important: If you are using external dependencies, you will need to include them into webpack
externals. At /webpack/config.js
Like the example below:
externals: {
react: {
commonjs: 'react',
commonjs2: 'react',
amd: 'React',
root: 'React',
},
}
Document boilerplateClean projectAdd CSS Preprocessor supportAdd Test support- Add GitHub pages
react-dumb-component is available under MIT. See LICENSE for more details.