Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🪣 Bump minimum NodeJS version #1162

Merged
merged 8 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sharp-poems-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"myst-cli": minor
---

Update NodeJS minimum version
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['16', '18', '20']
node: ['18', '20', '22']
name: Testing on node ${{ matrix.node }}
steps:
- name: Checkout Repo
Expand Down
34 changes: 17 additions & 17 deletions docs/installing-prerequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ There are a number of ways to install `node` and you can choose one that is suit

:::{important} Node Versions

MyST currently supports `node` v16, v18 and v20. Note that odd-numbered releases of `node` are not long-lived and you should prefer even-numbered releases when installing (see [Node release schedule](https://nodejs.org/en/about/previous-releases)).
MyST currently supports `node` v18, v20, and v22. Note that odd-numbered releases of `node` are not long-lived and you should prefer even-numbered releases when installing (see [Node release schedule](https://nodejs.org/en/about/previous-releases)).
:::

Following any of the install methods below, verify your installation and ensure that `node` and `npm` are available on your system _PATH_ by opening a new terminal window or command line prompt and typing:

```text
```shell
% node -v
v18.16.1
% npm -v
Expand All @@ -35,18 +35,18 @@ Download the installer package, and follow instructions to execute the installer

🛠️ Use the following command can be used to lock down the version you are installing, adjust as necessary for the even-numbered version you are targeting:

```python
(my-conda-env)% conda install -c conda-forge 'nodejs>=16,<17'
```shell
(my-conda-env)% conda install -c conda-forge 'nodejs>=20,<21'
(my-conda-env)% node -v
(my-conda-env)% v16.14.2
v20.11.1
(my-conda-env)% npm -v
(my-conda-env)% v
10.2.4
```

💡 Alternatively, you can create a new `conda` environment directly as a `node` environment:

```shell
% conda create -yn my-node-env 'nodejs>=16,<17'
% conda create -yn my-node-env 'nodejs>=20,<21'
% ....
#
# To activate this environment, use
Expand All @@ -66,26 +66,26 @@ Download the installer package, and follow instructions to execute the installer

🛠️ Install `nodeenv`\:

```python
```shell
% pip install nodeenv
```

🛠️ Query available node versions:

```python
```shell
% nodeenv --list
% ... 16.15.0 ...
% ... 20.11.1 ...
```

🛠️ Create a new environment based on a specific `node` version, and activate it:

```shell
% nodeenv -n 16.15.0 node_env
% nodeenv -n 20.11.1 node_env
% . node_env/bin/activate
(node_env) % node -v
(node_env) % v16.15.0
v20.11.1
(node_env) % npm -v
(node_env) % v8.5.5
10.2.4
```

Read more about `nodeenv` in [their docs](https://ekalinin.github.io/nodeenv/).
Expand All @@ -108,11 +108,11 @@ Read more about `nodeenv` in [their docs](https://ekalinin.github.io/nodeenv/).

🛠️ Next, install an initial (default) version of `node`\:

```python
% nvm install 18
Downloading and installing node v18.18.2...
```shell
% nvm install 20
Downloading and installing node v20.11.1...
...
Now using node v18.18.2 (npm v9.8.1)
Now using node v20.11.1 (npm v10.2.4)
%
```

Expand Down
4 changes: 2 additions & 2 deletions docs/installing.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description: MyST Markdown is available through Node and npm, install the packag

The MyST Markdown Command Line Interface (CLI) is available through [NodeJS](./installing-prerequisites.md) and the node package manager, `npm`. Node is used by Jupyter as well as many other Python packages so you may already have it installed on your _PATH_ and the following command may just work 🤞.

🛠️ [Install NodeJS](./installing-prerequisites.md), either version 16, 18 or 20
🛠️ [Install NodeJS](./installing-prerequisites.md), either version 18, 20, or 22

```{important} Installing Node

Expand Down Expand Up @@ -57,4 +57,4 @@ MyST performs web requests to download templates, check DOIs, etc. If you are wo
```shell
HTTPS_PROXY=http://168.63.76.32:3128 \
myst build
```
```
2 changes: 1 addition & 1 deletion packages/myst-cli/src/utils/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type VersionResults = Parameters<Parameters<typeof check>[1]>[1];

export async function getNodeVersion(session: ISession): Promise<VersionResults | null> {
const result = new Promise<VersionResults | null>((resolve) => {
check({ node: '>= 16.0.0', npm: '>=7' }, (error, results) => {
check({ node: '>= 18.0.0', npm: '>=8.6.0' }, (error, results) => {
if (error) {
session.log.error(error);
resolve(null);
Expand Down
6 changes: 3 additions & 3 deletions packages/mystmd-py/src/mystmd_py/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def main():

if not NODE_LOCATION:
raise SystemExit(
"You must install node >=16 to run MyST\n\n"
"You must install node >=18 to run MyST\n\n"
"We recommend installing the latest LTS release, using your preferred package manager\n"
"or following instructions here: https://nodejs.org/en/download"
)
Expand All @@ -27,9 +27,9 @@ def main():
raise SystemExit(f"MyST could not determine the version of Node.js: {_version}")

major_version = int(major_version_match[1])
if not (major_version in {16, 18} or major_version >= 20):
if not (major_version in {18, 20, 22} or major_version > 22):
raise SystemExit(
f"MyST requires node 16, 18, or 20+; you are running node {version[1:3]}.\n\n"
f"MyST requires node 18, 20, or 22+; you are running node {version[1:3]}.\n\n"
"Please update to the latest LTS release, using your preferred package manager\n"
"or following instructions here: https://nodejs.org/en/download"
)
Expand Down