Skip to content

Commit f15371c

Browse files
committed
feat(affine-vscode): npm package manifest + tag-driven publish (issue #104)
In-repo half of #104 so consumers can `npm install @hyperpolymath/affine-vscode` instead of vendoring mod.js — which is what makes --vscode-extension's default `require("@hyperpolymath/affine-vscode")` resolvable downstream. - packages/affine-vscode/package.json: publish manifest (name, main, PMPL license matching the sibling deno.json, repository.directory, peerDependencies vscode + optional vscode-languageclient, files allowlist, public publishConfig). vscode-languageclient is marked optional to match --vscode-extension-no-lc. - .github/workflows/affine-vscode-publish.yml: publishes on a scoped `affine-vscode-v*` tag (kept distinct from the compiler's `v*` tags), verifies tag==package version, uses runner-provided Node and a runtime $HOME/.npmrc (no committed .npmrc, so the npm/bun blocker stays green). - README: npm-install section as the primary entry point. Out of scope (needs npm org/token + other repos): the @hyperpolymath npm org, first manual publish, and the my-lang / standards consumer ports. https://claude.ai/code/session_01FkzAgzpZFSGxzorVNZ9FUF
1 parent 766755f commit f15371c

3 files changed

Lines changed: 112 additions & 0 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
2+
# Publishes @hyperpolymath/affine-vscode to npm on a scoped tag push.
3+
#
4+
# This repo is Deno-first (see CLAUDE.md). The npm publish here is a
5+
# deliberate, owner-sanctioned exception (issue #104): the VS Code
6+
# extension host is npm-native and cannot consume the Deno/JSR manifest,
7+
# so AffineScript-authored extensions resolve the adapter via
8+
# `require("@hyperpolymath/affine-vscode")`. Only the publish step touches
9+
# npm; no npm runtime deps are added to the repo and no .npmrc is
10+
# committed (the auth file is written to $HOME at runtime).
11+
#
12+
# Trigger: push a tag matching `affine-vscode-v*` (e.g. affine-vscode-v0.1.0).
13+
# This pattern is intentionally distinct from the `v*` tags used by the
14+
# OCaml compiler Release workflow so the two never collide.
15+
#
16+
# Requires repository secret NPM_TOKEN (an npm automation token with
17+
# publish rights to the @hyperpolymath scope).
18+
19+
name: Publish affine-vscode
20+
21+
on:
22+
push:
23+
tags:
24+
- 'affine-vscode-v*'
25+
26+
permissions:
27+
contents: read
28+
29+
jobs:
30+
publish:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout code
34+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
35+
36+
- name: Verify tag matches package version
37+
working-directory: packages/affine-vscode
38+
run: |
39+
tag="${GITHUB_REF_NAME#affine-vscode-v}"
40+
pkg="$(node -p "require('./package.json').version")"
41+
if [ "$tag" != "$pkg" ]; then
42+
echo "❌ Tag version ($tag) does not match package.json version ($pkg)" >&2
43+
exit 1
44+
fi
45+
echo "✅ Publishing @hyperpolymath/affine-vscode@$pkg"
46+
47+
- name: Configure npm auth
48+
env:
49+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
50+
run: |
51+
if [ -z "${NPM_TOKEN}" ]; then
52+
echo "❌ NPM_TOKEN secret is not set" >&2
53+
exit 1
54+
fi
55+
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > "${HOME}/.npmrc"
56+
57+
- name: Publish to npm
58+
working-directory: packages/affine-vscode
59+
run: npm publish --access public
60+
61+
- name: Clean up npm auth
62+
if: always()
63+
run: rm -f "${HOME}/.npmrc"

packages/affine-vscode/README.adoc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ JS-side adapter for the `stdlib/Vscode.affine` and
66
`stdlib/VscodeLanguageClient.affine` binding modules. Issue #35 Phase 2
77
deliverable.
88

9+
== Install
10+
11+
[source,sh]
12+
----
13+
npm install @hyperpolymath/affine-vscode
14+
----
15+
16+
Add it to your extension's `package.json` `dependencies`. `vscode` and
17+
`vscode-languageclient` are peer dependencies (the latter is optional —
18+
omit it with `--vscode-extension-no-lc`).
19+
920
== Usage
1021

1122
=== Recommended: `--vscode-extension` (issue #105)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "@hyperpolymath/affine-vscode",
3+
"version": "0.1.0",
4+
"description": "JS-side adapter for AffineScript's stdlib/Vscode.affine + stdlib/VscodeLanguageClient.affine binding modules. Resolves each extern fn to a real vscode / vscode-languageclient call and maintains the FFI handle table.",
5+
"main": "./mod.js",
6+
"license": "PMPL-1.0-or-later",
7+
"repository": {
8+
"type": "git",
9+
"url": "https://github.com/hyperpolymath/affinescript.git",
10+
"directory": "packages/affine-vscode"
11+
},
12+
"homepage": "https://github.com/hyperpolymath/affinescript/tree/main/packages/affine-vscode",
13+
"bugs": "https://github.com/hyperpolymath/affinescript/issues",
14+
"keywords": [
15+
"affinescript",
16+
"vscode",
17+
"vscode-extension",
18+
"language-server",
19+
"wasm",
20+
"ffi-adapter"
21+
],
22+
"files": [
23+
"mod.js",
24+
"README.adoc"
25+
],
26+
"peerDependencies": {
27+
"vscode": "*",
28+
"vscode-languageclient": "^9.0.0"
29+
},
30+
"peerDependenciesMeta": {
31+
"vscode-languageclient": {
32+
"optional": true
33+
}
34+
},
35+
"publishConfig": {
36+
"access": "public"
37+
}
38+
}

0 commit comments

Comments
 (0)