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
Binary file removed .DS_Store
Binary file not shown.
17 changes: 3 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
**/.idea/
**/node_modules/
**/coverage/
**/comunica_temp/
**/local_temp/
test_files/
output/
.eslintcache
.yarn/

node_modules/
coverage/

**/lib/**/*.js
**/lib/**/*.js.map
**/lib/**/*.d.ts
**/test/**/*.js
**/test/**/*.js.map
**/test/**/*.d.ts
**/bin/**/*.js
**/bin/**/*.js.map
**/bin/**/*.d.ts
**/index.js
**/index.js.map
**/index.d.ts
!/test/data/**/*.d.ts
1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

7 changes: 3 additions & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run build && npm run lint && npm run test
yarn run build
yarn run lint
yarn run test
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

2 changes: 2 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
compressionLevel: mixed
enableGlobalCache: false
nodeLinker: node-modules
136 changes: 0 additions & 136 deletions debug

This file was deleted.

1 change: 0 additions & 1 deletion index.ts

This file was deleted.

31 changes: 31 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import type { Config } from '@jest/types';

const config: Config.InitialOptions = {
collectCoverage: true,
coveragePathIgnorePatterns: [
'/test/',
],
coverageProvider: 'babel',
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},
moduleFileExtensions: [
'ts',
'js',
],
testEnvironment: 'node',
testMatch: [
'<rootDir>/test/**/*.test.ts',
'<rootDir>/packages/*/test/**/*-test.ts',
],
transform: {
'\\.ts$': 'ts-jest',
},
};

