Skip to content

Commit

Permalink
feat: publish to jsr (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret authored Apr 6, 2024
1 parent 2e884cc commit 3aa9523
Show file tree
Hide file tree
Showing 61 changed files with 635 additions and 218 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ jobs:
if: |
github.event_name == 'push' ||
!startsWith(github.event.pull_request.head.label, 'dsherret:')
permissions:
contents: read
id-token: write
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
Expand Down Expand Up @@ -44,6 +47,10 @@ jobs:
registry-url: 'https://registry.npmjs.org'
- name: npm build
run: deno run -A ./scripts/build_npm.ts ${{steps.get_tag_version.outputs.TAG_VERSION}}

- name: Publish to JSR on tag
if: runner.os == 'Linux'
run: deno run -A jsr:@david/[email protected]
- name: npm publish
if: startsWith(github.ref, 'refs/tags/') && runner.os == 'Linux'
env:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/target
.vscode
deno.lock
npm
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,26 @@ Cross-platform shell tools for Deno and Node.js inspired by [zx](https://github.
1. Good for application code in addition to use as a shell script replacement.
1. Named after my cat.

## Install

Deno:

```sh
# or skip and import directly from `jsr:@david/dax@<version>`
deno add @david/dax
```

Node:

```sh
npm install dax-sh
```

## Executing commands

```ts
#!/usr/bin/env -S deno run --allow-all
import $ from "https://deno.land/x/dax/mod.ts";
import $ from "@david/dax"; // "dax-sh" in Node

// run a command
await $`echo 5`; // outputs: 5
Expand All @@ -40,8 +55,6 @@ await Promise.all([
]);
```

Note: Above instructions are for Deno. For Node.js, install via `npm install --save-dev dax-sh` then import via `import $ from "dax-sh";`.

### Getting output

Get the stdout of a command (makes stdout "quiet"):
Expand Down
24 changes: 22 additions & 2 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"lock": false,
"name": "@david/dax",
"version": "0.0.0",
"tasks": {
"test": "deno test -A",
"wasmbuild": "deno run -A https://deno.land/x/[email protected]/main.ts --sync --out ./src/lib"
Expand All @@ -18,7 +19,26 @@
}
},
"exclude": [
".gitattributes",
".gitignore",
".github",
".rustfmt.toml",
".vscode",
"Cargo.toml",
"Cargo.lock",
"npm/",
"target/"
]
],
"exports": "./mod.ts",
"imports": {
"@deno/dnt": "jsr:@deno/dnt@^0.41.1",
"@std/assert": "jsr:@std/assert@^0.221.0",
"@std/fmt": "jsr:@std/fmt@^0.221.0",
"@std/fs": "jsr:@std/[email protected]",
"@std/io": "jsr:@std/[email protected]",
"@std/path": "jsr:@std/[email protected]",
"@std/streams": "jsr:@std/[email protected]",
"which": "jsr:@david/[email protected]",
"which_runtime": "jsr:@david/[email protected]"
}
}
Loading

0 comments on commit 3aa9523

Please sign in to comment.