@geekmidas/cli 1.10.2 ā 1.10.3
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/CHANGELOG.md +6 -0
- package/dist/index.cjs +45 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +45 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/dev/index.ts +23 -8
- package/src/setup/__tests__/reconcile-secrets.spec.ts +248 -0
- package/src/setup/index.ts +46 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @geekmidas/cli
|
|
2
2
|
|
|
3
|
+
## 1.10.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- š [`6a92fa7`](https://github.com/geekmidas/toolbox/commit/6a92fa737057d77178a4d31480505013fbe033af) Thanks [@geekmidas](https://github.com/geekmidas)! - Fix dev scripts and spawns also when canceling prcocess.
|
|
8
|
+
|
|
3
9
|
## 1.10.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -35,7 +35,7 @@ const prompts = require_chunk.__toESM(require("prompts"));
|
|
|
35
35
|
|
|
36
36
|
//#region package.json
|
|
37
37
|
var name = "@geekmidas/cli";
|
|
38
|
-
var version = "1.10.
|
|
38
|
+
var version = "1.10.2";
|
|
39
39
|
var description = "CLI tools for building Lambda handlers, server applications, and generating OpenAPI specs";
|
|
40
40
|
var private$1 = false;
|
|
41
41
|
var type = "module";
|
|
@@ -1345,7 +1345,8 @@ async function workspaceDevCommand(workspace, options) {
|
|
|
1345
1345
|
], {
|
|
1346
1346
|
cwd: workspace.root,
|
|
1347
1347
|
stdio: "inherit",
|
|
1348
|
-
env: turboEnv
|
|
1348
|
+
env: turboEnv,
|
|
1349
|
+
detached: true
|
|
1349
1350
|
});
|
|
1350
1351
|
let openApiWatcher = null;
|
|
1351
1352
|
if (frontendApps.length > 0 && backendApps.length > 0) {
|
|
@@ -1391,14 +1392,24 @@ async function workspaceDevCommand(workspace, options) {
|
|
|
1391
1392
|
isShuttingDown = true;
|
|
1392
1393
|
logger$11.log("\nš Shutting down workspace...");
|
|
1393
1394
|
if (openApiWatcher) openApiWatcher.close().catch(() => {});
|
|
1394
|
-
|
|
1395
|
-
|
|
1395
|
+
const pid = turboProcess.pid;
|
|
1396
|
+
if (pid) try {
|
|
1397
|
+
process.kill(-pid, "SIGTERM");
|
|
1396
1398
|
} catch {
|
|
1397
|
-
|
|
1399
|
+
try {
|
|
1400
|
+
process.kill(pid, "SIGTERM");
|
|
1401
|
+
} catch {}
|
|
1398
1402
|
}
|
|
1399
1403
|
setTimeout(() => {
|
|
1404
|
+
if (pid) try {
|
|
1405
|
+
process.kill(-pid, "SIGKILL");
|
|
1406
|
+
} catch {
|
|
1407
|
+
try {
|
|
1408
|
+
process.kill(pid, "SIGKILL");
|
|
1409
|
+
} catch {}
|
|
1410
|
+
}
|
|
1400
1411
|
process.exit(0);
|
|
1401
|
-
},
|
|
1412
|
+
}, 3e3);
|
|
1402
1413
|
};
|
|
1403
1414
|
process.on("SIGINT", shutdown);
|
|
1404
1415
|
process.on("SIGTERM", shutdown);
|
|
@@ -11216,7 +11227,11 @@ async function resolveSecrets(stage, workspace, options) {
|
|
|
11216
11227
|
if (require_storage.secretsExist(stage, workspace.root)) {
|
|
11217
11228
|
logger$1.log("š Using existing local secrets");
|
|
11218
11229
|
const secrets = await require_storage.readStageSecrets(stage, workspace.root);
|
|
11219
|
-
if (secrets)
|
|
11230
|
+
if (secrets) {
|
|
11231
|
+
const reconciled = reconcileSecrets(secrets, workspace);
|
|
11232
|
+
if (reconciled) await require_storage.writeStageSecrets(reconciled, workspace.root);
|
|
11233
|
+
return reconciled ?? secrets;
|
|
11234
|
+
}
|
|
11220
11235
|
}
|
|
11221
11236
|
if (require_sync.isSSMConfigured(workspace)) {
|
|
11222
11237
|
logger$1.log("āļø Checking for remote secrets in SSM...");
|
|
@@ -11236,6 +11251,29 @@ async function resolveSecrets(stage, workspace, options) {
|
|
|
11236
11251
|
return generateFreshSecrets(stage, workspace, options);
|
|
11237
11252
|
}
|
|
11238
11253
|
/**
|
|
11254
|
+
* Reconcile existing secrets with expected workspace-derived keys.
|
|
11255
|
+
* Adds missing keys (e.g. BETTER_AUTH_*) without overwriting existing values.
|
|
11256
|
+
* Returns the updated secrets if changes were made, or null if no changes needed.
|
|
11257
|
+
* @internal Exported for testing
|
|
11258
|
+
*/
|
|
11259
|
+
function reconcileSecrets(secrets, workspace) {
|
|
11260
|
+
const isMultiApp = Object.keys(workspace.apps).length > 1;
|
|
11261
|
+
if (!isMultiApp) return null;
|
|
11262
|
+
const expected = require_fullstack_secrets.generateFullstackCustomSecrets(workspace);
|
|
11263
|
+
const missing = {};
|
|
11264
|
+
for (const [key, value] of Object.entries(expected)) if (!(key in secrets.custom)) missing[key] = value;
|
|
11265
|
+
if (Object.keys(missing).length === 0) return null;
|
|
11266
|
+
logger$1.log(` š Adding missing secrets: ${Object.keys(missing).join(", ")}`);
|
|
11267
|
+
return {
|
|
11268
|
+
...secrets,
|
|
11269
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11270
|
+
custom: {
|
|
11271
|
+
...secrets.custom,
|
|
11272
|
+
...missing
|
|
11273
|
+
}
|
|
11274
|
+
};
|
|
11275
|
+
}
|
|
11276
|
+
/**
|
|
11239
11277
|
* Generate fresh secrets for the workspace.
|
|
11240
11278
|
*/
|
|
11241
11279
|
async function generateFreshSecrets(stage, workspace, options) {
|