Skip to content

Commit d9492dd

Browse files
committed
feat: publish as @polyscope/sdk, tag-triggered npm workflow
Made-with: Cursor
1 parent 2e0a1a5 commit d9492dd

4 files changed

Lines changed: 52 additions & 6 deletions

File tree

.github/workflows/publish-npm.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish npm
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: "20"
19+
registry-url: "https://registry.npmjs.org"
20+
cache: npm
21+
22+
- name: Align tag with package.json version
23+
run: |
24+
TAG="${GITHUB_REF#refs/tags/v}"
25+
PKG="$(node -p "require('./package.json').version")"
26+
if [ "$TAG" != "$PKG" ]; then
27+
echo "::error::Tag v$TAG does not match package.json version $PKG"
28+
exit 1
29+
fi
30+
31+
- run: npm ci
32+
33+
- run: npm run typecheck
34+
35+
- run: npm test
36+
37+
- run: npm publish
38+
env:
39+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ A TypeScript/JavaScript SDK for the Polyscope API.
55
## Installation
66

77
```bash
8-
npm install polyscope
8+
npm install @polyscope/sdk
99
```
1010

1111
## Quick Start
1212

1313
```typescript
14-
import { Polyscope } from "polyscope";
14+
import { Polyscope } from "@polyscope/sdk";
1515

1616
const polyscope = new Polyscope({ apiToken: "your-api-token" });
1717

@@ -75,7 +75,7 @@ The SDK maps common HTTP/API failures to typed errors:
7575
Example:
7676

7777
```typescript
78-
import { Polyscope, ValidationError } from "polyscope";
78+
import { Polyscope, ValidationError } from "@polyscope/sdk";
7979

8080
try {
8181
await polyscope.createWorkspace({ repositoryId: "" });

package-lock.json

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

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "polyscope",
2+
"name": "@polyscope/sdk",
33
"version": "0.1.0",
44
"description": "Official Polyscope SDK for JavaScript and TypeScript",
55
"type": "module",
@@ -37,6 +37,13 @@
3737
],
3838
"author": "Beyond Code",
3939
"license": "MIT",
40+
"repository": {
41+
"type": "git",
42+
"url": "git+https://github.com/beyondcode/polyscope-js.git"
43+
},
44+
"publishConfig": {
45+
"access": "public"
46+
},
4047
"devDependencies": {
4148
"@types/node": "^25.3.2",
4249
"tsup": "^8.4.0",

0 commit comments

Comments
 (0)