@code-shaper/jest-config

Code Shaper Jest configuration


Keywords
generator
License
MIT
Install
npm install @code-shaper/jest-config@1.0.0

Documentation

Code Shaper

A delightful, modular code generator

Prerequisites for development

  1. Node Version Manager (nvm) - allows using different versions of node via the command line

Building Code Shaper

nvm use        # use the required version of node
npm ci         # install dependencies
npm run build  # builds all workspaces

Note: Do not run npm install or npm ci in any of the subdirectories. It will break the build. There should be only one package-lock.json file in the entire repo (at the root).

All Commands

npm ci                   # install dependencies
npm run build            # builds all workspaces
npm run ci-validate      # builds, lints, formats, and tests all code (runs in CI pipeline, don't run locally)
npm run clean            # deletes all build artifacts
npm run commit           # displays commit helper prompt to ensure your commits use conventional commits
npm run dev              # run all workspaces in dev mode
npm run fix              # lints, formats and attempts to fix any issues (requires `npm run build` has been ran)
npm run format           # formats all workspaces, useful for debugging format issues (generally `npm run fix` is preferred)
npm run lint             # runs the linter on all workspaces, useful for debugging lint issues (generally `npm run fix` is preferred)
npm run test             # runs full build, lint, format, and all tests - run before pushing to remote

Common Workflows

Publishing a package

npm run build  # run a full build
npm test       # test

# Change working directory to the package that needs to be published, e.g.
cd plugins/react
npm publish  # you will be prompted for an OTP from Google Authenticator

Package publishing order

  1. configs
  2. packages/shaper-utils
  3. apps/code-shaper
  4. generators
  5. plugins

Clean build

Removes all build artifacts and performs a clean build.

npm run clean
npm ci
npm run dev

For an "aggressive" clean build, add one more step as shown below. This will build the lock file from scratch.

npm run clean
rm package-lock.json
npm install
npm run dev

Running unit tests

The following command runs a full build, lint, format, and all tests. However, it uses the Turborepo cache to skip steps that have no changes since the last run. Hence it is very efficient. Always run this command before pushing to remote.

npm test

Linting, formatting and fixing coding issues

npm run fix