Skip to main content

@hz-9/heft-nest-rig

About 1 min

@hz-9/heft-nest-rig

A rig package for Nest.js projects that build using Heft build system. To learn more about rig packages, consult the @rushstack/rig-packageopen in new window documentation.

NPM Version NPM License NPM Downloads

Introduction

@hz-9/heft-nest-rig is a rigopen in new window pacakge. So the project must have used Heftopen in new window.

@hz-9/heft-nest-rig provides two profiles.

  • library: A configuration for Nest.js component libraries, currently used for the @hz-9/a4-* series of repositories, exporting CommonJS (CJS) .
  • service: A configuration for Nest.js services, exporting CommonJS (CJS) .

Installation

npm install @hz-9/heft-nest-rig --save-dev

For information on the PeerDependencies of @hz-9/heft-nest-rig, please see.

Usage

  1. 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-nest-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": "service"
    }
    
    
  2. add file config/jest.config.json:

    {
      "extends": "@hz-9/heft-nest-rig/profiles/service/config/jest.config.json"
    }
    
    
  3. add to config/tsconfig.json:

    {
      "extends": "./node_modules/@hz-9/heft-nest-rig/profiles/service/tsconfig.json",
      "compilerOptions": {
        // ...
      }
    }
    
    
  4. add to package.json:

    {
      "scripts": {
        // ...
    
        "build": "heft test --clean",
        "test": "heft test --clean",
        "test:watch": "heft test-watch --clean"
      }
    }
    
  5. now, you can run:

    npm run build