Encapsulated development scripts and dependencies for building React apps and components.
Table of Contents
This module should be installed in
$ yarn add -D @haaretz/htz-react-base
htz-react-base will make an
htz-scripts executable available to
the consuming package, which can be run like so:
$ ./node_modules/.bin/htz-scripts <command>
However, for ease of use, it is recommended to add scripts mirroring the
htz-scripts commands to the
scripts field of your
file. Scripts run this way will automatically have
htz-scripts in their
A helper command is provided to do this for you. Run this once (or when
htz-react-base is updated with new scripts), and you will henceforth be able
yarn run <command> or
npm run <command> instead of running
$ ./node_modules/.bin/htz-scripts update-scripts
Some commands accept arguments, which should be passed after the command name.
Note that if running via Yarn or npm
scripts, you will need to add
after the script name to add arguments, for example:
$ yarn run test -- --verbose
Build production distributable files. For apps, this will involve running the Next.js build process. For libraries, this will usually involve running Babel and/or webpack.
Remove built distribution files and the Jest cache directory.
Format code in the current directory with Prettier. You should do this before opening any pull request that contains code, for consistency.
Run the Flow typechecker. Initializes the package to use flow if
not already initialized. For only initializing the package without running any
checks, run with the
Run the styleguide development server, which renders previews and documentation for components found in the package.
Build a production-ready page rendering the component styleguide for the module.
The output will be written to
Run the package’s test suite with Jest.
scripts field in
package.json to contain aliases for
--no-overwrite to avoid clobbering any existing scripts with the
Before opening a pull request for this package, make sure to run the
test scripts as necessary.
To add scripts to this module, place them in /scripts. The command
will be mapped to a file of the same name. Commands namespaced with a
character are mapped to subdirectories. For example: