fix: Strip JSR deps before publishing and add deno.json

JSR itself does not accept 'jsr:' dependencies in package.json, remove
them in the publish workflow before publishing. Add $schema to jsr.json.
This commit is contained in:
Shibo Lyu 2025-11-30 10:28:57 +08:00
parent 34e710f036
commit b51545ab39
3 changed files with 22 additions and 0 deletions

View file

@ -32,5 +32,21 @@ jobs:
- name: Install dependencies
run: pnpm install
# This step removes JSR dependencies from package.json before publishing,
# Because apparently now while major npm compatible package managers
# support JSR dependencies in package.json, JSR itself does not.
- name: Remove JSR deps from package.json
run: |
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
for (const dep in pkg.dependencies ?? {}) {
if (pkg.dependencies[dep].startsWith('jsr:')) {
delete pkg.dependencies[dep];
}
}
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
"
- name: Publish to JSR
run: pnpm dlx jsr publish

5
deno.json Normal file
View file

@ -0,0 +1,5 @@
{
"imports": {
"@std/cli": "jsr:@std/cli@1"
}
}

View file

@ -1,4 +1,5 @@
{
"$schema": "https://jsr.io/schema/config-file.v1.json",
"name": "@textplace/core",
"version": "0.5.0",
"exports": "./src/mod.ts",