Skip to content

Commit 528ace8

Browse files
authored
Deno 2.0 and jsr.io compatibility (#37)
1 parent 947c8fe commit 528ace8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+684
-413
lines changed

.github/workflows/release.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,8 @@ for (const file of files) {
1919
const updated = orig.replace(/v\d+\.\d+\.\d+/, version);
2020
Deno.writeFileSync(file, new TextEncoder().encode(updated));
2121
}
22+
23+
console.log(`Updating jsr.json for ${version}...`);
24+
const orig = Deno.readTextFileSync("jsr.json");
25+
const updated = orig.replace(/\d+\.\d+\.\d+/, version.substring(1));
26+
Deno.writeFileSync("jsr.json", new TextEncoder().encode(updated));

.github/workflows/release.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: Release apex version
22

33
on:
4+
push:
5+
branches:
6+
- main
7+
- release-*
8+
tags:
9+
- v*
410
workflow_dispatch:
511
inputs:
612
version:
@@ -20,7 +26,7 @@ jobs:
2026
- name: Update version and README.md
2127
env:
2228
VERSION: ${{ inputs.version }}
23-
FILES: 'apex.ts,README.md'
29+
FILES: 'mod.ts,README.md'
2430
run: |
2531
deno run --allow-run --allow-env --allow-write --allow-read ./.github/workflows/release.ts
2632
deno run --allow-run --allow-env --allow-write --allow-read ./.github/workflows/update-readme.ts
@@ -35,3 +41,25 @@ jobs:
3541
generateReleaseNotes: true
3642
makeLatest: true
3743
tag: ${{ inputs.version }}
44+
45+
build:
46+
runs-on: ubuntu-latest
47+
permissions:
48+
contents: read
49+
id-token: write # The OIDC ID token is used for authentication with JSR.
50+
steps:
51+
- uses: actions/checkout@v4
52+
- uses: denoland/setup-deno@v2
53+
with:
54+
deno-version: v2.x
55+
56+
# - name: Run tests
57+
# run: deno test
58+
59+
- name: Is Release?
60+
if: startswith(github.ref, 'refs/tags/v')
61+
run: echo "DEPLOY_PACKAGE=true" >> $GITHUB_ENV
62+
63+
- name: Publish to npm
64+
if: env.DEPLOY_PACKAGE == 'true'
65+
run: npx jsr publish

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
steps:
1414
- uses: actions/checkout@v2
15-
- uses: denolib/setup-deno@v2
15+
- uses: denoland/setup-deno@v2
1616
- name: Add SSH key
1717
env:
1818
TEST_SSH_KEY: ${{ secrets.TEST_SSH_KEY }}

.github/workflows/update-readme.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const readme = "README.md";
33
console.log(`Updating ${readme} examples`);
44
const orig = Deno.readTextFileSync(readme);
55

6+
// deno-lint-ignore no-control-regex
67
const colorCodes = /\x1b\[\d+;*m/g;
78
const upgradeNotification = /\(New version.*$/m;
89

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ Install `deno` with instructions
2222
To install a release version of the `apex` CLI, run the command below:
2323

2424
```
25-
deno install -A -f -n apex https://deno.land/x/[email protected]/apex.ts
25+
deno install -g -A --unstable-worker-options -f -n apex jsr:@apexlang/apex
2626
```
2727

2828
To install from source, clone this repository and run `./apex install`
2929

3030
```sh
3131
git clone https://github.com/apexlang/apex.git
3232
cd apex
33-
./apex install # or deno install -A -f ./apex.ts
33+
deno install -g -A --config deno.json --unstable-worker-options -f ./mod.ts
3434
```
3535

3636
## Usage

apex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
22
# deno install mocker
3-
exec deno run --allow-all './apex.ts' "$@"
3+
exec deno run -A --config deno.json --unstable-worker-options './mod.ts' "$@"

apex.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ tasks:
44
cmds:
55
- deno fmt --check src/ test/
66
- deno lint src/
7-
- deno check apex.ts
8-
- deno test -A
7+
- deno check mod.ts
8+
- deno test -A --unstable-worker-options
99
install:
1010
description: Install apex
1111
cmds:
12-
- deno install -A -f ./apex.ts
12+
- deno install -g -A --config deno.json --unstable-worker-options -f ./mod.ts

deno.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"imports": {
3+
"@apexlang/core": "jsr:@apexlang/core@^0.2.0",
4+
"@cliffy/ansi": "jsr:@cliffy/ansi@^1.0.0-rc.7",
5+
"@cliffy/command": "jsr:@cliffy/command@^1.0.0-rc.7",
6+
"@cliffy/prompt": "jsr:@cliffy/prompt@^1.0.0-rc.7",
7+
"@cliffy/table": "jsr:@cliffy/table@^1.0.0-rc.7",
8+
"@david/dax": "jsr:@david/dax@^0.42.0",
9+
"@eta-dev/eta": "jsr:@eta-dev/eta@^3.5.0",
10+
"@fmt/gofmt": "jsr:@fmt/gofmt@^0.4.9",
11+
"@fmt/ruff-fmt": "jsr:@fmt/ruff-fmt@^0.9.4",
12+
"@std/assert": "jsr:@std/assert@^1.0.11",
13+
"@std/encoding": "jsr:@std/encoding@^1.0.7",
14+
"@std/fs": "jsr:@std/fs@^1.0.13",
15+
"@std/io": "jsr:@std/io@^0.225.2",
16+
"@std/log": "jsr:@std/log@^0.224.14",
17+
"@std/path": "jsr:@std/path@^1.0.8",
18+
"@std/yaml": "jsr:@std/yaml@^1.0.5"
19+
}
20+
}

deno.lock

Lines changed: 220 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jsr.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "@apexlang/core",
3+
"version": "0.1.2",
4+
"description": "Apex language JavaScript support",
5+
"keywords": ["apex", "idl", "codegen"],
6+
"license": "Apache-2.0",
7+
"repository": {
8+
"type": "git",
9+
"url": "https://www.github.com/apexlang/apex"
10+
},
11+
"bugs": {
12+
"url": "https://www.github.com/apexlang/apex/issues"
13+
},
14+
"exports": "./mod.ts",
15+
"publish": {
16+
"include": ["LICENSE", "README.md", "src/**/*.ts"],
17+
"exclude": ["src/tests"]
18+
}
19+
}

0 commit comments

Comments
 (0)