Skip to content

asdelday/react-dumb-component

Repository files navigation

react-dumb-component

GitHub issues GitHub forks GitHub stars GitHub license

A personal boilerplate to create ReactJS dumb components quickly.

Table of Contents

  1. Installation
  2. Develop
  3. Demo
  4. Testing
  5. Create Version
  6. Build bundles
  7. TODO
  8. License

1. Installation

Install all the dependencies for the project.

npm install

2. Develop

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

3. Demo

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

4. Testing

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

5. Create Version

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"

6. Build bundles

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',
    },
  }

7. TODO

  • Document boilerplate
  • Clean project
  • Add CSS Preprocessor support
  • Add Test support
  • Add GitHub pages

8. License

react-dumb-component is available under MIT. See LICENSE for more details.

About

Boilerplate for ReactJS dumb components

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published