From 466ae1452b2357658e8bd15d15372d0d1d555381 Mon Sep 17 00:00:00 2001 From: Michal Piechowiak Date: Fri, 8 Dec 2023 11:12:20 +0100 Subject: [PATCH 01/10] Update handlerUtils.ts --- packages/runtime/src/templates/handlerUtils.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/runtime/src/templates/handlerUtils.ts b/packages/runtime/src/templates/handlerUtils.ts index babcd0bf5d..1b361f165c 100644 --- a/packages/runtime/src/templates/handlerUtils.ts +++ b/packages/runtime/src/templates/handlerUtils.ts @@ -135,6 +135,10 @@ export const augmentFsModule = ({ // ...then monkey-patch it to see if it's requesting a CDN file promises.readFile = (async (file, options) => { + console.log({ + file, + type: typeof file + }) const baseUrl = getBase() // We only care about page files From af903f237e0723780beb0a8a4cbc83ce3ab3fa43 Mon Sep 17 00:00:00 2001 From: Michal Piechowiak Date: Fri, 8 Dec 2023 11:13:10 +0100 Subject: [PATCH 02/10] Create .nvmrc --- demos/default/.nvmrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 demos/default/.nvmrc diff --git a/demos/default/.nvmrc b/demos/default/.nvmrc new file mode 100644 index 0000000000..209e3ef4b6 --- /dev/null +++ b/demos/default/.nvmrc @@ -0,0 +1 @@ +20 From f7492c39df77adf10c3918d637cc9ea14579d3ae Mon Sep 17 00:00:00 2001 From: Michal Piechowiak Date: Fri, 8 Dec 2023 11:22:21 +0100 Subject: [PATCH 03/10] Update handlerUtils.ts --- packages/runtime/src/templates/handlerUtils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/runtime/src/templates/handlerUtils.ts b/packages/runtime/src/templates/handlerUtils.ts index 1b361f165c..db06f84bc8 100644 --- a/packages/runtime/src/templates/handlerUtils.ts +++ b/packages/runtime/src/templates/handlerUtils.ts @@ -137,7 +137,8 @@ export const augmentFsModule = ({ promises.readFile = (async (file, options) => { console.log({ file, - type: typeof file + type: typeof file, + nodeVersion: process.versions.node }) const baseUrl = getBase() From 5b57b99ee65924f572b0ce3a84cfcc4467544485 Mon Sep 17 00:00:00 2001 From: Michal Piechowiak Date: Fri, 8 Dec 2023 11:48:32 +0100 Subject: [PATCH 04/10] Update handlerUtils.ts --- packages/runtime/src/templates/handlerUtils.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/runtime/src/templates/handlerUtils.ts b/packages/runtime/src/templates/handlerUtils.ts index db06f84bc8..fc7bf55e81 100644 --- a/packages/runtime/src/templates/handlerUtils.ts +++ b/packages/runtime/src/templates/handlerUtils.ts @@ -135,15 +135,12 @@ export const augmentFsModule = ({ // ...then monkey-patch it to see if it's requesting a CDN file promises.readFile = (async (file, options) => { - console.log({ - file, - type: typeof file, - nodeVersion: process.versions.node - }) - const baseUrl = getBase() - - // We only care about page files - if (file.startsWith(pageRoot)) { + // file argument can be a string, URL, etc - Next.js cache reading uses a string + // and that's only thing we really want to handle here, so we just do type checking + // instead of trying to handle all possible type before checking weather read + // is about page files. + if (typeof file === 'string' && file.startsWith(pageRoot)) { + const baseUrl = getBase() // We only want the part after `.next/server/` const filePath = file.slice(pageRoot.length + 1) From 42d8ff9c5164cb8d57392e5abdb25409849a34d4 Mon Sep 17 00:00:00 2001 From: Michal Piechowiak Date: Fri, 8 Dec 2023 12:36:06 +0100 Subject: [PATCH 05/10] maybe downgrade cli? --- .github/workflows/test-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index 516b3a628c..6756e9e3f0 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -28,7 +28,7 @@ jobs: with: deno-version: v1.x - name: Install netlify-cli and npm - run: npm install -g netlify-cli npm + run: npm install -g netlify-cli@17.9.0 npm - name: NPM Install run: npm install - name: Run integration tests From 75c29ab85122e921037d5ebd417350a3d4b9bfe0 Mon Sep 17 00:00:00 2001 From: Michal Piechowiak Date: Fri, 8 Dec 2023 12:47:42 +0100 Subject: [PATCH 06/10] chore: remove nvmrc --- demos/default/.nvmrc | 1 - 1 file changed, 1 deletion(-) delete mode 100644 demos/default/.nvmrc diff --git a/demos/default/.nvmrc b/demos/default/.nvmrc deleted file mode 100644 index 209e3ef4b6..0000000000 --- a/demos/default/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -20 From f48e52b8e4f52ac74e76788e148d0f9658c6cc86 Mon Sep 17 00:00:00 2001 From: Michal Piechowiak Date: Fri, 8 Dec 2023 12:59:55 +0100 Subject: [PATCH 07/10] Revert "maybe downgrade cli?" This reverts commit 42d8ff9c5164cb8d57392e5abdb25409849a34d4. --- .github/workflows/test-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index 6756e9e3f0..516b3a628c 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -28,7 +28,7 @@ jobs: with: deno-version: v1.x - name: Install netlify-cli and npm - run: npm install -g netlify-cli@17.9.0 npm + run: npm install -g netlify-cli npm - name: NPM Install run: npm install - name: Run integration tests From 5eb6901385efb8ff2f13b1aaf82d72751832c80b Mon Sep 17 00:00:00 2001 From: Michal Piechowiak Date: Fri, 8 Dec 2023 13:01:57 +0100 Subject: [PATCH 08/10] chore: ? --- .../integration/next-package-not-resolvable-in-base-dir.spec.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/integration/next-package-not-resolvable-in-base-dir.spec.ts b/test/integration/next-package-not-resolvable-in-base-dir.spec.ts index 5fd4cc1725..9ccd9164d0 100644 --- a/test/integration/next-package-not-resolvable-in-base-dir.spec.ts +++ b/test/integration/next-package-not-resolvable-in-base-dir.spec.ts @@ -34,6 +34,8 @@ beforeAll(async () => { return new Promise(async (resolve, reject) => { try { + execa(`find`, [`node_modules/@netlify/plugin-nextjs`], { cwd: siteDestDir, stdio: `inherit` }) + // run let isServeRunning = true const serveProcess = execa('netlify', ['serve', `-p`, `8888`], { cwd: siteDestDir, stdio: `inherit` }) From a806341b6c3fe89a2cb0e57c004df1353fd90ae4 Mon Sep 17 00:00:00 2001 From: Michal Piechowiak Date: Fri, 8 Dec 2023 13:10:08 +0100 Subject: [PATCH 09/10] chore: how about different cli? --- .github/workflows/test-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index 516b3a628c..66a5193518 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -28,7 +28,7 @@ jobs: with: deno-version: v1.x - name: Install netlify-cli and npm - run: npm install -g netlify-cli npm + run: npm install -g netlify-cli npm@10.2.4 - name: NPM Install run: npm install - name: Run integration tests From 66a26d77b2d8424777c4409091d4c22dd32d9c76 Mon Sep 17 00:00:00 2001 From: Michal Piechowiak Date: Fri, 8 Dec 2023 13:17:00 +0100 Subject: [PATCH 10/10] chore: remove test debug code --- .../integration/next-package-not-resolvable-in-base-dir.spec.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/integration/next-package-not-resolvable-in-base-dir.spec.ts b/test/integration/next-package-not-resolvable-in-base-dir.spec.ts index 9ccd9164d0..5fd4cc1725 100644 --- a/test/integration/next-package-not-resolvable-in-base-dir.spec.ts +++ b/test/integration/next-package-not-resolvable-in-base-dir.spec.ts @@ -34,8 +34,6 @@ beforeAll(async () => { return new Promise(async (resolve, reject) => { try { - execa(`find`, [`node_modules/@netlify/plugin-nextjs`], { cwd: siteDestDir, stdio: `inherit` }) - // run let isServeRunning = true const serveProcess = execa('netlify', ['serve', `-p`, `8888`], { cwd: siteDestDir, stdio: `inherit` })