vize 0.429.2 → 0.430.1
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/cli.mjs +30 -3
- package/dist/cli.mjs.map +1 -1
- package/dist/{config-DoZFwU3H.d.mts → config-GxBRbNGY.d.mts} +55 -2
- package/dist/config-GxBRbNGY.d.mts.map +1 -0
- package/dist/config.d.mts +1 -1
- package/dist/index.d.mts +1 -1
- package/package.json +2 -2
- package/pkl/FormatterConfig.pkl +4 -0
- package/pkl/LinterConfig.pkl +27 -0
- package/pkl/SortImportsConfig.pkl +27 -0
- package/pkl/jsonschema/ConfigArtifactDefinitions.pkl +2 -16
- package/pkl/jsonschema/FormatterSchemaDefinitions.pkl +124 -0
- package/pkl/jsonschema/ImportSortSchemaDefinitions.pkl +56 -0
- package/pkl/jsonschema/LintRuleOptionsSchemaDefinitions.pkl +38 -0
- package/pkl/jsonschema/LinterSchemaDefinitions.pkl +74 -0
- package/pkl/jsonschema/generate.pkl +7 -173
- package/pkl/vize.pkl +46 -0
- package/schemas/vize.config.schema.json +159 -0
- package/src/init/detect.ts +17 -0
- package/src/init/plan-project.ts +8 -2
- package/src/init/templates.ts +13 -1
- package/src/types/generated.ts +57 -0
- package/src/types/index.ts +2 -0
- package/src/types/rules.ts +1 -0
- package/dist/config-DoZFwU3H.d.mts.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -280,7 +280,19 @@ ${blocks.join("\n")}
|
|
|
280
280
|
`;
|
|
281
281
|
}
|
|
282
282
|
/** Minimum project config written only when typechecking is selected and no config exists. */
|
|
283
|
-
function renderTypecheckTsconfig(typescript) {
|
|
283
|
+
function renderTypecheckTsconfig(typescript, nuxtMajor) {
|
|
284
|
+
if (nuxtMajor !== void 0) {
|
|
285
|
+
const config = nuxtMajor !== null && nuxtMajor >= 4 ? {
|
|
286
|
+
files: [],
|
|
287
|
+
references: [
|
|
288
|
+
"app",
|
|
289
|
+
"server",
|
|
290
|
+
"shared",
|
|
291
|
+
"node"
|
|
292
|
+
].map((part) => ({ path: `./.nuxt/tsconfig.${part}.json` }))
|
|
293
|
+
} : { extends: "./.nuxt/tsconfig.json" };
|
|
294
|
+
return `${JSON.stringify(config, null, 2)}\n`;
|
|
295
|
+
}
|
|
284
296
|
const compilerOptions = {
|
|
285
297
|
strict: true,
|
|
286
298
|
target: "ES2022",
|
|
@@ -1030,6 +1042,7 @@ function detectProject(root) {
|
|
|
1030
1042
|
packageManager: detectPackageManager(root),
|
|
1031
1043
|
framework: detectFramework(nuxtConfig, viteConfigs, dependencies),
|
|
1032
1044
|
nuxtConfig,
|
|
1045
|
+
nuxtMajor: declaredNuxtMajor(packageJson),
|
|
1033
1046
|
viteConfigs,
|
|
1034
1047
|
usesVitePlus: detectVitePlus(dependencies, viteSource, scripts),
|
|
1035
1048
|
typescript: dependencies.has("typescript") || fs.existsSync(path.join(root, "tsconfig.json")),
|
|
@@ -1044,6 +1057,20 @@ function detectProject(root) {
|
|
|
1044
1057
|
vscodeRecommendsVize: detectVscodeRecommendation(root)
|
|
1045
1058
|
};
|
|
1046
1059
|
}
|
|
1060
|
+
function declaredNuxtMajor(packageJson) {
|
|
1061
|
+
for (const field of [
|
|
1062
|
+
"dependencies",
|
|
1063
|
+
"devDependencies",
|
|
1064
|
+
"optionalDependencies"
|
|
1065
|
+
]) {
|
|
1066
|
+
const group = packageJson[field];
|
|
1067
|
+
if (group === null || typeof group !== "object" || Array.isArray(group)) continue;
|
|
1068
|
+
const version = group.nuxt;
|
|
1069
|
+
const major = typeof version === "string" ? /^[~^<>=\s]*(\d+)(?:\.|$)/u.exec(version) : null;
|
|
1070
|
+
if (major) return Number(major[1]);
|
|
1071
|
+
}
|
|
1072
|
+
return null;
|
|
1073
|
+
}
|
|
1047
1074
|
function detectFramework(nuxtConfig, viteConfigs, dependencies) {
|
|
1048
1075
|
if (nuxtConfig !== null || dependencies.has("nuxt")) return "nuxt";
|
|
1049
1076
|
return viteConfigs.length > 0 ? "vite" : "none";
|
|
@@ -1343,7 +1370,7 @@ function planVizeConfig(detection, selection, draft) {
|
|
|
1343
1370
|
if (selection.typecheck && detection.tsconfig === null) {
|
|
1344
1371
|
draft.files.push({
|
|
1345
1372
|
filename: path.join(detection.root, "tsconfig.json"),
|
|
1346
|
-
source: renderTypecheckTsconfig(detection.typescript)
|
|
1373
|
+
source: renderTypecheckTsconfig(detection.typescript, detection.framework === "nuxt" ? detection.nuxtMajor : void 0)
|
|
1347
1374
|
});
|
|
1348
1375
|
draft.createdFiles.push("tsconfig.json");
|
|
1349
1376
|
}
|
|
@@ -1395,7 +1422,7 @@ function planScripts(detection, selection, draft) {
|
|
|
1395
1422
|
const source = fs.readFileSync(packagePath, "utf8");
|
|
1396
1423
|
const packageJson = parsePackageJson(packagePath, source);
|
|
1397
1424
|
const scripts = { ...detection.scripts };
|
|
1398
|
-
for (const name of missing) scripts[name] = DEFAULT_SCRIPTS[name];
|
|
1425
|
+
for (const name of missing) scripts[name] = name === "vize:check" && detection.framework === "nuxt" ? "nuxt prepare && vize check" : DEFAULT_SCRIPTS[name];
|
|
1399
1426
|
packageJson.scripts = scripts;
|
|
1400
1427
|
draft.files.push({
|
|
1401
1428
|
filename: packagePath,
|