Skip to content

Commit

Permalink
build: configure JSR publish (#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhr authored Jan 21, 2025
1 parent 39537d0 commit 26babcd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
node_modules
build
coverage
jsr.json

!.git*
!.vscode
Expand Down
17 changes: 16 additions & 1 deletion build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,19 @@ const objectCjs = await Deno.readTextFile("build/script/Object.js")
await Deno.writeTextFile(
"build/script/Object.js",
objectCjs.replace(/^Object\.defineProperty/m, "globalThis.Object.defineProperty"),
)
)

// Generate `jsr.json`
const jsrJson = {
name: "@runtypes/runtypes",
version: packageBuildJson.version,
license: packageBuildJson.license,
exports: Object.fromEntries(
entryPoints.map(entry => [entry.name === "./index" ? "." : entry.name, "./" + entry.path]),
),
publish: {
include: ["LICENSE", "README.md", "src/**/*.ts"],
exclude: ["src/**/*.test.ts"],
},
}
await Deno.writeTextFile("jsr.json", JSON.stringify(jsrJson, null, "\t"))
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ check *ARGS='src/**/*.ts src/*.test.ts examples/**/*.ts examples/*.ts':
deno check {{ARGS}}

pack: build
cd lib && pnpm pack
cd build && pnpm pack

0 comments on commit 26babcd

Please sign in to comment.