Repository: geoffrich/svelte-adapter-azure-swa (js)

Issue:
Move to latest Node version
Docs and demo app are still using Node 18.

Pull request description:
Move to Node 20
Closes #191

Patch:
diff --git a/.github/workflows/azure-static-web-apps-polite-desert-00b80111e.yml b/.github/workflows/azure-static-web-apps-polite-desert-00b80111e.yml
index a560c33..98eea40 100644
--- a/.github/workflows/azure-static-web-apps-polite-desert-00b80111e.yml
+++ b/.github/workflows/azure-static-web-apps-polite-desert-00b80111e.yml
@@ -59,7 +59,7 @@ jobs:
       - uses: actions/checkout@v3
       - uses: actions/setup-node@v2
         with:
-          node-version: '18.x'
+          node-version: '20.x'
       - name: Install dependencies
         run: npm ci
       - name: Install Playwright
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index c3ac089..090efd3 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -27,7 +27,7 @@ jobs:
 
       - uses: actions/setup-node@v1
         with:
-          node-version: 18
+          node-version: 20
           registry-url: 'https://registry.npmjs.org'
         if: ${{ steps.release.outputs.release_created }}
 
diff --git a/README.md b/README.md
index b4462d7..aaa665c 100644
--- a/README.md
+++ b/README.md
@@ -43,16 +43,6 @@ If you use a custom API directory (see [below](#apiDir)), your `api_location` wi
 
 If your `app_location` is in a subfolder (e.g. `./my_app_location`), then your `api_location` should include the path to that subfolder (e.g. `my_app_location/build/server`.) `output_location` should still be `build/static`.
 
-### Building with the correct version of Node
-
-Oryx, Azure's build system, may attempt to build your application with an EOL version of Node that SvelteKit doesn't support. If you get an error like "Unsupported engine - Not compatible with your version of node/npm", you can force Oryx to use the correct version by setting an `engines` field in your app's `package.json`:
-
-```js
-"engines": {
-	"node": ">=18.13 <19"
-}
-```
-
 ### CUSTOM_BUILD_COMMAND considerations
 
 If you are setting a [`CUSTOM_BUILD_COMMAND`](https://github.com/microsoft/Oryx/blob/main/doc/configuration.md) in your build pipeline to customize how the API is built (e.g. to run `npm ci` instead of `npm install`), make sure to run `npm install` inside the API directory to install production dependencies. Otherwise, the SvelteKit render function will not be able to start up.
diff --git a/demo/package.json b/demo/package.json
index 5bb8bc3..c27af65 100644
--- a/demo/package.json
+++ b/demo/package.json
@@ -23,8 +23,5 @@
 		"svelte-check": "^4.0.0",
 		"typescript": "^5.0.0",
 		"vite": "^6.0.0"
-	},
-	"engines": {
-		"node": ">=18.13 <19"
 	}
 }
diff --git a/index.js b/index.js
index 279deaf..a3e6d19 100644
--- a/index.js
+++ b/index.js
@@ -115,7 +115,7 @@ If you want to suppress this error, set allowReservedSwaRoutes to true in your a
 				outfile: join(functionDir, 'index.js'),
 				bundle: true,
 				platform: 'node',
-				target: 'node18',
+				target: 'node20',
 				sourcemap: 'linked',
 				external: esbuildOptions.external,
 				keepNames: esbuildOptions.keepNames,
@@ -203,7 +203,7 @@ export function generateConfig(customStaticWebAppConfig, appDir) {
 			rewrite: ssrFunctionRoute
 		},
 		platform: {
-			apiRuntime: 'node:18',
+			apiRuntime: 'node:20',
 			...customStaticWebAppConfig.platform
 		}
 	};


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index d6dcdef..e9ca59e 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -15,7 +15,7 @@ jobs:
       - name: Setup Node
         uses: actions/setup-node@v3
         with:
-          node-version: '18.x'
+          node-version: '20.x'
       - run: npm ci
       - run: npm run check-types
       - run: npm run check-format
diff --git a/test/index.test.js b/test/index.test.js
index a00131d..fdf184f 100644
--- a/test/index.test.js
+++ b/test/index.test.js
@@ -25,7 +25,7 @@ describe('generateConfig', () => {
 				rewrite: '/api/sk_render'
 			},
 			platform: {
-				apiRuntime: 'node:18'
+				apiRuntime: 'node:20'
 			},
 			routes: expect.arrayContaining([
 				{