feat: tsc switches to swc (#190)

* feat: `tsc` switches to `swc`

[skip ci]

---------

Co-authored-by: pengap <penganpingprivte@gmail.com>
This commit is contained in:
Pengap 2023-10-11 21:04:48 +08:00 committed by GitHub
parent 168385ec85
commit d31e08b50b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 35 additions and 15 deletions

View File

@ -1,7 +1,7 @@
# All node_modules directories # All node_modules directories
node_modules node_modules
**/node_modules **/node_modules
dist **/dist
**/.next **/.next
# All secrets # All secrets
@ -53,4 +53,5 @@ tmp
.vscode .vscode
# other # other
**/.assets
.DS_Store .DS_Store

View File

@ -208,13 +208,11 @@ db-push: ## connects to your database and adds Prisma models to your Prisma sch
else echo "Unknown command."; fi else echo "Unknown command."; fi
sqlite-mode: ## sqlite-mode sqlite-mode: ## sqlite-mode
@make gen-sqlite-prisma-schema
@cd ./packages/db-main-prisma; \ @cd ./packages/db-main-prisma; \
yarn prisma-generate --schema ./prisma/sqlite/schema.prisma; \ yarn prisma-generate --schema ./prisma/sqlite/schema.prisma; \
yarn prisma-migrate deploy --schema ./prisma/sqlite/schema.prisma yarn prisma-migrate deploy --schema ./prisma/sqlite/schema.prisma
postgres-mode: ## postgres-mode postgres-mode: ## postgres-mode
@make gen-postgres-prisma-schema
@cd ./packages/db-main-prisma; \ @cd ./packages/db-main-prisma; \
yarn prisma-generate --schema ./prisma/postgres/schema.prisma; \ yarn prisma-generate --schema ./prisma/postgres/schema.prisma; \
yarn prisma-migrate deploy --schema ./prisma/postgres/schema.prisma yarn prisma-migrate deploy --schema ./prisma/postgres/schema.prisma

View File

@ -0,0 +1,13 @@
{
"$schema": "https://json.schemastore.org/swcrc",
"sourceMaps": true,
"jsc": {
"parser": {
"syntax": "typescript",
"decorators": true,
"dynamicImport": true
},
"baseUrl": "./"
},
"minify": false
}

View File

@ -4,6 +4,7 @@
"entryFile": "index", "entryFile": "index",
"flat": true, "flat": true,
"compilerOptions": { "compilerOptions": {
"tsConfigPath": "./tsconfig.json" "builder": "swc",
"typeCheck": true
} }
} }

View File

@ -31,11 +31,11 @@
] ]
}, },
"scripts": { "scripts": {
"build": "nest build", "build": "nest build -b swc --type-check",
"clean": "rimraf ./out ./coverage ./main ./dist ./tsconfig.tsbuildinfo ./node_modules/.cache", "clean": "rimraf ./out ./coverage ./main ./dist ./tsconfig.tsbuildinfo ./node_modules/.cache",
"dev": "nest start --watch", "dev": "nest start -b swc --type-check -w",
"start": "NODE_ENV=production node ./dist", "start": "nest start -b swc",
"start:debug": "nest start --debug --watch", "start:debug": "nest start -b swc --debug --watch",
"check-dist": "es-check -v", "check-dist": "es-check -v",
"check-size": "size-limit --highlight-less", "check-size": "size-limit --highlight-less",
"test": "run-s test-unit test:e2e", "test": "run-s test-unit test:e2e",
@ -53,6 +53,8 @@
"@faker-js/faker": "8.1.0", "@faker-js/faker": "8.1.0",
"@nestjs/cli": "10.1.18", "@nestjs/cli": "10.1.18",
"@nestjs/testing": "10.2.7", "@nestjs/testing": "10.2.7",
"@swc/cli": "0.1.62",
"@swc/core": "1.3.92",
"@teable-group/eslint-config-bases": "workspace:^", "@teable-group/eslint-config-bases": "workspace:^",
"@types/bcrypt": "5.0.0", "@types/bcrypt": "5.0.0",
"@types/cookie": "0.5.2", "@types/cookie": "0.5.2",

View File

@ -7,6 +7,8 @@ services:
context: ../ context: ../
dockerfile: ./dockers/teable/Dockerfile dockerfile: ./dockers/teable/Dockerfile
target: builder target: builder
args:
INTEGRATION_TEST: 1
hostname: integration-test hostname: integration-test
networks: networks:
- teable-net - teable-net

View File

@ -34,6 +34,8 @@ RUN yarn install --immutable --inline-builds
FROM deps AS builder FROM deps AS builder
ARG INTEGRATION_TEST
ENV NEXT_BUILD_ENV_TYPECHECK=false ENV NEXT_BUILD_ENV_TYPECHECK=false
ENV NEXT_BUILD_ENV_LINT=false ENV NEXT_BUILD_ENV_LINT=false
ENV NEXT_BUILD_ENV_OUTPUT=standalone ENV NEXT_BUILD_ENV_OUTPUT=standalone
@ -56,14 +58,15 @@ COPY --from=deps --link /workspace-install ./
# Optional: if the app depends on global /static shared assets like images, locales... # Optional: if the app depends on global /static shared assets like images, locales...
RUN yarn workspace @teable-group/db-main-prisma prisma-generate --schema ./prisma/postgres/schema.prisma RUN yarn workspace @teable-group/db-main-prisma prisma-generate --schema ./prisma/postgres/schema.prisma
RUN yarn workspace @teable-group/app share-static-hardlink; \
yarn g:build
# Does not play well with buildkit on CI # integration_test
# https://github.com/moby/buildkit/issues/1673 RUN if [ -n "$INTEGRATION_TEST" ]; \
RUN SKIP_POSTINSTALL=1 \ then yarn workspaces foreach -A -tv --exclude '@teable-group/(app|backend)' run build; \
yarn workspaces focus --production @teable-group/core @teable-group/openapi @teable-group/db-main-prisma \ else yarn workspace @teable-group/app share-static-hardlink && \
@teable-group/backend @teable-group/app yarn g:build && \
SKIP_POSTINSTALL=1 yarn workspaces focus --production @teable-group/core @teable-group/openapi @teable-group/db-main-prisma \
@teable-group/backend @teable-group/app; \
fi
################################################################## ##################################################################
# Stage 3: Extract a minimal image from the build # # Stage 3: Extract a minimal image from the build #

BIN
yarn.lock

Binary file not shown.