umbaudit 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +149 -0
- package/biome.json +62 -0
- package/dist/cli/commands/audit.d.ts +17 -0
- package/dist/cli/commands/audit.d.ts.map +1 -0
- package/dist/cli/commands/audit.js +179 -0
- package/dist/cli/commands/audit.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +41 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/output/ascii-logo.d.ts +3 -0
- package/dist/cli/output/ascii-logo.d.ts.map +1 -0
- package/dist/cli/output/ascii-logo.js +23 -0
- package/dist/cli/output/ascii-logo.js.map +1 -0
- package/dist/cli/output/formatters/console.d.ts +11 -0
- package/dist/cli/output/formatters/console.d.ts.map +1 -0
- package/dist/cli/output/formatters/console.js +46 -0
- package/dist/cli/output/formatters/console.js.map +1 -0
- package/dist/cli/output/formatters/html.d.ts +3 -0
- package/dist/cli/output/formatters/html.d.ts.map +1 -0
- package/dist/cli/output/formatters/html.js +215 -0
- package/dist/cli/output/formatters/html.js.map +1 -0
- package/dist/cli/output/formatters/json.d.ts +9 -0
- package/dist/cli/output/formatters/json.d.ts.map +1 -0
- package/dist/cli/output/formatters/json.js +51 -0
- package/dist/cli/output/formatters/json.js.map +1 -0
- package/dist/cli/output/table-renderer.d.ts +8 -0
- package/dist/cli/output/table-renderer.d.ts.map +1 -0
- package/dist/cli/output/table-renderer.js +44 -0
- package/dist/cli/output/table-renderer.js.map +1 -0
- package/dist/cli/schemas.d.ts +59 -0
- package/dist/cli/schemas.d.ts.map +1 -0
- package/dist/cli/schemas.js +43 -0
- package/dist/cli/schemas.js.map +1 -0
- package/dist/models/finding.d.ts +23 -0
- package/dist/models/finding.d.ts.map +1 -0
- package/dist/models/finding.js +37 -0
- package/dist/models/finding.js.map +1 -0
- package/dist/models/project.d.ts +13 -0
- package/dist/models/project.d.ts.map +1 -0
- package/dist/models/project.js +2 -0
- package/dist/models/project.js.map +1 -0
- package/dist/models/report.d.ts +78 -0
- package/dist/models/report.d.ts.map +1 -0
- package/dist/models/report.js +2 -0
- package/dist/models/report.js.map +1 -0
- package/dist/rules/index.d.ts +57 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +115 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/rule-01-nuget-packages.d.ts +3 -0
- package/dist/rules/rule-01-nuget-packages.d.ts.map +1 -0
- package/dist/rules/rule-01-nuget-packages.js +103 -0
- package/dist/rules/rule-01-nuget-packages.js.map +1 -0
- package/dist/rules/rule-02-obsolete-controller-classes.d.ts +3 -0
- package/dist/rules/rule-02-obsolete-controller-classes.d.ts.map +1 -0
- package/dist/rules/rule-02-obsolete-controller-classes.js +70 -0
- package/dist/rules/rule-02-obsolete-controller-classes.js.map +1 -0
- package/dist/rules/rule-03-tiptap-import.d.ts +3 -0
- package/dist/rules/rule-03-tiptap-import.d.ts.map +1 -0
- package/dist/rules/rule-03-tiptap-import.js +46 -0
- package/dist/rules/rule-03-tiptap-import.js.map +1 -0
- package/dist/rules/rule-04-removed-packages.d.ts +3 -0
- package/dist/rules/rule-04-removed-packages.d.ts.map +1 -0
- package/dist/rules/rule-04-removed-packages.js +51 -0
- package/dist/rules/rule-04-removed-packages.js.map +1 -0
- package/dist/rules/rule-05-program-cs.d.ts +3 -0
- package/dist/rules/rule-05-program-cs.d.ts.map +1 -0
- package/dist/rules/rule-05-program-cs.js +46 -0
- package/dist/rules/rule-05-program-cs.js.map +1 -0
- package/dist/rules/rule-06-view-imports.d.ts +3 -0
- package/dist/rules/rule-06-view-imports.d.ts.map +1 -0
- package/dist/rules/rule-06-view-imports.js +48 -0
- package/dist/rules/rule-06-view-imports.js.map +1 -0
- package/dist/rules/rule-07-angular-detection.d.ts +3 -0
- package/dist/rules/rule-07-angular-detection.d.ts.map +1 -0
- package/dist/rules/rule-07-angular-detection.js +140 -0
- package/dist/rules/rule-07-angular-detection.js.map +1 -0
- package/dist/rules/rule-08-published-snapshot-interfaces.d.ts +3 -0
- package/dist/rules/rule-08-published-snapshot-interfaces.d.ts.map +1 -0
- package/dist/rules/rule-08-published-snapshot-interfaces.js +104 -0
- package/dist/rules/rule-08-published-snapshot-interfaces.js.map +1 -0
- package/dist/rules/rule-09-uda-property-editors.d.ts +3 -0
- package/dist/rules/rule-09-uda-property-editors.d.ts.map +1 -0
- package/dist/rules/rule-09-uda-property-editors.js +78 -0
- package/dist/rules/rule-09-uda-property-editors.js.map +1 -0
- package/dist/rules/rule-10-license-files.d.ts +3 -0
- package/dist/rules/rule-10-license-files.d.ts.map +1 -0
- package/dist/rules/rule-10-license-files.js +67 -0
- package/dist/rules/rule-10-license-files.js.map +1 -0
- package/dist/rules/types.d.ts +77 -0
- package/dist/rules/types.d.ts.map +1 -0
- package/dist/rules/types.js +2 -0
- package/dist/rules/types.js.map +1 -0
- package/dist/scanners/code-searcher.d.ts +43 -0
- package/dist/scanners/code-searcher.d.ts.map +1 -0
- package/dist/scanners/code-searcher.js +76 -0
- package/dist/scanners/code-searcher.js.map +1 -0
- package/dist/scanners/csproj-parser.d.ts +35 -0
- package/dist/scanners/csproj-parser.d.ts.map +1 -0
- package/dist/scanners/csproj-parser.js +71 -0
- package/dist/scanners/csproj-parser.js.map +1 -0
- package/dist/scanners/file-scanner.d.ts +44 -0
- package/dist/scanners/file-scanner.d.ts.map +1 -0
- package/dist/scanners/file-scanner.js +66 -0
- package/dist/scanners/file-scanner.js.map +1 -0
- package/dist/scanners/nuget-client.d.ts +19 -0
- package/dist/scanners/nuget-client.d.ts.map +1 -0
- package/dist/scanners/nuget-client.js +208 -0
- package/dist/scanners/nuget-client.js.map +1 -0
- package/dist/utils/hours.d.ts +29 -0
- package/dist/utils/hours.d.ts.map +1 -0
- package/dist/utils/hours.js +36 -0
- package/dist/utils/hours.js.map +1 -0
- package/dist/utils/logger.d.ts +35 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +52 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +49 -0
- package/specs/001-umbraco-upgrade-audit/checklists/requirements.md +36 -0
- package/specs/001-umbraco-upgrade-audit/contracts/cli-interface.md +278 -0
- package/specs/001-umbraco-upgrade-audit/data-model.md +354 -0
- package/specs/001-umbraco-upgrade-audit/plan.md +120 -0
- package/specs/001-umbraco-upgrade-audit/quickstart.md +187 -0
- package/specs/001-umbraco-upgrade-audit/research.md +238 -0
- package/specs/001-umbraco-upgrade-audit/spec.md +162 -0
- package/specs/001-umbraco-upgrade-audit/tasks.md +291 -0
- package/src/cli/commands/audit.ts +221 -0
- package/src/cli/index.ts +47 -0
- package/src/cli/output/ascii-logo.ts +27 -0
- package/src/cli/output/formatters/console.ts +57 -0
- package/src/cli/output/formatters/html.ts +227 -0
- package/src/cli/output/formatters/json.ts +54 -0
- package/src/cli/output/table-renderer.ts +58 -0
- package/src/cli/schemas.ts +53 -0
- package/src/models/finding.ts +47 -0
- package/src/models/project.ts +16 -0
- package/src/models/report.ts +97 -0
- package/src/rules/index.ts +128 -0
- package/src/rules/rule-01-nuget-packages.ts +132 -0
- package/src/rules/rule-02-obsolete-controller-classes.ts +89 -0
- package/src/rules/rule-03-tiptap-import.ts +66 -0
- package/src/rules/rule-04-removed-packages.ts +70 -0
- package/src/rules/rule-05-program-cs.ts +66 -0
- package/src/rules/rule-06-view-imports.ts +69 -0
- package/src/rules/rule-07-angular-detection.ts +169 -0
- package/src/rules/rule-08-published-snapshot-interfaces.ts +147 -0
- package/src/rules/rule-09-uda-property-editors.ts +98 -0
- package/src/rules/rule-10-license-files.ts +88 -0
- package/src/rules/types.ts +102 -0
- package/src/scanners/code-searcher.ts +114 -0
- package/src/scanners/csproj-parser.ts +97 -0
- package/src/scanners/file-scanner.ts +77 -0
- package/src/scanners/nuget-client.ts +266 -0
- package/src/utils/hours.ts +38 -0
- package/src/utils/logger.ts +59 -0
- package/tests/fixtures/sample-umbraco-project/BlogPost.uda +58 -0
- package/tests/fixtures/sample-umbraco-project/ContentModels.generated.cs +20 -0
- package/tests/fixtures/sample-umbraco-project/ModernPage.uda +36 -0
- package/tests/fixtures/sample-umbraco-project/Program.cs +26 -0
- package/tests/fixtures/sample-umbraco-project/PublishedContentService.cs +25 -0
- package/tests/fixtures/sample-umbraco-project/SampleCode.cs +16 -0
- package/tests/fixtures/sample-umbraco-project/TestProject.csproj +13 -0
- package/tests/fixtures/sample-umbraco-project/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs +4 -0
- package/tests/fixtures/sample-umbraco-project/obj/Debug/net8.0/TestProject.AssemblyInfo.cs +22 -0
- package/tests/fixtures/sample-umbraco-project/obj/Debug/net8.0/TestProject.AssemblyInfoInputs.cache +1 -0
- package/tests/fixtures/sample-umbraco-project/obj/Debug/net8.0/TestProject.GeneratedMSBuildEditorConfig.editorconfig +31 -0
- package/tests/fixtures/sample-umbraco-project/obj/Debug/net8.0/TestProject.GlobalUsings.g.cs +19 -0
- package/tests/fixtures/sample-umbraco-project/obj/Debug/net8.0/TestProject.assets.cache +0 -0
- package/tests/fixtures/sample-umbraco-project/obj/Debug/net8.0/TestProject.csproj.AssemblyReference.cache +0 -0
- package/tests/fixtures/sample-umbraco-project/obj/TestProject.csproj.nuget.dgspec.json +84 -0
- package/tests/fixtures/sample-umbraco-project/obj/TestProject.csproj.nuget.g.props +26 -0
- package/tests/fixtures/sample-umbraco-project/obj/TestProject.csproj.nuget.g.targets +13 -0
- package/tests/fixtures/sample-umbraco-project/obj/project.assets.json +17414 -0
- package/tests/fixtures/sample-umbraco-project/obj/project.nuget.cache +404 -0
- package/tests/fixtures/sample-umbraco-project/umbraco/Licenses/umbracoDeploy.lic +1 -0
- package/tests/fixtures/sample-umbraco-project/umbraco/Licenses/umbracoForms.lic +1 -0
- package/tests/unit/rules/rule-09-uda-property-editors.test.ts +131 -0
- package/tests/unit/rules/rule-10-license-files.test.ts +82 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
import process from 'node:process';
|
|
3
|
+
import { beforeEach, describe, expect, it } from 'vitest';
|
|
4
|
+
import { rule10LicenseFiles } from '../../../src/rules/rule-10-license-files.js';
|
|
5
|
+
import type { RuleContext } from '../../../src/rules/types.js';
|
|
6
|
+
|
|
7
|
+
describe('Rule 10: License File Structure Changes', () => {
|
|
8
|
+
const testFixturesPath = resolve(process.cwd(), 'tests/fixtures/sample-umbraco-project');
|
|
9
|
+
|
|
10
|
+
let context: RuleContext;
|
|
11
|
+
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
context = {
|
|
14
|
+
projectPath: testFixturesPath,
|
|
15
|
+
projectFiles: [],
|
|
16
|
+
allFiles: [],
|
|
17
|
+
debug: false,
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should have correct metadata', () => {
|
|
22
|
+
expect(rule10LicenseFiles.id).toBe('rule-10-license-files');
|
|
23
|
+
expect(rule10LicenseFiles.name).toBe('License File Structure Changes');
|
|
24
|
+
expect(rule10LicenseFiles.category).toBe('configuration');
|
|
25
|
+
expect(rule10LicenseFiles.baseHours).toBe(0.5);
|
|
26
|
+
expect(rule10LicenseFiles.enabled).toBe(true);
|
|
27
|
+
expect(rule10LicenseFiles.filePatterns).toEqual(['**/*.lic']);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('should detect Umbraco Forms and Deploy license files', async () => {
|
|
31
|
+
const findings = await rule10LicenseFiles.execute(context);
|
|
32
|
+
|
|
33
|
+
expect(findings.length).toBe(1); // Should create only one finding for all license files
|
|
34
|
+
expect(findings[0].ruleId).toBe('rule-10-license-files');
|
|
35
|
+
expect(findings[0].hours).toBe(0.5); // Fixed total hours
|
|
36
|
+
expect(findings[0].severity).toBe('warning');
|
|
37
|
+
expect(findings[0].lineContent).toContain('umbracoDeploy.lic');
|
|
38
|
+
expect(findings[0].lineContent).toContain('umbracoForms.lic');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('should report correct total hours (0.5h total, not per file)', async () => {
|
|
42
|
+
const findings = await rule10LicenseFiles.execute(context);
|
|
43
|
+
|
|
44
|
+
// Should be exactly one finding with 0.5h total
|
|
45
|
+
expect(findings.length).toBe(1);
|
|
46
|
+
expect(findings[0].hours).toBe(0.5);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should have descriptive finding message', async () => {
|
|
50
|
+
const findings = await rule10LicenseFiles.execute(context);
|
|
51
|
+
|
|
52
|
+
expect(findings.length).toBe(1);
|
|
53
|
+
expect(findings[0].metadata?.description).toContain('Legacy license files detected');
|
|
54
|
+
expect(findings[0].metadata?.description).toContain('Umbraco 17 licensing structure');
|
|
55
|
+
expect(findings[0].metadata?.action).toBe('Change licensing structure for Forms and Deploy');
|
|
56
|
+
expect(findings[0].metadata?.filesFound).toBe(2);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('should detect files in umbraco/Licenses directory', async () => {
|
|
60
|
+
const findings = await rule10LicenseFiles.execute(context);
|
|
61
|
+
|
|
62
|
+
expect(findings.length).toBe(1);
|
|
63
|
+
expect(findings[0].filePath).toContain('umbraco');
|
|
64
|
+
expect(findings[0].filePath).toContain('Licenses');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('should return empty findings when no license files exist', async () => {
|
|
68
|
+
// Create a context pointing to a different directory without license files
|
|
69
|
+
const emptyContext: RuleContext = {
|
|
70
|
+
projectPath: resolve(process.cwd(), 'tests/fixtures'),
|
|
71
|
+
projectFiles: [],
|
|
72
|
+
allFiles: [],
|
|
73
|
+
debug: false,
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const findings = await rule10LicenseFiles.execute(emptyContext);
|
|
77
|
+
|
|
78
|
+
// Note: This might still find files if they exist in the parent directory
|
|
79
|
+
// The test is mainly to verify the rule doesn't crash with no files
|
|
80
|
+
expect(Array.isArray(findings)).toBe(true);
|
|
81
|
+
});
|
|
82
|
+
});
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ES2022",
|
|
5
|
+
"lib": ["ES2022"],
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"outDir": "./dist",
|
|
8
|
+
"rootDir": "./src",
|
|
9
|
+
"strict": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"declarationMap": true,
|
|
16
|
+
"sourceMap": true,
|
|
17
|
+
"noUnusedLocals": true,
|
|
18
|
+
"noUnusedParameters": true,
|
|
19
|
+
"noImplicitReturns": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true
|
|
21
|
+
},
|
|
22
|
+
"include": ["src/**/*"],
|
|
23
|
+
"exclude": ["node_modules", "dist", "tests"]
|
|
24
|
+
}
|