@lark-apaas/fullstack-cli 1.1.12-alpha.8 → 1.1.12-alpha.9
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 +29 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -141,22 +141,39 @@ async function run(options = {}) {
|
|
|
141
141
|
console.log("[gen-db-schema] Starting...");
|
|
142
142
|
const __filename = fileURLToPath(import.meta.url);
|
|
143
143
|
const __dirname2 = path.dirname(__filename);
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
const configPathCandidates = [
|
|
145
|
+
path.resolve(__dirname2, "config/drizzle.config.js"),
|
|
146
|
+
path.resolve(__dirname2, "../../config/drizzle.config.js"),
|
|
147
|
+
path.resolve(__dirname2, "../../../dist/config/drizzle.config.js")
|
|
148
|
+
];
|
|
149
|
+
const configPath = configPathCandidates.find((p) => fs.existsSync(p));
|
|
150
|
+
console.log("[gen-db-schema] Using drizzle config from:", configPath ?? "(not found)");
|
|
151
|
+
if (!configPath) {
|
|
147
152
|
console.error("[gen-db-schema] Error: drizzle config not found in CLI package");
|
|
148
153
|
process.exit(1);
|
|
149
154
|
}
|
|
150
155
|
const resolveDrizzleKitBin = () => {
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
156
|
+
const entryPath = require2.resolve("drizzle-kit");
|
|
157
|
+
let currentDir = path.dirname(entryPath);
|
|
158
|
+
let lastDir = null;
|
|
159
|
+
while (currentDir !== lastDir) {
|
|
160
|
+
const pkgJsonPath = path.join(currentDir, "package.json");
|
|
161
|
+
if (fs.existsSync(pkgJsonPath)) {
|
|
162
|
+
const pkgJsonRaw = fs.readFileSync(pkgJsonPath, "utf8");
|
|
163
|
+
const pkgJson = JSON.parse(pkgJsonRaw);
|
|
164
|
+
if (pkgJson.name === "drizzle-kit") {
|
|
165
|
+
const binField = pkgJson.bin;
|
|
166
|
+
const binRelPath = typeof binField === "string" ? binField : binField?.["drizzle-kit"];
|
|
167
|
+
if (!binRelPath) {
|
|
168
|
+
throw new Error("Unable to resolve drizzle-kit binary from package.json");
|
|
169
|
+
}
|
|
170
|
+
return path.resolve(currentDir, binRelPath);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
lastDir = currentDir;
|
|
174
|
+
currentDir = path.dirname(currentDir);
|
|
175
|
+
}
|
|
176
|
+
throw new Error("Unable to locate drizzle-kit package root");
|
|
160
177
|
};
|
|
161
178
|
try {
|
|
162
179
|
const env = {
|