Skip to content

Commit

Permalink
Bump NodeJS to v20, CI dependencies, miscellaneous maintenance updates (
Browse files Browse the repository at this point in the history
#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
  • Loading branch information
RichDom2185 authored Aug 19, 2024
1 parent c317391 commit 047af93
Show file tree
Hide file tree
Showing 11 changed files with 247 additions and 506 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
22 changes: 6 additions & 16 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v2-beta
uses: actions/setup-node@v4
with:
node-version: '14'
node-version: 20
cache: yarn
- name: Install pandoc
run: |
URL="https://github.com/jgm/pandoc/releases/download/2.14.0.1/pandoc-2.14.0.1-1-amd64.deb"
Expand All @@ -27,19 +28,8 @@ jobs:
run: |
sudo apt-get update -y
sudo apt-get install -y texlive texlive-fonts-extra latexmk
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Fetch Yarn dependencies
run: |
yarn install
run: yarn install
- name: Build
run: |
set -euxo pipefail
Expand All @@ -52,7 +42,7 @@ jobs:
yarn run prepare
find docs_out -name .gitignore -delete -print
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs_out
Expand Down
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.11.0
5 changes: 2 additions & 3 deletions javascript/generateSearchData.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,8 @@ const processTextFunctions = {
addBodyToObj(obj, node, false);
obj["id"] = `#footnote-${display_footnote_count}`;
obj["count"] = display_footnote_count;
obj[
"href"
] = `/sicpjs/${chapterIndex}#footnote-link-${display_footnote_count}`;
obj["href"] =
`/sicpjs/${chapterIndex}#footnote-link-${display_footnote_count}`;

recursiveProcessTextJson(node.firstChild, obj);
},
Expand Down
24 changes: 12 additions & 12 deletions javascript/generateTocHtml.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ export const recursiveProcessTOC = (index, writeTo, option, toIndexFolder) => {
<span class="collapsed" data-toggle="collapse" href="#index-collapse-${
index + 1
}" aria-expanded="false" aria-controls="index-collapse-${
index + 1
}">
index + 1
}">
<a href="${toIndexFolder}${chapterIndex}.html"> ${displayTitle}</a>
</span>
</h5>
Expand All @@ -144,8 +144,8 @@ export const recursiveProcessTOC = (index, writeTo, option, toIndexFolder) => {
<span class="collapsed" data-toggle="collapse" href="#sidebar-collapse-${
index + 1
}" aria-expanded="false" aria-controls="sidebar-collapse-${
index + 1
}">
index + 1
}">
<a href="${toIndexFolder}${chapterIndex}.html"> ${displayTitle}</a>
</span>
</h5>
Expand All @@ -170,15 +170,15 @@ export const recursiveProcessTOC = (index, writeTo, option, toIndexFolder) => {
<a class="index-show collapsed" data-toggle="collapse" href="#index-collapse-${
index + 1
}" aria-expanded="true" aria-controls="index-collapse-${
index + 1
}">
index + 1
}">
&#10148; <!-- ➤ (because this one is rendered blue on mobile: ▶ -->
</a>
<a class="index-hide collapsed" data-toggle="collapse" href="#index-collapse-${
index + 1
}" aria-expanded="true" aria-controls="index-collapse-${
index + 1
}">
index + 1
}">
&#x25BC; <!-- ▼ (because the corresponding one is not rendered) -->
</a>
<a href="${toIndexFolder}${chapterIndex}.html">${displayTitle}</a>
Expand All @@ -198,15 +198,15 @@ export const recursiveProcessTOC = (index, writeTo, option, toIndexFolder) => {
<a class="sidebar-show collapsed" data-toggle="collapse" href="#sidebar-collapse-${
index + 1
}" aria-expanded="true" aria-controls="sidebar-collapse-${
index + 1
}">
index + 1
}">
&#10148; <!-- ➤ (because this one is rendered blue on mobile: ▶ -->
</a>
<a class="sidebar-hide collapsed" data-toggle="collapse" href="#sidebar-collapse-${
index + 1
}" aria-expanded="true" aria-controls="sidebar-collapse-${
index + 1
}">
index + 1
}">
&#x25BC; <!-- ▼ (because the corresponding one is not rendered) -->
</a>
<a href="${toIndexFolder}${chapterIndex}.html">${displayTitle}</a>
Expand Down
4 changes: 2 additions & 2 deletions javascript/parseXmlHtml.js
Original file line number Diff line number Diff line change
Expand Up @@ -864,8 +864,8 @@ const afterContent = writeTo => {
if (chapArrIndex < allFilepath.length - 1) {
writeTo.push(`
<a class='btn btn-secondary btn-nav' id='${chapArrIndex + 2}' href='./${
tableOfContent[allFilepath[chapArrIndex + 1]].index
}.html'>Next &gt;</a>
tableOfContent[allFilepath[chapArrIndex + 1]].index
}.html'>Next &gt;</a>
`);
}
writeTo.push(`</div>
Expand Down
5 changes: 2 additions & 3 deletions javascript/parseXmlJson.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,8 @@ const processTextFunctions = {
addBodyToObj(obj, node, false);
obj["id"] = `#footnote-${display_footnote_count}`;
obj["count"] = display_footnote_count;
obj[
"href"
] = `/sicpjs/${chapterIndex}#footnote-link-${display_footnote_count}`;
obj["href"] =
`/sicpjs/${chapterIndex}#footnote-link-${display_footnote_count}`;

recursiveProcessTextJson(node.firstChild, obj);
},
Expand Down
16 changes: 8 additions & 8 deletions javascript/processingFunctions/processSnippetPdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ export const processSnippetPdf = (node, writeTo) => {
const postSpace = inFigure
? ""
: inFootnote
? "\\PostBoxCmdFn%\n"
: "\\PostBoxCmd%\n";
? "\\PostBoxCmdFn%\n"
: "\\PostBoxCmd%\n";
const midSpace = inFigure ? "\\smallskip" : "";

const jsPromptSnippet = node.getElementsByTagName("JAVASCRIPT_PROMPT")[0];
Expand Down Expand Up @@ -236,10 +236,10 @@ export const processSnippetPdf = (node, writeTo) => {
let codeEnv = isSmall
? "JavaScriptSmaller" //"JavaScript" + LatexString + "SmallTwo"
: ancestorHasTag(node, "FOOTNOTE")
? "JavaScript" + LatexString + "Footnote"
: ancestorHasTag(node, "EXERCISE")
? "JavaScript" + LatexString + "Small"
: "JavaScript" + LatexString;
? "JavaScript" + LatexString + "Footnote"
: ancestorHasTag(node, "EXERCISE")
? "JavaScript" + LatexString + "Small"
: "JavaScript" + LatexString;

const separator =
"\\end{" +
Expand Down Expand Up @@ -390,8 +390,8 @@ export const processSnippetPdf = (node, writeTo) => {
let codeEnv = ancestorHasTag(node, "FOOTNOTE")
? "JavaScriptClickableFootnote"
: ancestorHasTag(node, "EXERCISE") || isSmall
? "JavaScriptClickableSmall"
: "JavaScriptClickable";
? "JavaScriptClickableSmall"
: "JavaScriptClickable";

const separator =
"\\end{" +
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,21 @@
},
"homepage": "https://sourceacademy.org/sicpjs",
"devDependencies": {
"@babel/node": "^7.25.0",
"@babel/core": "^7.25.2",
"@babel/node": "^7.25.0",
"@babel/preset-env": "^7.25.3",
"fs-extra": "^11.2.0",
"http-server": "^14.1.1",
"husky": "^8.0.3",
"js-slang": "^1.0.57",
"js-slang": "^1.0.74",
"lz-string": "^1.5.0",
"prettier": "^2.8.8",
"prettier": "^3.3.3",
"xmldom": "^0.6.0",
"xpath": "0.0.33"
},
"resolutions": {
"**/gl": "^8.0.2"
},
"scripts": {
"process": "babel-node ./javascript/index.js",
"do": "./scripts/do.sh",
Expand Down
Loading

0 comments on commit 047af93

Please sign in to comment.