Skip to content

Commit 722910a

Browse files
authored
Merge pull request #21 from vim-denops/publish-jsr
JSR support
2 parents 8cd38d5 + a38c7e6 commit 722910a

File tree

14 files changed

+152
-109
lines changed

14 files changed

+152
-109
lines changed

.github/workflows/jsr.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: jsr
2+
3+
env:
4+
DENO_VERSION: 1.x
5+
6+
on:
7+
push:
8+
tags:
9+
- "v*"
10+
11+
permissions:
12+
contents: read
13+
id-token: write
14+
15+
jobs:
16+
publish:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
- uses: denoland/setup-deno@v1
23+
with:
24+
deno-version: ${{ env.DENO_VERSION }}
25+
- name: Publish
26+
run: |
27+
deno run -A jsr:@david/[email protected]

.github/workflows/test.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,22 @@ env:
44
DENO_VERSION: 1.x
55

66
on:
7-
schedule:
8-
- cron: "0 7 * * 0"
97
push:
108
branches:
119
- main
1210
pull_request:
11+
paths:
12+
- "**.md"
13+
- "**.ts"
14+
- "deno.jsonc"
15+
- ".github/workflows/test.yml"
16+
workflow_dispatch:
1317

1418
jobs:
1519
check:
1620
runs-on: ubuntu-latest
1721
steps:
18-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
1923
- uses: denoland/setup-deno@v1
2024
with:
2125
deno-version: ${{ env.DENO_VERSION }}
@@ -30,16 +34,29 @@ jobs:
3034
test:
3135
runs-on: ubuntu-latest
3236
steps:
33-
- uses: actions/checkout@v3
37+
- uses: actions/checkout@v4
3438
- uses: denoland/setup-deno@v1
3539
with:
3640
deno-version: ${{ env.DENO_VERSION }}
3741
- name: Test
3842
run: |
39-
deno task test
43+
deno task test:coverage
4044
timeout-minutes: 5
4145
- run: |
4246
deno task coverage --lcov > coverage.lcov
43-
- uses: codecov/codecov-action@v1
47+
- uses: codecov/codecov-action@v4
4448
with:
45-
file: ./coverage.lcov
49+
os: ${{ runner.os }}
50+
files: ./coverage.lcov
51+
token: ${{ secrets.CODECOV_TOKEN }}
52+
53+
jsr-publish:
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@v4
57+
- uses: denoland/setup-deno@v1
58+
with:
59+
deno-version: ${{ env.DENO_VERSION }}
60+
- name: Publish (dry-run)
61+
run: |
62+
deno publish --dry-run

.github/workflows/udd.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/workflows/update.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: update
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
workflow_dispatch:
7+
8+
jobs:
9+
update:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: denoland/setup-deno@v1
14+
with:
15+
deno-version: 1.x
16+
- name: Configure Git
17+
run: |
18+
git config user.name github-actions[bot]
19+
git config user.email github-actions[bot]@users.noreply.github.com
20+
- name: Update dependencies and commit changes
21+
run: deno task -q upgrade:commit --summary ../title.txt --report ../body.md
22+
- name: Check result
23+
id: result
24+
uses: andstor/file-existence-action@v2
25+
with:
26+
files: ../title.txt, ../body.md
27+
- name: Read title.txt
28+
id: title
29+
if: steps.result.outputs.files_exists == 'true'
30+
uses: juliangruber/read-file-action@v1
31+
with:
32+
path: ../title.txt
33+
- name: Read body.md
34+
id: body
35+
if: steps.result.outputs.files_exists == 'true'
36+
uses: juliangruber/read-file-action@v1
37+
with:
38+
path: ../body.md
39+
- name: Create a pull request
40+
if: steps.result.outputs.files_exists == 'true'
41+
uses: peter-evans/create-pull-request@v6
42+
with:
43+
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
44+
branch: automation/update-dependencies
45+
title: ${{ steps.title.outputs.content }}
46+
body: ${{ steps.body.outputs.content }}
47+
labels: automation
48+
delete-branch: true

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# vim-channel-command
22

