Skip to content

Commit 2ef03f9

Browse files
committed
refactor: remove npm build test workflow and streamline npm publishing setup
1 parent 2d0d03f commit 2ef03f9

File tree

9 files changed

+171
-310
lines changed

9 files changed

+171
-310
lines changed

.github/workflows/npm-build-test.yml

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

.github/workflows/publish.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,20 @@ jobs:
3434
- uses: denoland/setup-deno@v2
3535
with:
3636
deno-version: ${{ env.DENO_VERSION }}
37+
cache: true
3738
- uses: actions/setup-node@v4
3839
with:
3940
node-version: ${{ env.NODE_VERSION }}
40-
registry-url: 'https://registry.npmjs.org'
41+
registry-url: "https://registry.npmjs.org"
4142
- name: Extract version from tag
4243
id: version
4344
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
4445
- name: Build npm package
45-
run: |
46-
echo "Attempting to build with dnt..."
47-
if deno task build:npm ${{ steps.version.outputs.VERSION }}; then
48-
echo "✅ dnt build successful"
49-
else
50-
echo "⚠️ dnt build failed, using manual fallback..."
51-
deno task build:npm:manual ${{ steps.version.outputs.VERSION }}
52-
fi
46+
run: deno task npm:build
47+
env:
48+
VERSION: ${{ steps.version.outputs.VERSION }}
5349
- name: Publish to npm
54-
run: |
55-
cd npm
56-
npm publish
50+
run: npm publish --provenance --access=public
51+
working-directory: ./npm
5752
env:
5853
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ common utilities.
1515

1616
### Installation
1717

18-
This library supports both JSR (JavaScript Registry) and npm installation methods.
18+
This library supports both JSR (JavaScript Registry) and npm installation
19+
methods.
1920

2021
#### Option 1: JSR (Recommended for Deno projects)
2122

@@ -50,14 +51,12 @@ npm install @cosense/std
5051

5152
2. Import the library:
5253

54+
**Only ESM syntax is supported.**
55+
5356
```typescript
54-
// ESM syntax (recommended)
57+
// ESM syntax
5558
import { getPage } from "@cosense/std/rest";
5659
import { parseAbsoluteLink } from "@cosense/std";
57-
58-
// CommonJS syntax
59-
const { getPage } = require("@cosense/std/rest");
60-
const { parseAbsoluteLink } = require("@cosense/std");
6160
```
6261

6362
2. Module Organization The library is organized into the following main modules:

