@hz-9/heft-node-rig
About 1 min
@hz-9/heft-node-rig
A rig package for Node.js projects that build using Heft build system. To learn more about rig packages, consult the @rushstack/rig-package documentation.
Introduction
@hz-9/heft-node-rig
is a rig pacakge. So the project must have used Heft.
@hz-9/heft-node-rig
provides two profiles.
default
: A configuration for common, exporting CommonJS (CJS) and ES Module (ESM).tool
: A configuration for command-line tool, exporting CommonJS (CJS) .
Installation
npm install @hz-9/heft-node-rig --save-dev
For information on the PeerDependencies
of @hz-9/heft-node-rig
, please see.
Usage
add file
config/rig.json
:// The "rig.json" file directs tools to look for their config files in an external package. // Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package { "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", /** * (Required) The name of the rig package to inherit from. * It should be an NPM package name with the "-rig" suffix. */ "rigPackageName": "@hz-9/heft-node-rig", /** * (Optional) Selects a config profile from the rig package. The name must consist of * lowercase alphanumeric words separated by hyphens, for example "sample-profile". * If omitted, then the "default" profile will be used." */ "rigProfile": "tool" }
add file
config/jest.config.json
:{ "extends": "@hz-9/heft-node-rig/profiles/tool/config/jest.config.json" }
add to
config/tsconfig.json
:{ "extends": "./node_modules/@hz-9/heft-node-rig/profiles/tool/tsconfig.json", "compilerOptions": { // ... } }
add to
package.json
:{ "scripts": { // ... "build": "heft test --clean", "test": "heft test --clean", "test:watch": "heft test-watch --clean" } }
now, you can run:
npm run build