Skip to content

Commit db09ba0

Browse files
committed
BREAKING: Make module ESM only
1 parent 8748797 commit db09ba0

15 files changed

Lines changed: 142 additions & 837 deletions

.github/workflows/nodejs-test.yml

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ on:
99
env:
1010
CI: true
1111
FORCE_COLOR: 2
12-
NODE_COV: lts/* # The Node.js version to run coveralls on
1312

1413
permissions:
15-
contents: read # to fetch code (actions/checkout)
14+
contents: read
1615

1716
jobs:
1817
lint:
@@ -27,21 +26,17 @@ jobs:
2726
- run: npm run lint
2827

2928
test:
30-
permissions:
31-
contents: read # to fetch code (actions/checkout)
32-
checks: write # to create new checks (coverallsapp/github-action)
33-
3429
name: Node ${{ matrix.node }}
3530
runs-on: ubuntu-latest
3631

3732
strategy:
3833
fail-fast: false
3934
matrix:
4035
node:
41-
- 18
4236
- 20
4337
- 22
44-
- lts/*
38+
- 24
39+
- "lts/*"
4540

4641
steps:
4742
- uses: actions/checkout@v6
@@ -52,18 +47,5 @@ jobs:
5247
cache: npm
5348
- run: npm ci
5449
- run: npm run build --if-present
55-
5650
- name: Run tests
5751
run: npm run test:vi
58-
if: matrix.node != env.NODE_COV
59-
60-
- name: Run tests with coverage
61-
run: npm run test:vi -- --coverage
62-
if: matrix.node == env.NODE_COV
63-
64-
- name: Run Coveralls
65-
uses: coverallsapp/github-action@v2.3.7
66-
if: matrix.node == env.NODE_COV
67-
continue-on-error: true
68-
with:
69-
github-token: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/publish.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Publish
2+
on:
3+
push:
4+
tags:
5+
- "v*"
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
11+
permissions:
12+
contents: read
13+
id-token: write
14+
15+
steps:
16+
- uses: actions/checkout@v6
17+
18+
- uses: actions/setup-node@v6
19+
with:
20+
node-version: lts/*
21+
registry-url: https://registry.npmjs.org
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Create jsr.json based on package.json
27+
run: |
28+
node --input-type=module -e '
29+
import { readFileSync, writeFileSync } from "fs";
30+
const p = JSON.parse(readFileSync("./package.json", "utf8"));
31+
const jsrJson = {
32+
name: `@cheerio/${p.name}`,
33+
version: p.version,
34+
exports: {
35+
".": "./src/index.ts",
36+
"./WritableStream": "./src/WritableStream.ts",
37+
},
38+
imports: {
39+
"domelementtype": `jsr:@cheerio/domelementtype@${p.dependencies.domelementtype}`,
40+
"domhandler": `jsr:@cheerio/domhandler@${p.dependencies.domhandler}`,
41+
"domutils": `jsr:@cheerio/domutils@${p.dependencies.domutils}`,
42+
"entities": `jsr:@cheerio/entities@${p.dependencies.entities}`,
43+
},
44+
};
45+
writeFileSync("./jsr.json", JSON.stringify(jsrJson, null, 2));
46+
'
47+
48+
- name: Publish package to JSR
49+
run: npx jsr publish
50+
51+
- name: Publish package to npm
52+
run: npm publish --provenance --access public

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
node_modules/
22
coverage/
33
dist/
4-
.tshy/
4+
jsr.json

WritableStream.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.4.6/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.4.7/schema.json",
33
"vcs": {
44
"enabled": true,
55
"clientKind": "git",

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default defineConfig([
3939
parser: tseslint.parser,
4040

4141
parserOptions: {
42-
project: "./tsconfig.json",
42+
project: "./tsconfig.eslint.json",
4343
},
4444
},
4545

0 commit comments

Comments
 (0)