diff --git a/.github/workflows/scripts/setup-linux.sh b/.github/workflows/scripts/setup-linux.sh index 01cc9530d..2d4a32e9e 100755 --- a/.github/workflows/scripts/setup-linux.sh +++ b/.github/workflows/scripts/setup-linux.sh @@ -13,8 +13,8 @@ ## ##===----------------------------------------------------------------------===## -export NODE_VERSION=v20.19.0 -export NODE_PATH=/usr/local/nvm/versions/node/v20.19.0/bin +export NODE_VERSION=v22.21.1 +export NODE_PATH=/usr/local/nvm/versions/node/${NODE_VERSION}/bin export NVM_DIR=/usr/local/nvm apt-get update && apt-get install -y rsync curl gpg libasound2 libgbm1 libgtk-3-0 libnss3 xvfb build-essential diff --git a/.github/workflows/scripts/windows/install-nodejs.ps1 b/.github/workflows/scripts/windows/install-nodejs.ps1 index 749dc065b..fd6b71119 100644 --- a/.github/workflows/scripts/windows/install-nodejs.ps1 +++ b/.github/workflows/scripts/windows/install-nodejs.ps1 @@ -1,5 +1,5 @@ -$NODEJS='https://nodejs.org/dist/v20.19.0/node-v20.19.0-x64.msi' -$NODEJS_SHA256='c2654d3557abd59de08474c6dd009b1d358f420b8e4010e4debbf130b1dfb90a' +$NODEJS='https://nodejs.org/dist/v22.21.1/node-v22.21.1-x64.msi' +$NODEJS_SHA256='fd7a63fec3a54a665851e2d3d93e07cfead2ffb4521675ffdbceb1bb5ac009bb' Set-Variable ErrorActionPreference Stop Set-Variable ProgressPreference SilentlyContinue Write-Host -NoNewLine ('Downloading {0} ... ' -f ${NODEJS}) diff --git a/.github/workflows/scripts/windows/setup.ps1 b/.github/workflows/scripts/windows/setup.ps1 index ec6ffe5a9..c5d2690d4 100644 --- a/.github/workflows/scripts/windows/setup.ps1 +++ b/.github/workflows/scripts/windows/setup.ps1 @@ -3,10 +3,7 @@ # Download the VSIX archived upstream npm ci --ignore-scripts -$Process = Start-Process npx "tsx scripts/download_vsix.ts" -Wait -PassThru -NoNewWindow -if ($Process.ExitCode -eq 0) { - Write-Host 'SUCCESS' -} else { - Write-Host ('FAILED ({0})' -f $Process.ExitCode) - exit 1 +npx tsx scripts/download_vsix.ts +if ($LastExitCode -ne 0) { + exit $LastExitCode } diff --git a/.vscode/launch.json b/.vscode/launch.json index b101f2537..4b668964e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -52,11 +52,11 @@ "preLaunchTask": "compile-tests" }, { - "name": "Update swift-docc-render", + "name": "Build swift-docc-render", "type": "node", "request": "launch", "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/tsx", - "runtimeArgs": ["${workspaceFolder}/scripts/update_swift_docc_render.ts"] + "runtimeArgs": ["${workspaceFolder}/scripts/build_swift_docc_render.ts"] }, { "name": "Preview Package", diff --git a/package.json b/package.json index b125db4d2..48400e5ae 100644 --- a/package.json +++ b/package.json @@ -2047,10 +2047,10 @@ "compile-documentation-webview": "del-cli ./assets/documentation-webview && esbuild ./src/documentation/webview/webview.ts --bundle --outfile=assets/documentation-webview/index.js --define:process.env.NODE_ENV=\\\"production\\\" --define:process.env.CI=\\\"\\\" --format=cjs --sourcemap", "watch-documentation-webview": "npm run compile-documentation-webview -- --watch", "lint": "eslint ./ --ext ts && tsc --noEmit && tsc --noEmit -p scripts/tsconfig.json", - "update-swift-docc-render": "tsx ./scripts/update_swift_docc_render.ts", + "build-swift-docc-render": "tsx ./scripts/build_swift_docc_render.ts", "compile-icons": "tsx ./scripts/compile_icons.ts", "format": "prettier --check .", - "postinstall": "npm run compile-icons && npm run update-swift-docc-render", + "postinstall": "npm run compile-icons && npm run build-swift-docc-render", "pretest": "npm run compile-tests", "soundness": "scripts/soundness.sh", "check-package-json": "tsx ./scripts/check_package_json.ts", diff --git a/scripts/update_swift_docc_render.ts b/scripts/build_swift_docc_render.ts similarity index 86% rename from scripts/update_swift_docc_render.ts rename to scripts/build_swift_docc_render.ts index 8ea6eb9af..2de4c1831 100644 --- a/scripts/update_swift_docc_render.ts +++ b/scripts/build_swift_docc_render.ts @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// /* eslint-disable no-console */ -import { mkdir, readdir, rm, stat } from "fs/promises"; +import { cp, readdir, rm, stat } from "fs/promises"; import * as path from "path"; import * as semver from "semver"; import simpleGit, { ResetMode } from "simple-git"; @@ -26,9 +26,9 @@ function checkNodeVersion() { "Unable to determine the version of NodeJS that this script is running under." ); } - if (!semver.satisfies(nodeVersion, "20")) { + if (!semver.satisfies(nodeVersion, "^22.17")) { throw new Error( - `Cannot build swift-docc-render with NodeJS v${nodeVersion.raw}. Please install and use NodeJS v20.` + `Cannot build swift-docc-render with NodeJS v${nodeVersion.raw}. Please install and use at least NodeJS v22.17.x.` ); } } @@ -38,7 +38,7 @@ async function cloneSwiftDocCRender(buildDirectory: string): Promise { const swiftDocCRenderDirectory = path.join(buildDirectory, "swift-docc-render"); const git = simpleGit({ baseDir: buildDirectory }); console.log("> git clone https://github.com/swiftlang/swift-docc-render.git"); - const revision = "10b097153d89d7bfc2dd400b47181a782a0cfaa0"; + const revision = "c781d3783f23fda5a4721f5361c6c523772b7a62"; await git.clone("https://github.com/swiftlang/swift-docc-render.git", swiftDocCRenderDirectory); await git.cwd(swiftDocCRenderDirectory); await git.reset(ResetMode.HARD, [revision]); @@ -69,16 +69,16 @@ main(async () => { } checkNodeVersion(); await rm(outputDirectory, { force: true, recursive: true }); - await mkdir(outputDirectory, { recursive: true }); await withTemporaryDirectory("update-swift-docc-render_", async buildDirectory => { const swiftDocCRenderDirectory = await cloneSwiftDocCRender(buildDirectory); - await exec("npm", ["install"], { cwd: swiftDocCRenderDirectory }); - await exec("npx", ["vue-cli-service", "build", "--dest", outputDirectory], { + await exec("npm", ["ci"], { cwd: swiftDocCRenderDirectory }); + await exec("npx", ["vue-cli-service", "build"], { cwd: swiftDocCRenderDirectory, env: { ...process.env, VUE_APP_TARGET: "ide", }, }); + await cp(path.join(swiftDocCRenderDirectory, "dist"), outputDirectory, { recursive: true }); }); }); diff --git a/scripts/patches/swift-docc-render/01_add-live-routes.patch b/scripts/patches/swift-docc-render/01_add-live-routes.patch index 71f700fec..2bf0fc1a7 100644 --- a/scripts/patches/swift-docc-render/01_add-live-routes.patch +++ b/scripts/patches/swift-docc-render/01_add-live-routes.patch @@ -1,5 +1,5 @@ diff --git a/src/routes.js b/src/routes.js -index 0c928ce..f745003 100644 +index 11343be..62c13c9 100644 --- a/src/routes.js +++ b/src/routes.js @@ -9,7 +9,6 @@ @@ -10,9 +10,9 @@ index 0c928ce..f745003 100644 notFoundRouteName, serverErrorRouteName, } from 'docc-render/constants/router'; -@@ -18,25 +17,32 @@ import NotFound from 'theme/views/NotFound.vue'; +@@ -31,25 +30,34 @@ export const fallbackRoutes = [ - export default [ + export const pagesRoutes = [ { - path: '/tutorials/:id', - name: 'tutorials-overview', @@ -40,15 +40,14 @@ index 0c928ce..f745003 100644 { - path: '/documentation*', - name: documentationTopicName, -- component: () => import( -- /* webpackChunkName: "documentation-topic" */ 'theme/views/DocumentationTopic.vue' -- ), + path: '/live/documentation', + name: 'live-documentation', -+ component: () => import(/* webpackChunkName: "documentation-topic" */ 'docc-render/views/DocumentationTopic.vue'), + component: () => import( + /* webpackChunkName: "documentation-topic" */ 'theme/views/DocumentationTopic.vue' + ), + meta: { + skipFetchingData: true, + }, }, - { - path: '*', + ]; +