3.2.0 • Published 1 year ago

@neuledge/tsconfig v3.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

TypeScript Config

This package provides a base TypeScript configuration for Neuledge packages.

Config Files

  • base.json: Base TypeScript configuration.
  • nestjs.json: TypeScript configuration for Nest.js projects.
  • nextjs.json: TypeScript configuration for Next.js projects.

Initial Setup

  1. Install the package:
pnpm add -D rimraf typescript @types/node tsc-alias tsup @neuledge/tsconfig
  1. Create a tsconfig.json file with the following content:
{
  "extends": "@neuledge/tsconfig/base.json",
  "compilerOptions": {
    "baseUrl": "src",
    "rootDir": "src",
    "outDir": "dist"
  },
  "include": ["src"],
  "exclude": ["node_modules", "**/__ignore__/**"]
}
  1. Create a tsup.config.json file with the following content:
{
  "entry": ["src/index.ts"],
  "format": ["esm", "cjs"],
  "sourcemap": true,
  "shims": true
}
  1. Add the following scripts to your package.json:
{
  "scripts": {
    "types": "rimraf --glob dist/*.{d.ts,d.ts.map} dist/**/*.{d.ts,d.ts.map} && tsc --emitDeclarationOnly && tsc-alias",
    "build": "rimraf --glob dist/*.{js,js.map,mjs,mjs.map} && tsup"
  }
}
  1. Add the following to your .gitignore:
dist
  1. Add the following to your .npmignore:
/*
!/dist/*.js
!/dist/*.js.map
!/dist/*.mjs
!/dist/*.mjs.map
!/dist/**/*.d.ts

Next.js Setup

If you're using a Next.js project, you should follow the instructions below instead of the ones above:

  1. Setup new project with TypeScript:
pnpm create next-app
  1. Install the package:
pnpm add -D @neuledge/tsconfig
  1. Replace the tsconfig.json file with the following content:
{
  "extends": "@neuledge/tsconfig/nextjs.json",
  "compilerOptions": {
    "baseUrl": ".",
    "rootDir": ".",
    "paths": {
      "@/*": ["./src/*"]
    },
    "plugins": [{ "name": "next" }]
  },
  "include": [
    ".eslintrc.cjs",
    "next-env.d.ts",
    "**/*.ts",
    "**/*.tsx",
    "**/*.cjs",
    "**/*.mjs",
    ".next/types/**/*.ts"
  ],
  "exclude": ["node_modules", "**/__ignore__/**"]
}

Nest.js Setup

If you're using a Nest.js project, you should follow the instructions below instead of the ones above:

  1. Install the package:
pnpm add -D @neuledge/tsconfig
  1. Replace the tsconfig.json file with the following content:
{
  "extends": "@neuledge/tsconfig/nestjs.json",
  "compilerOptions": {
    "baseUrl": "./",
    "rootDir": "./",
    "outDir": "./dist"
  },
  "exclude": ["dist", "node_modules"]
}
3.2.0

1 year ago

3.1.0

2 years ago

2.1.2-alpha.0

2 years ago

3.0.0

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

1.0.0

2 years ago

1.0.0-alpha.19

2 years ago

1.0.0-alpha.20

2 years ago

2.0.0-next.0

2 years ago

2.0.0

2 years ago

1.0.0-alpha.17

3 years ago

1.0.0-alpha.16

3 years ago

1.0.0-alpha.15

3 years ago

1.0.0-alpha.12

3 years ago

1.0.0-alpha.11

3 years ago

1.0.0-alpha.9

3 years ago