File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ node_modules
6
6
7
7
# Ignore built ts files
8
8
dist
9
+ src /version.ts
9
10
10
11
# consignments
11
- files /*
12
+ files /*
Original file line number Diff line number Diff line change 5
5
"main" : " index.js" ,
6
6
"scripts" : {
7
7
"start" : " node ./dist/server.js" ,
8
+ "predev" : " npm run version" ,
8
9
"dev" : " ts-node-dev ./src/server.ts" ,
10
+ "prebuild" : " npm run version" ,
9
11
"build" : " tsc" ,
10
12
"lint" : " eslint --ignore-path .gitignore . --ext .ts" ,
11
13
"lint:fix" : " npm run lint -- --fix" ,
12
- "test" : " jest --verbose"
14
+ "test" : " jest --verbose" ,
15
+ "version" : " echo 'export const APP_VERSION = \" '$npm_package_version'\" ' > src/version.ts"
13
16
},
14
17
"author" : " " ,
15
18
"license" : " MIT" ,
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ import path from "path";
9
9
import logger from "../logger" ;
10
10
import { genHashFromFile , setDir } from "../util" ;
11
11
import { APP_DIR } from "../vars" ;
12
+ import { APP_VERSION } from "../version" ;
12
13
13
- const VERSION = process . env . npm_package_version ;
14
14
const TMP_DIR = "tmp" ;
15
15
const CONSIGNMENTS_DIR = "consignments" ;
16
16
const MEDIA_DIR = "media" ;
@@ -355,7 +355,7 @@ export const loadApiEndpoints = (app: Application): void => {
355
355
middleware ,
356
356
async ( _req : Request , res : Response ) => {
357
357
return res . status ( 200 ) . send ( {
358
- version : VERSION ,
358
+ version : APP_VERSION ,
359
359
uptime : Math . trunc ( process . uptime ( ) ) ,
360
360
} ) ;
361
361
}
You can’t perform that action at this time.
0 commit comments