uilint 0.2.28 → 0.2.30
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/bin/uilint.js +29 -0
- package/dist/{chunk-VNANPKR2.js → chunk-NAO64XXO.js} +9 -7
- package/dist/chunk-NAO64XXO.js.map +1 -0
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/{install-ui-RGTAARNC.js → install-ui-UPHDMZWG.js} +100 -48
- package/dist/install-ui-UPHDMZWG.js.map +1 -0
- package/dist/{plan-5WHKVACB.js → plan-QAONO66T.js} +81 -3
- package/dist/plan-QAONO66T.js.map +1 -0
- package/package.json +9 -8
- package/dist/chunk-VNANPKR2.js.map +0 -1
- package/dist/install-ui-RGTAARNC.js.map +0 -1
- package/dist/plan-5WHKVACB.js.map +0 -1
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
pc,
|
|
16
16
|
select,
|
|
17
17
|
uninstallEslintPlugin
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-NAO64XXO.js";
|
|
19
19
|
import {
|
|
20
20
|
GENSTYLEGUIDE_COMMAND_MD,
|
|
21
21
|
loadSkill,
|
|
@@ -1037,15 +1037,18 @@ function buildGlobalConfigItems(selections) {
|
|
|
1037
1037
|
}
|
|
1038
1038
|
return items;
|
|
1039
1039
|
}
|
|
1040
|
-
var
|
|
1040
|
+
var MIN_NODE_MAJOR = 20;
|
|
1041
|
+
var MIN_NODE_MINOR = 19;
|
|
1041
1042
|
function checkNodeVersion() {
|
|
1042
1043
|
const ver = process.versions.node || "";
|
|
1043
|
-
const
|
|
1044
|
-
const major = Number.parseInt(
|
|
1044
|
+
const parts = ver.split(".");
|
|
1045
|
+
const major = Number.parseInt(parts[0] || "", 10);
|
|
1046
|
+
const minor = Number.parseInt(parts[1] || "", 10);
|
|
1047
|
+
const meetsRequirement = Number.isFinite(major) && Number.isFinite(minor) && (major > MIN_NODE_MAJOR || major === MIN_NODE_MAJOR && minor >= MIN_NODE_MINOR);
|
|
1045
1048
|
return {
|
|
1046
|
-
ok:
|
|
1049
|
+
ok: meetsRequirement,
|
|
1047
1050
|
current: ver,
|
|
1048
|
-
required:
|
|
1051
|
+
required: `${MIN_NODE_MAJOR}.${MIN_NODE_MINOR}.0`
|
|
1049
1052
|
};
|
|
1050
1053
|
}
|
|
1051
1054
|
function Header({ subtitle }) {
|
|
@@ -1128,7 +1131,7 @@ function InstallApp({
|
|
|
1128
1131
|
} else {
|
|
1129
1132
|
setError(
|
|
1130
1133
|
new Error(
|
|
1131
|
-
`Node.js ${result.required}+ is required. You are running
|
|
1134
|
+
`Node.js v${result.required}+ is required. You are running v${result.current}.`
|
|
1132
1135
|
)
|
|
1133
1136
|
);
|
|
1134
1137
|
setPhase("error");
|
|
@@ -1723,15 +1726,15 @@ async function analyze(projectPath = process.cwd()) {
|
|
|
1723
1726
|
|
|
1724
1727
|
// src/commands/install/execute.ts
|
|
1725
1728
|
import {
|
|
1726
|
-
existsSync as
|
|
1729
|
+
existsSync as existsSync11,
|
|
1727
1730
|
mkdirSync,
|
|
1728
|
-
writeFileSync as
|
|
1729
|
-
readFileSync as
|
|
1731
|
+
writeFileSync as writeFileSync5,
|
|
1732
|
+
readFileSync as readFileSync9,
|
|
1730
1733
|
unlinkSync,
|
|
1731
1734
|
chmodSync,
|
|
1732
1735
|
rmSync
|
|
1733
1736
|
} from "fs";
|
|
1734
|
-
import { dirname as dirname4, join as
|
|
1737
|
+
import { dirname as dirname4, join as join11 } from "path";
|
|
1735
1738
|
|
|
1736
1739
|
// src/utils/react-inject.ts
|
|
1737
1740
|
import { existsSync as existsSync5, readFileSync as readFileSync5, writeFileSync } from "fs";
|
|
@@ -3298,6 +3301,35 @@ function touchFiles(filePaths) {
|
|
|
3298
3301
|
|
|
3299
3302
|
// src/commands/install/execute.ts
|
|
3300
3303
|
import { findWorkspaceRoot as findWorkspaceRoot2 } from "uilint-core/node";
|
|
3304
|
+
|
|
3305
|
+
// src/utils/tsconfig-inject.ts
|
|
3306
|
+
import { existsSync as existsSync10, readFileSync as readFileSync8, writeFileSync as writeFileSync4 } from "fs";
|
|
3307
|
+
import { join as join10 } from "path";
|
|
3308
|
+
function injectTsconfigExclusion(projectPath) {
|
|
3309
|
+
const tsconfigPath = join10(projectPath, "tsconfig.json");
|
|
3310
|
+
if (!existsSync10(tsconfigPath)) {
|
|
3311
|
+
return { modified: false };
|
|
3312
|
+
}
|
|
3313
|
+
try {
|
|
3314
|
+
const content = readFileSync8(tsconfigPath, "utf-8");
|
|
3315
|
+
const tsconfig = JSON.parse(content);
|
|
3316
|
+
const exclude = tsconfig.exclude ?? [];
|
|
3317
|
+
if (exclude.includes(".uilint")) {
|
|
3318
|
+
return { modified: false, tsconfigPath };
|
|
3319
|
+
}
|
|
3320
|
+
tsconfig.exclude = [...exclude, ".uilint"];
|
|
3321
|
+
writeFileSync4(tsconfigPath, JSON.stringify(tsconfig, null, 2) + "\n", "utf-8");
|
|
3322
|
+
return { modified: true, tsconfigPath };
|
|
3323
|
+
} catch (err) {
|
|
3324
|
+
return {
|
|
3325
|
+
modified: false,
|
|
3326
|
+
tsconfigPath,
|
|
3327
|
+
error: err instanceof Error ? err.message : String(err)
|
|
3328
|
+
};
|
|
3329
|
+
}
|
|
3330
|
+
}
|
|
3331
|
+
|
|
3332
|
+
// src/commands/install/execute.ts
|
|
3301
3333
|
async function executeAction(action, options) {
|
|
3302
3334
|
const { dryRun = false } = options;
|
|
3303
3335
|
try {
|
|
@@ -3310,7 +3342,7 @@ async function executeAction(action, options) {
|
|
|
3310
3342
|
wouldDo: `Create directory: ${action.path}`
|
|
3311
3343
|
};
|
|
3312
3344
|
}
|
|
3313
|
-
if (!
|
|
3345
|
+
if (!existsSync11(action.path)) {
|
|
3314
3346
|
mkdirSync(action.path, { recursive: true });
|
|
3315
3347
|
}
|
|
3316
3348
|
return { action, success: true };
|
|
@@ -3324,10 +3356,10 @@ async function executeAction(action, options) {
|
|
|
3324
3356
|
};
|
|
3325
3357
|
}
|
|
3326
3358
|
const dir = dirname4(action.path);
|
|
3327
|
-
if (!
|
|
3359
|
+
if (!existsSync11(dir)) {
|
|
3328
3360
|
mkdirSync(dir, { recursive: true });
|
|
3329
3361
|
}
|
|
3330
|
-
|
|
3362
|
+
writeFileSync5(action.path, action.content, "utf-8");
|
|
3331
3363
|
if (action.permissions) {
|
|
3332
3364
|
chmodSync(action.path, action.permissions);
|
|
3333
3365
|
}
|
|
@@ -3342,18 +3374,18 @@ async function executeAction(action, options) {
|
|
|
3342
3374
|
};
|
|
3343
3375
|
}
|
|
3344
3376
|
let existing = {};
|
|
3345
|
-
if (
|
|
3377
|
+
if (existsSync11(action.path)) {
|
|
3346
3378
|
try {
|
|
3347
|
-
existing = JSON.parse(
|
|
3379
|
+
existing = JSON.parse(readFileSync9(action.path, "utf-8"));
|
|
3348
3380
|
} catch {
|
|
3349
3381
|
}
|
|
3350
3382
|
}
|
|
3351
3383
|
const merged = deepMerge(existing, action.merge);
|
|
3352
3384
|
const dir = dirname4(action.path);
|
|
3353
|
-
if (!
|
|
3385
|
+
if (!existsSync11(dir)) {
|
|
3354
3386
|
mkdirSync(dir, { recursive: true });
|
|
3355
3387
|
}
|
|
3356
|
-
|
|
3388
|
+
writeFileSync5(action.path, JSON.stringify(merged, null, 2), "utf-8");
|
|
3357
3389
|
return { action, success: true };
|
|
3358
3390
|
}
|
|
3359
3391
|
case "delete_file": {
|
|
@@ -3364,7 +3396,7 @@ async function executeAction(action, options) {
|
|
|
3364
3396
|
wouldDo: `Delete file: ${action.path}`
|
|
3365
3397
|
};
|
|
3366
3398
|
}
|
|
3367
|
-
if (
|
|
3399
|
+
if (existsSync11(action.path)) {
|
|
3368
3400
|
unlinkSync(action.path);
|
|
3369
3401
|
}
|
|
3370
3402
|
return { action, success: true };
|
|
@@ -3377,12 +3409,12 @@ async function executeAction(action, options) {
|
|
|
3377
3409
|
wouldDo: `Append to file: ${action.path}`
|
|
3378
3410
|
};
|
|
3379
3411
|
}
|
|
3380
|
-
if (
|
|
3381
|
-
const content =
|
|
3412
|
+
if (existsSync11(action.path)) {
|
|
3413
|
+
const content = readFileSync9(action.path, "utf-8");
|
|
3382
3414
|
if (action.ifNotContains && content.includes(action.ifNotContains)) {
|
|
3383
3415
|
return { action, success: true };
|
|
3384
3416
|
}
|
|
3385
|
-
|
|
3417
|
+
writeFileSync5(action.path, content + action.content, "utf-8");
|
|
3386
3418
|
}
|
|
3387
3419
|
return { action, success: true };
|
|
3388
3420
|
}
|
|
@@ -3401,6 +3433,9 @@ async function executeAction(action, options) {
|
|
|
3401
3433
|
case "inject_vitest_coverage": {
|
|
3402
3434
|
return await executeInjectVitestCoverage(action, options);
|
|
3403
3435
|
}
|
|
3436
|
+
case "inject_tsconfig": {
|
|
3437
|
+
return await executeInjectTsconfig(action, options);
|
|
3438
|
+
}
|
|
3404
3439
|
case "install_next_routes": {
|
|
3405
3440
|
return await executeInstallNextRoutes(action, options);
|
|
3406
3441
|
}
|
|
@@ -3537,6 +3572,23 @@ async function executeInjectVitestCoverage(action, options) {
|
|
|
3537
3572
|
modifiedFiles: modified ? [vitestConfigPath] : void 0
|
|
3538
3573
|
};
|
|
3539
3574
|
}
|
|
3575
|
+
async function executeInjectTsconfig(action, options) {
|
|
3576
|
+
const { dryRun = false } = options;
|
|
3577
|
+
if (dryRun) {
|
|
3578
|
+
return {
|
|
3579
|
+
action,
|
|
3580
|
+
success: true,
|
|
3581
|
+
wouldDo: `Add .uilint to tsconfig.json exclude: ${action.projectPath}`
|
|
3582
|
+
};
|
|
3583
|
+
}
|
|
3584
|
+
const result = injectTsconfigExclusion(action.projectPath);
|
|
3585
|
+
return {
|
|
3586
|
+
action,
|
|
3587
|
+
success: true,
|
|
3588
|
+
// Soft failure - don't fail install if tsconfig not found
|
|
3589
|
+
modifiedFiles: result.modified && result.tsconfigPath ? [result.tsconfigPath] : void 0
|
|
3590
|
+
};
|
|
3591
|
+
}
|
|
3540
3592
|
async function executeInjectNextConfig(action, options) {
|
|
3541
3593
|
const { dryRun = false } = options;
|
|
3542
3594
|
if (dryRun) {
|
|
@@ -3679,7 +3731,7 @@ async function executeRemoveDirectory(action, options) {
|
|
|
3679
3731
|
wouldDo: `Remove directory: ${action.path}`
|
|
3680
3732
|
};
|
|
3681
3733
|
}
|
|
3682
|
-
if (
|
|
3734
|
+
if (existsSync11(action.path)) {
|
|
3683
3735
|
rmSync(action.path, { recursive: true, force: true });
|
|
3684
3736
|
}
|
|
3685
3737
|
return { action, success: true };
|
|
@@ -3828,14 +3880,14 @@ function getProjectPathFromActions(actionsPerformed) {
|
|
|
3828
3880
|
}
|
|
3829
3881
|
function normalizePnpmWorkspaceUilintSpecs(packagePath, packages) {
|
|
3830
3882
|
const workspaceRoot = findWorkspaceRoot2(packagePath);
|
|
3831
|
-
if (!
|
|
3883
|
+
if (!existsSync11(join11(workspaceRoot, "pnpm-workspace.yaml"))) return packages;
|
|
3832
3884
|
const touchesUilint = packages.some((p) => p === "uilint-eslint" || p.startsWith("uilint-"));
|
|
3833
3885
|
if (!touchesUilint) return packages;
|
|
3834
|
-
const pkgJsonPath =
|
|
3835
|
-
if (!
|
|
3886
|
+
const pkgJsonPath = join11(packagePath, "package.json");
|
|
3887
|
+
if (!existsSync11(pkgJsonPath)) return packages;
|
|
3836
3888
|
let pkg = null;
|
|
3837
3889
|
try {
|
|
3838
|
-
pkg = JSON.parse(
|
|
3890
|
+
pkg = JSON.parse(readFileSync9(pkgJsonPath, "utf-8"));
|
|
3839
3891
|
} catch {
|
|
3840
3892
|
return packages;
|
|
3841
3893
|
}
|
|
@@ -3947,7 +3999,7 @@ async function execute(plan, options = {}) {
|
|
|
3947
3999
|
import { ruleRegistry as ruleRegistry3 } from "uilint-eslint";
|
|
3948
4000
|
|
|
3949
4001
|
// src/commands/install/installers/genstyleguide.ts
|
|
3950
|
-
import { join as
|
|
4002
|
+
import { join as join12 } from "path";
|
|
3951
4003
|
var genstyleguideInstaller = {
|
|
3952
4004
|
id: "genstyleguide",
|
|
3953
4005
|
name: "/genstyleguide command",
|
|
@@ -3957,7 +4009,7 @@ var genstyleguideInstaller = {
|
|
|
3957
4009
|
return true;
|
|
3958
4010
|
},
|
|
3959
4011
|
getTargets(project) {
|
|
3960
|
-
const commandPath =
|
|
4012
|
+
const commandPath = join12(project.cursorDir.path, "commands", "genstyleguide.md");
|
|
3961
4013
|
const isInstalled = project.commands.genstyleguide;
|
|
3962
4014
|
return [
|
|
3963
4015
|
{
|
|
@@ -3970,7 +4022,7 @@ var genstyleguideInstaller = {
|
|
|
3970
4022
|
},
|
|
3971
4023
|
plan(targets, config, project) {
|
|
3972
4024
|
const actions = [];
|
|
3973
|
-
const commandsDir =
|
|
4025
|
+
const commandsDir = join12(project.cursorDir.path, "commands");
|
|
3974
4026
|
if (!project.cursorDir.exists) {
|
|
3975
4027
|
actions.push({
|
|
3976
4028
|
type: "create_directory",
|
|
@@ -3983,7 +4035,7 @@ var genstyleguideInstaller = {
|
|
|
3983
4035
|
});
|
|
3984
4036
|
actions.push({
|
|
3985
4037
|
type: "create_file",
|
|
3986
|
-
path:
|
|
4038
|
+
path: join12(commandsDir, "genstyleguide.md"),
|
|
3987
4039
|
content: GENSTYLEGUIDE_COMMAND_MD
|
|
3988
4040
|
});
|
|
3989
4041
|
return {
|
|
@@ -4012,7 +4064,7 @@ var genstyleguideInstaller = {
|
|
|
4012
4064
|
},
|
|
4013
4065
|
planUninstall(targets, project) {
|
|
4014
4066
|
const actions = [];
|
|
4015
|
-
const commandPath =
|
|
4067
|
+
const commandPath = join12(project.cursorDir.path, "commands", "genstyleguide.md");
|
|
4016
4068
|
actions.push({
|
|
4017
4069
|
type: "delete_file",
|
|
4018
4070
|
path: commandPath
|
|
@@ -4022,8 +4074,8 @@ var genstyleguideInstaller = {
|
|
|
4022
4074
|
};
|
|
4023
4075
|
|
|
4024
4076
|
// src/commands/install/installers/skill.ts
|
|
4025
|
-
import { existsSync as
|
|
4026
|
-
import { join as
|
|
4077
|
+
import { existsSync as existsSync12 } from "fs";
|
|
4078
|
+
import { join as join13 } from "path";
|
|
4027
4079
|
var skillInstaller = {
|
|
4028
4080
|
id: "skill",
|
|
4029
4081
|
name: "UI Consistency Agent skill",
|
|
@@ -4033,9 +4085,9 @@ var skillInstaller = {
|
|
|
4033
4085
|
return true;
|
|
4034
4086
|
},
|
|
4035
4087
|
getTargets(project) {
|
|
4036
|
-
const skillsDir =
|
|
4037
|
-
const skillMdPath =
|
|
4038
|
-
const isInstalled =
|
|
4088
|
+
const skillsDir = join13(project.cursorDir.path, "skills", "ui-consistency-enforcer");
|
|
4089
|
+
const skillMdPath = join13(skillsDir, "SKILL.md");
|
|
4090
|
+
const isInstalled = existsSync12(skillMdPath);
|
|
4039
4091
|
return [
|
|
4040
4092
|
{
|
|
4041
4093
|
id: "ui-consistency-skill",
|
|
@@ -4054,21 +4106,21 @@ var skillInstaller = {
|
|
|
4054
4106
|
path: project.cursorDir.path
|
|
4055
4107
|
});
|
|
4056
4108
|
}
|
|
4057
|
-
const skillsDir =
|
|
4109
|
+
const skillsDir = join13(project.cursorDir.path, "skills");
|
|
4058
4110
|
actions.push({
|
|
4059
4111
|
type: "create_directory",
|
|
4060
4112
|
path: skillsDir
|
|
4061
4113
|
});
|
|
4062
4114
|
try {
|
|
4063
4115
|
const skill = loadSkill("ui-consistency-enforcer");
|
|
4064
|
-
const skillDir =
|
|
4116
|
+
const skillDir = join13(skillsDir, skill.name);
|
|
4065
4117
|
actions.push({
|
|
4066
4118
|
type: "create_directory",
|
|
4067
4119
|
path: skillDir
|
|
4068
4120
|
});
|
|
4069
4121
|
for (const file of skill.files) {
|
|
4070
|
-
const filePath =
|
|
4071
|
-
const fileDir =
|
|
4122
|
+
const filePath = join13(skillDir, file.relativePath);
|
|
4123
|
+
const fileDir = join13(
|
|
4072
4124
|
skillDir,
|
|
4073
4125
|
file.relativePath.split("/").slice(0, -1).join("/")
|
|
4074
4126
|
);
|
|
@@ -4124,7 +4176,7 @@ var skillInstaller = {
|
|
|
4124
4176
|
},
|
|
4125
4177
|
planUninstall(targets, project) {
|
|
4126
4178
|
const actions = [];
|
|
4127
|
-
const skillDir =
|
|
4179
|
+
const skillDir = join13(project.cursorDir.path, "skills", "ui-consistency-enforcer");
|
|
4128
4180
|
actions.push({
|
|
4129
4181
|
type: "remove_directory",
|
|
4130
4182
|
path: skillDir
|
|
@@ -4134,7 +4186,7 @@ var skillInstaller = {
|
|
|
4134
4186
|
};
|
|
4135
4187
|
|
|
4136
4188
|
// src/commands/install/installers/eslint.ts
|
|
4137
|
-
import { join as
|
|
4189
|
+
import { join as join14 } from "path";
|
|
4138
4190
|
import { ruleRegistry as ruleRegistry2, getRulesByCategory as getRulesByCategory2 } from "uilint-eslint";
|
|
4139
4191
|
function getUpgradeInfo(configuredRuleIds) {
|
|
4140
4192
|
const configuredSet = new Set(configuredRuleIds);
|
|
@@ -4323,7 +4375,7 @@ var eslintInstaller = {
|
|
|
4323
4375
|
for (const target of targets) {
|
|
4324
4376
|
const pkgInfo = project.packages.find((p) => p.path === target.path);
|
|
4325
4377
|
if (!pkgInfo || !pkgInfo.eslintConfigPath) continue;
|
|
4326
|
-
const rulesDir =
|
|
4378
|
+
const rulesDir = join14(target.path, ".uilint", "rules");
|
|
4327
4379
|
actions.push({
|
|
4328
4380
|
type: "create_directory",
|
|
4329
4381
|
path: rulesDir
|
|
@@ -4348,7 +4400,7 @@ var eslintInstaller = {
|
|
|
4348
4400
|
hasExistingRules: pkgInfo.hasUilintRules
|
|
4349
4401
|
});
|
|
4350
4402
|
}
|
|
4351
|
-
const gitignorePath =
|
|
4403
|
+
const gitignorePath = join14(project.workspaceRoot, ".gitignore");
|
|
4352
4404
|
actions.push({
|
|
4353
4405
|
type: "append_to_file",
|
|
4354
4406
|
path: gitignorePath,
|
|
@@ -4390,7 +4442,7 @@ var eslintInstaller = {
|
|
|
4390
4442
|
packagePath: target.path,
|
|
4391
4443
|
configPath: pkgInfo.eslintConfigPath
|
|
4392
4444
|
});
|
|
4393
|
-
const rulesDir =
|
|
4445
|
+
const rulesDir = join14(target.path, ".uilint", "rules");
|
|
4394
4446
|
actions.push({
|
|
4395
4447
|
type: "remove_directory",
|
|
4396
4448
|
path: rulesDir
|
|
@@ -4698,7 +4750,7 @@ async function installUI(options = {}, executeOptions = {}) {
|
|
|
4698
4750
|
console.log("\nNo changes selected");
|
|
4699
4751
|
process.exit(0);
|
|
4700
4752
|
}
|
|
4701
|
-
const { createPlan } = await import("./plan-
|
|
4753
|
+
const { createPlan } = await import("./plan-QAONO66T.js");
|
|
4702
4754
|
const plan = createPlan(project, choices, { force: options.force });
|
|
4703
4755
|
if (hasUninstalls && uninstallSelections) {
|
|
4704
4756
|
for (const selection of uninstallSelections) {
|
|
@@ -4750,4 +4802,4 @@ ${pc.blue("Running tests with coverage...")}`);
|
|
|
4750
4802
|
export {
|
|
4751
4803
|
installUI
|
|
4752
4804
|
};
|
|
4753
|
-
//# sourceMappingURL=install-ui-
|
|
4805
|
+
//# sourceMappingURL=install-ui-UPHDMZWG.js.map
|