@famgia/omnify-cli 0.0.119 → 0.0.121
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.js +34 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +31 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -3
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/cli.js
CHANGED
|
@@ -875,7 +875,7 @@ function registerDiffCommand(program2) {
|
|
|
875
875
|
}
|
|
876
876
|
|
|
877
877
|
// src/commands/generate.ts
|
|
878
|
-
import { existsSync as existsSync5, mkdirSync as mkdirSync3, writeFileSync as writeFileSync4, readdirSync as readdirSync2 } from "fs";
|
|
878
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync3, writeFileSync as writeFileSync4, readdirSync as readdirSync2, readFileSync as readFileSync3 } from "fs";
|
|
879
879
|
import { resolve as resolve7, dirname as dirname5, relative } from "path";
|
|
880
880
|
import {
|
|
881
881
|
loadSchemas as loadSchemas3,
|
|
@@ -1024,6 +1024,20 @@ function generateAIGuides(rootDir, _plugins) {
|
|
|
1024
1024
|
}
|
|
1025
1025
|
|
|
1026
1026
|
// src/commands/generate.ts
|
|
1027
|
+
async function loadRegisteredSchemaPaths(rootDir) {
|
|
1028
|
+
const schemaPathsFile = resolve7(rootDir, "storage/omnify/schema-paths.json");
|
|
1029
|
+
if (!existsSync5(schemaPathsFile)) {
|
|
1030
|
+
return [];
|
|
1031
|
+
}
|
|
1032
|
+
try {
|
|
1033
|
+
const content = readFileSync3(schemaPathsFile, "utf-8");
|
|
1034
|
+
const data = JSON.parse(content);
|
|
1035
|
+
return data.paths ?? [];
|
|
1036
|
+
} catch {
|
|
1037
|
+
logger.debug("Could not read registered schema paths file");
|
|
1038
|
+
return [];
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1027
1041
|
function hasPluginGenerators(plugins) {
|
|
1028
1042
|
return plugins.some((p) => p.generators && p.generators.length > 0);
|
|
1029
1043
|
}
|
|
@@ -1456,13 +1470,28 @@ async function runGenerate(options) {
|
|
|
1456
1470
|
validateConfig(config, rootDir);
|
|
1457
1471
|
const schemaPath = resolve7(rootDir, config.schemasDir);
|
|
1458
1472
|
logger.step(`Loading schemas from ${schemaPath}`);
|
|
1459
|
-
|
|
1473
|
+
let schemas = await loadSchemas3(schemaPath);
|
|
1474
|
+
logger.debug(`Found ${Object.keys(schemas).length} schema(s) in main directory`);
|
|
1475
|
+
const additionalPaths = await loadRegisteredSchemaPaths(rootDir);
|
|
1476
|
+
if (additionalPaths.length > 0) {
|
|
1477
|
+
logger.step(`Loading schemas from ${additionalPaths.length} registered path(s)`);
|
|
1478
|
+
for (const entry of additionalPaths) {
|
|
1479
|
+
if (existsSync5(entry.path)) {
|
|
1480
|
+
const packageSchemas = await loadSchemas3(entry.path);
|
|
1481
|
+
const count = Object.keys(packageSchemas).length;
|
|
1482
|
+
logger.debug(` \u2022 ${entry.path}: ${count} schema(s)`);
|
|
1483
|
+
schemas = { ...packageSchemas, ...schemas };
|
|
1484
|
+
} else {
|
|
1485
|
+
logger.warn(` \u2022 ${entry.path}: directory not found (skipped)`);
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1460
1489
|
const schemaCount = Object.keys(schemas).length;
|
|
1461
1490
|
if (schemaCount === 0) {
|
|
1462
1491
|
logger.warn("No schema files found");
|
|
1463
1492
|
return;
|
|
1464
1493
|
}
|
|
1465
|
-
logger.debug(`
|
|
1494
|
+
logger.debug(`Total: ${schemaCount} schema(s)`);
|
|
1466
1495
|
const customTypeNames = [];
|
|
1467
1496
|
for (const plugin of config.plugins) {
|
|
1468
1497
|
if (plugin.types) {
|
|
@@ -1978,7 +2007,7 @@ function registerResetCommand(program2) {
|
|
|
1978
2007
|
|
|
1979
2008
|
// src/commands/create-project.ts
|
|
1980
2009
|
import { execSync, spawn } from "child_process";
|
|
1981
|
-
import { existsSync as existsSync7, rmSync as rmSync2, readFileSync as
|
|
2010
|
+
import { existsSync as existsSync7, rmSync as rmSync2, readFileSync as readFileSync4, writeFileSync as writeFileSync5 } from "fs";
|
|
1982
2011
|
import { resolve as resolve9 } from "path";
|
|
1983
2012
|
var BOILERPLATE_REPO = "https://github.com/omnifyjp/omnify-laravel-boilerplate.git";
|
|
1984
2013
|
var IS_WINDOWS = process.platform === "win32";
|
|
@@ -2082,7 +2111,7 @@ var GITIGNORE_ENTRIES_TO_REMOVE = [
|
|
|
2082
2111
|
function cleanupGitignore(targetDir) {
|
|
2083
2112
|
const gitignorePath = resolve9(targetDir, ".gitignore");
|
|
2084
2113
|
if (!existsSync7(gitignorePath)) return;
|
|
2085
|
-
const content =
|
|
2114
|
+
const content = readFileSync4(gitignorePath, "utf-8");
|
|
2086
2115
|
const lines = content.split("\n");
|
|
2087
2116
|
const cleanedLines = lines.filter((line) => {
|
|
2088
2117
|
const trimmed = line.trim();
|