diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fa5b8e4..fcd10b9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,20 +1,16 @@ name: test on: - schedule: - - cron: "0 7 * * 0" push: - paths: - - "**.md" - - "**.ts" - - ".github/workflows/test.yml" - - "deno.jsonc" + branches: + - main pull_request: paths: - "**.md" - "**.ts" - ".github/workflows/test.yml" - "deno.jsonc" + workflow_dispatch: jobs: check: @@ -22,14 +18,14 @@ jobs: matrix: runner: - ubuntu-latest - version: + deno_version: - "1.x" runs-on: ${{ matrix.runner }} steps: - uses: actions/checkout@v4 - uses: denoland/setup-deno@v1 with: - deno-version: "${{ matrix.version }}" + deno-version: "${{ matrix.deno_version }}" - name: Lint check run: deno lint - name: Format check diff --git a/README.md b/README.md index 43798ff..e9d2ff1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 🪐 denops_core -[![jsr](https://img.shields.io/jsr/v/%40denops/core?logo=javascript&logoColor=white)](https://jsr.io/@denops/core) +[![JSR](https://jsr.io/badges/@denops/core)](https://jsr.io/@denops/core) [![denoland](https://img.shields.io/github/v/release/vim-denops/deno-denops-core?logo=deno&label=denoland)](https://deno.land/x/denops_core) [![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/denops_core/mod.ts) [![test](https://github.com/vim-denops/deno-denops/workflows/test/badge.svg)](https://github.com/vim-denops/deno-denops/actions?query=workflow%3Atest) diff --git a/deno.jsonc b/deno.jsonc index 99aba83..ccfcc3f 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -3,8 +3,14 @@ "version": "0.0.0", "exports": "./mod.ts", "tasks": { - "test": "deno test -A --parallel --shuffle --doc --coverage=.coverage", - "check": "deno check ./**/*.ts", - "coverage": "deno coverage .coverage" + "check": "deno check **/*.ts", + "test": "deno test -A --parallel --shuffle --doc", + "test:coverage": "deno task test --coverage=.coverage", + "coverage": "deno coverage .coverage", + "update": "deno run --allow-env --allow-read --allow-write=. --allow-run=git,deno --allow-net=jsr.io,registry.npmjs.org jsr:@molt/cli ./*.ts", + "update:commit": "deno task -q update --commit --pre-commit=fmt,lint" + }, + "imports": { + "https://deno.land/x/denops_core@$MODULE_VERSION/": "./" } } diff --git a/denops.ts b/denops.ts index e2b6aa6..18bfe25 100644 --- a/denops.ts +++ b/denops.ts @@ -138,3 +138,18 @@ export interface Denops { */ dispatch(name: string, fn: string, ...args: unknown[]): Promise; } + +/** + * Denops's entrypoint definition. + * + * Use this type to ensure the `main` function is properly implemented like + * + * ```ts + * import type { Entrypoint } from "https://deno.land/x/denops_core@$MODULE_VERSION/mod.ts"; + * + * export const main: Entrypoint = (denops) => { + * // ... + * } + * ``` + */ +export type Entrypoint = (denops: Denops) => void | Promise; diff --git a/mod.ts b/mod.ts index 463fc38..803fdbc 100644 --- a/mod.ts +++ b/mod.ts @@ -12,4 +12,10 @@ */ export { BatchError } from "./denops.ts"; -export type { Context, Denops, Dispatcher, Meta } from "./denops.ts"; +export type { + Context, + Denops, + Dispatcher, + Entrypoint, + Meta, +} from "./denops.ts";