Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,39 @@ jobs:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}

publish-npm:
needs: publish
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # npm trusted-publishing OIDC
steps:
- uses: actions/checkout@v6
with:
ref: v${{ inputs.version }}
- uses: actions/setup-node@v6
with:
# Trusted publishing needs npm >=11.5.1; Node 22 LTS ships npm 10.x.
node-version: 24
cache: npm
cache-dependency-path: bindings/typescript/package-lock.json
- name: Install dependencies
run: npm ci
working-directory: bindings/typescript
- name: Build
run: npm run build
working-directory: bindings/typescript
# LICENSE is a symlink in-tree (matches bindings/{haskell,rust}); npm-pack drops symlinks.
- name: Materialize LICENSE for npm pack
run: |
rm -f bindings/typescript/LICENSE
cp LICENSE bindings/typescript/LICENSE
- uses: JS-DevTools/npm-publish@v4
with:
package: bindings/typescript
access: public
provenance: true

build-go-binaries:
needs: publish
permissions:
Expand Down Expand Up @@ -192,7 +225,7 @@ jobs:
gh release upload "$TAG" "$ASSET.tar.gz" "$ASSET.tar.gz.sha256" --clobber

finalize-release:
needs: [release-crate, build-go-binaries, publish-jvm-bindings]
needs: [release-crate, build-go-binaries, publish-jvm-bindings, publish-npm]
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ dist-newstyle/
# Nix output
/result

# TypeScript bindings build output
/bindings/typescript/dist/

vendor/
1 change: 1 addition & 0 deletions bindings/typescript/LICENSE
31 changes: 31 additions & 0 deletions bindings/typescript/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# `@scip-code/scip`

Generated TypeScript definitions for the [SCIP Code Intelligence Protocol].

## Install

``` sh
npm install @scip-code/scip
```

The package is ESM-only and ships with `.d.ts` declarations. Peer-style runtime
dependency on [`@bufbuild/protobuf`], which is installed transitively.

## Use

``` ts
import { fromBinary, toBinary } from "@bufbuild/protobuf";
import { IndexSchema } from "@scip-code/scip";
import { readFileSync } from "node:fs";

const bytes = readFileSync("index.scip");
const index = fromBinary(IndexSchema, bytes);

console.log(index.metadata?.projectRoot);
for (const doc of index.documents) {
console.log(doc.relativePath, doc.occurrences.length);
}
```

[SCIP Code Intelligence Protocol]: https://github.com/scip-code/scip
[`@bufbuild/protobuf`]: https://www.npmjs.com/package/@bufbuild/protobuf
21 changes: 19 additions & 2 deletions bindings/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,28 @@
"name": "@scip-code/scip",
"version": "0.8.0",
"description": "Generated TypeScript definitions for the Semantic Code Intelligence Protocol.",
"repository": "https://github.com/scip-code/scip/bindings/typescript",
"repository": {
"type": "git",
"url": "git+https://github.com/scip-code/scip.git",
"directory": "bindings/typescript"
},
"author": "Sourcegraph",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/scip_pb.js",
"types": "./dist/scip_pb.d.ts",
"exports": {
".": {
"types": "./dist/scip_pb.d.ts",
"import": "./dist/scip_pb.js"
}
},
"files": ["dist", "LICENSE"],
"sideEffects": false,
"private": false,
"scripts": {
"build": "tsc",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@bufbuild/protobuf": "^2.11.0"
},
Expand Down
16 changes: 11 additions & 5 deletions bindings/typescript/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "ES2020",
"moduleResolution": "bundler",
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "dist",
"rootDir": ".",
"strict": true
}
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"strict": true,
"skipLibCheck": true
},
"include": ["scip_pb.ts"]
}
2 changes: 1 addition & 1 deletion checks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
npmDepsHash = "sha256-c+UXwcqJVmRvaIwmzjj42gbmu0X/iEUJUiTcqfXNDvg=";
buildPhase = ''
runHook preBuild
npx tsc --noEmit
npm run build
runHook postBuild
'';
installPhase = "touch $out";
Expand Down
Loading