0.29.2 • Published 5 years ago

@dr-kobros/broilerplate v0.29.2

Weekly downloads
175
License
BSD-3-Clause
Repository
github
Last release
5 years ago

Broilerplate

What is it?

A reusable Webpack / React configuration toolbox / broilerplate.

Why is it?

I don't believe in create-react-app. You always end up ejecting, and I think that it is too naive. That is why I believe create-react-app-rewired, which is a great tool, is doomed to fail.

My own previous reusable broilerplates have all failed. Some believe that all broilerplate projects are doomed to fail.

Still, mostly everything Webpack and broilerplate stuff are copy-paste. Making a webpack config is not hard per se, what is hard is to know and understand all the caveats. This knowledge also grows by doing, thus causing somewhat hidden technical debt in older projects.

Broilerplate offers a thin abstraction over Webpack. It has features that enable loaders and plugins, and a two by two matrix of feature sets: development / production + client / server.

From these combinations Broilerplate "just knows" how to configure your application.

  • Production grade settings from the get go.
  • Re-configure / remove / add anything
  • Never eject

And so forth. Will write good instructions when thoughts are validated.

How?

Initialize a project

  • yarn init

Add Broilerplate and all it's peer dependencies

Add broilerplate and all it's peer dependencies, somehow. This script will do.

(
  export PKG=@dr-kobros/broilerplate;
  npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs yarn add --dev "$PKG@latest"
)

Initialize Broilerplate

This will create the two base files for Broilerplate, .broilerplate.js and webpack.config.babel.js

  • yarn run broilerplate

Tune your configuration

Broilerplate's default configuration is a sane one, but you may edit .broilerplate.js to add and / or remove some features.

Add package scripts

Edit your package.json to contain the following scripts:

"scripts": {
  "start": "cross-env NODE_ENV=development webpack-dev-server --port 9000 --history-api-fallback --hot --inline --disable-host-check --progress",
  "build:client": "cross-env NODE_ENV=production webpack --progress --display-optimization-bailout",
  "build:server": "cross-env NODE_ENV=production webpack --progress --config webpack.server.config.babel.js --display-optimization-bailout",
  "build:node": "cross-env NODE_ENV=production babel src/index.js > dist-server/index.js",
  "build": "yarn run build:client && yarn run build:server && yarn run build:node"
}

Run start script for the first time

This will ensure that all the files from your selected feature set exist.

  • yarn run start

Develop

Have fun!

0.29.2

5 years ago

0.29.1

5 years ago

0.29.0

5 years ago

0.28.0

5 years ago

0.27.0

5 years ago

0.26.0

5 years ago

0.25.0

5 years ago

0.24.3

5 years ago

0.24.2

5 years ago

0.24.1

5 years ago

0.24.0

5 years ago

0.23.1

5 years ago

0.23.0

5 years ago

0.22.0

5 years ago

0.21.0

5 years ago

0.20.2

5 years ago

0.20.1

5 years ago

0.20.0

5 years ago

0.19.2

5 years ago

0.19.1

5 years ago

0.19.0

5 years ago

0.18.4

5 years ago

0.18.3

5 years ago

0.18.0

6 years ago

0.17.5

6 years ago

0.17.4

6 years ago

0.17.3

6 years ago

0.17.2

6 years ago

0.17.0

6 years ago

0.16.5

6 years ago

0.16.3

6 years ago

0.15.10

6 years ago

0.15.9

6 years ago

0.15.7

6 years ago

0.15.6

6 years ago

0.15.5

6 years ago

0.15.4

6 years ago

0.15.3

6 years ago

0.15.2

6 years ago

0.15.1

6 years ago

0.15.0

6 years ago

0.14.3

6 years ago

0.14.2

6 years ago

0.14.1

6 years ago

0.14.0

6 years ago

0.13.6

6 years ago

0.13.5

6 years ago

0.13.4

6 years ago

0.13.3

6 years ago

0.13.2

6 years ago

0.13.1

6 years ago

0.13.0

6 years ago

0.12.4

6 years ago

0.12.3

6 years ago

0.12.2

6 years ago

0.12.1

6 years ago

0.12.0

6 years ago

0.11.1

6 years ago

0.11.0

6 years ago

0.10.0

6 years ago

0.9.5

6 years ago

0.9.4

6 years ago

0.9.3

6 years ago

0.9.2

6 years ago

0.9.1

6 years ago

0.9.0

6 years ago

0.8.0

6 years ago

0.7.3

6 years ago

0.7.2

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.6.6

6 years ago

0.6.5

6 years ago

0.6.4

6 years ago

0.6.3

6 years ago

0.6.2

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago