Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
name: ci

env:
DENO_VERSION: 1.x

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: denoland/setup-deno@main
- name: Install Deno
uses: denoland/setup-deno@v1
with:
deno-version: "1.29.1"
- name: Check fmt
run: deno fmt --check
- name: Run lint
run: deno lint
- name: Run type check
run: deno check rest.ts userscript.ts
- name: Run test
run: deno test
deno-version: ${{ env.DENO_VERSION }}
- name: Check fmt & lint & type check & test
run: deno task check:dry
27 changes: 27 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# cf. https://jsr.io/@core/unknownutil/3.18.1/.github/workflows/jsr.yml
name: publish

env:
DENO_VERSION: 1.x

on:
push:
tags:
- '*'

permissions:
contents: read
id-token: write # The OIDC ID token is used for authentication with JSR.


jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Deno
uses: denoland/setup-deno@v1
with:
deno-version: ${{ env.DENO_VERSION }}
- name: Publish on tag
run: deno task publish
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
## types
## @cosense/types

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

### Document
## Getting Started

- [rest.ts](https://doc.deno.land/https://raw.githubusercontent.com/scrapbox-jp/types/0.3.6/rest.ts)
- REST API関連の型定義
- [userscript.ts](https://doc.deno.land/https://raw.githubusercontent.com/scrapbox-jp/types/0.3.6/userscript.ts)
- `window.scrapbox`で使う型定義
If you want to use type definitions for REST API, run

```bash
deno add jsr:@cosense/types/rest
```

If you want to use type definitions for UserScript, run

```bash
deno add jsr:@cosense/types/userscript
```
4 changes: 2 additions & 2 deletions blocks.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assertType, IsExact } from "./deps/testing.ts";
import { Line } from "./blocks.ts";
import { assertType, type IsExact } from "@std/testing/types";
import type { Line } from "./blocks.ts";

// scrapbox.Page.lines の型定義が正しいか確認する
// サンプルは https://scrapbox.io/villagepump/記法サンプル より拝借した
Expand Down
2 changes: 1 addition & 1 deletion change.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BasePage, LineId, StringLc } from "./base.ts";
import type { BasePage, LineId, StringLc } from "./base.ts";

/** ページの変更内容 */
export type Change =
Expand Down
4 changes: 2 additions & 2 deletions commit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CommitId, PageId, UnixTime, UserId } from "./base.ts";
import { Change } from "./change.ts";
import type { CommitId, PageId, UnixTime, UserId } from "./base.ts";
import type { Change } from "./change.ts";

/** Scrapboxのページの編集commit */
export interface Commit {
Expand Down
24 changes: 24 additions & 0 deletions deno.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "@cosense/types",
"version": "0.0.0",
"tasks": {
"check:dry": "deno fmt --check && deno lint && deno check --remote **/*.ts && deno test --parallel",
"check": "deno fmt && deno lint && deno check --remote **/*.ts && deno test --parallel",
"check:publish": "deno task check && deno publish --dry-run --allow-dirty",
"publish": "deno run --allow-env --allow-run=deno --allow-read --allow-write=deno.jsonc jsr:@david/publish-on-tag@0.1.x"
},
"imports": {
"@std/testing/types": "jsr:@std/testing@0/types"
},
"exports": {
"./rest": "./rest.ts",
"./userscript": "./userscript.ts"
},
"compilerOptions": {
"lib": [
"dom",
"dom.iterable",
"esnext"
]
}
}
20 changes: 20 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion deps/events.ts

This file was deleted.

1 change: 0 additions & 1 deletion deps/testing.ts

This file was deleted.

3 changes: 3 additions & 0 deletions mod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function add(a: number, b: number): number {
return a + b;
}
4 changes: 2 additions & 2 deletions node/anchor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Unit } from "./unit.ts";
import { PlainText } from "./plainText.ts";
import type { Unit } from "./unit.ts";
import type { PlainText } from "./plainText.ts";

/** Anchor埋め込み */
export interface Anchor {
Expand Down
4 changes: 2 additions & 2 deletions node/audio.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Unit } from "./unit.ts";
import { PlainText } from "./plainText.ts";
import type { Unit } from "./unit.ts";
import type { PlainText } from "./plainText.ts";

/** 音声埋め込み */
export interface Audio {
Expand Down
4 changes: 2 additions & 2 deletions node/audioLink.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Unit } from "./unit.ts";
import { PlainText } from "./plainText.ts";
import type { Unit } from "./unit.ts";
import type { PlainText } from "./plainText.ts";

