Skip to content

Commit 7e99826

Browse files
authored
Merge pull request #35 from hypermedia-app/sparqlc-tsc
feat(cli): add `sparqlc-cli`
2 parents 7176851 + 6317a76 commit 7e99826

25 files changed

Lines changed: 1961 additions & 213 deletions

‎.changeset/add-sparqlc-tsc.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"sparqlc": patch
3+
"ts-plugin-sparqlc": patch
4+
"sparqlc-cli": minor
5+
---
6+
7+
Add `sparqlc-cli` package containing `sparqlc-tsc` (a drop-in `tsc` replacement for SPARQL query/update imports) and `sparqlc` (a CLI SPARQL compiler).
8+
Extract shared declaration generator `toDeclaration` into `sparqlc/declarations.js` and update `ts-plugin-sparqlc` to use it.

‎.changeset/lovely-poets-report.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"sparqlc": minor
3+
---
4+
5+
`sparqlc` reimplemented in `sparqlc-cli` package

‎.github/workflows/tests.yaml‎

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
path: packages/vite-plugin-sparql
2525
steps:
2626
- uses: actions/checkout@v7
27-
- uses: fabasoad/setup-prolog-action@v1
2827
- uses: actions/setup-node@v7
2928
with:
3029
node-version: ${{ matrix.node }}
@@ -40,11 +39,40 @@ jobs:
4039
token: ${{ secrets.CODECOV_TOKEN }}
4140
flags: ${{ matrix.package.name }}
4241

42+
sparql-cli:
43+
name: sparql-cli (TS ${{ matrix.typescript }}, node ${{ matrix.node }})
44+
runs-on: ubuntu-latest
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
node: [ "lts/*" ]
49+
typescript: [ "5", "6" ]
50+
include:
51+
- node: "lts/-1"
52+
typescript: "5"
53+
- node: "lts/-2"
54+
typescript: "5"
55+
steps:
56+
- uses: actions/checkout@v7
57+
- uses: actions/setup-node@v7
58+
with:
59+
node-version: ${{ matrix.node }}
60+
- run: npm ci
61+
- run: npm run -w sparqlc build
62+
- name: Install target TypeScript version in sparqlc-cli
63+
run: npm install --no-save typescript@${{ matrix.typescript }} -w packages/sparqlc-cli
64+
- name: Run CLI tests against target TypeScript version
65+
run: npx c8 --all --src packages/sparqlc-cli --include packages/sparqlc-cli --reporter lcovonly --reporter text npm run -w sparqlc-cli test
66+
- name: Codecov
67+
uses: codecov/codecov-action@v5
68+
with:
69+
token: ${{ secrets.CODECOV_TOKEN }}
70+
flags: sparqlc-cli
71+
4372
lint:
4473
runs-on: ubuntu-latest
4574
steps:
4675
- uses: actions/checkout@v7
47-
- uses: fabasoad/setup-prolog-action@v1
4876
- uses: actions/setup-node@v7
4977
with:
5078
node-version: lts/*
@@ -55,7 +83,6 @@ jobs:
5583
runs-on: ubuntu-latest
5684
steps:
5785
- uses: actions/checkout@v7
58-
- uses: fabasoad/setup-prolog-action@v1
5986
- uses: actions/setup-node@v7
6087
with:
6188
node-version: lts/*

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ node_modules/
44
!packages/ts-plugin-sparqlc/*.js
55
coverage/
66
.vitest-attachments/
7+
!packages/*/bin/*.js

‎README.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
A set of tools for compiling and using SPARQL queries as first‑class modules across Node.js, Vite, esbuild, and TypeScript.
44

55
Packages (in usage order):
6-
- `sparqlc` – core compiler and runtime (JS API + CLI)
6+
- `sparqlc` – core compiler and runtime (JS API)
7+
- `sparqlc-cli` – CLI tools (`sparqlc-tsc` drop-in replacement for `tsc`, and `sparqlc` CLI compiler)
78
- `node-loader-sparql` – Node.js loader to import `.rq` files directly
89
- `vite-plugin-sparql` – Vite plugin to import `.rq` in web apps
910
- `esbuild-plugin-sparql` – esbuild plugin to import `.rq`
10-
- `ts-plugin-sparqlc` – TypeScript language service plugin to get strong types for `.rq` imports
11+
- `ts-plugin-sparqlc` – TypeScript language service plugin to get strong types for `.rq` imports in IDEs
1112

1213
## Installation
1314

0 commit comments

Comments
 (0)