Skip to content

Commit 047af93

Browse files
authored
Bump NodeJS to v20, CI dependencies, miscellaneous maintenance updates (#1055)
* Bump to NodeJS 20 * Bump gl to v8 * Bump prettier to latest * Reformat post-prettier update * Update GitHub Actions dependencies and workflow * Bump js-slang * Deduplicate dependencies
1 parent c317391 commit 047af93

11 files changed

+247
-506
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
- name: Checkout repository
1313
uses: actions/checkout@v4
1414
- name: Setup Node.js
15-
uses: actions/setup-node@v3
15+
uses: actions/setup-node@v4
1616
with:
17-
node-version: 16
17+
node-version: 20
1818
cache: yarn
1919
- name: Install dependencies
2020
run: yarn install --frozen-lockfile

.github/workflows/codeql-analysis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939

4040
steps:
4141
- name: Checkout repository
42-
uses: actions/checkout@v2
42+
uses: actions/checkout@v4
4343

4444
# Initializes the CodeQL tools for scanning.
4545
- name: Initialize CodeQL

.github/workflows/deploy-pages.yml

+6-16
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ jobs:
1212
deploy:
1313
runs-on: ubuntu-20.04
1414
steps:
15-
- uses: actions/checkout@master
15+
- uses: actions/checkout@v4
1616
- name: Use Node.js
17-
uses: actions/setup-node@v2-beta
17+
uses: actions/setup-node@v4
1818
with:
19-
node-version: '14'
19+
node-version: 20
20+
cache: yarn
2021
- name: Install pandoc
2122
run: |
2223
URL="https://github.com/jgm/pandoc/releases/download/2.14.0.1/pandoc-2.14.0.1-1-amd64.deb"
@@ -27,19 +28,8 @@ jobs:
2728
run: |
2829
sudo apt-get update -y
2930
sudo apt-get install -y texlive texlive-fonts-extra latexmk
30-
- name: Get yarn cache directory path
31-
id: yarn-cache-dir-path
32-
run: echo "::set-output name=dir::$(yarn cache dir)"
33-
- uses: actions/cache@v2
34-
id: yarn-cache
35-
with:
36-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
37-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
38-
restore-keys: |
39-
${{ runner.os }}-yarn-
4031
- name: Fetch Yarn dependencies
41-
run: |
42-
yarn install
32+
run: yarn install
4333
- name: Build
4434
run: |
4535
set -euxo pipefail
@@ -52,7 +42,7 @@ jobs:
5242
yarn run prepare
5343
find docs_out -name .gitignore -delete -print
5444
- name: Deploy
55-
uses: peaceiris/actions-gh-pages@v3
45+
uses: peaceiris/actions-gh-pages@v4
5646
with:
5747
github_token: ${{ secrets.GITHUB_TOKEN }}
5848
publish_dir: ./docs_out

.node-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.11.0

javascript/generateSearchData.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,8 @@ const processTextFunctions = {
460460
addBodyToObj(obj, node, false);
461461
obj["id"] = `#footnote-${display_footnote_count}`;
462462
obj["count"] = display_footnote_count;
463-
obj[
464-
"href"
465-
] = `/sicpjs/${chapterIndex}#footnote-link-${display_footnote_count}`;
463+
obj["href"] =
464+
`/sicpjs/${chapterIndex}#footnote-link-${display_footnote_count}`;
466465

467466
recursiveProcessTextJson(node.firstChild, obj);
468467
},

javascript/generateTocHtml.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ export const recursiveProcessTOC = (index, writeTo, option, toIndexFolder) => {
128128
<span class="collapsed" data-toggle="collapse" href="#index-collapse-${
129129
index + 1
130130
}" aria-expanded="false" aria-controls="index-collapse-${
131-
index + 1
132-
}">
131+
index + 1
132+
}">
133133
<a href="${toIndexFolder}${chapterIndex}.html"> ${displayTitle}</a>
134134
</span>
135135
</h5>
@@ -144,8 +144,8 @@ export const recursiveProcessTOC = (index, writeTo, option, toIndexFolder) => {
144144
<span class="collapsed" data-toggle="collapse" href="#sidebar-collapse-${
145145
index + 1
146146
}" aria-expanded="false" aria-controls="sidebar-collapse-${
147-
index + 1
148-
}">
147+
index + 1
148+
}">
149149
<a href="${toIndexFolder}${chapterIndex}.html"> ${displayTitle}</a>
150150
</span>
151151
</h5>
@@ -170,15 +170,15 @@ export const recursiveProcessTOC = (index, writeTo, option, toIndexFolder) => {
170170
<a class="index-show collapsed" data-toggle="collapse" href="#index-collapse-${
171171
index + 1
172172
}" aria-expanded="true" aria-controls="index-collapse-${
173-
index + 1
174-
}">
173+
index + 1
174+
}">
175175
&#10148; <!-- ➤ (because this one is rendered blue on mobile: ▶ -->
176176
</a>
177177
<a class="index-hide collapsed" data-toggle="collapse" href="#index-collapse-${
178178
index + 1
179179
}" aria-expanded="true" aria-controls="index-collapse-${
180-
index + 1
181-
}">
180+
index + 1
181+
}">
182182
&#x25BC; <!-- ▼ (because the corresponding one is not rendered) -->
183183
</a>
184184
<a href="${toIndexFolder}${chapterIndex}.html">${displayTitle}</a>
@@ -198,15 +198,15 @@ export const recursiveProcessTOC = (index, writeTo, option, toIndexFolder) => {
198198
<a class="sidebar-show collapsed" data-toggle="collapse" href="#sidebar-collapse-${
199199
index + 1
200200
}" aria-expanded="true" aria-controls="sidebar-collapse-${
201-
index + 1
202-
}">
201+
index + 1
202+
}">
203203
&#10148; <!-- ➤ (because this one is rendered blue on mobile: ▶ -->
204204
</a>
205205
<a class="sidebar-hide collapsed" data-toggle="collapse" href="#sidebar-collapse-${
206206
index + 1
207207
}" aria-expanded="true" aria-controls="sidebar-collapse-${
208-
index + 1
209-
}">
208+
index + 1
209+
}">
210210
&#x25BC; <!-- ▼ (because the corresponding one is not rendered) -->
211211
</a>
212212
<a href="${toIndexFolder}${chapterIndex}.html">${displayTitle}</a>

