Skip to content

Commit b567ce8

Browse files
authored
Support npm 11 (#618)
* Test with node 24 * add test * dbg windows * update test for npm 11 * fix dry with run npm 11
1 parent e3d9183 commit b567ce8

File tree

12 files changed

+96
-6
lines changed

12 files changed

+96
-6
lines changed

.github/workflows/check-release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v4
1717
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
18+
with:
19+
node_version: "24.x"
1820
- name: Install Dependencies
1921
shell: bash
2022
run: |

.github/workflows/generate-changelog.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
steps:
3333
- uses: actions/checkout@v4
3434
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
35+
with:
36+
node_version: "24.x"
3537
- name: Install Dependencies
3638
shell: bash
3739
run: |

.github/workflows/prep-release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
steps:
3333
- uses: actions/checkout@v4
3434
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
35+
with:
36+
node_version: "24.x"
3537
- name: Install Dependencies
3638
shell: bash
3739
run: |

.github/workflows/prep-self-release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ jobs:
3131
steps:
3232
- uses: actions/checkout@v4
3333
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
34+
with:
35+
node_version: "24.x"
3436
- name: Install Dependencies
3537
shell: bash
3638
run: |

.github/workflows/publish-changelog.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v4
1818
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
19+
with:
20+
node_version: "24.x"
1921

2022
- name: Install Dependencies
2123
shell: bash

.github/workflows/publish-release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v4
2323
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
24+
with:
25+
node_version: "24.x"
2426
- name: Install Dependencies
2527
shell: bash
2628
run: |

.github/workflows/publish-self-release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v4
2323
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
24+
with:
25+
node_version: "24.x"
2426
- name: Install Dependencies
2527
shell: bash
2628
run: |

.github/workflows/test.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
steps:
2121
- uses: actions/checkout@v4
2222
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
23+
with:
24+
node_version: "24.x"
2325
- name: Run Linters
2426
run: |
2527
hatch run typing:test
@@ -32,6 +34,8 @@ jobs:
3234
steps:
3335
- uses: actions/checkout@v4
3436
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
37+
with:
38+
node_version: "24.x"
3539
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1
3640
with:
3741
ignore_links: https://blog.jupyter.org/.*
@@ -46,6 +50,8 @@ jobs:
4650
steps:
4751
- uses: actions/checkout@v4
4852
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
53+
with:
54+
node_version: "24.x"
4955

5056
- name: Run the tests with coverage on Ubuntu
5157
if: ${{ matrix.os == 'ubuntu-latest' }}
@@ -72,6 +78,8 @@ jobs:
7278
steps:
7379
- uses: actions/checkout@v4
7480
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
81+
with:
82+
node_version: "24.x"
7583
- env:
7684
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7785
RH_REPOSITORY: jupyter-server/jupyter_releaser
@@ -103,6 +111,7 @@ jobs:
103111
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
104112
with:
105113
dependency_type: minimum
114+
node_version: "24.x"
106115
- name: Run the unit tests
107116
run: |
108117
hatch run test:nowarn || hatch run test:nowarn --lf
@@ -117,6 +126,7 @@ jobs:
117126
with:
118127
dependency_type: pre
119128
python_version: "3.12"
129+
node_version: "24.x"
120130
- name: Run the tests
121131
run: |
122132
hatch run test:nowarn || hatch run test:nowarn --lf
@@ -127,13 +137,17 @@ jobs:
127137
steps:
128138
- uses: actions/checkout@v4
129139
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
140+
with:
141+
node_version: "24.x"
130142
- run: hatch run docs:build
131143

132144
check_local_actions:
133145
runs-on: ubuntu-latest
134146
steps:
135147
- uses: actions/checkout@v4
136148
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
149+
with:
150+
node_version: "24.x"
137151

138152
- name: prep-release
139153
uses: ./.github/actions/prep-release

jupyter_releaser/lib.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,16 @@ def publish_assets(
417417
twine_cmd = "pipx run twine upload --repository-url=http://0.0.0.0:8081"
418418
os.environ["TWINE_USERNAME"] = "foo"
419419
twine_token = twine_token or "bar"
420-
npm_cmd = "npm publish --dry-run"
420+
# Preserve --tag flag if it was added for prereleases
421+
if " --tag " in npm_cmd:
422+
# Extract the tag and add --dry-run while preserving it
423+
tag_match = re.search(r"--tag\s+(\S+)", npm_cmd)
424+
if tag_match:
425+
npm_cmd = f"npm publish --dry-run --tag {tag_match.group(1)}"
426+
else:
427+
npm_cmd = "npm publish --dry-run"
428+
else:
429+
npm_cmd = "npm publish --dry-run"
421430
else:
422431
os.environ.setdefault("TWINE_USERNAME", "__token__")
423432

jupyter_releaser/util.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ def _run_win(cmd, **kwargs):
9898
"""Run a command as a subprocess and get the output as a string"""
9999
quiet = kwargs.pop("quiet", False)
100100

101-
if not quiet:
102-
kwargs.setdefault("stderr", PIPE)
101+
# Always capture stderr so we can decode/log it on error
102+
kwargs.setdefault("stderr", PIPE)
103103

104104
kwargs.setdefault("shell", True)
105105

@@ -117,11 +117,13 @@ def _run_win(cmd, **kwargs):
117117
log(output)
118118
return output
119119
except CalledProcessError as e:
120-
e.output = e.output.decode("utf-8")
121-
if quiet:
120+
if e.output is not None:
121+
e.output = e.output.decode("utf-8")
122+
if quiet and e.stderr is not None:
122123
e.stderr = e.stderr.decode("utf-8")
123124
log("stderr:\n", e.stderr.strip(), "\n\n")
124-
log("stdout:\n", e.output.strip(), "\n\n")
125+
if e.output:
126+
log("stdout:\n", e.output.strip(), "\n\n")
125127
if check:
126128
raise e
127129

0 commit comments

Comments
 (0)