Skip to content

Commit

Permalink
Publish adl typescript runtime to npm
Browse files Browse the repository at this point in the history
  • Loading branch information
timbod7 committed Nov 20, 2024
1 parent 4179115 commit e724ada
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 2 deletions.
1 change: 1 addition & 0 deletions typescript/runtime/published/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm/
1 change: 1 addition & 0 deletions typescript/runtime/published/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Runtime support code for the [ADL][] system.

[ADL]: https://github.com/adl-lang/adl

5 changes: 4 additions & 1 deletion typescript/runtime/published/deno.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{

"name": "@adllang/adl-runtime",
"version": "0.0.2",
"license": "BSD",
"exports": "./src/mod.ts",
"imports": {
"@adllang/jsonbinding": "jsr:@adllang/jsonbinding@^0.2.3",
"@deno/dnt": "jsr:@deno/dnt@^0.41.3",
"@std/encoding": "jsr:@std/encoding@^1.0.5"
},
"tasks": {
"build_npm": "deno run -A scripts/build_npm.ts"
}
}
113 changes: 112 additions & 1 deletion typescript/runtime/published/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions typescript/runtime/published/docs/dev.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
To publish to jsr

```
deno check src/mod.rs
deno publish # publish to jsr
```

To publish to npm

```
deno task build_npm
(cd npm; npm publish --access public)
```
34 changes: 34 additions & 0 deletions typescript/runtime/published/scripts/build_npm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { build, emptyDir } from "@deno/dnt";

await emptyDir("./npm");

const version : string | undefined = JSON.parse(await Deno.readTextFile("deno.json"))['version'];
if (!version) {
throw new Error("can't get version from deno.json")
}

await build({
entryPoints: ["./src/mod.ts"],
outDir: "./npm",
shims: {
deno: true,
},
importMap: "deno.json",
package: {
name: "@adllang/adl-runtime",
version,
description: "Runtime support code for the ADL system",
license: "BSD",
repository: {
type: "git",
url: "git+https://github.com/adl-lang/adl.git",
},
bugs: {
url: "https://github.com/adl-lang/adl/issues",
},
},
postBuild() {
Deno.copyFileSync("LICENSE", "npm/LICENSE");
Deno.copyFileSync("README.md", "npm/README.md");
},
});

0 comments on commit e724ada

Please sign in to comment.