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
37 changes: 23 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
"chalk": "^5.1.2",
"commander": "^9.4.1",
"cosmiconfig": "^8.0.0",
"glob": "^8.0.3",
"ora": "^5.4.1",
"table": "^6.8.2",
"glob": "^8.0.3"
"table": "^6.8.2"
},
"devDependencies": {
"@commitlint/cli": "^17.3.0",
Expand All @@ -66,6 +66,7 @@
"jest": "^29.3.1",
"jest-ts-webcompat-resolver": "^1.0.0",
"lint-staged": "^13.0.3",
"prettier": "^3.7.4",
"replace-json-property": "^1.8.0",
"ts-jest": "^29.0.3",
"ts-mocha": "^10.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/bin/ng-parsel.bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ program.version(
But import assertions are not supported by Node 14.
*/
JSON.parse(readFileSync(resolve(dirname(fileURLToPath(import.meta.url)), '../../package.json')).toString() as any)
.version
.version,
);

program
Expand Down
4 changes: 2 additions & 2 deletions src/commands/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function writeParsedOutputToDisk(config: NgParselConfig, parseOutput: NgParselOu
parseOutput.ngParselSpecs,
parseOutput.ngParselHarnesses,
parseOutput.ngParselPipes,
parseOutput.ngParselValidators
parseOutput.ngParselValidators,
);

writeOutputSpinner.succeed(`Files successfully written to ${config.out}`);
Expand All @@ -60,7 +60,7 @@ function writeOutputFiles(
ngParselSpecs: NgParselSpec[],
ngParselHarnesses: NgParselHarness[],
ngParselPipes: NgParselPipe[],
ngParselValidators: NgParselValidator[]
ngParselValidators: NgParselValidator[],
): void {
if (!existsSync(config.out as string)) {
mkdirSync(config.out as string, { recursive: true });
Expand Down
3 changes: 3 additions & 0 deletions src/converters/component/component.converter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ describe('Component converter', () => {
implementation: '',
template: '',
styles: '',
methods: [],
methodsPublicExplicit: [],
fieldsPublicExplicit: [],
},
Expand All @@ -33,6 +34,7 @@ describe('Component converter', () => {
implementation: '',
template: '',
styles: '',
methods: [],
methodsPublicExplicit: [],
fieldsPublicExplicit: [],
},
Expand All @@ -49,6 +51,7 @@ describe('Component converter', () => {
implementation: '',
template: '',
styles: '',
methods: [],
methodsPublicExplicit: [],
fieldsPublicExplicit: [],
},
Expand Down
2 changes: 1 addition & 1 deletion src/converters/component/component.converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ export function convertToComponentStats(componentStats: NgParselComponent[]): Ng
moduleBased: 0,
cva: 0,
total: 0,
}
},
);
}
3 changes: 3 additions & 0 deletions src/converters/directive/directive.converter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ describe('Directive converter', () => {
inputs: [],
outputs: [],
implementation: '',
methods: [],
methodsPublicExplicit: [],
fieldsPublicExplicit: [],
},
Expand All @@ -25,6 +26,7 @@ describe('Directive converter', () => {
inputs: [],
outputs: [],
implementation: '',
methods: [],
methodsPublicExplicit: [],
fieldsPublicExplicit: [],
},
Expand All @@ -37,6 +39,7 @@ describe('Directive converter', () => {
inputs: [],
outputs: [],
implementation: '',
methods: [],
methodsPublicExplicit: [],
fieldsPublicExplicit: [],
},
Expand Down
2 changes: 1 addition & 1 deletion src/converters/directive/directive.converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ export function convertToDirectiveStats(directiveStats: NgParselDirective[]): Ng
standalone: 0,
moduleBased: 0,
total: 0,
}
},
);
}
3 changes: 3 additions & 0 deletions src/converters/harness/harness.converter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,21 @@ describe('Harness converter', () => {
className: 'first',
type: NgParselOutputType.HARNESS,
filePath: '',
methods: [],
methodsPublicExplicit: [],
},
{
className: 'second',
type: NgParselOutputType.HARNESS,
filePath: '',
methods: [],
methodsPublicExplicit: [],
},
{
className: 'third',
type: NgParselOutputType.HARNESS,
filePath: '',
methods: [],
methodsPublicExplicit: [],
},
];
Expand Down
2 changes: 1 addition & 1 deletion src/converters/pipes/pipes.converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ export function convertToPipeStats(pipeStats: NgParselPipe[]): NgParselPipeStats
standalone: 0,
pure: 0,
total: 0,
}
},
);
}
3 changes: 3 additions & 0 deletions src/converters/service/service.converter.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,23 @@ describe('Service stats converter', () => {
type: NgParselOutputType.SERVICE,
filePath: '',
fieldsPublicExplicit: [],
methods: [],
methodsPublicExplicit: [],
},
{
className: 'second',
type: NgParselOutputType.SERVICE,
filePath: '',
fieldsPublicExplicit: [],
methods: [],
methodsPublicExplicit: [],
},
{
className: 'third',
type: NgParselOutputType.SERVICE,
filePath: '',
fieldsPublicExplicit: [],
methods: [],
methodsPublicExplicit: [],
},
];
Expand Down
1 change: 1 addition & 0 deletions src/parser/component/component.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface NgParselComponent extends NgParselOutput {
implementation: string;
template: string;
styles: string | string[];
methods: NgParselMethod[];
methodsPublicExplicit: NgParselMethod[];
fieldsPublicExplicit: NgParselField[];
classJsDoc?: string | undefined;
Expand Down
48 changes: 43 additions & 5 deletions src/parser/component/component.parser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,38 @@ describe('ComponentParser', () => {
},
],
implementation,
methods: [
{
name: 'foo',
args: [{ name: 'bar', type: 'string' }],
returnType: 'string',
jsDoc: undefined,
accessType: 'public',
},
{
name: 'bar',
args: [{ name: 'foo', type: 'string' }],
returnType: 'string',
jsDoc: undefined,
accessType: 'publicImplicit',
},
],
methodsPublicExplicit: [
{
name: 'foo',
args: [{ name: 'bar', type: 'string' }],
returnType: 'string',
accessType: 'public',
},
],
fieldsPublicExplicit: [{
name: 'value',
type: 'inferred',
value: `signal<string>('')`,
}],
fieldsPublicExplicit: [
{
name: 'value',
type: 'inferred',
value: `signal<string>('')`,
},
],
classJsDoc: undefined,
};
jest.spyOn(fs, 'readFileSync').mockReturnValue(implementation);

Expand Down Expand Up @@ -137,14 +157,32 @@ describe('ComponentParser', () => {
},
],
implementation,
methods: [
{
name: 'foo',
args: [{ name: 'bar', type: 'string' }],
returnType: 'string',
jsDoc: undefined,
accessType: 'public',
},
{
name: 'bar',
args: [{ name: 'foo', type: 'string' }],
returnType: 'string',
jsDoc: undefined,
accessType: 'publicImplicit',
},
],
methodsPublicExplicit: [
{
name: 'foo',
args: [{ name: 'bar', type: 'string' }],
returnType: 'string',
accessType: 'public',
},
],
fieldsPublicExplicit: [],
classJsDoc: undefined,
};
jest.spyOn(fs, 'readFileSync').mockReturnValue(implementation);

Expand Down
Loading
Loading