1.1.0 • Published 8 months ago

@djoman/npu-config v1.1.0

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
8 months ago

Clean Config - Shared Configuration

The purpose of the package is to expose configuration files to be used in all potpay new Backend projects.

To install it:

npm i --save-dev @djoman/npu-config

TS Config

TS configuration file for Node is available, use it with:

// tsconfig.json
{
  "extends": "@djoman/npu-config/tsconfig.json",
  "compilerOptions": {
    "baseUrl": ".",
    "outDir": "./dist"
  },
  "include": [
    "./src"
  ]
}

Optional TS Alias

The configuration provides the # TS alias as ./src. It is recommended to use it to replace ascending imports to improve source readability, for example

// Prefer the use of the alias
import { Event } from '#/event'
// over
import { Event } from '../../event'

The alias may be removed after transpilation with tsc-alias like:

"scripts": {
    "build": "tsc --p . -d && tsc-alias",
}

Or use it with tsconfig-paths:

"scripts": {
    "dev": "node -r ts-node/register -r tsconfig-paths/register ./src/index.ts",
}

Eslint & Prettier

Eslint configuration file is available, use it with:

// .eslintrc.js
module.exports = require('@epsor/npu-config/.eslintrc.js')

Please note:

  • The exposed ESLint config is importing a Prettier configuration thus it is not required to configure Prettier.