Skip to content

Commit 8d22e9a

Browse files
authored
Merge pull request #1 from lambdalisue/support-jsr
Support jsr
2 parents c810cbe + 86f666a commit 8d22e9a

10 files changed

+57
-73
lines changed

.github/workflows/jsr.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: jsr
2+
3+
env:
4+
DENO_VERSION: 1.x
5+
6+
on:
7+
push:
8+
tags:
9+
- "v*"
10+
11+
permissions:
12+
contents: read
13+
id-token: write
14+
15+
jobs:
16+
publish:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
- uses: denoland/setup-deno@v1
23+
with:
24+
deno-version: ${{ env.DENO_VERSION }}
25+
- name: Publish
26+
run: |
27+
deno run -A jsr:@david/[email protected]

.github/workflows/test.yml

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
branches:
1212
- main
1313
pull_request:
14+
workflow_dispatch:
1415

1516
jobs:
1617
check:
@@ -39,6 +40,9 @@ jobs:
3940
run: |
4041
deno task test
4142
timeout-minutes: 5
43+
- name: JSR publish (dry-run)
44+
run: |
45+
deno publish --dry-run
4246
4347
build-npm:
4448
runs-on: ubuntu-latest

.github/workflows/update.yml

-49
This file was deleted.

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# errorutil
22

3+
[![jsr](https://img.shields.io/jsr/v/%40lambdalisue/errorutil?logo=javascript&logoColor=white)](https://jsr.io/@lambdalisue/errorutil)
4+
[![denoland](https://img.shields.io/github/v/release/lambdalisue/deno-errorutil?logo=deno&label=denoland)](https://github.com/lambdalisue/deno-errorutil/releases)
35
[![npm](http://img.shields.io/badge/available%20on-npm-lightgrey.svg?logo=npm&logoColor=white)](https://www.npmjs.com/package/@lambdalisue/errorutil)
4-
[![deno land](http://img.shields.io/badge/available%20on-deno.land/x-lightgrey.svg?logo=deno)](https://deno.land/x/errorutil)
56
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/errorutil/mod.ts)
67
[![Test](https://github.com/lambdalisue/deno-errorutil/workflows/Test/badge.svg)](https://github.com/lambdalisue/deno-errorutil/actions?query=workflow%3ATest)
78
[![npm version](https://badge.fury.io/js/@lambdalisue%2Ferrorutil.svg)](https://badge.fury.io/js/@lambdalisue%2Ferrorutil)

deno.jsonc

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
{
2-
"lock": false,
2+
"name": "@lambdalisue/errorutil",
3+
"version": "0.0.0",
4+
"exports": "./mod.ts",
35
"tasks": {
46
"build-npm": "deno run -A scripts/build_npm.ts $(git describe --tags --always --dirty)",
5-
"test": "deno test -A --parallel --shuffle --doc --coverage=.coverage",
67
"check": "deno check ./**/*.ts",
7-
"coverage": "deno coverage .coverage",
8-
"upgrade": "deno run -q -A https://deno.land/x/[email protected]/cli.ts ./**/*.ts",
9-
"upgrade:commit": "deno task -q upgrade --commit --prefix :package: --pre-commit=fmt"
8+
"test": "deno test -A --parallel --shuffle --doc --coverage=.coverage",
9+
"coverage": "deno coverage .coverage"
10+
},
11+
"imports": {
12+
"@core/unknownutil": "jsr:@core/unknownutil@^3.17.2",
13+
"@deno/dnt": "jsr:@deno/dnt@^0.41.1",
14+
"@std/assert": "jsr:@std/assert@^0.221.0"
1015
}
1116
}

error_object.ts

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
import {
2-
is,
3-
PredicateType,
4-
} from "https://deno.land/x/[email protected]/mod.ts";
1+
import { is, type Predicate } from "@core/unknownutil";
52

6-
export const isErrorObject = is.ObjectOf({
3+
export type ErrorObject = {
4+
proto: string;
5+
name: string;
6+
message: string;
7+
stack?: string;
8+
attributes: Record<string, unknown>;
9+
};
10+
11+
export const isErrorObject: Predicate<ErrorObject> = is.ObjectOf({
712
proto: is.String,
813
name: is.String,
914
message: is.String,
1015
stack: is.OptionalOf(is.String),
1116
attributes: is.Record,
1217
});
1318

14-
export type ErrorObject = PredicateType<typeof isErrorObject>;
15-
1619
/**
1720
* Convert an error to an error object
1821
*/

error_object_test.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import {
2-
assertEquals,
3-
assertInstanceOf,
4-
} from "https://deno.land/[email protected]/assert/mod.ts";
1+
import { assertEquals, assertInstanceOf } from "@std/assert";
52
import { fromErrorObject, toErrorObject } from "./error_object.ts";
63

74
class CustomError extends Error {

raise_test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { assertThrows } from "https://deno.land/[email protected]/assert/mod.ts";
1+
import { assertThrows } from "@std/assert";
22
import { raise } from "./raise.ts";
33

44
Deno.test("raise", () => {

scripts/build_npm.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { build, emptyDir } from "https://deno.land/x/dnt@0.39.0/mod.ts";
1+
import { build, emptyDir } from "@deno/dnt";
22

33
const name = "@lambdalisue/errorutil";
44
const version = Deno.args[0];

try_or_test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {
2-
assertEquals,
3-
assertRejects,
4-
assertThrows,
5-
} from "https://deno.land/[email protected]/assert/mod.ts";
1+
import { assertEquals, assertRejects, assertThrows } from "@std/assert";
62
import { raise } from "./raise.ts";
73
import { tryOr, tryOrElse } from "./try_or.ts";
84

0 commit comments

Comments
 (0)