Skip to content

Commit 527f5d7

Browse files
authored
Update JavaScript dependencies (#329)
* Update less to version 4.2.2 * Update po2json to 1.0.0-beta-3 to fix CVE with dependency * Update jupyterlab/apputils and fix peer dependencies * Fix html-css-sanitizer-minified.js not found * Fix rjsf/utils is incompatible with Node 12 * Add npm build step before running tests * Bump CasperJS version * Update yarn and pip caching * Bump PhantomJS version * Fix incomplete build process on CI * Revert jupyterlab/apputils to v3.6 * Pin yarn to classic version only
1 parent 3a01249 commit 527f5d7

File tree

5 files changed

+306
-1980
lines changed

5 files changed

+306
-1980
lines changed

.github/workflows/js.yml

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Linux JS Tests
1+
name: JavaScript Tests
22

33
on:
44
push:
@@ -33,27 +33,36 @@ jobs:
3333
- name: Set up Node
3434
uses: actions/setup-node@v4
3535
with:
36-
node-version: '12.x'
36+
node-version: '16.x'
3737

38-
- name: Cache node modules
38+
- name: get yarn cache directory path
39+
id: yarn-cache-dir-path
40+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
41+
42+
- name: Cache yarn
3943
uses: actions/cache@v4
40-
env:
41-
cache-name: cache-node-modules
44+
id: yarn-cache
4245
with:
43-
# npm cache files are stored in `~/.npm` on Linux/macOS
44-
path: ~/.npm
45-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
46+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
47+
key: ${{ runner.os }}-yarn-${{ hashfiles('**/yarn.lock') }}
4648
restore-keys: |
47-
${{ runner.os }}-build-${{ env.cache-name }}-
48-
${{ runner.os }}-build-
49-
${{ runner.os }}-
49+
${{ runner.os }}-yarn-
5050
5151
- name: Cache pip on Linux
5252
uses: actions/cache@v4
5353
if: startsWith(runner.os, 'Linux')
5454
with:
5555
path: ~/.cache/pip
56-
key: ${{ runner.os }}-pip-${{ env.python-version }}-${{ hashFiles('pyproject.toml') }}
56+
key: ${{ runner.os }}-pip-${{ env.python-version }}-${{ hashfiles('pyproject.toml') }}
57+
restore-keys: |
58+
${{ runner.os }}-pip-${{ env.python-version }}
59+
60+
- name: Cache pip on macOS
61+
uses: actions/cache@v4
62+
if: startsWith(runner.os, 'macOS')
63+
with:
64+
path: ~/Library/Caches/pip
65+
key: ${{ runner.os }}-pip-${{ env.python-version }}-${{ hashfiles('pyproject.toml') }}
5766
restore-keys: |
5867
${{ runner.os }}-pip-${{ env.python-version }}
5968
@@ -65,8 +74,8 @@ jobs:
6574
run: |
6675
pip install --upgrade pip
6776
pip install --upgrade setuptools wheel
68-
yarn install
69-
77+
npm run build
78+
7079
pip install .[test]
7180
7281
- name: Run Tests

.github/workflows/playwright.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ jobs:
3030
- name: Set up Node
3131
uses: actions/setup-node@v4
3232
with:
33-
node-version: '12.x'
33+
node-version: '16.x'
3434

35-
- name: Install JS
35+
- name: Install and build JS
3636
run: |
37-
yarn install
37+
npm run build
3838
3939
- name: Install Python dependencies
4040
run: |

CONTRIBUTING.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ Installing Node.js and npm
2727
Building the NbClassic from its GitHub source code requires some tools to
2828
create and minify JavaScript components and the CSS,
2929
specifically Node.js and Node's package manager, ``npm``.
30-
It should be node version ≥ 6.0.
30+
It should be node version ≥ 16.0. We also use Yarn (classic) version 1.x.
3131

3232
If you use ``conda``, you can get them with::
3333

34-
conda install -c conda-forge nodejs
34+
conda install -c conda-forge nodejs=16 yarn=1
3535

3636
If you use `Homebrew <https://brew.sh/>`_ on Mac OS X::
3737

38-
brew install node
38+
brew install node yarn
3939

4040
Installation on Linux may vary, but be aware that the `nodejs` or `npm` packages
4141
included in the system package repository may be too old to work properly.
@@ -181,6 +181,10 @@ installed::
181181

182182
npm install -g casperjs phantomjs-prebuilt
183183

184+
Re-build the JavaScript prior to running tests::
185+
186+
npm run build
187+
184188
Then, to run the JavaScript tests::
185189

186190
python -m nbclassic.jstest [group]

package.json

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,23 @@
3939
"devDependencies": {
4040
"@babel/core": "^7.15.0",
4141
"@babel/preset-env": "^7.15.0",
42-
"@jupyterlab/apputils": "^3.1.3",
42+
"@jupyterlab/apputils": "^3.6.1",
4343
"babel-loader": "^8.2.2",
4444
"babel-polyfill": "^6.26.0",
45-
"bower": "^1.8.8",
46-
"less": "~2",
45+
"commander": "^6.0.0",
46+
"gettext-parser": "2.0.0",
47+
"gettext-to-messageformat": "0.3.1",
48+
"less": "^4.2.2",
4749
"onchange": "^6.0.0",
48-
"po2json": "^0.4.5",
50+
"po2json": "1.0.0-beta-3",
4951
"requirejs": "^2.3.6",
5052
"webpack": "^5.46.0",
5153
"webpack-cli": "^4.7.2"
5254
},
55+
"devDependenciesNotes": {
56+
"@jupyterlab/apputils": "Restricted to 3.6.x because v4.x changes sanitizer API breaking Markdown cells",
57+
"pos2json": "Using a beta 1.0.0 version because previous version have security problems, and no 1.0.0 release"
58+
},
5359
"dependencies": {
5460
"@bower_components/MathJax": "mathjax/MathJax#^2.7.4",
5561
"@bower_components/backbone": "jashkenas/backbone#~1.6.0",
@@ -58,10 +64,10 @@
5864
"@bower_components/codemirror": "components/codemirror#5.58.2+components1",
5965
"@bower_components/es6-promise": "components/es6-promise#~1.0",
6066
"@bower_components/font-awesome": "components/font-awesome#~4.7.0",
61-
"@bower_components/google-caja": "github:minrk/google-caja-bower#5669",
67+
"@bower_components/google-caja": "https://github.com/minrk/google-caja-bower/archive/refs/tags/5669.0.0.tar.gz",
6268
"@bower_components/jed": "SlexAxton/Jed#~1.1.1",
6369
"@bower_components/jquery": "components/jquery#~3.7.1",
64-
"@bower_components/jquery-typeahead": "running-coder/jquery-typeahead#~2.10.7",
70+
"@bower_components/jquery-typeahead": "running-coder/jquery-typeahead#~2.11.1",
6571
"@bower_components/jquery-ui": "jquery/jquery-ui#~1.13.3",
6672
"@bower_components/marked": "chjj/marked#~4.0.10",
6773
"@bower_components/moment": "moment/moment#~2.29.4",
@@ -73,6 +79,7 @@
7379
"@bower_components/underscore": "jashkenas/underscore#~1.13.7"
7480
},
7581
"engines": {
76-
"yarn": ">= 1.0.0"
82+
"yarn": "^1.22.22",
83+
"node": ">=16"
7784
}
7885
}

0 commit comments

Comments
 (0)