Skip to content

Commit 8cda56e

Browse files
authored
fix(nx-cloud): ensure generated ci workflows use dlx for nx-cloud (#23333)
1 parent 4f31608 commit 8cda56e

File tree

9 files changed

+21
-51
lines changed

9 files changed

+21
-51
lines changed

.eslintrc.base.json

Lines changed: 0 additions & 35 deletions
This file was deleted.

nx-dev/ui-blog/.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": ["../../.eslintrc.base.json"],
2+
"extends": ["../../.eslintrc.json"],
33
"ignorePatterns": ["!**/*"],
44
"overrides": [
55
{

packages/workspace/src/generators/ci-workflow/__snapshots__/ci-workflow.spec.ts.snap

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ jobs:
502502
503503
# Connect your workspace on nx.app and uncomment this to enable task distribution.
504504
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
505-
# - script: pnpm exec nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
505+
# - script: pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
506506
507507
- script: pnpm install --frozen-lockfile
508508
- script: git branch --track main origin/main
@@ -532,7 +532,7 @@ pipelines:
532532
533533
# Connect your workspace on nx.app and uncomment this to enable task distribution.
534534
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
535-
# - pnpm exec nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
535+
# - pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
536536
537537
- pnpm install --frozen-lockfile
538538
@@ -547,7 +547,7 @@ pipelines:
547547
- export NX_BRANCH=$BITBUCKET_BRANCH
548548
# Connect your workspace on nx.app and uncomment this to enable task distribution.
549549
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
550-
# - pnpm exec nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
550+
# - pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
551551
552552
- npm install --prefix=$HOME/.local -g pnpm@8
553553
@@ -578,7 +578,7 @@ jobs:
578578
579579
# Connect your workspace on nx.app and uncomment this to enable task distribution.
580580
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
581-
# - run: pnpm exec nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
581+
# - run: pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
582582
583583
- run: pnpm install --frozen-lockfile
584584
- nx/set-shas:
@@ -624,7 +624,7 @@ jobs:
624624
625625
# Connect your workspace on nx.app and uncomment this to enable task distribution.
626626
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
627-
# - run: pnpm exec nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
627+
# - run: pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
628628
629629
# Cache node_modules
630630
- uses: actions/setup-node@v3
@@ -667,7 +667,7 @@ jobs:
667667
668668
# Connect your workspace on nx.app and uncomment this to enable task distribution.
669669
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
670-
# - run: pnpm exec nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
670+
# - run: pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
671671
672672
# Cache node_modules
673673
- uses: actions/setup-node@v3
@@ -699,7 +699,7 @@ CI:
699699
700700
# Connect your workspace on nx.app and uncomment this to enable task distribution.
701701
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
702-
# - pnpm exec nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
702+
# - pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
703703
704704
- pnpm install --frozen-lockfile
705705
- NX_HEAD=$CI_COMMIT_SHA

packages/workspace/src/generators/ci-workflow/ci-workflow.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ interface Substitutes {
3838
packageManager: string;
3939
packageManagerInstall: string;
4040
packageManagerPrefix: string;
41+
packageManagerPreInstallPrefix: string;
4142
nxCloudHost: string;
4243
hasE2E: boolean;
4344
tmpl: '';
@@ -48,8 +49,11 @@ function normalizeOptions(options: Schema, tree: Tree): Substitutes {
4849
options.name
4950
);
5051
const packageManager = detectPackageManager();
51-
const { exec: packageManagerPrefix, ciInstall: packageManagerInstall } =
52-
getPackageManagerCommand(packageManager);
52+
const {
53+
exec: packageManagerPrefix,
54+
ciInstall: packageManagerInstall,
55+
dlx: packageManagerPreInstallPrefix,
56+
} = getPackageManagerCommand(packageManager);
5357

5458
let nxCloudHost: string = 'nx.app';
5559
try {
@@ -72,6 +76,7 @@ function normalizeOptions(options: Schema, tree: Tree): Substitutes {
7276
packageManager,
7377
packageManagerInstall,
7478
packageManagerPrefix,
79+
packageManagerPreInstallPrefix,
7580
mainBranch: deduceDefaultBase(),
7681
hasE2E,
7782
nxCloudHost,

packages/workspace/src/generators/ci-workflow/files/azure/azure-pipelines.yml__tmpl__

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
<% } %>
4949
# Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
5050
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" targets have been requested
51-
# - script: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
51+
# - script: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
5252

5353
- script: <%= packageManagerInstall %>
5454
- script: git branch --track <%= mainBranch %> origin/<%= mainBranch %>

packages/workspace/src/generators/ci-workflow/files/bitbucket-pipelines/bitbucket-pipelines.yml__tmpl__

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pipelines:
1717
<% } %>
1818
# Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
1919
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" targets have been requested
20-
# - <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
20+
# - <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
2121

2222
- <%= packageManagerInstall %>
2323

@@ -33,7 +33,7 @@ pipelines:
3333
- export NX_BRANCH=$BITBUCKET_BRANCH
3434
# Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
3535
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" targets have been requested
36-
# - <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
36+
# - <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
3737

3838
<% if(packageManager == 'pnpm'){ %>
3939
- npm install --prefix=$HOME/.local -g pnpm@8

packages/workspace/src/generators/ci-workflow/files/circleci/.circleci/config.yml__tmpl__

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
# Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
1919
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" targets have been requested
20-
# - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
20+
# - run: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
2121

2222
- run: <%= packageManagerInstall %>
2323
- nx/set-shas:

packages/workspace/src/generators/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml__tmpl__

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525

2626
# Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
2727
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" targets have been requested
28-
# - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
28+
# - run: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
2929

3030
# Cache node_modules
3131
- uses: actions/setup-node@v3

packages/workspace/src/generators/ci-workflow/files/gitlab/.gitlab-ci.yml__tmpl__

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ variables:
1414
<% } %>
1515
# Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
1616
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" targets have been requested
17-
# - <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
17+
# - <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
1818

1919
- <%= packageManagerInstall %>
2020
- NX_HEAD=$CI_COMMIT_SHA

0 commit comments

Comments
 (0)