/** タイトル付き音声 */
export interface AudioLink {
Expand Down
4 changes: 2 additions & 2 deletions node/blank.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Unit } from "./unit.ts";
import { PlainText } from "./plainText.ts";
import type { Unit } from "./unit.ts";
import type { PlainText } from "./plainText.ts";

/** 空白記法 */
export interface Blank {
Expand Down
4 changes: 2 additions & 2 deletions node/code.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Unit } from "./unit.ts";
import { PlainText } from "./plainText.ts";
import type { Unit } from "./unit.ts";
import type { PlainText } from "./plainText.ts";

/** コード記法 */
export interface Code {
Expand Down
40 changes: 20 additions & 20 deletions node/decoration.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { Unit } from "./unit.ts";
import { PlainText } from "./plainText.ts";
import { Formula } from "./formula.ts";
import { Link } from "./link.ts";
import { HashTag } from "./hashTag.ts";
import { Icon } from "./icon.ts";
import { UrlLink } from "./urlLink.ts";
import { Url } from "./url.ts";
import { Image } from "./image.ts";
import { Gyazo } from "./gyazo.ts";
import { ImageLink } from "./imageLink.ts";
import { GyazoLink } from "./gyazoLink.ts";
import { Video } from "./video.ts";
import { Youtube } from "./youtube.ts";
import { Vimeo } from "./vimeo.ts";
import { Audio } from "./audio.ts";
import { AudioLink } from "./audioLink.ts";
import { Spotify } from "./spotify.ts";
import { Anchor } from "./anchor.ts";
import { GoogleMap } from "./googleMap.ts";
import type { Unit } from "./unit.ts";
import type { PlainText } from "./plainText.ts";
import type { Formula } from "./formula.ts";
import type { Link } from "./link.ts";
import type { HashTag } from "./hashTag.ts";
import type { Icon } from "./icon.ts";
import type { UrlLink } from "./urlLink.ts";
import type { Url } from "./url.ts";
import type { Image } from "./image.ts";
import type { Gyazo } from "./gyazo.ts";
import type { ImageLink } from "./imageLink.ts";
import type { GyazoLink } from "./gyazoLink.ts";
import type { Video } from "./video.ts";
import type { Youtube } from "./youtube.ts";
import type { Vimeo } from "./vimeo.ts";
import type { Audio } from "./audio.ts";
import type { AudioLink } from "./audioLink.ts";
import type { Spotify } from "./spotify.ts";
import type { Anchor } from "./anchor.ts";
import type { GoogleMap } from "./googleMap.ts";

/** 文字装飾記法中に入れられる記法 */
export type NodeInDecoration =
Expand Down
4 changes: 2 additions & 2 deletions node/formula.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Unit } from "./unit.ts";
import { PlainText } from "./plainText.ts";
import type { Unit } from "./unit.ts";
import type { PlainText } from "./plainText.ts";

/** 数式記法 */
export interface Formula {
Expand Down
4 changes: 2 additions & 2 deletions node/googleMap.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Unit } from "./unit.ts";
import { PlainText } from "./plainText.ts";
import type { Unit } from "./unit.ts";
import type { PlainText } from "./plainText.ts";

/** Location記法 */
export interface GoogleMap {
Expand Down
4 changes: 2 additions & 2 deletions node/gyazo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Unit } from "./unit.ts";
import { PlainText } from "./plainText.ts";
import type { Unit } from "./unit.ts";
import type { PlainText } from "./plainText.ts";

/** Gyazoから引っ張ってきた画像の画像記法 */
export interface Gyazo extends GyazoBase {
Expand Down
4 changes: 2 additions & 2 deletions node/gyazoLink.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Unit } from "./unit.ts";
import { PlainText } from "./plainText.ts";
import type { Unit } from "./unit.ts";
import type { PlainText } from "./plainText.ts";

/** Gyazoから引っ張ってきた画像のリンク付き画像記法 */
export interface GyazoLink {
Expand Down
4 changes: 2 additions & 2 deletions node/hashTag.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NodeWithoutIndent } from "./node.ts";
import { Unit } from "./unit.ts";
import type { NodeWithoutIndent } from "./node.ts";
import type { Unit } from "./unit.ts";

/** hashtag */
export interface HashTag {
Expand Down
4 changes: 2 additions & 2 deletions node/icon.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PlainText } from "./plainText.ts";
import { Unit } from "./unit.ts";
import type { PlainText } from "./plainText.ts";
import type { Unit } from "./unit.ts";

