Skip to content

Commit

Permalink
Merge pull request #155 from bcgov/ci/tsc
Browse files Browse the repository at this point in the history
Refactor backend stack to explicitly transpile code
  • Loading branch information
TimCsaky authored Dec 19, 2023
2 parents b819c72 + 0886eab commit 90004e9
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dist
files
**/e2e/videos
node_modules
sbin
# Ignore only top-level package-lock.json
/package-lock.json

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dist
files
**/e2e/videos
node_modules
sbin
# Ignore only top-level package-lock.json
/package-lock.json

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ WORKDIR ${APP_ROOT}
# Install Application
RUN chown -R 1001:0 ${APP_ROOT}
USER 1001
RUN npm ci --omit=dev
RUN npm ci --omit=dev && npm run build

EXPOSE ${APP_PORT}
CMD ["node", "-r", "ts-node/register", "./bin/www"]
CMD ["node", "./sbin/bin/www"]
3 changes: 3 additions & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ dist
files
**/e2e/videos
node_modules
sbin
# Ignore only top-level package-lock.json
/package-lock.json

# Ignore Helm subcharts
charts/**/charts
Expand Down
3 changes: 2 additions & 1 deletion app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ appRouter.get('/api', (_req: Request, res: Response): void => {
});

// Host the static frontend assets
appRouter.use('/', express.static(join(__dirname, 'dist')));
// This route assumes being executed from '/sbin'
appRouter.use('/', express.static(join(__dirname, '../dist')));

// Mount application endpoints
app.use('/', appRouter);
Expand Down
9 changes: 6 additions & 3 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
"author": "NR Common Service Showcase <[email protected]>",
"license": "Apache-2.0",
"scripts": {
"build": "ts-node ./frontend-utils.ts",
"clean": "rimraf coverage dist",
"clean:all": "npm run clean && ts-node ./frontend-utils.ts clean",
"build": "tsc",
"build:all": "ts-node ./frontend-utils.ts",
"postbuild:all": "npm run build",
"clean": "rimraf coverage dist sbin",
"clean:all": "ts-node ./frontend-utils.ts clean",
"postclean:all": "npm run clean",
"debug": "ts-node-dev --debug --respawn --transpile-only --rs --watch bin,config,dist ./bin/www",
"format": "prettier ./src --write",
"lint": "eslint . **/www* --no-fix --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --ignore-path .gitignore",
Expand Down
2 changes: 1 addition & 1 deletion app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
"outDir": "./sbin" /* Specify an output folder for all emitted files. */,
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
Expand Down

0 comments on commit 90004e9

Please sign in to comment.