Skip to content

Commit 910df8a

Browse files
authored
Merge pull request #3 from lambdalisue/fix-deno-ladn
🐛 Fix for deno.land
2 parents 8d22e9a + 9d4070d commit 910df8a

File tree

13 files changed

+100
-28
lines changed

13 files changed

+100
-28
lines changed

.github/workflows/test.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ env:
55
NODE_VERSION: 16.x
66

77
on:
8-
schedule:
9-
- cron: "0 7 * * 0"
108
push:
119
branches:
1210
- main
1311
pull_request:
12+
paths:
13+
- "**.md"
14+
- "**.ts"
15+
- "deno.jsonc"
16+
- ".github/workflows/test.yml"
1417
workflow_dispatch:
1518

1619
jobs:
@@ -38,11 +41,15 @@ jobs:
3841
deno-version: ${{ env.DENO_VERSION }}
3942
- name: Test
4043
run: |
41-
deno task test
44+
deno task test:coverage
4245
timeout-minutes: 5
43-
- name: JSR publish (dry-run)
44-
run: |
45-
deno publish --dry-run
46+
- run: |
47+
deno task coverage --lcov > coverage.lcov
48+
- uses: codecov/codecov-action@v4
49+
with:
50+
os: ${{ runner.os }}
51+
files: ./coverage.lcov
52+
token: ${{ secrets.CODECOV_TOKEN }}
4653

4754
build-npm:
4855
runs-on: ubuntu-latest
@@ -57,3 +64,14 @@ jobs:
5764
registry-url: "https://registry.npmjs.org"
5865
- name: Build
5966
run: deno task build-npm
67+
68+
jsr-publish:
69+
runs-on: ubuntu-latest
70+
steps:
71+
- uses: actions/checkout@v4
72+
- uses: denoland/setup-deno@v1
73+
with:
74+
deno-version: ${{ env.DENO_VERSION }}
75+
- name: Publish (dry-run)
76+
run: |
77+
deno publish --dry-run

