diff --git a/.dockerignore b/.dockerignore index 28441f1be..21e5592f6 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,7 @@ # All node_modules directories node_modules **/node_modules -dist +**/dist **/.next # All secrets @@ -53,4 +53,5 @@ tmp .vscode # other +**/.assets .DS_Store diff --git a/Makefile b/Makefile index bef3b553a..d085f42ac 100644 --- a/Makefile +++ b/Makefile @@ -208,13 +208,11 @@ db-push: ## connects to your database and adds Prisma models to your Prisma sch else echo "Unknown command."; fi sqlite-mode: ## sqlite-mode - @make gen-sqlite-prisma-schema @cd ./packages/db-main-prisma; \ yarn prisma-generate --schema ./prisma/sqlite/schema.prisma; \ yarn prisma-migrate deploy --schema ./prisma/sqlite/schema.prisma postgres-mode: ## postgres-mode - @make gen-postgres-prisma-schema @cd ./packages/db-main-prisma; \ yarn prisma-generate --schema ./prisma/postgres/schema.prisma; \ yarn prisma-migrate deploy --schema ./prisma/postgres/schema.prisma diff --git a/apps/nestjs-backend/.swcrc b/apps/nestjs-backend/.swcrc new file mode 100644 index 000000000..dbdd55b88 --- /dev/null +++ b/apps/nestjs-backend/.swcrc @@ -0,0 +1,13 @@ +{ + "$schema": "https://json.schemastore.org/swcrc", + "sourceMaps": true, + "jsc": { + "parser": { + "syntax": "typescript", + "decorators": true, + "dynamicImport": true + }, + "baseUrl": "./" + }, + "minify": false +} diff --git a/apps/nestjs-backend/nest-cli.json b/apps/nestjs-backend/nest-cli.json index 4eaa65555..95656e781 100644 --- a/apps/nestjs-backend/nest-cli.json +++ b/apps/nestjs-backend/nest-cli.json @@ -4,6 +4,7 @@ "entryFile": "index", "flat": true, "compilerOptions": { - "tsConfigPath": "./tsconfig.json" + "builder": "swc", + "typeCheck": true } } diff --git a/apps/nestjs-backend/package.json b/apps/nestjs-backend/package.json index 91b87735c..e16b80e8c 100644 --- a/apps/nestjs-backend/package.json +++ b/apps/nestjs-backend/package.json @@ -31,11 +31,11 @@ ] }, "scripts": { - "build": "nest build", + "build": "nest build -b swc --type-check", "clean": "rimraf ./out ./coverage ./main ./dist ./tsconfig.tsbuildinfo ./node_modules/.cache", - "dev": "nest start --watch", - "start": "NODE_ENV=production node ./dist", - "start:debug": "nest start --debug --watch", + "dev": "nest start -b swc --type-check -w", + "start": "nest start -b swc", + "start:debug": "nest start -b swc --debug --watch", "check-dist": "es-check -v", "check-size": "size-limit --highlight-less", "test": "run-s test-unit test:e2e", @@ -53,6 +53,8 @@ "@faker-js/faker": "8.1.0", "@nestjs/cli": "10.1.18", "@nestjs/testing": "10.2.7", + "@swc/cli": "0.1.62", + "@swc/core": "1.3.92", "@teable-group/eslint-config-bases": "workspace:^", "@types/bcrypt": "5.0.0", "@types/cookie": "0.5.2", diff --git a/dockers/integration-test.yml b/dockers/integration-test.yml index 70566f633..0d137a204 100644 --- a/dockers/integration-test.yml +++ b/dockers/integration-test.yml @@ -7,6 +7,8 @@ services: context: ../ dockerfile: ./dockers/teable/Dockerfile target: builder + args: + INTEGRATION_TEST: 1 hostname: integration-test networks: - teable-net diff --git a/dockers/teable/Dockerfile b/dockers/teable/Dockerfile index 0adf0ed42..c9bb09a9a 100644 --- a/dockers/teable/Dockerfile +++ b/dockers/teable/Dockerfile @@ -34,6 +34,8 @@ RUN yarn install --immutable --inline-builds FROM deps AS builder +ARG INTEGRATION_TEST + ENV NEXT_BUILD_ENV_TYPECHECK=false ENV NEXT_BUILD_ENV_LINT=false 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... 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 -# https://github.com/moby/buildkit/issues/1673 -RUN SKIP_POSTINSTALL=1 \ - yarn workspaces focus --production @teable-group/core @teable-group/openapi @teable-group/db-main-prisma \ - @teable-group/backend @teable-group/app +# integration_test +RUN if [ -n "$INTEGRATION_TEST" ]; \ + then yarn workspaces foreach -A -tv --exclude '@teable-group/(app|backend)' run build; \ + else yarn workspace @teable-group/app share-static-hardlink && \ + 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 # diff --git a/yarn.lock b/yarn.lock index 5affba1b5..d57d8f8be 100644 Binary files a/yarn.lock and b/yarn.lock differ