@lark-apaas/fullstack-cli 1.1.40-alpha.10 → 1.1.40-alpha.11
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 +22 -1
- package/package.json +1 -1
- package/templates/nest-cli.json +1 -2
package/dist/index.js
CHANGED
|
@@ -2152,6 +2152,24 @@ async function parseAndGenerateNestResourceTemplate(options) {
|
|
|
2152
2152
|
|
|
2153
2153
|
// src/commands/db/schema.handler.ts
|
|
2154
2154
|
var require2 = createRequire(import.meta.url);
|
|
2155
|
+
var STALE_RUN_DIR_MAX_AGE_MS = 60 * 60 * 1e3;
|
|
2156
|
+
function sweepStaleRunDirs(rootDir) {
|
|
2157
|
+
try {
|
|
2158
|
+
const now = Date.now();
|
|
2159
|
+
for (const name of fs4.readdirSync(rootDir)) {
|
|
2160
|
+
if (!name.startsWith("run-")) continue;
|
|
2161
|
+
const full = path2.join(rootDir, name);
|
|
2162
|
+
try {
|
|
2163
|
+
const stat = fs4.statSync(full);
|
|
2164
|
+
if (!stat.isDirectory()) continue;
|
|
2165
|
+
if (now - stat.mtimeMs < STALE_RUN_DIR_MAX_AGE_MS) continue;
|
|
2166
|
+
fs4.rmSync(full, { recursive: true, force: true });
|
|
2167
|
+
} catch {
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
} catch {
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2155
2173
|
async function run(options = {}) {
|
|
2156
2174
|
let exitCode = 0;
|
|
2157
2175
|
const envPath2 = path2.resolve(process.cwd(), ".env");
|
|
@@ -2167,7 +2185,9 @@ async function run(options = {}) {
|
|
|
2167
2185
|
process.exit(1);
|
|
2168
2186
|
}
|
|
2169
2187
|
const outputPath = options.output || process.env.DB_SCHEMA_OUTPUT || "server/database/schema.ts";
|
|
2170
|
-
const
|
|
2188
|
+
const INTROSPECT_ROOT = path2.resolve(process.cwd(), "server/database/.introspect");
|
|
2189
|
+
fs4.mkdirSync(INTROSPECT_ROOT, { recursive: true });
|
|
2190
|
+
const OUT_DIR = fs4.mkdtempSync(path2.join(INTROSPECT_ROOT, "run-"));
|
|
2171
2191
|
const SCHEMA_FILE = path2.resolve(process.cwd(), outputPath);
|
|
2172
2192
|
console.log("[gen-db-schema] Starting...");
|
|
2173
2193
|
const __filename = fileURLToPath2(import.meta.url);
|
|
@@ -2347,6 +2367,7 @@ async function run(options = {}) {
|
|
|
2347
2367
|
if (fs4.existsSync(OUT_DIR)) {
|
|
2348
2368
|
fs4.rmSync(OUT_DIR, { recursive: true, force: true });
|
|
2349
2369
|
}
|
|
2370
|
+
sweepStaleRunDirs(INTROSPECT_ROOT);
|
|
2350
2371
|
process.exit(exitCode);
|
|
2351
2372
|
}
|
|
2352
2373
|
}
|
package/package.json
CHANGED
package/templates/nest-cli.json
CHANGED