Install the latest Node@^17.4.0 and Yarn and simply run yarn node ./bootstrap.js
in the root project directory.
During development,
yarn start # watch, build, and serves packages
# or
yarn dev # same as above, but includes development sources and maps
yarn add <package-name> --dev # for dev tools, story dependencies, libraries to be bundled
yarn add <package-name> [--peer] # for external dependencies (Note: Include in externals from rollup.config.common.js whenever update)
yarn workspace <workspace-name> add <package-name>@* [--dev] # Add/link a package to a specific local package. See section: Including local packages
Note: All packages are installed using the PnP strategy by default. To see advantages, visit the official Yarn docs. Some tools however, such as Flow, are not compatible with the PnP resolution strategy. In order to circumvent you can opt out by installing non PnP configurations as a seperate Yarn project. For example, see Static Types.
This boilerplate supports Monorepo configurations out of the box and will watch, build, serve any local packages. Each package should have src/index.js
entry file. Refer to Yarn's CLI docs for more information on running workspace commands.
You can also give alias to source files of the packages in order to work with Visual Studio Code's Intellisense and ESLint. See jsconfig.json and usage. Also see the Lint section.
yarn flow-typed-install # clean & install flow definitions from dependencies and peerDependencies
yarn flow-typed-update # downloads and updates new flow definitions
cd shared/flow-deps && yarn install <package-name> # install any node modules that flow cannot resolve with PnP strategy
yarn flow-typed-create-stub <package-name> # create a flow-typed stub for a package name into shared/flow-typed/npm
Note: Since the shared/flow-typed/npm is ignored, it is best to move the stub file so it can be committed.
yarn flow # performs type checking on files
yarn lint # runs linter to detect any style issues (css & js)
yarn lint:css # lint only css
yarn lint:js # lint only js
yarn lint:js --fix # attempts to fix js lint issues
Alias for local packages can be configured in .eslintrc.json using the Alias Resolver plugin. In the future, package names for workspace projects will be automatically configured by the usage of workspaces.js. Due to the nature of this, that work will be postponed until eslint have support for ESM Configurations.
yarn test # runs functional/unit tests for all packages
Supports the PACKAGES variable. You can also inspect all tests in debug mode within Visual Studio Code.
Coverage will be uploaded to your codecov account, individually for packages by using each package's name as a flag.
yarn build # builds sources for prod and dev
yarn build:dev # builds sources for development
yarn build:prod # builds sources for production
yarn watch # watches dev builds
yarn dist # builds all packages and publishes to npm
Supports the PACKAGES variable.
Some scripts optionally allow the environment variable to specific local packages(s) (in Glob format) for running scripts e.g. PACKAGES=default-export,package-* yarn test