⚙️Project configuration

Node

The global Node.js configuration is defined in the project's package.json file located in <project-root>/package.json:

package.json
{
    "name": "my-multijet-project",
    "private": true,
    "workspaces": [
        "microservices/*",
        "libs/*"
    ],
    "scripts": {
        "ts": "esr",
        "build": "npm run openapi:generate && turbo run build",
        "build:debug": "npm run openapi:generate && turbo run build:debug",
        "lint": "turbo run lint",
        "lint:fix": "turbo run lint:fix",
        "test": "turbo run test --parallel",
        "typecheck": "turbo run typecheck",
        "openapi:generate": "turbo run openapi:generate",
        // AWS SAM specific commands
        "presam:build": "npm run build",
        "sam:build": "sam build -t deploy/aws/sam/template.yaml --parallel",
        "presam:start": "npm run sam:build",
        "sam:start": "sam local start-api -t deploy/aws/sam/template.yaml"
    },
    "dependencies": {
        "esbuild": "...",
        "fastify": "...",
        "turbo": "..."
    },
    "devDependencies": {
        ...
    }
    "packageManager": "npm@8.11.0",
}

In this we define all the global scripts (most of them runs Turborepo pipelines, head to theTurborepo configuration section to know more), global dependencies (can be imported by all libs or microservices) and the npm workspaces.

Note that the tsscript can be used to run any arbitrary TypeScript file using esbuild-runner (similar to ts-node)

TypeScript

The main Typescript configuration file is located in <project-root>/tsconfig.base.json:

tsconfig.base.json
{
    "exclude": ["node_modules", "**/*/dist", "**/*.test.ts"],
    "compilerOptions": {
        // Disable emitting file from a compilation.
        // We'll use esbuild to compile our TypeScript files to JavaScript, so we
        // avoid emitting files when using tsc (and use it only for type-checking).
        "noEmit": true,
        "resolveJsonModule": true,
        "esModuleInterop": true,
        "lib": ["es2023"],
        "module": "Node16",
        "strict": true,
        "skipLibCheck": true,
        "forceConsistentCasingInFileNames": true,
        "moduleResolution": "node",
        "alwaysStrict": true
    }
}

Every lib or microservice extends this configuration file.

The noEmit option is essential to the Multijet build process. This disables any output file from the compilation because it is not needed since we will use esbuild to make an output bundle file (See the Build configuration section). We use tsc to only do the type checking.

Last updated