9

I am trying to write jenkins shell script to deploy nestjs app, I try "npm run start:prod" this generate dist folder, but it serve also the app which I dont need it,

How to just build the app ?

maroodb
  • 1,026
  • 2
  • 16
  • 28

2 Answers2

13

You can run:

npm run build

This will just build application. This script can be found in generated Nest.js project when you generate project with Nest CLI.

The script itself could look like this:

"build": "tsc -p tsconfig.build.json"

And content of tsconfig.build.json could look like this:

{
  "extends": "./tsconfig.json",
  "exclude": ["node_modules", "test", "**/*spec.ts"]
}
Ivan Vasiljevic
  • 5,478
  • 2
  • 30
  • 35
1

Add the following command in the script tag in the package.json

 "scripts": {
    "build": "nest build"
    ...
  },

then run :

npm run build

or you can run the following command in the terminal:

npx tsc -p tsconfig.build.json
Abolfazl Roshanzamir
  • 12,730
  • 5
  • 63
  • 79