Skip to content

Commit 894622f

Browse files
authored
Merge pull request #53 from takker99/jsr
feat: Ready for publishing to JSR
2 parents 58edfe0 + da668e7 commit 894622f

Some content is hidden

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

42 files changed

+996
-130
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
name: ci
22

3+
env:
4+
DENO_VERSION: 1.x
5+
36
on: [push, pull_request]
47

58
jobs:
69
test:
710
runs-on: ubuntu-latest
811
steps:
912
- uses: actions/checkout@master
10-
- uses: denoland/setup-deno@main
13+
- name: Install Deno
14+
uses: denoland/setup-deno@v1
1115
with:
12-
deno-version: "1.29.1"
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 rest.ts userscript.ts
19-
- name: Run test
20-
run: deno test
16+
deno-version: ${{ env.DENO_VERSION }}
17+
- name: Check fmt & lint & type check & test
18+
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

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
## types
1+
## @cosense/types
22

3-
scrapbox関連の型定義ファイル
3+
Type definitions for [cosense](https://cosen.se)
44

5-
### Document
5+
## Getting Started
66

7-
- [rest.ts](https://doc.deno.land/https://raw.githubusercontent.com/scrapbox-jp/types/0.3.6/rest.ts)
8-
- REST API関連の型定義
9-
- [userscript.ts](https://doc.deno.land/https://raw.githubusercontent.com/scrapbox-jp/types/0.3.6/userscript.ts)
10-
- `window.scrapbox`で使う型定義
7+
If you want to use type definitions for REST API, run
8+
9+
```bash
10+
deno add jsr:@cosense/types/rest
11+
```
12+
13+
If you want to use type definitions for UserScript, run
14+
15+
```bash
16+
deno add jsr:@cosense/types/userscript
17+
```

blocks.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { assertType, IsExact } from "./deps/testing.ts";
2-
import { Line } from "./blocks.ts";
1+
import { assertType, type IsExact } from "@std/testing/types";
2+
import type { Line } from "./blocks.ts";
33

44
// scrapbox.Page.lines の型定義が正しいか確認する
55
// サンプルは https://scrapbox.io/villagepump/記法サンプル より拝借した

change.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BasePage, LineId, StringLc } from "./base.ts";
1+
import type { BasePage, LineId, StringLc } from "./base.ts";
22

33
/** ページの変更内容 */
44
export type Change =

commit.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { CommitId, PageId, UnixTime, UserId } from "./base.ts";
2-
import { Change } from "./change.ts";
1+
import type { CommitId, PageId, UnixTime, UserId } from "./base.ts";
2+
import type { Change } from "./change.ts";
33

44
/** Scrapboxのページの編集commit */
55
export interface Commit {

deno.jsonc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "@cosense/types",
3+
"version": "0.0.0",
4+
"tasks": {
5+
"check:dry": "deno fmt --check && deno lint && deno check --remote **/*.ts && deno test --parallel",
6+
"check": "deno fmt && deno lint && deno check --remote **/*.ts && deno test --parallel",
7+
"check:publish": "deno task check && deno publish --dry-run --allow-dirty",
8+
"publish": "deno run --allow-env --allow-run=deno --allow-read --allow-write=deno.jsonc jsr:@david/[email protected]"
9+
},
10+
"imports": {
11+
"@std/testing/types": "jsr:@std/testing@0/types"
12+
},
13+
"exports": {
14+
"./rest": "./rest.ts",
15+
"./userscript": "./userscript.ts"
16+
},
17+
"compilerOptions": {
18+
"lib": [
19+
"dom",
20+
"dom.iterable",
21+
"esnext"
22+
]
23+
}
24+
}

deno.lock

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deps/events.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

deps/testing.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)