uilint 0.2.42 → 0.2.43
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/dist/chunk-CZNPG4UI.js +118 -0
- package/dist/chunk-CZNPG4UI.js.map +1 -0
- package/dist/{chunk-OTU5FY6B.js → chunk-JPE27ROY.js} +68 -2
- package/dist/chunk-JPE27ROY.js.map +1 -0
- package/dist/{chunk-PVUDWWTL.js → chunk-KNZVCCXM.js} +41 -154
- package/dist/chunk-KNZVCCXM.js.map +1 -0
- package/dist/{plan-QVR3RBLG.js → chunk-Y7ZNZFVZ.js} +2 -245
- package/dist/chunk-Y7ZNZFVZ.js.map +1 -0
- package/dist/chunk-ZDSDZNIB.js +93 -0
- package/dist/chunk-ZDSDZNIB.js.map +1 -0
- package/dist/index.js +20 -9
- package/dist/index.js.map +1 -1
- package/dist/{install-ui-HG73W6P7.js → install-ui-COFD7H2I.js} +54 -11
- package/dist/install-ui-COFD7H2I.js.map +1 -0
- package/dist/plan-N453UW4O.js +259 -0
- package/dist/plan-N453UW4O.js.map +1 -0
- package/dist/upgrade-TGYLZ4QX.js +587 -0
- package/dist/upgrade-TGYLZ4QX.js.map +1 -0
- package/package.json +5 -5
- package/dist/chunk-OTU5FY6B.js.map +0 -1
- package/dist/chunk-PVUDWWTL.js.map +0 -1
- package/dist/install-ui-HG73W6P7.js.map +0 -1
- package/dist/plan-QVR3RBLG.js.map +0 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/utils/manifest.ts
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
5
|
+
import { dirname, join } from "path";
|
|
6
|
+
var MANIFEST_SCHEMA_VERSION = 1;
|
|
7
|
+
function getManifestPath(projectPath) {
|
|
8
|
+
return join(projectPath, ".uilint", "rules", "manifest.json");
|
|
9
|
+
}
|
|
10
|
+
function readManifest(projectPath) {
|
|
11
|
+
const manifestPath = getManifestPath(projectPath);
|
|
12
|
+
if (!existsSync(manifestPath)) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
const content = readFileSync(manifestPath, "utf-8");
|
|
17
|
+
const manifest = JSON.parse(content);
|
|
18
|
+
if (!isValidManifest(manifest)) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return manifest;
|
|
22
|
+
} catch {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function isValidManifest(obj) {
|
|
27
|
+
if (typeof obj !== "object" || obj === null) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
const manifest = obj;
|
|
31
|
+
if (typeof manifest.schemaVersion !== "number") {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
if (manifest.schemaVersion !== MANIFEST_SCHEMA_VERSION) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
if (typeof manifest.installedAt !== "string") {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (typeof manifest.uilintVersion !== "string") {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
if (typeof manifest.rules !== "object" || manifest.rules === null) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
function writeManifest(projectPath, manifest) {
|
|
49
|
+
const manifestPath = getManifestPath(projectPath);
|
|
50
|
+
const dir = dirname(manifestPath);
|
|
51
|
+
if (!existsSync(dir)) {
|
|
52
|
+
mkdirSync(dir, { recursive: true });
|
|
53
|
+
}
|
|
54
|
+
writeFileSync(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
55
|
+
}
|
|
56
|
+
function updateManifestRule(projectPath, ruleId, version, uilintVersion) {
|
|
57
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
58
|
+
let manifest = readManifest(projectPath);
|
|
59
|
+
if (!manifest) {
|
|
60
|
+
manifest = createEmptyManifest(uilintVersion);
|
|
61
|
+
}
|
|
62
|
+
manifest.rules[ruleId] = {
|
|
63
|
+
version,
|
|
64
|
+
installedAt: now
|
|
65
|
+
};
|
|
66
|
+
manifest.uilintVersion = uilintVersion;
|
|
67
|
+
writeManifest(projectPath, manifest);
|
|
68
|
+
}
|
|
69
|
+
function createEmptyManifest(uilintVersion) {
|
|
70
|
+
return {
|
|
71
|
+
schemaVersion: MANIFEST_SCHEMA_VERSION,
|
|
72
|
+
installedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
73
|
+
uilintVersion,
|
|
74
|
+
rules: {}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function getInstalledRuleVersions(projectPath) {
|
|
78
|
+
const manifest = readManifest(projectPath);
|
|
79
|
+
if (!manifest) {
|
|
80
|
+
return {};
|
|
81
|
+
}
|
|
82
|
+
const result = {};
|
|
83
|
+
for (const [ruleId, info] of Object.entries(manifest.rules)) {
|
|
84
|
+
result[ruleId] = info.version;
|
|
85
|
+
}
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
updateManifestRule,
|
|
91
|
+
getInstalledRuleVersions
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=chunk-ZDSDZNIB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/manifest.ts"],"sourcesContent":["/**\n * Manifest System\n *\n * Manages the manifest file that tracks installed rule versions.\n * Location: .uilint/rules/manifest.json\n */\n\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"fs\";\nimport { dirname, join } from \"path\";\n\n/**\n * Current schema version for the manifest file.\n * Increment when making breaking changes to the manifest structure.\n */\nexport const MANIFEST_SCHEMA_VERSION = 1;\n\n/**\n * Information about an installed rule\n */\nexport interface InstalledRuleInfo {\n /** Semantic version of the installed rule */\n version: string;\n /** ISO timestamp of when this rule was installed/updated */\n installedAt: string;\n}\n\n/**\n * The manifest file structure\n */\nexport interface RuleManifest {\n /** Schema version for forward compatibility */\n schemaVersion: number;\n /** ISO timestamp of initial installation */\n installedAt: string;\n /** Version of uilint CLI that created/updated this manifest */\n uilintVersion: string;\n /** Map of rule IDs to their installation info */\n rules: Record<string, InstalledRuleInfo>;\n}\n\n/**\n * Get the path to the manifest file for a project\n */\nexport function getManifestPath(projectPath: string): string {\n return join(projectPath, \".uilint\", \"rules\", \"manifest.json\");\n}\n\n/**\n * Read the manifest file for a project\n *\n * @param projectPath - Path to the project root\n * @returns The parsed manifest, or null if not found or invalid\n */\nexport function readManifest(projectPath: string): RuleManifest | null {\n const manifestPath = getManifestPath(projectPath);\n\n if (!existsSync(manifestPath)) {\n return null;\n }\n\n try {\n const content = readFileSync(manifestPath, \"utf-8\");\n const manifest = JSON.parse(content) as unknown;\n\n // Validate manifest structure\n if (!isValidManifest(manifest)) {\n return null;\n }\n\n return manifest as RuleManifest;\n } catch {\n // Invalid JSON or read error\n return null;\n }\n}\n\n/**\n * Validate that an object is a valid manifest\n */\nfunction isValidManifest(obj: unknown): obj is RuleManifest {\n if (typeof obj !== \"object\" || obj === null) {\n return false;\n }\n\n const manifest = obj as Record<string, unknown>;\n\n // Check required fields\n if (typeof manifest.schemaVersion !== \"number\") {\n return false;\n }\n if (manifest.schemaVersion !== MANIFEST_SCHEMA_VERSION) {\n return false;\n }\n if (typeof manifest.installedAt !== \"string\") {\n return false;\n }\n if (typeof manifest.uilintVersion !== \"string\") {\n return false;\n }\n if (typeof manifest.rules !== \"object\" || manifest.rules === null) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Write a manifest file to a project\n *\n * @param projectPath - Path to the project root\n * @param manifest - The manifest to write\n */\nexport function writeManifest(\n projectPath: string,\n manifest: RuleManifest\n): void {\n const manifestPath = getManifestPath(projectPath);\n const dir = dirname(manifestPath);\n\n // Ensure directory exists\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n\n writeFileSync(manifestPath, JSON.stringify(manifest, null, 2), \"utf-8\");\n}\n\n/**\n * Update a single rule's version in the manifest\n *\n * Creates the manifest if it doesn't exist.\n *\n * @param projectPath - Path to the project root\n * @param ruleId - The rule ID to update\n * @param version - The new version of the rule\n * @param uilintVersion - The version of uilint CLI performing the update\n */\nexport function updateManifestRule(\n projectPath: string,\n ruleId: string,\n version: string,\n uilintVersion: string\n): void {\n const now = new Date().toISOString();\n let manifest = readManifest(projectPath);\n\n if (!manifest) {\n manifest = createEmptyManifest(uilintVersion);\n }\n\n // Update the rule entry\n manifest.rules[ruleId] = {\n version,\n installedAt: now,\n };\n\n // Update uilint version to the latest\n manifest.uilintVersion = uilintVersion;\n\n writeManifest(projectPath, manifest);\n}\n\n/**\n * Create an empty manifest with default values\n *\n * @param uilintVersion - The version of uilint CLI\n * @returns A new empty manifest\n */\nexport function createEmptyManifest(uilintVersion: string): RuleManifest {\n return {\n schemaVersion: MANIFEST_SCHEMA_VERSION,\n installedAt: new Date().toISOString(),\n uilintVersion,\n rules: {},\n };\n}\n\n/**\n * Get the installed version of a specific rule\n *\n * @param projectPath - Path to the project root\n * @param ruleId - The rule ID to look up\n * @returns The installed version, or null if not installed\n */\nexport function getInstalledRuleVersion(\n projectPath: string,\n ruleId: string\n): string | null {\n const manifest = readManifest(projectPath);\n if (!manifest) {\n return null;\n }\n\n return manifest.rules[ruleId]?.version ?? null;\n}\n\n/**\n * Get all installed rule versions\n *\n * @param projectPath - Path to the project root\n * @returns Map of rule IDs to versions, or empty object if no manifest\n */\nexport function getInstalledRuleVersions(\n projectPath: string\n): Record<string, string> {\n const manifest = readManifest(projectPath);\n if (!manifest) {\n return {};\n }\n\n const result: Record<string, string> = {};\n for (const [ruleId, info] of Object.entries(manifest.rules)) {\n result[ruleId] = info.version;\n }\n return result;\n}\n"],"mappings":";;;AAOA,SAAS,YAAY,WAAW,cAAc,qBAAqB;AACnE,SAAS,SAAS,YAAY;AAMvB,IAAM,0BAA0B;AA6BhC,SAAS,gBAA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BAAoB,aAAa;AAAA,EAC9C;AAGA,WAAS,MAAM,MAAM,IAAI;AAAA,IACvB;AAAA,IACA,aAAa;AAAA,EACf;AAGA,WAAS,gBAAgB;AAEzB,gBAAc,aAAa,QAAQ;AACrC;AAQO,SAAS,oBAAoB,eAAqC;AACvE,SAAO;AAAA,IACL,eAAe;AAAA,IACf,cAAa,oBAAI,KAAK,GAAE,YAAY;AAAA,IACpC;AAAA,IACA,OAAO,CAAC;AAAA,EACV;AACF;AA2BO,SAAS,yBACd,aACwB;AACxB,QAAM,WAAW,aAAa,WAAW;AACzC,MAAI,CAAC,UAAU;AACb,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,SAAiC,CAAC;AACxC,aAAW,CAAC,QAAQ,IAAI,KAAK,OAAO,QAAQ,SAAS,KAAK,GAAG;AAC3D,WAAO,MAAM,IAAI,KAAK;AAAA,EACxB;AACA,SAAO;AACT;","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
createSpinner,
|
|
4
3
|
detectCoverageSetup,
|
|
5
4
|
detectNextAppRouter,
|
|
6
5
|
findEslintConfigFile,
|
|
7
6
|
findNextAppRouterProjects,
|
|
7
|
+
needsCoveragePreparation,
|
|
8
|
+
prepareCoverage,
|
|
9
|
+
readRuleConfigsFromConfig,
|
|
10
|
+
updateRuleConfigInConfig,
|
|
11
|
+
updateRuleSeverityInConfig
|
|
12
|
+
} from "./chunk-KNZVCCXM.js";
|
|
13
|
+
import {
|
|
14
|
+
createSpinner,
|
|
8
15
|
intro,
|
|
9
16
|
logError,
|
|
10
17
|
logInfo,
|
|
11
18
|
logSuccess,
|
|
12
19
|
logWarning,
|
|
13
|
-
needsCoveragePreparation,
|
|
14
20
|
note,
|
|
15
21
|
outro,
|
|
16
22
|
pc,
|
|
17
|
-
prepareCoverage,
|
|
18
|
-
readRuleConfigsFromConfig,
|
|
19
|
-
updateRuleConfigInConfig,
|
|
20
|
-
updateRuleSeverityInConfig,
|
|
21
23
|
withSpinner
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
+
} from "./chunk-CZNPG4UI.js";
|
|
25
|
+
import "./chunk-JPE27ROY.js";
|
|
24
26
|
|
|
25
27
|
// src/index.ts
|
|
26
28
|
import { Command as Command6 } from "commander";
|
|
@@ -3643,7 +3645,7 @@ program.command("update").description("Update existing style guide with new styl
|
|
|
3643
3645
|
});
|
|
3644
3646
|
});
|
|
3645
3647
|
program.command("install").description("Install UILint integration").option("--force", "Overwrite existing configuration files").action(async (options) => {
|
|
3646
|
-
const { installUI } = await import("./install-ui-
|
|
3648
|
+
const { installUI } = await import("./install-ui-COFD7H2I.js");
|
|
3647
3649
|
await installUI({ force: options.force });
|
|
3648
3650
|
});
|
|
3649
3651
|
program.command("serve").description("Start WebSocket server for real-time UI linting").option("-p, --port <number>", "Port to listen on", "9234").action(async (options) => {
|
|
@@ -3691,5 +3693,14 @@ program.command("config").description("Get or set UILint configuration options")
|
|
|
3691
3693
|
});
|
|
3692
3694
|
});
|
|
3693
3695
|
program.addCommand(createDuplicatesCommand());
|
|
3696
|
+
program.command("upgrade").description("Update installed ESLint rules to latest versions").option("--check", "Show available updates without applying").option("-y, --yes", "Auto-confirm all updates").option("--dry-run", "Show what would change without modifying files").option("--rule <id>", "Upgrade only a specific rule").action(async (options) => {
|
|
3697
|
+
const { upgrade } = await import("./upgrade-TGYLZ4QX.js");
|
|
3698
|
+
await upgrade({
|
|
3699
|
+
check: options.check,
|
|
3700
|
+
yes: options.yes,
|
|
3701
|
+
dryRun: options.dryRun,
|
|
3702
|
+
rule: options.rule
|
|
3703
|
+
});
|
|
3704
|
+
});
|
|
3694
3705
|
program.parse();
|
|
3695
3706
|
//# sourceMappingURL=index.js.map
|