javascript/parseXmlHtml.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -864,8 +864,8 @@ const afterContent = writeTo => {
864864
if (chapArrIndex < allFilepath.length - 1) {
865865
writeTo.push(`
866866
<a class='btn btn-secondary btn-nav' id='${chapArrIndex + 2}' href='./${
867-
tableOfContent[allFilepath[chapArrIndex + 1]].index
868-
}.html'>Next &gt;</a>
867+
tableOfContent[allFilepath[chapArrIndex + 1]].index
868+
}.html'>Next &gt;</a>
869869
`);
870870
}
871871
writeTo.push(`</div>

javascript/parseXmlJson.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,8 @@ const processTextFunctions = {
251251
addBodyToObj(obj, node, false);
252252
obj["id"] = `#footnote-${display_footnote_count}`;
253253
obj["count"] = display_footnote_count;
254-
obj[
255-
"href"
256-
] = `/sicpjs/${chapterIndex}#footnote-link-${display_footnote_count}`;
254+
obj["href"] =
255+
`/sicpjs/${chapterIndex}#footnote-link-${display_footnote_count}`;
257256

258257
recursiveProcessTextJson(node.firstChild, obj);
259258
},

javascript/processingFunctions/processSnippetPdf.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ export const processSnippetPdf = (node, writeTo) => {
117117
const postSpace = inFigure
118118
? ""
119119
: inFootnote
120-
? "\\PostBoxCmdFn%\n"
121-
: "\\PostBoxCmd%\n";
120+
? "\\PostBoxCmdFn%\n"
121+
: "\\PostBoxCmd%\n";
122122
const midSpace = inFigure ? "\\smallskip" : "";
123123

124124
const jsPromptSnippet = node.getElementsByTagName("JAVASCRIPT_PROMPT")[0];
@@ -236,10 +236,10 @@ export const processSnippetPdf = (node, writeTo) => {
236236
let codeEnv = isSmall
237237
? "JavaScriptSmaller" //"JavaScript" + LatexString + "SmallTwo"
238238
: ancestorHasTag(node, "FOOTNOTE")
239-
? "JavaScript" + LatexString + "Footnote"
240-
: ancestorHasTag(node, "EXERCISE")
241-
? "JavaScript" + LatexString + "Small"
242-
: "JavaScript" + LatexString;
239+
? "JavaScript" + LatexString + "Footnote"
240+
: ancestorHasTag(node, "EXERCISE")
241+
? "JavaScript" + LatexString + "Small"
242+
: "JavaScript" + LatexString;
243243

244244
const separator =
245245
"\\end{" +
@@ -390,8 +390,8 @@ export const processSnippetPdf = (node, writeTo) => {
390390
let codeEnv = ancestorHasTag(node, "FOOTNOTE")
391391
? "JavaScriptClickableFootnote"
392392
: ancestorHasTag(node, "EXERCISE") || isSmall
393-
? "JavaScriptClickableSmall"
394-
: "JavaScriptClickable";
393+
? "JavaScriptClickableSmall"
394+
: "JavaScriptClickable";
395395

396396
const separator =
397397
"\\end{" +

package.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,21 @@
2525
},
2626
"homepage": "https://sourceacademy.org/sicpjs",
2727
"devDependencies": {
28-
"@babel/node": "^7.25.0",
2928
"@babel/core": "^7.25.2",
29+
"@babel/node": "^7.25.0",
3030
"@babel/preset-env": "^7.25.3",
3131
"fs-extra": "^11.2.0",
3232
"http-server": "^14.1.1",
3333
"husky": "^8.0.3",
34-
"js-slang": "^1.0.57",
34+
"js-slang": "^1.0.74",
3535
"lz-string": "^1.5.0",
36-
"prettier": "^2.8.8",
36+
"prettier": "^3.3.3",
3737
"xmldom": "^0.6.0",
3838
"xpath": "0.0.33"
3939
},
40+
"resolutions": {
41+
"**/gl": "^8.0.2"
42+
},
4043
"scripts": {
4144
"process": "babel-node ./javascript/index.js",
4245
"do": "./scripts/do.sh",

0 commit comments

Comments
 (0)