Skip to content

Commit 88d0568

Browse files
committed
chore: Add skeleton code
1 parent b571bf5 commit 88d0568

File tree

6 files changed

+168
-0
lines changed

6 files changed

+168
-0
lines changed

.github/workflows/test.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
inputs:
10+
denops_branch:
11+
description: "Denops branch to test"
12+
required: false
13+
default: "main"
14+
15+
defaults:
16+
run:
17+
shell: bash --noprofile --norc -eo pipefail {0}
18+
19+
env:
20+
DENOPS_BRANCH: ${{ github.event.inputs.denops_branch || 'main' }}
21+
22+
jobs:
23+
check:
24+
strategy:
25+
matrix:
26+
runner:
27+
- ubuntu-latest
28+
deno_version:
29+
- "2.x"
30+
runs-on: ${{ matrix.runner }}
31+
steps:
32+
- run: git config --global core.autocrlf false
33+
if: runner.os == 'Windows'
34+
35+
- uses: actions/checkout@v4
36+
37+
- uses: denoland/setup-deno@v2
38+
with:
39+
deno-version: "${{ matrix.deno_version }}"
40+
41+
- uses: actions/cache@v4
42+
with:
43+
key: deno-${{ hashFiles('**/*') }}
44+
restore-keys: deno-
45+
path: |
46+
/home/runner/.cache/deno/deps/https/deno.land
47+
48+
- name: Lint check
49+
run: deno lint
50+
51+
- name: Format check
52+
run: deno fmt --check
53+
54+
- name: Type check
55+
run: deno task check
56+
57+
test:
58+
strategy:
59+
matrix:
60+
runner:
61+
- windows-latest
62+
- macos-latest
63+
- ubuntu-latest
64+
deno_version:
65+
- "2.x"
66+
host_version:
67+
- vim: "v9.1.0448"
68+
nvim: "v0.10.0"
69+
runs-on: ${{ matrix.runner }}
70+
timeout-minutes: 15
71+
steps:
72+
- run: git config --global core.autocrlf false
73+
if: runner.os == 'Windows'
74+
75+
- uses: actions/checkout@v4
76+
77+
- uses: denoland/setup-deno@v2
78+
with:
79+
deno-version: "${{ matrix.deno_version }}"
80+
81+
- name: Get denops
82+
run: |
83+
git clone https://github.com/vim-denops/denops.vim /tmp/denops.vim
84+
echo "DENOPS_TEST_DENOPS_PATH=/tmp/denops.vim" >> "$GITHUB_ENV"
85+
86+
- name: Try switching denops branch
87+
run: |
88+
git -C /tmp/denops.vim switch ${{ env.DENOPS_BRANCH }} || true
89+
git -C /tmp/denops.vim branch
90+
91+
- uses: rhysd/action-setup-vim@v1
92+
id: vim
93+
with:
94+
version: "${{ matrix.host_version.vim }}"
95+
96+
- uses: rhysd/action-setup-vim@v1
97+
id: nvim
98+
with:
99+
neovim: true
100+
version: "${{ matrix.host_version.nvim }}"
101+
102+
- name: Export executables
103+
run: |
104+
echo "DENOPS_TEST_VIM_EXECUTABLE=${{ steps.vim.outputs.executable }}" >> "$GITHUB_ENV"
105+
echo "DENOPS_TEST_NVIM_EXECUTABLE=${{ steps.nvim.outputs.executable }}" >> "$GITHUB_ENV"
106+
107+
- name: Check versions
108+
run: |
109+
deno --version
110+
${DENOPS_TEST_VIM_EXECUTABLE} --version
111+
${DENOPS_TEST_NVIM_EXECUTABLE} --version
112+
113+
- name: Perform pre-cache
114+
run: |
115+
deno cache \
116+
${DENOPS_TEST_DENOPS_PATH}/denops/@denops-private/mod.ts ./denops/fall/main.ts
117+
118+
- name: Test
119+
run: deno task test:coverage
120+
timeout-minutes: 15
121+
122+
# - run: |
123+
# deno task coverage --lcov > coverage.lcov
124+
125+
# - uses: codecov/codecov-action@v4
126+
# with:
127+
# os: ${{ runner.os }}
128+
# files: ./coverage.lcov
129+
# token: ${{ secrets.CODECOV_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.coverage
2+
deno.lock

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# denops-skeleton
2+
3+
[![Static Badge](https://img.shields.io/badge/denops-darkolivegreen?logo=deno&logoColor=darkolivegreen&label=Powered%20by&labelColor=white&link=https%3A%2F%2Fgithub.com%2Fvim-denops%2Fdenops.vim)](https://github.com/vim-denops/denops.vim)
4+
5+
This is a skeleton repository for creating a [Denops] plugin.
6+
7+
[Denops]: https://github.com/vim-denops/denops.vim

deno.jsonc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"exclude": [
3+
"docs/**",
4+
".coverage/**"
5+
],
6+
"tasks": {
7+
"check": "deno check ./**/*.ts",
8+
"test": "deno test -A --parallel --shuffle --doc",
9+
"test:coverage": "deno task test --coverage=.coverage",
10+
"coverage": "deno coverage .coverage --exclude=testdata/",
11+
"update": "deno run --allow-env --allow-read --allow-write=. --allow-run=git,deno --allow-net=deno.land,jsr.io,registry.npmjs.org jsr:@molt/cli ./**/*.ts",
12+
"update:write": "deno task -q update --write",
13+
"update:commit": "deno task -q update --commit --prefix :package: --pre-commit=fmt,lint"
14+
}
15+
}

denops/denops_skeleton/main.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import type { Entrypoint } from "jsr:@denops/[email protected]";
2+
3+
export const main: Entrypoint = (denops) => {
4+
denops.dispatcher = {
5+
hello: async () => {
6+
await denops.cmd("echo 'Hello, Denops!'");
7+
},
8+
};
9+
};

plugin/denops_skeleton.vim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
if exists('g:loaded_denops_skeleton')
2+
finish
3+
endif
4+
let g:loaded_denops_skeleton = 1
5+
6+
command! DenopsSkeletonHello call denops#request('denops_skeleton', 'hello', [])

0 commit comments

Comments
 (0)