Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: publish to jsr #122

Merged
merged 15 commits into from
Mar 1, 2024
6 changes: 6 additions & 0 deletions .github/contributing.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Contributing

Setup:

1. Install [Deno](https://deno.com/).
1. Install [Rust](https://www.rust-lang.org/).
1. Run `deno task build`

## Upgrading wasm-bindgen version

1. Upgrade the versions in the Cargo.toml files
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:
if: contains(matrix.os, 'ubuntu')
run: deno fmt --check && cargo fmt -- --check

- name: Test
run: deno task test

- name: Check Wasm up-to-date
run: deno task build --check

- name: Test
run: deno task test
37 changes: 37 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish
on: [push, pull_request]

jobs:
publish:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dsherret/rust-toolchain-file@v1

- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Build
run: deno task build

# temporary until https://github.com/denoland/deno/issues/22656 is fixed
- name: Delete .gitignore
run: rm .gitignore

# add back once https://github.com/denoland/deno/issues/22658 is fixed
# - name: Publish package (Dry run)
# if: ${{ github.ref != 'refs/heads/main' }}
# run: deno publish --dry-run
- name: Publish package
if: ${{ github.ref == 'refs/heads/main' }}
run: deno publish
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.vscode
target/
lib/loader_text.generated.ts
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Add a task to the _deno.json_ file in your project:
```json
{
"tasks": {
"wasmbuild": "deno run -A https://deno.land/x/wasmbuild@VERSION_GOES_HERE/main.ts"
"wasmbuild": "deno run -A jsr:@deno/wasmbuild@VERSION_GOES_HERE"
}
}
```
Expand Down
30 changes: 27 additions & 3 deletions deno.jsonc
Original file line number Diff line number Diff line change
@@ -1,24 +1,48 @@
{
"name": "@deno/wasmbuild",
"version": "0.15.3",
"version": "0.15.4",
"exports": "./main.ts",
"exclude": [
"./tests/target",
"./target"
],
"publish": {
"exclude": [
"**/*_test.ts",
"tests/",
"rs_lib/",
"**/*.toml",
"**/*.lock"
]
},
"compilerOptions": {
"checkJs": true
},
"tasks": {
"fmt": "deno fmt && cargo fmt",
"build": "deno run -A ./main.ts -p wasmbuild",
"build": "deno task build:loader && deno run -A ./main.ts -p wasmbuild",
"build:bindgen-upgrade": "WASMBUILD_BINDGEN_UPGRADE=1 deno task build",
"build:lkg": "deno run -A https://deno.land/x/[email protected]/main.ts -p wasmbuild",
"build:lkg": "deno run -A https://deno.land/x/[email protected]/main.ts -p wasmbuild",
"build:loader": "deno run -A scripts/build_loader_text.ts",
"test": "cd tests && rm -rf lib lib_out_js_file lib_sync lib_no_cache && deno task test:main && deno task test:no-cache && deno task test:sync && deno task test:js-ext && deno test -A && deno task test:check",
"test:main": "cd tests && deno run -A ../main.ts -p deno_test",
"test:sync": "deno task test:main --sync --out lib_sync",
"test:no-cache": "deno task test:main --no-cache --out lib_no_cache",
"test:js-ext": "deno task test:main --js-ext mjs --out lib_out_js_file && cat tests/lib_out_js_file/deno_test.generated.mjs > /dev/null",
"test:check": "deno task test:main --check && deno task test:sync --check"
},
"imports": {
"@david/dax": "jsr:@david/dax@^0.39.2",
"@std/archive": "jsr:@std/archive@^0.218.2",
"@std/assert": "jsr:@std/assert@^0.218.2",
"@std/cli": "jsr:@std/cli@^0.218.2",
"@std/encoding": "jsr:@std/encoding@^0.218.2",
"@std/fmt": "jsr:@std/fmt@^0.218.2",
"@std/fs": "jsr:@std/fs@^0.218.2",
"@std/io": "jsr:@std/io@^0.218.2",
"@std/path": "jsr:@std/path@^0.218.2",
"@std/streams": "jsr:@std/streams@^0.218.2",
"code-block-writer": "npm:code-block-writer@^13.0.1",
"ts-morph": "npm:ts-morph@^21"
}
}
Loading
Loading