Skip to content

Commit 091acae

Browse files
authored
Merge pull request #178 from takker99:jsr
build: Ready for publishing JSR
2 parents 8cf7b83 + 1eebf82 commit 091acae

Some content is hidden

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

78 files changed

+2390
-196
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,5 @@ jobs:
1010
- uses: denoland/setup-deno@v1
1111
with:
1212
deno-version: "v1.x"
13-
- name: Check fmt
14-
run: deno fmt --check
15-
- name: Run lint
16-
run: deno lint
17-
- name: Run type check
18-
run: deno check --remote ./**/*.ts
19-
- name: Run test
20-
run: deno test --allow-read --allow-write
13+
- name: Check fmt & lint & type check & test
14+
run: deno task check:dry

.github/workflows/publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# cf. https://jsr.io/@core/unknownutil/3.18.1/.github/workflows/jsr.yml
2+
name: publish
3+
4+
env:
5+
DENO_VERSION: 1.x
6+
7+
on:
8+
push:
9+
tags:
10+
- '*'
11+
12+
permissions:
13+
contents: read
14+
id-token: write # The OIDC ID token is used for authentication with JSR.
15+
16+
17+
jobs:
18+
publish:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Install Deno
23+
uses: denoland/setup-deno@v1
24+
with:
25+
deno-version: ${{ env.DENO_VERSION }}
26+
- name: Publish on tag
27+
run: deno task publish

.github/workflows/udd.yml

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,39 @@
1-
# from https://zenn.dev/kawarimidoll/articles/c68204d248c107#設定ファイル
2-
name: update-deno-dependencies
1+
# ported from https://github.com/jsr-core/unknownutil/blob/v3.18.1/.github/workflows/udd.yml and modified a bit
2+
name: Update
33

44
on:
55
schedule:
66
- cron: "0 0 * * *"
7+
workflow_dispatch:
78