export default config;
1 change: 1 addition & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './generate/Generator';
4 changes: 2 additions & 2 deletions lib/parse/CommentLoader.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { TSESTree } from '@typescript-eslint/typescript-estree';
import * as commentParse from 'comment-parser';
import { parse } from 'comment-parser';
import type { ClassReference, ClassReferenceLoaded } from './ClassIndex';
import type { ConstructorHolder } from './ConstructorLoader';
import type { DefaultNested, DefaultValue, ParameterRangeUnresolved } from './ParameterLoader';
Expand Down Expand Up @@ -126,7 +126,7 @@ export class CommentLoader {
public static getCommentDataFromComment(comment: string, clazz: ClassReference): CommentData {
const data: CommentData = {};

const commentParsed = commentParse(comment)[0];
const commentParsed = parse(comment)[0];
if (commentParsed) {
// Extract description
if (commentParsed.description.length > 0) {
Expand Down
7 changes: 3 additions & 4 deletions lib/parse/ParameterResolver.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { TSESTree } from '@typescript-eslint/typescript-estree';
import { AST_NODE_TYPES } from '@typescript-eslint/typescript-estree';
import * as LRUCache from 'lru-cache';
import { LRUCache } from 'lru-cache';
import type {
ClassIndex,
ClassReference,
Expand All @@ -15,7 +15,6 @@ import type {
ExtensionData,
GenericTypeParameterData,
ParameterData,
ParameterDataField,
ParameterRangeResolved,
ParameterRangeUnresolved,
ParameterLoader,
Expand All @@ -32,7 +31,7 @@ export class ParameterResolver {
this.classLoader = args.classLoader;
this.parameterLoader = args.parameterLoader;
this.ignoreClasses = args.ignoreClasses;
this.cacheInterfaceRange = new LRUCache(2_048);
this.cacheInterfaceRange = new LRUCache({ max: 2_048 });
}

/**
Expand Down Expand Up @@ -63,7 +62,7 @@ export class ParameterResolver {
unresolvedConstructorData: ConstructorData<ParameterRangeUnresolved>,
): Promise<ConstructorData<ParameterRangeResolved>> {
return {
parameters: <ParameterDataField<ParameterRangeResolved>[]> (await this.resolveParameterData(
parameters: (await this.resolveParameterData(
unresolvedConstructorData.parameters,
unresolvedConstructorData.classLoaded,
{},
Expand Down
4 changes: 2 additions & 2 deletions lib/resolution/ResolutionContext.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from 'node:fs';
import type { AST, TSESTreeOptions } from '@typescript-eslint/typescript-estree';
import { parse } from '@typescript-eslint/typescript-estree';
import * as LRUCache from 'lru-cache';
import { LRUCache } from 'lru-cache';
import { filePathDirName, joinFilePath, normalizeFilePath } from '../util/PathUtil';

/**
Expand All @@ -11,7 +11,7 @@ export class ResolutionContext {
private readonly parsedCache: LRUCache<string, AST<TSESTreeOptions>>;

public constructor() {
this.parsedCache = new LRUCache(2_048);
this.parsedCache = new LRUCache({ max: 2_048 });
}

/**
Expand Down
67 changes: 19 additions & 48 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "componentsjs-generator",
"version": "4.3.0",
"packageManager": "yarn@4.0.1",
"packageManager": "yarn@4.7.0",
"description": "Automatically generate component files from TypeScript classes for the Components.js dependency injection framework",
"author": "Ruben Taelman <rubensworks@gmail.com>",
"license": "MIT",
Expand All @@ -17,13 +17,11 @@
"dependency injection",
"typescript"
],
"main": "index.js",
"main": "lib/index.js",
"bin": "bin/componentsjs-generator.js",
"files": [
"bin/**/*.d.ts",
"bin/**/*.js",
"index.d.ts",
"index.ts",
"lib/**/*.d.ts",
"lib/**/*.js",
"lib/**/*.json"
Expand All @@ -33,65 +31,38 @@
},
"scripts": {
"build": "tsc",
"test": "jest",
"test": "jest --maxWorkers=50%",
"lint": "eslint . --cache",
"prepare": "husky install && yarn build",
"prepare": "husky && yarn build",
"version": "manual-git-changelog onversion"
},
"jest": {
"transform": {
"^.+\\.ts$": [
"ts-jest",
{
"tsconfig": "tsconfig.json"
}
]
},
"testRegex": "(/test/.*|(\\.|/)(test|spec))\\.test.ts$",
"moduleFileExtensions": [
"ts",
"js"
],
"collectCoverage": true,
"coveragePathIgnorePatterns": [
"test"
],
"coverageThreshold": {
"global": {
"branches": 100,
"functions": 100,
"lines": 100,
"statements": 100
}
}
},
"dependencies": {
"@types/lru-cache": "^5.1.0",
"@types/semver": "^7.3.4",
"@types/semver": "^7.0.0",
"@typescript-eslint/typescript-estree": "^7.1.0",
"comment-parser": "^0.7.6",
"componentsjs": "^6.2.0",
"comment-parser": "^1.4.0",
"componentsjs": "^6.3.0",
"jsonld-context-parser": "^3.0.0",
"lru-cache": "^6.0.0",
"minimist": "^1.2.5",
"lru-cache": "^11.0.0",
"minimist": "^1.2.0",
"rdf-object": "^2.0.0",
"semver": "^7.3.2"
"semver": "^7.0.0"
},
"devDependencies": {
"@rubensworks/eslint-config": "^3.0.0",
"@types/fs-extra": "^11.0.0",
"@types/jest": "^29.0.0",
"@types/minimist": "^1.2.0",
"@types/node": "^22.0.0",
"@types/rimraf": "^3.0.0",
"eslint": "^8.57.0",
"@types/rimraf": "^4.0.0",
"eslint": "^8.0.0",
"fs-extra": "^11.0.0",
"husky": "^9.0.0",
"jest": "^29.7.0",
"jest-extended": "^4.0.2",
"manual-git-changelog": "^1.0.1",
"rimraf": "latest",
"ts-jest": "^29.1.2",
"typescript": "^5.3.3"
"jest": "^29.0.0",
"jest-extended": "^4.0.0",
"manual-git-changelog": "^1.0.0",
"rimraf": "^6.0.1",
"ts-jest": "^29.0.0",
"ts-node": "^10.0.0",
"typescript": "^5.0.0"
}
}
Loading