Skip to content

Commit

Permalink
Fixup tsconfig paths for docker runtime
Browse files Browse the repository at this point in the history
Change-type: patch
Signed-off-by: Kyle Harding <kyle@balena.io>
  • Loading branch information
klutchell committed Dec 5, 2024
1 parent 29ef261 commit f0d71c9
Show file tree
Hide file tree
Showing 17 changed files with 66 additions and 54 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@
**/.editorconfig
**/dist
**/*.pem
**/lib
**/.github
Dockerfile
2 changes: 1 addition & 1 deletion .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"*.ts": [
"*/**/*.ts": [
"balena-lint --fix"
],
"*/**/*.js": [
Expand Down
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ FROM node:22-slim
WORKDIR /usr/src/app

COPY package.json package-lock.json ./
RUN HUSKY=0 npm ci --unsafe-perm --production && npm cache clean --force

COPY . /usr/src/app
RUN HUSKY=0 npm ci --omit=dev && npm cache clean --force

RUN npx tsc --noEmit --project ./tsconfig.build.json
COPY . ./

ENV NODE_ENV="production"

RUN npm run build

CMD [ "npm", "start" ]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ npm start
docker build -t deploynaut .

# 2. Start container
docker run -e APP_ID=<app-id> -e PRIVATE_KEY=<pem-value> deploynaut
docker run --env-file .env deploynaut
```

## Environment Variables
Expand Down
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
"probot-app"
],
"scripts": {
"build": "tsc",
"start": "probot run ./lib/src/index.js",
"clean": "rimraf lib",
"build": "tsc --project tsconfig.release.json",
"start": "probot run ./lib/index.js",
"test": "npm run lint && vitest --coverage",
"lint": "balena-lint src/ test/ && tsc --noEmit --project .",
"lint-fix": "balena-lint --fix src/ test/",
"lint": "balena-lint src tests && tsc --noEmit --project .",
"lint-fix": "balena-lint --fix src tests",
"prepare": "node -e \"try { (await import('husky')).default() } catch (e) { if (e.code !== 'ERR_MODULE_NOT_FOUND') throw e }\" --input-type module"
},
"dependencies": {
Expand All @@ -30,6 +31,7 @@
"husky": "^9.1.7",
"lint-staged": "^15.2.10",
"nock": "^14.0.0-beta.5",
"rimraf": "^6.0.1",
"smee-client": "^2.0.0",
"vitest": "^2.1.5"
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 0 additions & 34 deletions tsconfig.build.json

This file was deleted.

33 changes: 23 additions & 10 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
{
"extends": "./tsconfig.build",
"compilerOptions": {
"rootDir": "./",
"allowJs": true,
"checkJs": true
"module": "NodeNext",
"target": "es2022",
"declaration": true,
"outDir": "lib/",
"strict": true,
"strictPropertyInitialization": false,
"strictFunctionTypes": false,
"useUnknownInCatchVariables": false,
"noImplicitThis": false,
"noUnusedParameters": true,
"noUnusedLocals": true,
"preserveConstEnums": true,
"sourceMap": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"esModuleInterop": true
},
"include": [
"src/**/*.ts",
"*.js",
"*.ts",
"test/**/*.ts"
]
"include": ["src/**/*.ts", "tests/**/*.ts"],
"ts-node": {
"esm": true,
"experimentalResolver": true,
"experimentalTsImportSpecifiers": true,
"transpileOnly": true
}
}
5 changes: 5 additions & 0 deletions tsconfig.release.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "./tsconfig.json",
"include": ["src/**/*.ts"],
"exclude": ["src/**/*.spec.ts"]
}
2 changes: 1 addition & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
include: ["test/**/*.test.ts"],
include: ["tests/**/*.test.ts"],
coverage: {
provider: "v8",
},
Expand Down

0 comments on commit f0d71c9

Please sign in to comment.