89
jobs:
910
udd:
1011
runs-on: ubuntu-latest
1112
steps:
12-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1314
- uses: denoland/setup-deno@v1
1415
with:
15-
deno-version: "v1.x"
16+
deno-version: "1.x"
1617
- name: Update dependencies
17-
run: >
18-
deno run --allow-net --allow-read --allow-write=deps/
19-
--allow-run=deno https://deno.land/x/[email protected]/main.ts deps/*.ts
20-
--test="deno test --allow-read"
21-
- name: Create Pull Request
22-
uses: peter-evans/create-pull-request@v3
18+
run: |
19+
deno task upgrade > ../output.txt
20+
env:
21+
NO_COLOR: 1
22+
- name: Read ../output.txt
23+
id: log
24+
uses: juliangruber/read-file-action@v1
2325
with:
24-
commit-message: ":arrow_up: update deno dependencies"
25-
title: Update Deno Dependencies
26-
body: >
27-
Automated updates by [deno-udd](https://github.com/hayd/deno-udd)
28-
and [create-pull-request](https://github.com/peter-evans/create-pull-request)
29-
GitHub action
26+
path: ../output.txt
27+
- uses: peter-evans/create-pull-request@v6
28+
with:
29+
commit-message: ":package: Update Deno dependencies"
30+
title: ":package: Update Deno dependencies"
31+
body: |
32+
The output of `deno task update` is
33+
34+
```
35+
${{ steps.log.outputs.content }}
36+
```
3037
branch: update-deno-dependencies
3138
author: GitHub <[email protected]>
32-
delete-branch: true
39+
delete-branch: true

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# scrapbox-userscript-std
22

3-
UNOFFICIAL standard module for Scrapbox UserScript
3+
[![JSR](https://jsr.io/badges/@cosense/std)](https://jsr.io/@cosense/std)
4+
[![test](https://github.com/takker99/scrapbox-userscript-std/workflows/ci/badge.svg)](https://github.com/takker99/scrapbox-userscript-std/actions?query=workflow%3Aci)
45

5-
[document](https://doc.deno.land/https://github.com/raw/takker99/scrapbox-userscript-std/0.14.9/mod.ts)
6+
UNOFFICIAL standard module for Scrapbox UserScript

browser/dom/caret.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/// <reference no-default-lib="true"/>
2-
/// <reference lib="esnext"/>
3-
/// <reference lib="dom" />
4-
51
import { textInput } from "./dom.ts";
62

73
/** editor上の位置情報 */

browser/dom/click.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/// <reference no-default-lib="true"/>
2-
/// <reference lib="esnext"/>
3-
/// <reference lib="dom" />
4-
5-
import { sleep } from "../../sleep.ts";
1+
import { delay } from "@std/async/delay";
62

73
/** the options for `click()` */
84
export interface ClickOptions {
@@ -36,7 +32,7 @@ export const click = async (
3632

3733
// ScrapboxのReactの処理が終わるまで少し待つ
3834
// 待ち時間は感覚で決めた
39-
await sleep(10);
35+
await delay(10);
4036
};
4137

4238
export interface HoldDownOptions extends ClickOptions {
@@ -71,12 +67,12 @@ export const holdDown = async (
7167
};
7268
element.dispatchEvent(new TouchEvent("touchstart", mouseOptions));
7369
element.dispatchEvent(new MouseEvent("mousedown", mouseOptions));
74-
await sleep(options.holding ?? 1000);
70+
await delay(options.holding ?? 1000);
7571
element.dispatchEvent(new MouseEvent("mouseup", mouseOptions));
7672
element.dispatchEvent(new TouchEvent("touchend", mouseOptions));
7773
element.dispatchEvent(new MouseEvent("click", mouseOptions));
7874

7975
// ScrapboxのReactの処理が終わるまで少し待つ
8076
// 待ち時間は感覚で決めた
81-
await sleep(10);
77+
await delay(10);
8278
};

browser/dom/cursor.d.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
/// <reference no-default-lib="true"/>
2-
/// <reference lib="esnext"/>
3-
/// <reference lib="dom" />
4-
5-
import { BaseLine, BaseStore } from "../../deps/scrapbox.ts";
6-
import { Position } from "./position.ts";
7-
import { Page } from "./page.d.ts";
1+
import { type BaseLine, BaseStore } from "../../deps/scrapbox.ts";
2+
import type { Position } from "./position.ts";
3+
import type { Page } from "./page.d.ts";
84

95
export interface SetPositionOptions {
106
/** カーソルが画面外に移動したとき、カーソルが見える位置までページをスクロールするかどうか

browser/dom/cursor.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
/// <reference no-default-lib="true"/>
2-
/// <reference lib="esnext"/>
3-
/// <reference lib="dom" />
4-
51
import { takeStores } from "./stores.ts";
6-
import { Cursor } from "./cursor.d.ts";
2+
import type { Cursor } from "./cursor.d.ts";
73
export type { Cursor };
84

95
export const takeCursor = (): Cursor => takeStores().cursor;

browser/dom/dom.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/// <reference no-default-lib="true"/>
2-
/// <reference lib="esnext"/>
3-
/// <reference lib="dom" />
41
import {
52
ensureHTMLAnchorElement,
63
ensureHTMLDivElement,

browser/dom/edit.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { getLineCount } from "./node.ts";
44
import { range } from "../../range.ts";
55
import { textInput } from "./dom.ts";
66
import { isArray, isNumber, isString } from "../../is.ts";
7-
import { sleep } from "../../sleep.ts";
7+
import { delay } from "@std/async/delay";
88

99
export const undo = (count = 1): void => {
1010
for (const _ of range(0, count)) {
@@ -165,5 +165,5 @@ export const insertText = async (text: string): Promise<void> => {
165165

166166
const event = new InputEvent("input", { bubbles: true });
167167
cursor.dispatchEvent(event);
168-
await sleep(1); // 待ち時間は感覚で決めた
168+
await delay(1); // 待ち時間は感覚で決めた
169169
};

0 commit comments

Comments
 (0)