Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(#19): switch from tsc to swc #21

Merged
merged 3 commits into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .docker/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## build runner
FROM node:16.16-alpine as build-runner
FROM node:16.17-alpine as build-runner

# Set temp directory
WORKDIR /tmp/app
Expand All @@ -9,20 +9,23 @@ COPY package.json .
COPY package-lock.json .

# Install dependencies from package-lock.json
RUN npm ci
RUN npm ci && npm cache clean --force

# Move source files
COPY src ./src
COPY assets ./assets

COPY .swcrc .
COPY tsconfig.json .
COPY mikro-orm.config.ts .

# Build project
RUN npm run build

## producation runner
FROM node:16.16-alpine as prod-runner
FROM node:16.17-alpine as prod-runner

# set production mode
ARG NODE_ENV=production
ENV NODE_ENV $NODE_ENV

# Set work directory
WORKDIR /app
Expand All @@ -35,4 +38,8 @@ COPY --from=build-runner /tmp/app/package-lock.json /app/package-lock.json
RUN npm ci --omit=dev

# Move build files
COPY --from=build-runner /tmp/app/build /app/build
COPY --from=build-runner /tmp/app/build /app/build
# COPY assets /app/assets

# Finaly start the bot
CMD ["node", "build/main.js"]
32 changes: 32 additions & 0 deletions .swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": false,
"decorators": true,
"dynamicImport": true
},
"target": "es2021",
"baseUrl": ".",
"paths": {
"@types": ["src/utils/types"],
"@decorators": ["src/utils/decorators"],
"@errors": ["src/utils/errors"],
"@entities": ["src/entities"],
"@guards": ["src/guards"],
"@services": ["src/services"],
"@i18n": ["src/i18n"],
"@config": ["src/config"],

"@core/*": ["src/core/*"],
"@utils/*": ["src/utils/*"],
"@api/*": ["src/api/*"]
},
"transform": {
"decoratorMetadata": true
}
},
"module": {
"type": "commonjs"
}
}
4 changes: 1 addition & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"request": "launch",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "dev"],

"args": ["src/main.ts"],


"cwd": "${workspaceRoot}",
"internalConsoleOptions": "openOnSessionStart",
"skipFiles": ["<node_internals>/**", "node_modules/**"]
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ services:
build:
context: ./
dockerfile: ./.docker/app/Dockerfile
command: "npm run serve"
env_file:
- .env
ports:
- 4000:4000
volumes:
- ./database:/app/database
- ./logs/:/app/logs
- ./assets:/app/assets
restart: always
networks:
- dev
Expand Down
Loading