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 ?
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"]
}
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