Skip to content

Commit

Permalink
feat: JSR package (#271)
Browse files Browse the repository at this point in the history
* feat: JSR package

* Add jsr.json to release-please-config.json

* Include types.ts

* Fix formatting

* Update jsr.json

Co-authored-by: Milos Djermanovic <[email protected]>

---------

Co-authored-by: Milos Djermanovic <[email protected]>
  • Loading branch information
nzakas and mdjermanovic authored Aug 29, 2024
1 parent 7d918da commit 7040a2e
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 3 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,17 @@ jobs:
run: npm install eslint@${{ matrix.eslint }}
- name: Test
run: npm run test
jsr_test:
name: Verify JSR Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
- name: Install Packages
run: npm install
- name: Run --dry-run
run: |
npm run build
npm run test:jsr
9 changes: 8 additions & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,20 @@ jobs:
node-version: lts/*
registry-url: https://registry.npmjs.org
if: ${{ steps.release.outputs.release_created }}
- run: |
- name: Publish to npm
run: |
npm install
npm run build --if-present
npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: ${{ steps.release.outputs.release_created }}
- name: Publish to JSR
run: |
npm run build --if-present
npx jsr publish
if: ${{ steps.release.outputs.release_created }}

- run: 'npx @humanwhocodes/tweet "eslint/markdown v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} has been released: ${{ steps.release.outputs.html_url }}"'
if: ${{ steps.release.outputs.release_created }}
env:
Expand Down
16 changes: 16 additions & 0 deletions jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@eslint/markdown",
"version": "6.0.0",
"exports": "./dist/esm/index.js",
"publish": {
"include": [
"dist/esm/index.js",
"dist/esm/index.d.ts",
"dist/esm/types.ts",
"dist/esm/types.d.ts",
"README.md",
"jsr.json",
"LICENSE"
]
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"build:rules": "node tools/build-rules.js",
"build": "npm run build:rules && rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json",
"prepare": "node ./npm-prepare.cjs && npm run build",
"test": "c8 mocha \"tests/**/*.test.js\" --timeout 30000"
"test": "c8 mocha \"tests/**/*.test.js\" --timeout 30000",
"test:jsr": "npx jsr@latest publish --dry-run"
},
"devDependencies": {
"@eslint/core": "^0.3.0",
Expand Down
10 changes: 9 additions & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@
"release-type": "node",
"pull-request-title-pattern": "chore: release ${version} 🚀",
"include-component-in-tag": false,
"extra-files": ["src/index.js", "src/processor.js"]
"extra-files": [
"src/index.js",
"src/processor.js",
{
"type": "json",
"path": "jsr.json",
"jsonpath": "$.version"
}
]
}
}
}

0 comments on commit 7040a2e

Please sign in to comment.