From 0a8d75bc072ab084e074fe70f2563bd63cfe027b Mon Sep 17 00:00:00 2001 From: Paul Rastoin <45004772+prastoin@users.noreply.github.com> Date: Tue, 4 Feb 2025 18:46:16 +0100 Subject: [PATCH] [FIX] Nx project's scope build dependency management (#10010) # Introduction Defined `dependsOn` for each nx project's configuration that has a dependency to another local package ( ui, shared ). As follows: ```json "dependsOn": ["^build"] ``` Where the `^` symbol means "all dependencies of this project" Now on a fresh repo, no built or install deps after install dependencies you can directly hit `npx nx build PROJECT_NAME` closes https://github.com/twentyhq/core-team-issues/issues/371 Related what was failing [run](https://github.com/twentyhq/twenty-infra/actions/runs/13141544809/job/36669643182) Cancelled before deploy, attested build was correct within the publish and digest --- packages/twenty-chrome-extension/project.json | 3 ++- packages/twenty-docker/twenty/Dockerfile | 3 --- packages/twenty-emails/package.json | 3 +++ packages/twenty-emails/project.json | 3 ++- packages/twenty-server/project.json | 3 ++- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/twenty-chrome-extension/project.json b/packages/twenty-chrome-extension/project.json index 5f0e8815e..eb42f1ef6 100644 --- a/packages/twenty-chrome-extension/project.json +++ b/packages/twenty-chrome-extension/project.json @@ -8,7 +8,8 @@ "outputs": ["{options.outputPath}"], "options": { "outputPath": "{projectRoot}/dist" - } + }, + "dependsOn": ["^build"] }, "start": { "executor": "nx:run-commands", diff --git a/packages/twenty-docker/twenty/Dockerfile b/packages/twenty-docker/twenty/Dockerfile index 42d7064b2..d17168392 100644 --- a/packages/twenty-docker/twenty/Dockerfile +++ b/packages/twenty-docker/twenty/Dockerfile @@ -26,9 +26,6 @@ COPY ./packages/twenty-emails /app/packages/twenty-emails COPY ./packages/twenty-shared /app/packages/twenty-shared COPY ./packages/twenty-server /app/packages/twenty-server -RUN npx nx run twenty-shared:build -RUN npx nx run twenty-emails:build - RUN npx nx run twenty-server:build RUN mv /app/packages/twenty-server/dist /app/packages/twenty-server/build RUN npx nx run twenty-server:build:packageJson diff --git a/packages/twenty-emails/package.json b/packages/twenty-emails/package.json index 8e52e476b..062bac2da 100644 --- a/packages/twenty-emails/package.json +++ b/packages/twenty-emails/package.json @@ -9,6 +9,9 @@ "scripts": { "build": "npx vite build" }, + "dependencies": { + "twenty-shared": "workspace:*" + }, "exports": { ".": { "import": "./dist/index.mjs", diff --git a/packages/twenty-emails/project.json b/packages/twenty-emails/project.json index c5927d1bf..8442006c6 100644 --- a/packages/twenty-emails/project.json +++ b/packages/twenty-emails/project.json @@ -8,7 +8,8 @@ "outputs": ["{options.outputPath}"], "options": { "outputPath": "{projectRoot}/dist" - } + }, + "dependsOn": ["^build"] }, "typecheck": {}, "lint": { diff --git a/packages/twenty-server/project.json b/packages/twenty-server/project.json index b873fa607..8f2f1b888 100644 --- a/packages/twenty-server/project.json +++ b/packages/twenty-server/project.json @@ -10,7 +10,8 @@ "options": { "cwd": "packages/twenty-server", "commands": ["rimraf dist", "nest build --path ./tsconfig.build.json"] - } + }, + "dependsOn": ["^build"] }, "test:integration": { "executor": "nx:run-commands",