.github/workflows/update.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: update
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
workflow_dispatch:
7+
8+
jobs:
9+
update:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: denoland/setup-deno@v1
14+
with:
15+
deno-version: 1.x
16+
- name: Configure Git
17+
run: |
18+
git config user.name github-actions[bot]
19+
git config user.email github-actions[bot]@users.noreply.github.com
20+
- name: Update dependencies and commit changes
21+
run: deno task -q update:commit --summary ../title.txt --report ../body.md
22+
- name: Check result
23+
id: result
24+
uses: andstor/file-existence-action@v2
25+
with:
26+
files: ../title.txt, ../body.md
27+
- name: Read title.txt
28+
id: title
29+
if: steps.result.outputs.files_exists == 'true'
30+
uses: juliangruber/read-file-action@v1
31+
with:
32+
path: ../title.txt
33+
- name: Read body.md
34+
id: body
35+
if: steps.result.outputs.files_exists == 'true'
36+
uses: juliangruber/read-file-action@v1
37+
with:
38+
path: ../body.md
39+
- name: Create a pull request
40+
if: steps.result.outputs.files_exists == 'true'
41+
uses: peter-evans/create-pull-request@v6
42+
with:
43+
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
44+
branch: automation/update-dependencies
45+
title: ${{ steps.title.outputs.content }}
46+
body: ${{ steps.body.outputs.content }}
47+
labels: automation
48+
delete-branch: true

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
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)
3+
[![JSR](https://jsr.io/badges/@lambdalisue/errorutil)](https://jsr.io/@lambdalisue/errorutil)
4+
[![denoland](https://img.shields.io/github/v/release/lambdalisue/deno-errorutil?logo=deno&label=denoland)](https://deno.land/x/errorutil)
55
[![npm](http://img.shields.io/badge/available%20on-npm-lightgrey.svg?logo=npm&logoColor=white)](https://www.npmjs.com/package/@lambdalisue/errorutil)
66
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/errorutil/mod.ts)
77
[![Test](https://github.com/lambdalisue/deno-errorutil/workflows/Test/badge.svg)](https://github.com/lambdalisue/deno-errorutil/actions?query=workflow%3ATest)
88
[![npm version](https://badge.fury.io/js/@lambdalisue%2Ferrorutil.svg)](https://badge.fury.io/js/@lambdalisue%2Ferrorutil)
9+
[![codecov](https://codecov.io/gh/lambdalisue/deno-errorutil/graph/badge.svg?token=O0cA5Xj5la)](https://codecov.io/gh/lambdalisue/deno-errorutil)
910

1011
A utility pack for handling error.
1112

deno.jsonc

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@
22
"name": "@lambdalisue/errorutil",
33
"version": "0.0.0",
44
"exports": "./mod.ts",
5+
"exclude": [
6+
".coverage",
7+
"npm"
8+
],
59
"tasks": {
610
"build-npm": "deno run -A scripts/build_npm.ts $(git describe --tags --always --dirty)",
7-
"check": "deno check ./**/*.ts",
8-
"test": "deno test -A --parallel --shuffle --doc --coverage=.coverage",
9-
"coverage": "deno coverage .coverage"
11+
"check": "deno check **/*.ts",
12+
"test": "deno test -A --doc --parallel --shuffle",
13+
"test:coverage": "deno task test --coverage=.coverage",
14+
"coverage": "deno coverage .coverage",
15+
"update": "deno run --allow-env --allow-read --allow-write=. --allow-run=git,deno --allow-net=jsr.io,registry.npmjs.org jsr:@molt/cli ./*.ts",
16+
"update:commit": "deno task -q update --commit --pre-commit=fmt,lint"
1017
},
1118
"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"
19+
"https://deno.land/x/errorutil@$MODULE_VERSION/": "./"
1520
}
1621
}

error_object.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { is, type Predicate } from "@core/unknownutil";
1+
import { is } from "jsr:@core/unknownutil";
22

33
export type ErrorObject = {
44
proto: string;
@@ -8,7 +8,7 @@ export type ErrorObject = {
88
attributes: Record<string, unknown>;
99
};
1010

11-
export const isErrorObject: Predicate<ErrorObject> = is.ObjectOf({
11+
export const isErrorObject: (x: unknown) => x is ErrorObject = is.ObjectOf({
1212
proto: is.String,
1313
name: is.String,
1414
message: is.String,

error_object_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { assertEquals, assertInstanceOf } from "@std/assert";
1+
import { assertEquals, assertInstanceOf } from "jsr:@std/assert";
22
import { fromErrorObject, toErrorObject } from "./error_object.ts";
33

44
class CustomError extends Error {

raise.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This is function thus can be used as an expression.
55
*
66
* ```typescript
7-
* import { raise } from "./raise.ts";
7+
* import { raise } from "https://deno.land/x/errorutil@$MODULE_VERSION/raise.ts";
88
*
99
* const fn = () => raise(new Error("fail"));
1010
* ```

raise_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { assertThrows } from "@std/assert";
1+
import { assertThrows } from "jsr:@std/assert";
22
import { raise } from "./raise.ts";
33

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

scripts/build_npm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { build, emptyDir } from "@deno/dnt";
1+
import { build, emptyDir } from "jsr:@deno/dnt";
22

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

try_or.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* Try to execute a function and return the result or a default value.
33
*
44
* ```ts
5-
* import { tryOr } from "./try_or.ts";
6-
* import { raise } from "./raise.ts";
5+
* import { tryOr } from "https://deno.land/x/errorutil@$MODULE_VERSION/try_or.ts";
6+
* import { raise } from "https://deno.land/x/errorutil@$MODULE_VERSION/raise.ts";
77
*
88
* // Sync
99
* console.log(tryOr(() => 1, 2)); // 1
@@ -30,8 +30,8 @@ export function tryOr<T>(
3030
* Try to execute a function and return the result or execute another function.
3131
*
3232
* ```ts
33-
* import { tryOrElse } from "./try_or.ts";
34-
* import { raise } from "./raise.ts";
33+
* import { tryOrElse } from "https://deno.land/x/errorutil@$MODULE_VERSION/try_or.ts";
34+
* import { raise } from "https://deno.land/x/errorutil@$MODULE_VERSION/raise.ts";
3535
*
3636
* // Sync
3737
* console.log(tryOrElse(() => 1, () => 2)); // 1

0 commit comments

Comments
 (0)