mirror of
https://github.com/hectorm/otpauth.git
synced 2026-05-07 20:12:27 +00:00
Publish to JSR registry
This commit is contained in:
@@ -222,6 +222,33 @@ jobs:
|
||||
npm publish --provenance --access public
|
||||
fi
|
||||
|
||||
publish-jsr:
|
||||
name: "Publish JSR package"
|
||||
if: "startsWith(github.ref, 'refs/tags/v')"
|
||||
needs: ["test-node", "test-deno", "test-bun", "test-browser"]
|
||||
runs-on: "ubuntu-latest"
|
||||
permissions:
|
||||
contents: "read"
|
||||
id-token: "write"
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: "actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29"
|
||||
- name: "Remove dist directory"
|
||||
shell: "bash"
|
||||
run: "rm -rf ./dist/"
|
||||
- name: "Download dist artifact"
|
||||
uses: "actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e"
|
||||
with:
|
||||
name: "dist"
|
||||
path: "./dist/"
|
||||
- name: "Use Node.js lts/*"
|
||||
uses: "actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8"
|
||||
with:
|
||||
node-version: "lts/*"
|
||||
- name: "Publish"
|
||||
run: |
|
||||
npx jsr publish
|
||||
|
||||
publish-github-release:
|
||||
name: "Publish GitHub release"
|
||||
if: "startsWith(github.ref, 'refs/tags/v')"
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "@hectorm/otpauth",
|
||||
"version": "9.3.0",
|
||||
"exports": {
|
||||
".": "./dist/otpauth.esm.js"
|
||||
},
|
||||
"publish": {
|
||||
"include": ["./*.md", "./dist/otpauth.esm.js", "./dist/otpauth.d.ts"]
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -106,7 +106,9 @@
|
||||
"test:browser:webkit:umd": "run-s test:browser:webkit:umd:*",
|
||||
"test:browser:webkit:umd:unmin": "node ./test/browser.test.mjs webkit",
|
||||
"test:browser:webkit:umd:min": "node ./test/browser.test.min.mjs webkit",
|
||||
"version": "run-s all && git add -A ./types/ ./dist/ ./docs/"
|
||||
"version": "run-s all version:jsr version:git",
|
||||
"version:jsr": "node ./scripts/jsr.mjs",
|
||||
"version:git": "git add -A ./jsr.json ./types/ ./dist/ ./docs/"
|
||||
},
|
||||
"dependencies": {
|
||||
"@noble/hashes": "1.4.0"
|
||||
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env node
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import url from "node:url";
|
||||
|
||||
import { format, resolveConfig } from "prettier";
|
||||
|
||||
const __dirname = url.fileURLToPath(path.dirname(import.meta.url));
|
||||
|
||||
const pkgPath = path.join(__dirname, "../package.json");
|
||||
const pkgSpec = JSON.parse(await fs.readFile(pkgPath, "utf8"));
|
||||
|
||||
const jsrPath = path.join(__dirname, "../jsr.json");
|
||||
const jsrSpec = {
|
||||
name: "@hectorm/otpauth",
|
||||
version: pkgSpec.version,
|
||||
exports: {
|
||||
".": pkgSpec.exports["."].default,
|
||||
},
|
||||
publish: {
|
||||
include: ["./*.md", pkgSpec.exports["."].default, pkgSpec.exports["."].types.import],
|
||||
},
|
||||
};
|
||||
|
||||
const prettierOpts = (await resolveConfig(__dirname)) ?? {};
|
||||
prettierOpts.parser = "json";
|
||||
|
||||
await fs.writeFile(jsrPath, await format(JSON.stringify(jsrSpec, null, 2), prettierOpts));
|
||||
Reference in New Issue
Block a user