Skip to content

Commit

Permalink
introduce depcheck to CI + fix dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jitsedesmet committed Jan 15, 2025
1 parent c486366 commit ead04bd
Show file tree
Hide file tree
Showing 14 changed files with 343 additions and 39 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: yarn install --immutable
- run: yarn build
- run: yarn depcheck
- run: yarn test

spec:
Expand Down
10 changes: 8 additions & 2 deletions engines/engine-sparql-1-1-adjust/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,14 @@
},
"dependencies": {
"@traqula/core": "^0.0.0",
"@traqula/engine-sparql-1-1": "^0.0.0",
"@traqula/rules-sparql-1-1": "^0.0.0",
"chevrotain": "^11.0.3",
"rdf-data-factory": "^2.0.1"
"@traqula/rules-sparql-1-1-adjust": "^0.0.0"
},
"devDependencies": {
"@rdfjs/types": "^2.0.0",
"@traqula/test-utils": "^0.0.0",
"rdf-data-factory": "^2.0.1",
"rdf-test-suite": "^2.0.0"
}
}
2 changes: 1 addition & 1 deletion engines/engine-sparql-1-1-adjust/test/statics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('a SPARQL 1.1 + adjust parser', () => {
});
}

importSparql11NoteTests(parser, new DataFactory<BaseQuad>());
importSparql11NoteTests(args => new Sparql11AdjustParser(args), new DataFactory<BaseQuad>());

