Toolchain for Node projects:
- Babel
- ESLint
- Jest
- TypeScript
- Lint-Staged (using Husky)
With a pre-commit hook to enforce linting on commit.
Toolchain installs all dependencies & configurations needed to start creating Node projects using TypeScript. Compilation, typing, linting, and testing are pre-configured.
$ yarn add @skypilot/toolchain
$ yarn toolchain init
$ node node_modules/husky/husky.js install
The toolchain init
command creates a set of configuration files that include scripts & configs
for distributing the project as a package. A planned change is to have toolchain init
create only
the core files & configs. A separate command would add the files & configs for creating a package.
The husky.js install
command is required because Yarn doesn't automatically run Husky's
post-install script. A friendlier situation is in the works.
The linter runs automatically on each commit. Branches beginning with wip-
or ending with -wip
are not linted.
These run automatically when the package is published:
- type-checking
- testing
- building
- type-generation
In addition, these convenience scripts are added to package.json
by yarn toolchain init
:
all-ci-checks
: Locally run the status checks that are run by the continuous-integration workflowbuild
: Builds the project for distribution as an NPM packagecheck-types
: Checks that all types in the project are validgenerate-typings
: Generates typings for the distributionlint
: Run the linterprepublishOnly
: Run all checks and build steps in preparation for publication to NPMtest
: An alias fortest:standalone
test:all
: Run all tests using Jesttest:integration
: Run all integration tests (tests that rely on external services) using Jesttest:standalone
: Run all standalone tests (app, component, and unit tests, which do not rely on external services) using Jest
To run a script, use yarn run SCRIPT_NAME
.
- Toolchain will auto-configure a project to support a CI workflow using GitHub actions