From 8d56c9622dfed57b627363cb44e560cbc490b480 Mon Sep 17 00:00:00 2001 From: Gabriel Plassard <2485407+gplassard@users.noreply.github.com> Date: Mon, 29 Jan 2024 20:30:20 +0100 Subject: [PATCH] feat(node-npmrc): specify node version inside .npmrc in order for pnpm to honor it (#78) * feat(node-npmrc): specify node version inside .npmrc in order for pnpm to honor it * chore: self mutation Signed-off-by: github-actions --------- Signed-off-by: github-actions Co-authored-by: github-actions --- .npmrc | 1 + src/typescript/TypescriptApplicationProject.ts | 1 + .../__snapshots__/TypescriptApplicationProject.test.ts.snap | 2 ++ .../__snapshots__/TypescriptLibraryProject.test.ts.snap | 1 + 4 files changed, 5 insertions(+) diff --git a/.npmrc b/.npmrc index d53a2c2..bf04130 100644 --- a/.npmrc +++ b/.npmrc @@ -2,3 +2,4 @@ resolution-mode=highest @gplassard:registry=https://npm.pkg.github.com +use-node-version=20.8.0 diff --git a/src/typescript/TypescriptApplicationProject.ts b/src/typescript/TypescriptApplicationProject.ts index ebf4ee0..99f02c3 100644 --- a/src/typescript/TypescriptApplicationProject.ts +++ b/src/typescript/TypescriptApplicationProject.ts @@ -77,6 +77,7 @@ export class TypescriptApplicationProject extends TypeScriptProject { }; super(typescriptProjectOptions); this.npmrc.addRegistry('https://npm.pkg.github.com', '@gplassard'); + this.npmrc.addConfig('use-node-version', nodeVersion(options)); // we get it through a transitive dependency to @gplassard/projen-extensions, maybe should be a peer dependency instead new CustomGitignore(this, options.customGitignore); diff --git a/test/typescript/__snapshots__/TypescriptApplicationProject.test.ts.snap b/test/typescript/__snapshots__/TypescriptApplicationProject.test.ts.snap index f79ae59..b1119cf 100644 --- a/test/typescript/__snapshots__/TypescriptApplicationProject.test.ts.snap +++ b/test/typescript/__snapshots__/TypescriptApplicationProject.test.ts.snap @@ -659,6 +659,7 @@ tsconfig.tsbuildinfo ".npmrc": "# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen". @gplassard:registry=https://npm.pkg.github.com +use-node-version=20.8.0 ", ".projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".", @@ -2056,6 +2057,7 @@ tsconfig.tsbuildinfo resolution-mode=highest @gplassard:registry=https://npm.pkg.github.com +use-node-version=20.8.0 ", ".projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".", diff --git a/test/typescript/__snapshots__/TypescriptLibraryProject.test.ts.snap b/test/typescript/__snapshots__/TypescriptLibraryProject.test.ts.snap index 16cc991..65f5330 100644 --- a/test/typescript/__snapshots__/TypescriptLibraryProject.test.ts.snap +++ b/test/typescript/__snapshots__/TypescriptLibraryProject.test.ts.snap @@ -692,6 +692,7 @@ tsconfig.tsbuildinfo resolution-mode=highest @gplassard:registry=https://npm.pkg.github.com +use-node-version=20.8.0 ", ".projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".",