Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit 415b1ba

Browse files
author
Hendrik van Antwerpen
authored
Merge pull request #134 from github/more-npm
Automate NPM testing & publishing
2 parents 197a7ae + ef2274e commit 415b1ba

File tree

4 files changed

+85
-1
lines changed

4 files changed

+85
-1
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- cron: "0 0 1,15 * *"
88

99
jobs:
10-
test:
10+
test-rust:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
matrix:
@@ -54,3 +54,29 @@ jobs:
5454
run: cargo test --all-features
5555
- name: Run test suite with all optimizations
5656
run: cargo test --release
57+
58+
test-npm:
59+
runs-on: ${{ matrix.os }}
60+
strategy:
61+
matrix:
62+
node: [16.x]
63+
os: [ubuntu-latest]
64+
rust: [stable]
65+
66+
defaults:
67+
run:
68+
working-directory: tree-sitter-stack-graphs/npm
69+
70+
steps:
71+
- name: Install Node environment
72+
uses: actions/setup-node@v3
73+
with:
74+
node-version: ${{ matrix.node }}
75+
- name: Install Rust environment
76+
uses: hecrj/setup-rust-action@v1
77+
with:
78+
rust-version: ${{ matrix.rust }}
79+
- name: Checkout code
80+
uses: actions/checkout@v2
81+
- name: Build NPM package
82+
run: npm ci
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish tree-sitter-stack-graphs to NPM
2+
3+
on:
4+
push:
5+
tags:
6+
- tree-sitter-stack-graphs-v*'
7+
8+
env:
9+
PACKAGE_DIR: './tree-sitter-stack-graphs/npm'
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Install Node environment
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: 16.x
19+
registry-url: 'https://registry.npmjs.org'
20+
- name: Checkout repository
21+
uses: actions/checkout@v3
22+
# TODO Verify the package version matches the tag
23+
- name: Verify package
24+
run: npm publish --dry-run ${{ env.PACKAGE_DIR }}
25+
- name: Publish package
26+
run: npm publish ${{ env.PACKAGE_DIR }}
27+
env:
28+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# tree-sitter-stack-graphs
2+
3+
This package provides a convenient way to install the [tree-sitter-stack-graphs](https://crates.io/crates/tree-sitter-stack-graphs) CLI in an NPM project.
4+
5+
Add it as a dev dependency to an existing project using:
6+
7+
npm i -D tree-sitter-stack-graphs
8+
9+
It is also possible to invoke it directly using:
10+
11+
npx tree-sitter-stack-graphs
12+
13+
See the tree-sitter-stack-graphs [documentation](https://crates.io/crates/tree-sitter-stack-graphs) for details on usage.

tree-sitter-stack-graphs/npm/package-lock.json

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

0 commit comments

Comments
 (0)