uilint 0.2.20 → 0.2.21
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/index.js
CHANGED
|
@@ -2805,7 +2805,7 @@ program.command("update").description("Update existing style guide with new styl
|
|
|
2805
2805
|
});
|
|
2806
2806
|
});
|
|
2807
2807
|
program.command("install").description("Install UILint integration").option("--force", "Overwrite existing configuration files").action(async (options) => {
|
|
2808
|
-
const { installUI } = await import("./install-ui-
|
|
2808
|
+
const { installUI } = await import("./install-ui-2HMR6TZT.js");
|
|
2809
2809
|
await installUI({ force: options.force });
|
|
2810
2810
|
});
|
|
2811
2811
|
program.command("serve").description("Start WebSocket server for real-time UI linting").option("-p, --port <number>", "Port to listen on", "9234").action(async (options) => {
|
|
@@ -2458,11 +2458,17 @@ async function installReactUILintOverlay(opts) {
|
|
|
2458
2458
|
opts.projectPath,
|
|
2459
2459
|
opts.appRoot
|
|
2460
2460
|
);
|
|
2461
|
+
const modifiedFiles = [];
|
|
2462
|
+
if (result.modified) {
|
|
2463
|
+
modifiedFiles.push(join6(opts.projectPath, result.providersFile));
|
|
2464
|
+
modifiedFiles.push(join6(opts.projectPath, result.layoutFile));
|
|
2465
|
+
}
|
|
2461
2466
|
return {
|
|
2462
2467
|
targetFile: result.providersFile,
|
|
2463
2468
|
modified: result.modified,
|
|
2464
2469
|
createdFile: result.providersFile,
|
|
2465
|
-
layoutModified: result.layoutFile
|
|
2470
|
+
layoutModified: result.layoutFile,
|
|
2471
|
+
modifiedFiles
|
|
2466
2472
|
};
|
|
2467
2473
|
}
|
|
2468
2474
|
if (opts.targetFile) {
|
|
@@ -2488,7 +2494,8 @@ async function installReactUILintOverlay(opts) {
|
|
|
2488
2494
|
return {
|
|
2489
2495
|
targetFile: relTarget,
|
|
2490
2496
|
modified: false,
|
|
2491
|
-
alreadyConfigured: true
|
|
2497
|
+
alreadyConfigured: true,
|
|
2498
|
+
modifiedFiles: []
|
|
2492
2499
|
};
|
|
2493
2500
|
}
|
|
2494
2501
|
let changed2 = false;
|
|
@@ -2504,7 +2511,8 @@ async function installReactUILintOverlay(opts) {
|
|
|
2504
2511
|
return {
|
|
2505
2512
|
targetFile: relTarget,
|
|
2506
2513
|
modified: modified2,
|
|
2507
|
-
alreadyConfigured: false
|
|
2514
|
+
alreadyConfigured: false,
|
|
2515
|
+
modifiedFiles: modified2 ? [absTarget2] : []
|
|
2508
2516
|
};
|
|
2509
2517
|
}
|
|
2510
2518
|
const candidates = getDefaultCandidates(opts.projectPath, opts.appRoot);
|
|
@@ -2547,7 +2555,8 @@ async function installReactUILintOverlay(opts) {
|
|
|
2547
2555
|
return {
|
|
2548
2556
|
targetFile: chosen,
|
|
2549
2557
|
modified,
|
|
2550
|
-
alreadyConfigured: alreadyConfigured && !modified
|
|
2558
|
+
alreadyConfigured: alreadyConfigured && !modified,
|
|
2559
|
+
modifiedFiles: modified ? [absTarget] : []
|
|
2551
2560
|
};
|
|
2552
2561
|
}
|
|
2553
2562
|
|
|
@@ -2669,7 +2678,7 @@ function wrapCjsModuleExports(program) {
|
|
|
2669
2678
|
async function installJsxLocPlugin(opts) {
|
|
2670
2679
|
const configPath = findNextConfigFile(opts.projectPath);
|
|
2671
2680
|
if (!configPath) {
|
|
2672
|
-
return { configFile: null, modified: false };
|
|
2681
|
+
return { configFile: null, modified: false, modifiedFiles: [] };
|
|
2673
2682
|
}
|
|
2674
2683
|
const configFilename = getNextConfigFilename(configPath);
|
|
2675
2684
|
const original = readFileSync7(configPath, "utf-8");
|
|
@@ -2677,7 +2686,7 @@ async function installJsxLocPlugin(opts) {
|
|
|
2677
2686
|
try {
|
|
2678
2687
|
mod = parseModule4(original);
|
|
2679
2688
|
} catch {
|
|
2680
|
-
return { configFile: configFilename, modified: false };
|
|
2689
|
+
return { configFile: configFilename, modified: false, modifiedFiles: [] };
|
|
2681
2690
|
}
|
|
2682
2691
|
const program = mod.$ast;
|
|
2683
2692
|
const isCjs = configPath.endsWith(".cjs");
|
|
@@ -2696,9 +2705,9 @@ async function installJsxLocPlugin(opts) {
|
|
|
2696
2705
|
const updated = changed ? generateCode3(mod).code : original;
|
|
2697
2706
|
if (updated !== original) {
|
|
2698
2707
|
writeFileSync3(configPath, updated, "utf-8");
|
|
2699
|
-
return { configFile: configFilename, modified: true };
|
|
2708
|
+
return { configFile: configFilename, modified: true, modifiedFiles: [configPath] };
|
|
2700
2709
|
}
|
|
2701
|
-
return { configFile: configFilename, modified: false };
|
|
2710
|
+
return { configFile: configFilename, modified: false, modifiedFiles: [] };
|
|
2702
2711
|
}
|
|
2703
2712
|
|
|
2704
2713
|
// src/utils/vite-config-inject.ts
|
|
@@ -2882,7 +2891,7 @@ function ensurePluginsContainsJsxLoc(configObj) {
|
|
|
2882
2891
|
}
|
|
2883
2892
|
async function installViteJsxLocPlugin(opts) {
|
|
2884
2893
|
const configPath = findViteConfigFile2(opts.projectPath);
|
|
2885
|
-
if (!configPath) return { configFile: null, modified: false };
|
|
2894
|
+
if (!configPath) return { configFile: null, modified: false, modifiedFiles: [] };
|
|
2886
2895
|
const configFilename = getViteConfigFilename(configPath);
|
|
2887
2896
|
const original = readFileSync8(configPath, "utf-8");
|
|
2888
2897
|
const isCjs = configPath.endsWith(".cjs");
|
|
@@ -2890,10 +2899,10 @@ async function installViteJsxLocPlugin(opts) {
|
|
|
2890
2899
|
try {
|
|
2891
2900
|
mod = parseModule5(original);
|
|
2892
2901
|
} catch {
|
|
2893
|
-
return { configFile: configFilename, modified: false };
|
|
2902
|
+
return { configFile: configFilename, modified: false, modifiedFiles: [] };
|
|
2894
2903
|
}
|
|
2895
2904
|
const found = findExportedConfigObjectExpression(mod);
|
|
2896
|
-
if (!found) return { configFile: configFilename, modified: false };
|
|
2905
|
+
if (!found) return { configFile: configFilename, modified: false, modifiedFiles: [] };
|
|
2897
2906
|
let changed = false;
|
|
2898
2907
|
if (isCjs) {
|
|
2899
2908
|
const reqRes = ensureCjsJsxLocRequire(found.program);
|
|
@@ -2907,9 +2916,9 @@ async function installViteJsxLocPlugin(opts) {
|
|
|
2907
2916
|
const updated = changed ? generateCode4(mod).code : original;
|
|
2908
2917
|
if (updated !== original) {
|
|
2909
2918
|
writeFileSync4(configPath, updated, "utf-8");
|
|
2910
|
-
return { configFile: configFilename, modified: true };
|
|
2919
|
+
return { configFile: configFilename, modified: true, modifiedFiles: [configPath] };
|
|
2911
2920
|
}
|
|
2912
|
-
return { configFile: configFilename, modified: false };
|
|
2921
|
+
return { configFile: configFilename, modified: false, modifiedFiles: [] };
|
|
2913
2922
|
}
|
|
2914
2923
|
|
|
2915
2924
|
// src/utils/next-routes.ts
|
|
@@ -3394,7 +3403,7 @@ async function installNextUILintRoutes(opts) {
|
|
|
3394
3403
|
}
|
|
3395
3404
|
|
|
3396
3405
|
// src/utils/prettier.ts
|
|
3397
|
-
import { existsSync as existsSync10 } from "fs";
|
|
3406
|
+
import { existsSync as existsSync10, utimesSync } from "fs";
|
|
3398
3407
|
import { spawn } from "child_process";
|
|
3399
3408
|
import { join as join10, dirname as dirname4 } from "path";
|
|
3400
3409
|
function getPrettierPath(projectPath) {
|
|
@@ -3531,6 +3540,17 @@ async function formatFilesWithPrettier(filePaths, projectPath) {
|
|
|
3531
3540
|
});
|
|
3532
3541
|
});
|
|
3533
3542
|
}
|
|
3543
|
+
function touchFiles(filePaths) {
|
|
3544
|
+
const now = /* @__PURE__ */ new Date();
|
|
3545
|
+
for (const filePath of filePaths) {
|
|
3546
|
+
try {
|
|
3547
|
+
if (existsSync10(filePath)) {
|
|
3548
|
+
utimesSync(filePath, now, now);
|
|
3549
|
+
}
|
|
3550
|
+
} catch {
|
|
3551
|
+
}
|
|
3552
|
+
}
|
|
3553
|
+
}
|
|
3534
3554
|
|
|
3535
3555
|
// src/commands/install/execute.ts
|
|
3536
3556
|
async function executeAction(action, options) {
|
|
@@ -3701,7 +3721,8 @@ async function executeInjectReact(action, options) {
|
|
|
3701
3721
|
return {
|
|
3702
3722
|
action,
|
|
3703
3723
|
success,
|
|
3704
|
-
error: success ? void 0 : "Failed to configure React overlay"
|
|
3724
|
+
error: success ? void 0 : "Failed to configure React overlay",
|
|
3725
|
+
modifiedFiles: result.modifiedFiles
|
|
3705
3726
|
};
|
|
3706
3727
|
}
|
|
3707
3728
|
async function executeInjectViteConfig(action, options) {
|
|
@@ -3720,7 +3741,8 @@ async function executeInjectViteConfig(action, options) {
|
|
|
3720
3741
|
return {
|
|
3721
3742
|
action,
|
|
3722
3743
|
success: result.modified || result.configFile !== null,
|
|
3723
|
-
error: result.configFile === null ? "No vite.config found" : void 0
|
|
3744
|
+
error: result.configFile === null ? "No vite.config found" : void 0,
|
|
3745
|
+
modifiedFiles: result.modifiedFiles
|
|
3724
3746
|
};
|
|
3725
3747
|
}
|
|
3726
3748
|
async function executeInjectNextConfig(action, options) {
|
|
@@ -3739,7 +3761,8 @@ async function executeInjectNextConfig(action, options) {
|
|
|
3739
3761
|
return {
|
|
3740
3762
|
action,
|
|
3741
3763
|
success: result.modified || result.configFile !== null,
|
|
3742
|
-
error: result.configFile === null ? "No next.config found" : void 0
|
|
3764
|
+
error: result.configFile === null ? "No next.config found" : void 0,
|
|
3765
|
+
modifiedFiles: result.modifiedFiles
|
|
3743
3766
|
};
|
|
3744
3767
|
}
|
|
3745
3768
|
async function executeInstallNextRoutes(action, options) {
|
|
@@ -3873,6 +3896,14 @@ function collectFormattableFiles(actionsPerformed) {
|
|
|
3873
3896
|
files.push(filePath);
|
|
3874
3897
|
}
|
|
3875
3898
|
}
|
|
3899
|
+
if (result.modifiedFiles) {
|
|
3900
|
+
for (const modifiedPath of result.modifiedFiles) {
|
|
3901
|
+
const ext = modifiedPath.slice(modifiedPath.lastIndexOf(".")).toLowerCase();
|
|
3902
|
+
if (formattableExtensions.has(ext) && !files.includes(modifiedPath)) {
|
|
3903
|
+
files.push(modifiedPath);
|
|
3904
|
+
}
|
|
3905
|
+
}
|
|
3906
|
+
}
|
|
3876
3907
|
}
|
|
3877
3908
|
return files;
|
|
3878
3909
|
}
|
|
@@ -3941,6 +3972,8 @@ async function execute(plan, options = {}) {
|
|
|
3941
3972
|
() => {
|
|
3942
3973
|
}
|
|
3943
3974
|
);
|
|
3975
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
3976
|
+
touchFiles(filesToFormat);
|
|
3944
3977
|
}
|
|
3945
3978
|
}
|
|
3946
3979
|
}
|
|
@@ -4565,4 +4598,4 @@ async function installUI(options = {}, executeOptions = {}) {
|
|
|
4565
4598
|
export {
|
|
4566
4599
|
installUI
|
|
4567
4600
|
};
|
|
4568
|
-
//# sourceMappingURL=install-ui-
|
|
4601
|
+
//# sourceMappingURL=install-ui-2HMR6TZT.js.map
|