it('parses ADJUST function', ({expect}) => {
const query = `
Expand Down
7 changes: 4 additions & 3 deletions engines/engine-sparql-1-1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,14 @@
},
"dependencies": {
"@traqula/core": "^0.0.0",
"@traqula/rules-sparql-1-1": "^0.0.0",
"chevrotain": "^11.0.3",
"rdf-data-factory": "^2.0.1"
"@traqula/rules-sparql-1-1": "^0.0.0"
},
"devDependencies": {
"@rdfjs/types": "^2.0.0",
"@traqula/test-utils": "^0.0.0",
"@types/sparqljs": "^3.1.12",
"rdf-data-factory": "^2.0.1",
"rdf-test-suite": "^2.0.0",
"sparqljs": "^3.7.3"
}
}
2 changes: 1 addition & 1 deletion engines/engine-sparql-1-1/test/statics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ describe('a SPARQL 1.1 parser', () => {
});
}

importSparql11NoteTests(parser, new DataFactory<BaseQuad>());
importSparql11NoteTests(args => new Sparql11Parser(args), new DataFactory<BaseQuad>());
});
9 changes: 8 additions & 1 deletion engines/engine-sparql-1-2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@
"dependencies": {
"@traqula/core": "^0.0.0",
"@traqula/rules-sparql-1-1": "^0.0.0",
"chevrotain": "^11.0.3",
"@traqula/rules-sparql-1-2": "^0.0.0",
"@traqula/engine-sparql-1-1": "^0.0.0",
"rdf-data-factory": "^2.0.1"
},
"devDependencies": {
"@rdfjs/types": "^2.0.0",
"@traqula/test-utils": "^0.0.0",
"rdf-data-factory": "^2.0.1",
"rdf-test-suite": "^2.0.0"
}
}
3 changes: 2 additions & 1 deletion engines/engine-sparql-1-2/test/statics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Sparql12Parser } from "../lib";
import {positiveTest, importSparql11NoteTests, negativeTest} from "@traqula/test-utils";
import {DataFactory} from "rdf-data-factory";
import {BaseQuad} from "@rdfjs/types";
import {Sparql11Parser} from "@traqula/engine-sparql-1-1";

describe('a SPARQL 1.2 parser', () => {
const parser = new Sparql12Parser({ prefixes: { ex: 'http://example.org/' }});
Expand Down Expand Up @@ -43,5 +44,5 @@ describe('a SPARQL 1.2 parser', () => {
});
}

importSparql11NoteTests(parser, new DataFactory<BaseQuad>());
importSparql11NoteTests(args => new Sparql11Parser(args), new DataFactory<BaseQuad>());
});
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"build:transpile": "lerna run build:transpile",
"build:transpile-spec": "lerna run build:transpile-spec",
"clean": "git clean -dfx",
"depcheck": "lerna exec --concurrency 1 -- depcheck --ignores=\"vitest\"",
"publish": "yarn run build",
"spec:all": "lerna run spec:all --concurrency 1",
"spec:earl": "lerna run spec:earl --concurrency 1",
Expand All @@ -23,6 +24,7 @@
"devDependencies": {
"@rdfjs/types": "^2.0.0",
"@vitest/coverage-v8": "2.1.8",
"depcheck": "^1.4.7",
"esbuild": "^0.24.0",
"lerna": "8.1.4",
"manual-git-changelog": "^1.0.2",
Expand Down
4 changes: 4 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,9 @@
"dependencies": {
"chevrotain": "^11.0.3",
"rdf-data-factory": "^2.0.1"
},
"devDependencies": {
"@chevrotain/types": "^11.0.3",
"@rdfjs/types": "^2.0.0"
}
}
5 changes: 5 additions & 0 deletions packages/rules-sparql-1-1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@
"build:transpile": " node \"../../node_modules/esbuild/bin/esbuild\" --format=cjs --bundle --log-level=error --outfile=lib/index.cjs lib/index.ts"
},
"dependencies": {
"chevrotain": "^11.0.3",
"@traqula/core": "^0.0.0",
"rdf-data-factory": "^2.0.1"
},
"devDependencies": {
"@chevrotain/types": "^11.0.3",
"@rdfjs/types": "^2.0.0"
}
}
6 changes: 4 additions & 2 deletions packages/rules-sparql-1-2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
},
"dependencies": {
"@traqula/core": "^0.0.0",
"@traqula/rules-sparql-1-1": "^0.0.0",
"rdf-data-factory": "^2.0.1"
"@traqula/rules-sparql-1-1": "^0.0.0"
},
"devDependencies": {
"@rdfjs/types": "^2.0.0"
}
}
14 changes: 8 additions & 6 deletions packages/test-utils/lib/Sparql11NotesTest.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import {beforeEach, describe, it} from "vitest";
import {describe, it} from "vitest";
import type {TestFunction} from "vitest";
import {Sparql11Parser} from "@traqula/engine-sparql-1-1";
import {DataFactory} from "rdf-data-factory";
import {BaseQuad} from "@rdfjs/types";

interface Parser {
parse: (query: string) => unknown;
}

export function importSparql11NoteTests(parser: Parser, dataFactory: DataFactory<BaseQuad>) {
type ParserConstructor = (args?: {prefixes?: Record<string, string>, baseIRI?: string}) => Parser;

export function importSparql11NoteTests(constructor: ParserConstructor, dataFactory: DataFactory<BaseQuad>) {
const parser = constructor();

function testErroneousQuery(query: string, errorMsg: string): TestFunction<object> {
return ({ expect }) => {
Expand Down Expand Up @@ -75,7 +77,7 @@ export function importSparql11NoteTests(parser: Parser, dataFactory: DataFactory

describe('with pre-defined prefixes', () => {
const prefixes = { a: 'ex:abc#', b: 'ex:def#' };
const parser = new Sparql11Parser({ prefixes });
const parser = constructor({ prefixes });

it('should use those prefixes', ({ expect }) => {
const query = 'SELECT * { a:a b:b "" }';
Expand Down Expand Up @@ -141,7 +143,7 @@ export function importSparql11NoteTests(parser: Parser, dataFactory: DataFactory
});

describe('with pre-defined base IRI', () => {
const parser = new Sparql11Parser({ baseIRI: 'http://ex.org/' });
const parser = constructor({ baseIRI: 'http://ex.org/' });

it('should use the base IRI', ({ expect }) => {
const query = 'SELECT * { <> <#b> "" }';
Expand All @@ -162,7 +164,7 @@ export function importSparql11NoteTests(parser: Parser, dataFactory: DataFactory

const goodQuery = 'SELECT * { <> <#b> "" }';

const parser = new Sparql11Parser({ baseIRI: 'http://ex2.org/' });
const parser = constructor({ baseIRI: 'http://ex2.org/' });
const result = {
subject: dataFactory.namedNode('http://ex2.org/'),
predicate: dataFactory.namedNode('http://ex2.org/#b'),
Expand Down
7 changes: 5 additions & 2 deletions packages/test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@
},
"dependencies": {
"@traqula/core": "^0.0.0",
"rdf-data-factory": "^2.0.1",
"vitest": "^2.1.8"
"vitest": "^2.1.8",
"rdf-data-factory": "^2.0.1"
},
"devDependencies": {
"@rdfjs/types": "^2.0.0"
}
}
Loading

0 comments on commit ead04bd

Please sign in to comment.