cdk-real-drift 0.2.55 → 0.2.56
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 +48 -5
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -243,6 +243,44 @@ const BOOLEAN_FLAGS = new Set([
|
|
|
243
243
|
"--strict",
|
|
244
244
|
"--all"
|
|
245
245
|
]);
|
|
246
|
+
const CANONICAL_FLAG = {
|
|
247
|
+
"-y": "--yes",
|
|
248
|
+
"-v": "--verbose",
|
|
249
|
+
"-a": "--app",
|
|
250
|
+
"-c": "--context"
|
|
251
|
+
};
|
|
252
|
+
const canonicalFlag = (flag) => CANONICAL_FLAG[flag] ?? flag;
|
|
253
|
+
const GLOBAL_FLAGS = [
|
|
254
|
+
"--region",
|
|
255
|
+
"--profile",
|
|
256
|
+
"--app",
|
|
257
|
+
"--context",
|
|
258
|
+
"--all",
|
|
259
|
+
"--json",
|
|
260
|
+
"--yes"
|
|
261
|
+
];
|
|
262
|
+
const ALLOWED_FLAGS_BY_VERB = {
|
|
263
|
+
check: new Set([
|
|
264
|
+
...GLOBAL_FLAGS,
|
|
265
|
+
"--fail",
|
|
266
|
+
"--strict",
|
|
267
|
+
"--show-all",
|
|
268
|
+
"--pre-deploy",
|
|
269
|
+
"--undeclared-only",
|
|
270
|
+
"--declared-only",
|
|
271
|
+
"--verbose",
|
|
272
|
+
"--remove-unrecorded"
|
|
273
|
+
]),
|
|
274
|
+
record: new Set([...GLOBAL_FLAGS, "--verbose"]),
|
|
275
|
+
ignore: new Set(GLOBAL_FLAGS),
|
|
276
|
+
revert: new Set([
|
|
277
|
+
...GLOBAL_FLAGS,
|
|
278
|
+
"--verbose",
|
|
279
|
+
"--remove-unrecorded",
|
|
280
|
+
"--dry-run",
|
|
281
|
+
"--wait"
|
|
282
|
+
])
|
|
283
|
+
};
|
|
246
284
|
/**
|
|
247
285
|
* Whether prompts may be shown: only in a real TTY. Non-interactive now simply means
|
|
248
286
|
* non-TTY (real CI/cron/pipes). The single source of truth — command code threads this
|
|
@@ -252,7 +290,7 @@ const BOOLEAN_FLAGS = new Set([
|
|
|
252
290
|
function isInteractive() {
|
|
253
291
|
return Boolean(process.stdin.isTTY);
|
|
254
292
|
}
|
|
255
|
-
function parseCommonArgs(args) {
|
|
293
|
+
function parseCommonArgs(args, verb) {
|
|
256
294
|
const values = {};
|
|
257
295
|
const found = /* @__PURE__ */ new Set();
|
|
258
296
|
const stackNames = [];
|
|
@@ -297,6 +335,11 @@ function parseCommonArgs(args) {
|
|
|
297
335
|
}
|
|
298
336
|
throw new Error(`unknown option "${a}" — see cdkrd --help`);
|
|
299
337
|
}
|
|
338
|
+
if (verb !== void 0) {
|
|
339
|
+
const allowed = ALLOWED_FLAGS_BY_VERB[verb];
|
|
340
|
+
for (const flag of found) if (!allowed.has(canonicalFlag(flag))) throw new Error(`option "${flag}" is not valid for the \`${verb}\` command — see cdkrd --help`);
|
|
341
|
+
if (waitMs !== void 0 && !allowed.has("--wait")) throw new Error(`option "--wait" is not valid for the \`${verb}\` command — see cdkrd --help`);
|
|
342
|
+
}
|
|
300
343
|
const has = (flag) => found.has(flag);
|
|
301
344
|
const scopes = [
|
|
302
345
|
"--pre-deploy",
|
|
@@ -12426,7 +12469,7 @@ function availableActions(findings, baseline, schemas, removeUnrecorded) {
|
|
|
12426
12469
|
//#endregion
|
|
12427
12470
|
//#region src/commands/record.ts
|
|
12428
12471
|
async function runRecord(args) {
|
|
12429
|
-
const a = parseCommonArgs(args);
|
|
12472
|
+
const a = parseCommonArgs(args, "record");
|
|
12430
12473
|
if (a.profile) process.env.AWS_PROFILE = a.profile;
|
|
12431
12474
|
let config;
|
|
12432
12475
|
try {
|
|
@@ -12492,7 +12535,7 @@ async function runRecord(args) {
|
|
|
12492
12535
|
//#endregion
|
|
12493
12536
|
//#region src/commands/ignore.ts
|
|
12494
12537
|
async function runIgnore(args) {
|
|
12495
|
-
const a = parseCommonArgs(args);
|
|
12538
|
+
const a = parseCommonArgs(args, "ignore");
|
|
12496
12539
|
if (a.profile) process.env.AWS_PROFILE = a.profile;
|
|
12497
12540
|
let config;
|
|
12498
12541
|
try {
|
|
@@ -13398,7 +13441,7 @@ function finalCheckExit(code, fail) {
|
|
|
13398
13441
|
return fail || code !== 1 ? code : 0;
|
|
13399
13442
|
}
|
|
13400
13443
|
async function runCheck(args) {
|
|
13401
|
-
const a = parseCommonArgs(args);
|
|
13444
|
+
const a = parseCommonArgs(args, "check");
|
|
13402
13445
|
if (a.profile) process.env.AWS_PROFILE = a.profile;
|
|
13403
13446
|
let config;
|
|
13404
13447
|
try {
|
|
@@ -13581,7 +13624,7 @@ async function runCheck(args) {
|
|
|
13581
13624
|
//#endregion
|
|
13582
13625
|
//#region src/commands/revert.ts
|
|
13583
13626
|
async function runRevert(args) {
|
|
13584
|
-
const a = parseCommonArgs(args);
|
|
13627
|
+
const a = parseCommonArgs(args, "revert");
|
|
13585
13628
|
if (a.profile) process.env.AWS_PROFILE = a.profile;
|
|
13586
13629
|
const dryRun = args.includes("--dry-run");
|
|
13587
13630
|
let config;
|