From bb92857b2122497829229cb2c8132e2a618e2cb5 Mon Sep 17 00:00:00 2001 From: Jason Jean Date: Wed, 24 Jul 2024 14:46:09 -0500 Subject: [PATCH] chore(repo): make publishing depend on build targets (#27080) ## Current Behavior Populating the local registry for e2e tests is not dependent on the builds but runs them. It sometimes gets cache misses for some builds thus making that inconsistent. https://staging.nx.app/runs/FxIwbj6UQo/task/%40nx%2Fnx-source%3Apopulate-local-registry-storage ## Expected Behavior Populating the local registry for e2e tests is dependent on the builds and does not run them within itself. In the CI pipeline, this ensures that the build tasks are run first. https://staging.nx.app/runs/NUrFeUBbQk/task/%40nx%2Fnx-source%3Apopulate-local-registry-storage ## Related Issue(s) Fixes # --- nx-dev/util-ai/package.json | 1 + nx.json | 10 ++-------- package.json | 4 ++-- project.json | 22 ++++++++++++++++------ scripts/nx-release.ts | 7 ------- typedoc-theme/package.json | 1 + 6 files changed, 22 insertions(+), 23 deletions(-) diff --git a/nx-dev/util-ai/package.json b/nx-dev/util-ai/package.json index dd62437885..3ba6b2797a 100644 --- a/nx-dev/util-ai/package.json +++ b/nx-dev/util-ai/package.json @@ -1,5 +1,6 @@ { "name": "@nx/nx-dev/util-ai", + "private": true, "version": "0.0.1", "dependencies": { "@supabase/supabase-js": "^2.26.0", diff --git a/nx.json b/nx.json index cf7a475c3f..31fe57c0d0 100644 --- a/nx.json +++ b/nx.json @@ -139,18 +139,12 @@ "e2e-ci--**/*": { "inputs": ["e2eInputs", "^production"], "parallelism": false, - "dependsOn": [ - "nx:build-native", - "@nx/nx-source:populate-local-registry-storage" - ] + "dependsOn": ["@nx/nx-source:populate-local-registry-storage"] }, "e2e-macos-ci--**/*": { "inputs": ["e2eInputs", "^production"], "parallelism": false, - "dependsOn": [ - "nx:build-native", - "@nx/nx-source:populate-local-registry-storage" - ] + "dependsOn": ["@nx/nx-source:populate-local-registry-storage"] }, "e2e-base": { "inputs": ["default", "^production"] diff --git a/package.json b/package.json index 629e14dd30..65087545ed 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "homepage": "https://nx.dev", "private": true, "scripts": { - "build": "nx run-many --target build --parallel 8 --exclude nx-dev,typedoc-theme,tools-documentation-create-embeddings", + "build": "nx run-many --target build --parallel 8 --exclude nx-dev,typedoc-theme,tools-documentation-create-embeddings,nx-dev-util-ai", "commit": "czg", "check-commit": "node ./scripts/commit-lint.js", "check-format": "nx format:check --all", @@ -12,7 +12,7 @@ "check-lock-files": "node ./scripts/check-lock-files.js", "check-documentation-map": "ts-node -P ./scripts/tsconfig.scripts.json ./scripts/documentation/map-link-checker.ts", "check-codeowners": "ts-node -P ./scripts/tsconfig.scripts.json ./scripts/check-codeowners.ts", - "nx-release": "ts-node -P ./scripts/tsconfig.release.json ./scripts/nx-release", + "nx-release": "nx nx-release @nx/nx-source --parallel 8", "prepublishOnly": "node ./scripts/update-package-group.js", "local-registry": "nx local-registry @nx/nx-source", "documentation": "ts-node -P scripts/tsconfig.scripts.json ./scripts/documentation/generators/main.ts && pnpm check-documentation-map", diff --git a/project.json b/project.json index a191d8df29..b358d7a670 100644 --- a/project.json +++ b/project.json @@ -15,16 +15,26 @@ "inputs": [ { "input": "production", - "projects": [ - "*", - "!nx-dev", - "!typedoc-theme", - "!tools-documentation-create-embeddings" - ] + "projects": ["tag:npm:public"] + } + ], + "dependsOn": [ + { + "target": "build", + "projects": ["tag:npm:public"] } ], "command": "node ./scripts/local-registry/run-populate-storage.mjs", "outputs": ["{workspaceRoot}/build/local-registry/storage"] + }, + "nx-release": { + "dependsOn": [ + { + "target": "build", + "projects": ["tag:npm:public"] + } + ], + "command": "ts-node -P ./scripts/tsconfig.release.json ./scripts/nx-release" } } } diff --git a/scripts/nx-release.ts b/scripts/nx-release.ts index 0f4a0027ce..71728df240 100755 --- a/scripts/nx-release.ts +++ b/scripts/nx-release.ts @@ -31,13 +31,6 @@ const VALID_AUTHORS_FOR_LATEST = [ }); } - const buildCommand = 'pnpm build'; - console.log(`> ${buildCommand}`); - execSync(buildCommand, { - stdio: [0, 1, 2], - maxBuffer: LARGE_BUFFER, - }); - // Ensure all the native-packages directories are available at the top level of the build directory, enabling consistent packageRoot structure execSync(`pnpm nx copy-native-package-directories nx`, { stdio: isVerboseLogging ? [0, 1, 2] : 'ignore', diff --git a/typedoc-theme/package.json b/typedoc-theme/package.json index f9e039c51e..c7fd9ee8db 100644 --- a/typedoc-theme/package.json +++ b/typedoc-theme/package.json @@ -1,5 +1,6 @@ { "name": "@nx/typedoc-theme", + "private": true, "version": "0.0.1", "keywords": [ "typedocplugin"