Skip to content

Commit b9fd2dd

Browse files
Update to the latest version of swift-docc-render (#1964)
1 parent 0f33ac7 commit b9fd2dd

File tree

7 files changed

+26
-30
lines changed

7 files changed

+26
-30
lines changed

.github/workflows/scripts/setup-linux.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
##
1414
##===----------------------------------------------------------------------===##
1515

16-
export NODE_VERSION=v20.19.0
17-
export NODE_PATH=/usr/local/nvm/versions/node/v20.19.0/bin
16+
export NODE_VERSION=v22.21.1
17+
export NODE_PATH=/usr/local/nvm/versions/node/${NODE_VERSION}/bin
1818
export NVM_DIR=/usr/local/nvm
1919

2020
apt-get update && apt-get install -y rsync curl gpg libasound2 libgbm1 libgtk-3-0 libnss3 xvfb build-essential

.github/workflows/scripts/windows/install-nodejs.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
$NODEJS='https://nodejs.org/dist/v20.19.0/node-v20.19.0-x64.msi'
2-
$NODEJS_SHA256='c2654d3557abd59de08474c6dd009b1d358f420b8e4010e4debbf130b1dfb90a'
1+
$NODEJS='https://nodejs.org/dist/v22.21.1/node-v22.21.1-x64.msi'
2+
$NODEJS_SHA256='fd7a63fec3a54a665851e2d3d93e07cfead2ffb4521675ffdbceb1bb5ac009bb'
33
Set-Variable ErrorActionPreference Stop
44
Set-Variable ProgressPreference SilentlyContinue
55
Write-Host -NoNewLine ('Downloading {0} ... ' -f ${NODEJS})

.github/workflows/scripts/windows/setup.ps1

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33

44
# Download the VSIX archived upstream
55
npm ci --ignore-scripts
6-
$Process = Start-Process npx "tsx scripts/download_vsix.ts" -Wait -PassThru -NoNewWindow
7-
if ($Process.ExitCode -eq 0) {
8-
Write-Host 'SUCCESS'
9-
} else {
10-
Write-Host ('FAILED ({0})' -f $Process.ExitCode)
11-
exit 1
6+
npx tsx scripts/download_vsix.ts
7+
if ($LastExitCode -ne 0) {
8+
exit $LastExitCode
129
}

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@
5252
"preLaunchTask": "compile-tests"
5353
},
5454
{
55-
"name": "Update swift-docc-render",
55+
"name": "Build swift-docc-render",
5656
"type": "node",
5757
"request": "launch",
5858
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/tsx",
59-
"runtimeArgs": ["${workspaceFolder}/scripts/update_swift_docc_render.ts"]
59+
"runtimeArgs": ["${workspaceFolder}/scripts/build_swift_docc_render.ts"]
6060
},
6161
{
6262
"name": "Preview Package",

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,10 +2047,10 @@
20472047
"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",
20482048
"watch-documentation-webview": "npm run compile-documentation-webview -- --watch",
20492049
"lint": "eslint ./ --ext ts && tsc --noEmit && tsc --noEmit -p scripts/tsconfig.json",
2050-
"update-swift-docc-render": "tsx ./scripts/update_swift_docc_render.ts",
2050+
"build-swift-docc-render": "tsx ./scripts/build_swift_docc_render.ts",
20512051
"compile-icons": "tsx ./scripts/compile_icons.ts",
20522052
"format": "prettier --check .",
2053-
"postinstall": "npm run compile-icons && npm run update-swift-docc-render",
2053+
"postinstall": "npm run compile-icons && npm run build-swift-docc-render",
20542054
"pretest": "npm run compile-tests",
20552055
"soundness": "scripts/soundness.sh",
20562056
"check-package-json": "tsx ./scripts/check_package_json.ts",
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414
/* eslint-disable no-console */
15-
import { mkdir, readdir, rm, stat } from "fs/promises";
15+
import { cp, readdir, rm, stat } from "fs/promises";
1616
import * as path from "path";
1717
import * as semver from "semver";
1818
import simpleGit, { ResetMode } from "simple-git";
@@ -26,9 +26,9 @@ function checkNodeVersion() {
2626
"Unable to determine the version of NodeJS that this script is running under."
2727
);
2828
}
29-
if (!semver.satisfies(nodeVersion, "20")) {
29+
if (!semver.satisfies(nodeVersion, "^22.17")) {
3030
throw new Error(
31-
`Cannot build swift-docc-render with NodeJS v${nodeVersion.raw}. Please install and use NodeJS v20.`
31+
`Cannot build swift-docc-render with NodeJS v${nodeVersion.raw}. Please install and use at least NodeJS v22.17.x.`
3232
);
3333
}
3434
}
@@ -38,7 +38,7 @@ async function cloneSwiftDocCRender(buildDirectory: string): Promise<string> {
3838
const swiftDocCRenderDirectory = path.join(buildDirectory, "swift-docc-render");
3939
const git = simpleGit({ baseDir: buildDirectory });
4040
console.log("> git clone https://github.com/swiftlang/swift-docc-render.git");
41-
const revision = "10b097153d89d7bfc2dd400b47181a782a0cfaa0";
41+
const revision = "c781d3783f23fda5a4721f5361c6c523772b7a62";
4242
await git.clone("https://github.com/swiftlang/swift-docc-render.git", swiftDocCRenderDirectory);
4343
await git.cwd(swiftDocCRenderDirectory);
4444
await git.reset(ResetMode.HARD, [revision]);
@@ -69,16 +69,16 @@ main(async () => {
6969
}
7070
checkNodeVersion();
7171
await rm(outputDirectory, { force: true, recursive: true });
72-
await mkdir(outputDirectory, { recursive: true });
7372
await withTemporaryDirectory("update-swift-docc-render_", async buildDirectory => {
7473
const swiftDocCRenderDirectory = await cloneSwiftDocCRender(buildDirectory);
75-
await exec("npm", ["install"], { cwd: swiftDocCRenderDirectory });
76-
await exec("npx", ["vue-cli-service", "build", "--dest", outputDirectory], {
74+
await exec("npm", ["ci"], { cwd: swiftDocCRenderDirectory });
75+
await exec("npx", ["vue-cli-service", "build"], {
7776
cwd: swiftDocCRenderDirectory,
7877
env: {
7978
...process.env,
8079
VUE_APP_TARGET: "ide",
8180
},
8281
});
82+
await cp(path.join(swiftDocCRenderDirectory, "dist"), outputDirectory, { recursive: true });
8383
});
8484
});

scripts/patches/swift-docc-render/01_add-live-routes.patch

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/src/routes.js b/src/routes.js
2-
index 0c928ce..f745003 100644
2+
index 11343be..62c13c9 100644
33
--- a/src/routes.js
44
+++ b/src/routes.js
55
@@ -9,7 +9,6 @@
@@ -10,9 +10,9 @@ index 0c928ce..f745003 100644
1010
notFoundRouteName,
1111
serverErrorRouteName,
1212
} from 'docc-render/constants/router';
13-
@@ -18,25 +17,32 @@ import NotFound from 'theme/views/NotFound.vue';
13+
@@ -31,25 +30,34 @@ export const fallbackRoutes = [
1414

15-
export default [
15+
export const pagesRoutes = [
1616
{
1717
- path: '/tutorials/:id',
1818
- name: 'tutorials-overview',
@@ -40,15 +40,14 @@ index 0c928ce..f745003 100644
4040
{
4141
- path: '/documentation*',
4242
- name: documentationTopicName,
43-
- component: () => import(
44-
- /* webpackChunkName: "documentation-topic" */ 'theme/views/DocumentationTopic.vue'
45-
- ),
4643
+ path: '/live/documentation',
4744
+ name: 'live-documentation',
48-
+ component: () => import(/* webpackChunkName: "documentation-topic" */ 'docc-render/views/DocumentationTopic.vue'),
45+
component: () => import(
46+
/* webpackChunkName: "documentation-topic" */ 'theme/views/DocumentationTopic.vue'
47+
),
4948
+ meta: {
5049
+ skipFetchingData: true,
5150
+ },
5251
},
53-
{
54-
path: '*',
52+
];
53+

0 commit comments

Comments
 (0)