/** アイコン記法 */
export interface Icon {
Expand Down
4 changes: 2 additions & 2 deletions node/image.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Unit } from "./unit.ts";
import { PlainText } from "./plainText.ts";
import type { Unit } from "./unit.ts";
import type { PlainText } from "./plainText.ts";

/** 画像記法 */
export interface Image extends ImageBase {
Expand Down
4 changes: 2 additions & 2 deletions node/imageLink.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Unit } from "./unit.ts";
import { PlainText } from "./plainText.ts";
import type { Unit } from "./unit.ts";
import type { PlainText } from "./plainText.ts";

/** リンク付き画像記法 */
export interface ImageLink {
Expand Down
4 changes: 2 additions & 2 deletions node/indent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Unit } from "./unit.ts";
import { NodeWithoutIndent } from "./node.ts";
import type { Unit } from "./unit.ts";
import type { NodeWithoutIndent } from "./node.ts";

/** インデントがある行 */
export interface Indent {
Expand Down
4 changes: 2 additions & 2 deletions node/link.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PlainText } from "./plainText.ts";
import { Unit } from "./unit.ts";
import type { PlainText } from "./plainText.ts";
import type { Unit } from "./unit.ts";

/** リンク記法
*
Expand Down
50 changes: 25 additions & 25 deletions node/node.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import { Blank } from "./blank.ts";
import { PlainText } from "./plainText.ts";
import { Code } from "./code.ts";
import { Formula } from "./formula.ts";
import { Decoration } from "./decoration.ts";
import { Quote } from "./quote.ts";
import { Strong } from "./strong.ts";
import { Link } from "./link.ts";
import { HashTag } from "./hashTag.ts";
import { Icon, StrongIcon } from "./icon.ts";
import { UrlLink } from "./urlLink.ts";
import { Url } from "./url.ts";
import { Image, StrongImage } from "./image.ts";
import { Gyazo, StrongGyazo } from "./gyazo.ts";
import { ImageLink, StrongImageLink } from "./imageLink.ts";
import { GyazoLink, StrongGyazoLink } from "./gyazoLink.ts";
import { Video } from "./video.ts";
import { Youtube } from "./youtube.ts";
import { Vimeo } from "./vimeo.ts";
import { Audio } from "./audio.ts";
import { AudioLink } from "./audioLink.ts";
import { Spotify } from "./spotify.ts";
import { Anchor } from "./anchor.ts";
import { GoogleMap } from "./googleMap.ts";
import { Indent } from "./indent.ts";
import type { Blank } from "./blank.ts";
import type { PlainText } from "./plainText.ts";
import type { Code } from "./code.ts";
import type { Formula } from "./formula.ts";
import type { Decoration } from "./decoration.ts";
import type { Quote } from "./quote.ts";
import type { Strong } from "./strong.ts";
import type { Link } from "./link.ts";
import type { HashTag } from "./hashTag.ts";
import type { Icon, StrongIcon } from "./icon.ts";
import type { UrlLink } from "./urlLink.ts";
import type { Url } from "./url.ts";
import type { Image, StrongImage } from "./image.ts";
import type { Gyazo, StrongGyazo } from "./gyazo.ts";
import type { ImageLink, StrongImageLink } from "./imageLink.ts";
import type { GyazoLink, StrongGyazoLink } from "./gyazoLink.ts";
import type { Video } from "./video.ts";
import type { Youtube } from "./youtube.ts";
import type { Vimeo } from "./vimeo.ts";
import type { Audio } from "./audio.ts";
import type { AudioLink } from "./audioLink.ts";
import type { Spotify } from "./spotify.ts";
import type { Anchor } from "./anchor.ts";
import type { GoogleMap } from "./googleMap.ts";
import type { Indent } from "./indent.ts";

export type NodeWithoutIndent =
| Blank
Expand Down
4 changes: 2 additions & 2 deletions node/quote.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Unit } from "./unit.ts";
import { NodeWithoutIndent } from "./node.ts";
import type { Unit } from "./unit.ts";
import type { NodeWithoutIndent } from "./node.ts";

/** 引用記法 */
export interface Quote {
Expand Down
4 changes: 2 additions & 2 deletions node/spotify.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Unit } from "./unit.ts";
import { PlainText } from "./plainText.ts";
import type { Unit } from "./unit.ts";
import type { PlainText } from "./plainText.ts";

/** Spotify埋め込み */
export interface Spotify {
Expand Down
Loading