api/pages/project.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type {
2-
BasePage,
32
NotFoundError,
43
NotLoggedInError,
54
NotMemberError,
65
PageList,
6+
PageSummary,
77
} from "@cosense/types/rest";
88
import { type BaseOptions, setDefaults } from "../../util.ts";
99
import { cookie } from "../../rest/auth.ts";
@@ -150,7 +150,7 @@ export interface ListPagesStreamOption<R extends Response | undefined>
150150
export async function* listPagesStream(
151151
project: string,
152152
options?: ListPagesStreamOption<Response>,
153-
): AsyncGenerator<BasePage, void, unknown> {
153+
): AsyncGenerator<PageSummary, void, unknown> {
154154
const props = {
155155
...(options ?? {}),
156156
skip: options?.skip ?? 0,

deno.jsonc

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
},
1010
"exclude": [
1111
"coverage/",
12-
"docs/"
12+
"docs/",
13+
"npm/"
1314
],
1415
"exports": {
1516
".": "./mod.ts",
@@ -20,7 +21,6 @@
2021
"./rest": "./rest/mod.ts",
2122
"./text": "./text.ts",
2223
"./title": "./title.ts",
23-
"./websocket": "./websocket/mod.ts",
2424
"./unstable-api": "./api.ts",
2525
"./unstable-api/pages": "./api/pages.ts",
2626
"./unstable-api/pages/project": "./api/pages/project.ts",
@@ -30,36 +30,35 @@
3030
"./unstable-api/pages/project/search/query": "./api/pages/project/search/query.ts",
3131
"./unstable-api/pages/project/search/titles": "./api/pages/project/search/titles.ts",
3232
"./unstable-api/pages/project/title": "./api/pages/project/title.ts",
33+
"./unstable-api/pages/project/title/icon": "./api/pages/project/title/icon.ts",
34+
"./unstable-api/pages/project/title/text": "./api/pages/project/title/text.ts",
3335
"./unstable-api/pages/projects": "./api/projects.ts",
3436
"./unstable-api/pages/projects/project": "./api/projects/project.ts",
35-
"./unstable-api/pages/project/title/text": "./api/pages/project/title/text.ts",
36-
"./unstable-api/pages/project/title/icon": "./api/pages/project/title/icon.ts",
3737
"./unstable-api/pages/smart-context": "./api/smart-context.ts",
3838
"./unstable-api/pages/smart-context/export-1hop-links": "./api/smart-context/export-1hop-links/project.ts",
3939
"./unstable-api/pages/smart-context/export-2hop-links": "./api/smart-context/export-2hop-links/project.ts",
4040
"./unstable-api/users": "./api/users.ts",
41-
"./unstable-api/users/me": "./api/users/me.ts"
41+
"./unstable-api/users/me": "./api/users/me.ts",
42+
"./websocket": "./websocket/mod.ts"
4243
},
4344
"imports": {
4445
"@core/iterutil": "jsr:@core/iterutil@^0.9.0",
4546
"@core/unknownutil": "jsr:@core/unknownutil@^4.0.0",
4647
"@cosense/std/browser/websocket": "./websocket/mod.ts",
4748
"@cosense/std/rest": "./rest/mod.ts",
4849
"@cosense/std/websocket": "./websocket/mod.ts",
49-
"@cosense/types": "jsr:@cosense/types@^0.10.7",
50-
"@cosense/types/rest": "jsr:@cosense/types@0.10/rest",
51-
"@cosense/types/userscript": "jsr:@cosense/types@0.10/userscript",
52-
"@progfay/scrapbox-parser": "jsr:@progfay/scrapbox-parser@9",
50+
"@cosense/types": "jsr:@cosense/types@^0.11.0",
51+
"@deno/dnt": "jsr:@deno/dnt@^0.42.3",
52+
"@progfay/scrapbox-parser": "jsr:@progfay/scrapbox-parser@^10.0.1",
5353
"@std/assert": "jsr:@std/assert@1",
54-
"@std/async": "jsr:@std/async@^1.0.11",
54+
"@std/async": "jsr:@std/async@^1.0.14",
5555
"@std/encoding": "jsr:@std/encoding@1",
5656
"@std/http": "jsr:@std/http@^1.0.13",
5757
"@std/json": "jsr:@std/json@^1.0.0",
5858
"@std/testing": "jsr:@std/testing@^1.0.9",
59-
"@std/testing/snapshot": "jsr:@std/testing@1/snapshot",
6059
"@takker/md5": "jsr:@takker/md5@0.1",
6160
"@takker/onp": "./vendor/raw.githubusercontent.com/takker99/onp/0.0.1/mod.ts",
62-
"option-t": "npm:option-t@^51.0.0",
61+
"option-t": "npm:option-t@53",
6362
"socket.io-client": "npm:socket.io-client@^4.7.5"
6463
},
6564
"lint": {
@@ -69,16 +68,14 @@
6968
},
7069
"name": "@cosense/std",
7170
"tasks": {
72-
"build:npm": "deno run -A scripts/build_npm.ts",
73-
"build:npm:manual": "deno run -A scripts/build_npm_manual.ts",
7471
"check": {
7572
"command": "deno fmt --check && deno lint && deno publish --dry-run",
7673
"dependencies": [
7774
"type-check",
7875
"test"
7976
]
8077
},
81-
"coverage": "deno test --allow-read=./ --parallel --shuffle --coverage --no-check && deno coverage --html",
78+
"coverage": "deno test --allow-read=./ --doc --parallel --shuffle --coverage --no-check && deno coverage --html",
8279
"doc": "deno doc --html mod.ts",
8380
"fix": {
8481
"command": "deno fmt && deno lint --fix && deno publish --dry-run --allow-dirty",
@@ -87,6 +84,13 @@
8784
"test"
8885
]
8986
},
87+
"npm:build": "deno run -A scripts/build_npm.ts",
88+
"npm:check": {
89+
"command": "cd npm && npm publish --provenance --access=public --dry-run",
90+
"dependencies": [
91+
"npm:build"
92+
]
93+
},
9094
"test": "deno test --allow-read=./ --doc --parallel --shuffle --no-check",
9195
"type-check": "deno check --remote **/*.ts",
9296
// from https://github.com/jsr-core/unknownutil/blob/v4.2.2/deno.jsonc#L84-L85

deno.lock

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

0 commit comments

Comments
 (0)