Skip to content

Commit

Permalink
fix(node-version): downgrade node to fix broken cdk pipelines [INFRA-…
Browse files Browse the repository at this point in the history
…33946] (#315)

* fix(node-version): downgrade node to fix broken cdk pipelines [INFRA-33946]

* add tests for using workflowNodeVersion
  • Loading branch information
mattlewis92 authored Feb 7, 2025
1 parent d8a0dc3 commit 89e92c9
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 42 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .github/workflows/release.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/update-projen-main.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .npmrc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .nvmrc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/clickup-cdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export module clickupCdk {
// pnpm will manage the version of the package manager (pnpm)
this.npmrc.addConfig('manage-package-manager-versions', 'true');
// pnpm checks this value before running commands and will use (and install if missing) the specified version
this.npmrc.addConfig('use-node-version', parameters.PROJEN_NODE_VERSION);
this.npmrc.addConfig('use-node-version', options.workflowNodeVersion ?? parameters.PROJEN_NODE_VERSION);
// PNPM support for bundledDeps https://pnpm.io/npmrc#node-linker
this.npmrc.addConfig('node-linker', 'hoisted');
}
Expand Down Expand Up @@ -298,7 +298,7 @@ export module clickupCdk {
// necessary to allow minor/patch version updates of pnpm on dev boxes
this.npmrc.addConfig('package-manager-strict', 'false');
// pnpm checks this value before running commands and will use (and install if missing) the specified version
this.npmrc.addConfig('use-node-version', parameters.PROJEN_NODE_VERSION);
this.npmrc.addConfig('use-node-version', options.workflowNodeVersion ?? parameters.PROJEN_NODE_VERSION);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/clickup-ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export module clickupTs {
// pnpm will manage the version of the package manager (pnpm)
this.npmrc.addConfig('manage-package-manager-versions', 'true');
// pnpm checks this value before running commands and will use (and install if missing) the specified version
this.npmrc.addConfig('use-node-version', parameters.PROJEN_NODE_VERSION);
this.npmrc.addConfig('use-node-version', options.workflowNodeVersion ?? parameters.PROJEN_NODE_VERSION);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class parameters {

// This should be updated occasionally to the latest release of the current active version.
// This will drive all the other node versions throughout the system.
static PROJEN_NODE_VERSION: string = '22.13.1';
static PROJEN_NODE_VERSION: string = '20.11.1';

// This should be updated occasionally to the latest release of the current active version.
static PROJEN_PNPM_VERSION: string = '9.15.5';
Expand Down
12 changes: 6 additions & 6 deletions test/__snapshots__/cdk-diff-workflow.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 16 additions & 16 deletions test/__snapshots__/clickup-cdk.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions test/__snapshots__/clickup-ts.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions test/__snapshots__/node-version.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions test/clickup-cdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('ClickUpCdkTypeScriptApp', () => {
const npmrcEntries = [
'package-manager-strict=false',
// 'manage-package-manager-versions=true',
'use-node-version=22.13.1',
'use-node-version=20.11.1',
];
it.each(npmrcEntries)('%s', (npmrcEntry) => {
expect(synth['.npmrc']).toContain(npmrcEntry);
Expand Down Expand Up @@ -133,13 +133,25 @@ describe('ClickUpCdkConstructLibrary', () => {
const npmrcEntries = [
'package-manager-strict=false',
'manage-package-manager-versions=true',
'use-node-version=22.13.1',
'use-node-version=20.11.1',
'node-linker=hoisted',
];
it.each(npmrcEntries)('%s', (npmrcEntry) => {
expect(synth['.npmrc']).toContain(npmrcEntry);
});
});

describe('workflowNodeVersion', () => {
p = new clickupCdk.ClickUpCdkConstructLibrary({
...commonProps,
packageManager: javascript.NodePackageManager.PNPM,
workflowNodeVersion: '22.0.0',
});
const synth = Testing.synth(p);
it('use-node-version in .npmrc file', () => {
expect(synth['.npmrc']).toContain('use-node-version=22.0.0');
});
});
});
});

Expand Down
16 changes: 15 additions & 1 deletion test/clickup-ts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,26 @@ describe('ClickUpTypeScriptProject', () => {
const npmrcEntries = [
'package-manager-strict=false',
'manage-package-manager-versions=true',
'use-node-version=22.13.1',
'use-node-version=20.11.1',
];
it.each(npmrcEntries)('%s', (npmrcEntry) => {
expect(synth['.npmrc']).toContain(npmrcEntry);
});
});

describe('workflowNodeVersion', () => {
const p = new clickupTs.ClickUpTypeScriptProject({
name: '@time-loop/test',
defaultReleaseBranch: 'main',
packageManager: javascript.NodePackageManager.PNPM,
pnpmVersion: '9',
workflowNodeVersion: '22.0.0',
});
const synth = Testing.synth(p);
it('use-node-version in .npmrc file', () => {
expect(synth['.npmrc']).toContain('use-node-version=22.0.0');
});
});
});

describe('normalizeName', () => {
Expand Down

0 comments on commit 89e92c9

Please sign in to comment.