3-
[![deno land](http://img.shields.io/badge/available%20on-deno.land/x-lightgrey.svg?logo=deno)](https://deno.land/x/vim_channel_command)
4-
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/vim_channel_command/mod.ts)
3+
[![JSR](https://jsr.io/badges/@denops/vim-channel-command)](https://jsr.io/@denops/vim-channel-command)
54
[![Test](https://github.com/vim-denops/deno-vim-channel-command/workflows/Test/badge.svg)](https://github.com/vim-denops/deno-vim-channel-command/actions?query=workflow%3ATest)
65
[![codecov](https://codecov.io/github/vim-denops/deno-vim-channel-command/branch/main/graph/badge.svg?token=FYH6RHO6UC)](https://codecov.io/github/vim-denops/deno-vim-channel-command)
76

8-
[Deno][deno] module to support [Vim's Channel commands][vim's channel commands].
7+
[Deno] module to support [Vim's Channel commands].
98

10-
[deno]: https://deno.land/
11-
[vim's channel commands]: https://github.com/vim/vim/blob/master/runtime/doc/channel.txt#L291
9+
[Deno]: https://deno.land/
10+
[Vim's Channel commands]: https://github.com/vim/vim/blob/master/runtime/doc/channel.txt#L291
1211

1312
## License
1413

client.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { Indexer } from "https://deno.land/x/[email protected]/mod.ts";
2-
import { buildMessage, Message } from "./message.ts";
1+
import { Indexer } from "@lambdalisue/indexer";
2+
import { buildMessage, type Message } from "./message.ts";
33
import {
44
buildCallCommand,
55
buildExCommand,
66
buildExprCommand,
77
buildNormalCommand,
88
buildRedrawCommand,
9-
Command,
9+
type Command,
1010
} from "./command.ts";
1111

1212
const msgidThreshold = 2 ** 32;

client_test.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
import {
2-
assertEquals,
3-
assertRejects,
4-
} from "https://deno.land/[email protected]/assert/mod.ts";
1+
import { assertEquals, assertRejects } from "@std/assert";
52
import {
63
assertSpyCallArgs,
74
assertSpyCalls,
85
resolvesNext,
96
spy,
107
stub,
11-
} from "https://deno.land/[email protected]/testing/mock.ts";
12-
import { unimplemented } from "https://deno.land/x/[email protected]/mod.ts";
13-
import { Indexer } from "https://deno.land/x/[email protected]/mod.ts";
8+
} from "@std/testing/mock";
9+
import { unimplemented } from "@lambdalisue/errorutil";
10+
import { Indexer } from "@lambdalisue/indexer";
1411
import { buildMessage, type Message } from "./message.ts";
1512
import { Client, type Session } from "./client.ts";
1613

command_test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import {
2-
assertEquals,
3-
assertThrows,
4-
} from "https://deno.land/[email protected]/assert/mod.ts";
1+
import { assertEquals, assertThrows } from "@std/assert";
52
import {
63
buildCallCommand,
74
buildExCommand,

deno.jsonc

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,29 @@
11
{
2-
"lock": false,
2+
"name": "@denops/vim-channel-command",
3+
"version": "0.0.0",
4+
"exports": {
5+
".": "./mod.ts",
6+
"./client": "./client.ts",
7+
"./command": "./command.ts",
8+
"./message": "./message.ts",
9+
"./session": "./session.ts"
10+
},
311
"tasks": {
4-
"test": "deno test -A --parallel --doc --coverage=.coverage",
512
"check": "deno check **/*.ts",
13+
"test": "deno test -A --parallel --shuffle --doc",
14+
"test:coverage": "deno task test --coverage=.coverage",
615
"coverage": "deno coverage .coverage",
7-
"upgrade": "deno run -A https://deno.land/x/udd/main.ts **/*.ts"
16+
"update": "deno run --allow-env --allow-read --allow-write=. --allow-run=git,deno --allow-net=jsr.io,registry.npmjs.org jsr:@molt/cli ./*.ts",
17+
"update:commit": "deno task -q update --commit --pre-commit=fmt,lint"
18+
},
19+
"imports": {
20+
"@lambdalisue/async": "jsr:@lambdalisue/async@^2.1.1",
21+
"@lambdalisue/errorutil": "jsr:@lambdalisue/errorutil@^1.0.0",
22+
"@lambdalisue/indexer": "jsr:@lambdalisue/indexer@^1.0.0",
23+
"@lambdalisue/reservator": "jsr:@lambdalisue/reservator@^1.0.1",
24+
"@lambdalisue/streamtools": "jsr:@lambdalisue/streamtools@^1.0.0",
25+
"@std/assert": "jsr:@std/assert@^0.225.1",
26+
"@std/testing": "jsr:@std/testing@^0.224.0",
27+
"@streamparser/json": "npm:@streamparser/json@^0.0.21"
828
}
929
}

json_streams.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
// NOTE:
2-
// streamparser-json must be v0.0.5 because it automatically end-up parsing without separator after v0.0.5
3-
// https://github.com/juanjoDiaz/streamparser-json/commit/577e918b90c19d6758b87d41bdb6c5571a2c012d
4-
import JSONParser from "https://deno.land/x/[email protected]/jsonparse.ts#=";
1+
import { JSONParser } from "@streamparser/json";
52

63
/**
74
* EncodeStream encodes object stream to JSON string in Uin8Array stream.
@@ -22,12 +19,14 @@ export class EncodeStream<T> extends TransformStream<T, Uint8Array> {
2219
*/
2320
export class DecodeStream<T> extends TransformStream<Uint8Array, T> {
2421
constructor() {
25-
const parser = new JSONParser();
22+
const parser = new JSONParser({
23+
separator: "",
24+
});
2625
super({
2726
start(controller) {
28-
parser.onValue = (value, _key, _parent, stack) => {
27+
parser.onValue = ({ value, stack }) => {
2928
if (stack.length) return;
30-
controller.enqueue(value);
29+
controller.enqueue(value as T);
3130
};
3231
},
3332
transform(chunk) {

0 commit comments

Comments
 (0)