@mtndev/cli 2.0.0 → 2.0.1
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 +13 -0
- package/cjs/__chunks/VH7oDXx4.cjs +28 -0
- package/cjs/commands/aws/ec2/allow-ip/handler.cjs +261 -12
- package/cjs/commands/aws/ec2/allow-ip/index.cjs +25 -55
- package/cjs/commands/aws/ec2/allow-ip/schema.cjs +33 -13
- package/cjs/commands/aws/ec2/allow-ip/utils.cjs +379 -39
- package/cjs/commands/aws/iam/admin-group.cjs +111 -15
- package/cjs/commands/aws/iam/break-glass/handler.cjs +127 -12
- package/cjs/commands/aws/iam/break-glass/index.cjs +7 -19
- package/cjs/commands/aws/iam/break-glass/schema.cjs +21 -12
- package/cjs/commands/aws/iam/check-admin/handler.cjs +89 -10
- package/cjs/commands/aws/iam/check-admin/index.cjs +7 -17
- package/cjs/commands/aws/iam/check-admin/schema.cjs +19 -12
- package/cjs/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.json +20 -0
- package/cjs/commands/aws/iam/policies/sts-federation.json +11 -0
- package/cjs/commands/aws/iam/policies/user-admins-deny-list.json +175 -0
- package/cjs/commands/aws/iam/policies/user-admins-deny-regions-list.json +41 -0
- package/cjs/commands/aws/iam/policies/user-admins-self-service-iam.json +56 -0
- package/cjs/commands/aws/iam/policies/user-admins-write-list.json +117 -0
- package/cjs/commands/aws/iam/remove-admin/handler.cjs +120 -11
- package/cjs/commands/aws/iam/remove-admin/index.cjs +7 -18
- package/cjs/commands/aws/iam/remove-admin/schema.cjs +22 -12
- package/cjs/commands/aws/iam/setup-acl/handler.cjs +227 -14
- package/cjs/commands/aws/iam/setup-acl/index.cjs +13 -33
- package/cjs/commands/aws/iam/setup-acl/schema.cjs +19 -7
- package/cjs/commands/aws/iam/setup-acl/utils.cjs +305 -20
- package/cjs/commands/aws/iam/users/handler.cjs +59 -12
- package/cjs/commands/aws/iam/users/index.cjs +18 -41
- package/cjs/commands/aws/iam/users/schema.cjs +17 -7
- package/cjs/commands/aws/iam/users/utils.cjs +454 -30
- package/cjs/commands/aws/index.cjs +223 -229
- package/cjs/commands/aws/route53/add-record/handler.cjs +264 -18
- package/cjs/commands/aws/route53/add-record/index.cjs +26 -57
- package/cjs/commands/aws/route53/add-record/schema.cjs +43 -11
- package/cjs/commands/aws/route53/add-record/utils.cjs +404 -37
- package/cjs/commands/aws/route53/remove-record/handler.cjs +114 -14
- package/cjs/commands/aws/route53/remove-record/index.cjs +5 -18
- package/cjs/commands/aws/route53/remove-record/schema.cjs +22 -8
- package/cjs/commands/aws/schema.cjs +19 -10
- package/cjs/commands/aws/ses/send-email/handler.cjs +73 -12
- package/cjs/commands/aws/ses/send-email/index.cjs +9 -23
- package/cjs/commands/aws/ses/send-email/schema.cjs +24 -7
- package/cjs/commands/aws/ses/send-email/utils.cjs +87 -11
- package/cjs/commands/aws/ses/smtp-password.cjs +72 -10
- package/cjs/commands/aws/utils/exec-aws.cjs +145 -16
- package/cjs/commands/aws/utils/resolve-policy-path.cjs +15 -6
- package/cjs/commands/aws/utils/resolve-profile.cjs +93 -11
- package/cjs/commands/aws/utils/tty.cjs +54 -10
- package/cjs/commands/db/create-readonly-user/handler.cjs +254 -11
- package/cjs/commands/db/create-readonly-user/index.cjs +18 -40
- package/cjs/commands/db/create-readonly-user/mysql.cjs +102 -9
- package/cjs/commands/db/create-readonly-user/postgres.cjs +209 -9
- package/cjs/commands/db/create-readonly-user/schema.cjs +39 -12
- package/cjs/commands/db/create-readonly-user/utils.cjs +160 -22
- package/cjs/commands/db/index.cjs +46 -44
- package/cjs/commands/doppler/handler.cjs +95 -11
- package/cjs/commands/doppler/index.cjs +33 -68
- package/cjs/commands/doppler/schema.cjs +130 -14
- package/cjs/commands/doppler/set-secret.cjs +378 -19
- package/cjs/commands/doppler/utils/exec.cjs +106 -12
- package/cjs/commands/doppler/utils.cjs +412 -34
- package/cjs/commands/icons/handler.cjs +82 -8
- package/cjs/commands/icons/index.cjs +15 -31
- package/cjs/commands/icons/schema.cjs +101 -13
- package/cjs/commands/icons/utils.cjs +131 -13
- package/cjs/commands/index.cjs +54 -161
- package/cjs/commands/schema.cjs +25 -8
- package/cjs/index.cjs +3 -4
- package/esm/commands/aws/ec2/allow-ip/handler.js +258 -12
- package/esm/commands/aws/ec2/allow-ip/index.js +4 -55
- package/esm/commands/aws/ec2/allow-ip/schema.js +29 -13
- package/esm/commands/aws/ec2/allow-ip/utils.js +363 -39
- package/esm/commands/aws/iam/admin-group.js +104 -15
- package/esm/commands/aws/iam/break-glass/handler.js +124 -12
- package/esm/commands/aws/iam/break-glass/index.js +4 -19
- package/esm/commands/aws/iam/break-glass/schema.js +19 -12
- package/esm/commands/aws/iam/check-admin/handler.js +86 -10
- package/esm/commands/aws/iam/check-admin/index.js +4 -17
- package/esm/commands/aws/iam/check-admin/schema.js +17 -12
- package/esm/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.json +20 -0
- package/esm/commands/aws/iam/policies/sts-federation.json +11 -0
- package/esm/commands/aws/iam/policies/user-admins-deny-list.json +175 -0
- package/esm/commands/aws/iam/policies/user-admins-deny-regions-list.json +41 -0
- package/esm/commands/aws/iam/policies/user-admins-self-service-iam.json +56 -0
- package/esm/commands/aws/iam/policies/user-admins-write-list.json +117 -0
- package/esm/commands/aws/iam/remove-admin/handler.js +117 -11
- package/esm/commands/aws/iam/remove-admin/index.js +4 -18
- package/esm/commands/aws/iam/remove-admin/schema.js +20 -12
- package/esm/commands/aws/iam/setup-acl/handler.js +224 -14
- package/esm/commands/aws/iam/setup-acl/index.js +4 -33
- package/esm/commands/aws/iam/setup-acl/schema.js +18 -7
- package/esm/commands/aws/iam/setup-acl/utils.js +298 -20
- package/esm/commands/aws/iam/users/handler.js +56 -12
- package/esm/commands/aws/iam/users/index.js +4 -41
- package/esm/commands/aws/iam/users/schema.js +16 -7
- package/esm/commands/aws/iam/users/utils.js +440 -30
- package/esm/commands/aws/index.js +142 -229
- package/esm/commands/aws/route53/add-record/handler.js +258 -18
- package/esm/commands/aws/route53/add-record/index.js +4 -57
- package/esm/commands/aws/route53/add-record/schema.js +40 -11
- package/esm/commands/aws/route53/add-record/utils.js +389 -37
- package/esm/commands/aws/route53/remove-record/handler.js +111 -14
- package/esm/commands/aws/route53/remove-record/index.js +3 -18
- package/esm/commands/aws/route53/remove-record/schema.js +21 -8
- package/esm/commands/aws/schema.js +16 -10
- package/esm/commands/aws/ses/send-email/handler.js +70 -12
- package/esm/commands/aws/ses/send-email/index.js +4 -23
- package/esm/commands/aws/ses/send-email/schema.js +23 -7
- package/esm/commands/aws/ses/send-email/utils.js +84 -11
- package/esm/commands/aws/ses/smtp-password.js +69 -10
- package/esm/commands/aws/utils/exec-aws.js +136 -15
- package/esm/commands/aws/utils/resolve-policy-path.js +14 -6
- package/esm/commands/aws/utils/resolve-profile.js +88 -11
- package/esm/commands/aws/utils/tty.js +51 -10
- package/esm/commands/db/create-readonly-user/handler.js +251 -11
- package/esm/commands/db/create-readonly-user/index.js +4 -40
- package/esm/commands/db/create-readonly-user/mysql.js +98 -9
- package/esm/commands/db/create-readonly-user/postgres.js +205 -9
- package/esm/commands/db/create-readonly-user/schema.js +35 -12
- package/esm/commands/db/create-readonly-user/utils.js +151 -22
- package/esm/commands/db/index.js +31 -44
- package/esm/commands/doppler/handler.js +92 -11
- package/esm/commands/doppler/index.js +6 -68
- package/esm/commands/doppler/schema.js +125 -15
- package/esm/commands/doppler/set-secret.js +370 -19
- package/esm/commands/doppler/utils/exec.js +100 -12
- package/esm/commands/doppler/utils.js +396 -34
- package/esm/commands/icons/handler.js +79 -8
- package/esm/commands/icons/index.js +4 -31
- package/esm/commands/icons/schema.js +97 -15
- package/esm/commands/icons/utils.js +125 -13
- package/esm/commands/index.js +47 -155
- package/esm/commands/schema.js +22 -7
- package/esm/index.js +3 -4
- package/package.json +5 -2
- package/vitest.config.ts +11 -0
- package/cjs/__chunks/2FSYDFUV.cjs +0 -146
- package/cjs/__chunks/3A5ZYU5M.cjs +0 -105
- package/cjs/__chunks/3BY5Y4W7.cjs +0 -1
- package/cjs/__chunks/3NOHGUCF.cjs +0 -9
- package/cjs/__chunks/3T2LXW7J.cjs +0 -387
- package/cjs/__chunks/4SFWHCB3.cjs +0 -133
- package/cjs/__chunks/4XT5JEAS.cjs +0 -1
- package/cjs/__chunks/AZEB4H4I.cjs +0 -208
- package/cjs/__chunks/B2KFW7T7.cjs +0 -1
- package/cjs/__chunks/B5ENMOCD.cjs +0 -288
- package/cjs/__chunks/B6XM5KSF.cjs +0 -338
- package/cjs/__chunks/BDU2UCE5.cjs +0 -1
- package/cjs/__chunks/BLMSMR5E.cjs +0 -46
- package/cjs/__chunks/CMUD7LLN.cjs +0 -47
- package/cjs/__chunks/DTQ2LB3I.cjs +0 -49
- package/cjs/__chunks/FM5MVRQF.cjs +0 -23
- package/cjs/__chunks/FRHST54J.cjs +0 -135
- package/cjs/__chunks/FU4VP2LN.cjs +0 -1
- package/cjs/__chunks/G5K4PVIL.cjs +0 -26
- package/cjs/__chunks/GU3R54MK.cjs +0 -127
- package/cjs/__chunks/GUL36IFZ.cjs +0 -61
- package/cjs/__chunks/GZMTNK5N.cjs +0 -1
- package/cjs/__chunks/H74JSDBU.cjs +0 -30
- package/cjs/__chunks/INFOPAHN.cjs +0 -117
- package/cjs/__chunks/J36P6UNE.cjs +0 -75
- package/cjs/__chunks/JB7T7PKQ.cjs +0 -538
- package/cjs/__chunks/JSL2JDMW.cjs +0 -1
- package/cjs/__chunks/K4QNHRTP.cjs +0 -163
- package/cjs/__chunks/KU76LC42.cjs +0 -192
- package/cjs/__chunks/LFDSHANP.cjs +0 -34
- package/cjs/__chunks/LHE24ECK.cjs +0 -192
- package/cjs/__chunks/LIKQ3SI4.cjs +0 -1
- package/cjs/__chunks/LXDF5QVZ.cjs +0 -313
- package/cjs/__chunks/LXOOJR2R.cjs +0 -74
- package/cjs/__chunks/N5MXFOQZ.cjs +0 -167
- package/cjs/__chunks/N7D56LPP.cjs +0 -25
- package/cjs/__chunks/NFXQNOQH.cjs +0 -393
- package/cjs/__chunks/NIMXXHJQ.cjs +0 -92
- package/cjs/__chunks/NLKJIUEX.cjs +0 -126
- package/cjs/__chunks/NT2XXAI6.cjs +0 -89
- package/cjs/__chunks/NWZGFHKH.cjs +0 -121
- package/cjs/__chunks/R3GUC7O7.cjs +0 -110
- package/cjs/__chunks/RPVAXPJ4.cjs +0 -1
- package/cjs/__chunks/S3LVCWPN.cjs +0 -23
- package/cjs/__chunks/SBBNW2BF.cjs +0 -249
- package/cjs/__chunks/T2A7TN4F.cjs +0 -81
- package/cjs/__chunks/TKNNDDIB.cjs +0 -97
- package/cjs/__chunks/TNSRDJPR.cjs +0 -1
- package/cjs/__chunks/UWHPE2GI.cjs +0 -20
- package/cjs/__chunks/W6K7BV74.cjs +0 -1
- package/cjs/__chunks/WBOQ6AUN.cjs +0 -320
- package/cjs/__chunks/WHGN5PZI.cjs +0 -299
- package/cjs/__chunks/WOYF2L6T.cjs +0 -11
- package/cjs/__chunks/X26XY2N6.cjs +0 -18
- package/cjs/__chunks/XMKOKRXZ.cjs +0 -16
- package/cjs/__chunks/XTJPQ3EX.cjs +0 -1
- package/cjs/__chunks/YRHFKTW2.cjs +0 -63
- package/cjs/__chunks/ZMDIOZPT.cjs +0 -22
- package/cjs/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.cjs +0 -28
- package/cjs/commands/aws/iam/policies/sts-federation.cjs +0 -19
- package/cjs/commands/aws/iam/policies/user-admins-deny-list.cjs +0 -183
- package/cjs/commands/aws/iam/policies/user-admins-deny-regions-list.cjs +0 -49
- package/cjs/commands/aws/iam/policies/user-admins-self-service-iam.cjs +0 -64
- package/cjs/commands/aws/iam/policies/user-admins-write-list.cjs +0 -125
- package/esm/__chunks/2FTTEFEK.js +0 -97
- package/esm/__chunks/33UYMUQD.js +0 -338
- package/esm/__chunks/3BKWTHLJ.js +0 -25
- package/esm/__chunks/3HE4BEJX.js +0 -105
- package/esm/__chunks/3QLI5BDL.js +0 -387
- package/esm/__chunks/5GIUAFXL.js +0 -89
- package/esm/__chunks/5ZBVGSOK.js +0 -0
- package/esm/__chunks/6G4PXXKF.js +0 -75
- package/esm/__chunks/73BJG53F.js +0 -11
- package/esm/__chunks/7VF4Q43Q.js +0 -0
- package/esm/__chunks/AEDEAYF5.js +0 -0
- package/esm/__chunks/AZCP3SFJ.js +0 -0
- package/esm/__chunks/B2DVQ2UL.js +0 -61
- package/esm/__chunks/CVQVHLW5.js +0 -0
- package/esm/__chunks/D62SPZXC.js +0 -0
- package/esm/__chunks/DLEJ25GZ.js +0 -121
- package/esm/__chunks/DMYFNF54.js +0 -192
- package/esm/__chunks/DNFTUMGD.js +0 -23
- package/esm/__chunks/DVKD6YSR.js +0 -49
- package/esm/__chunks/EMSH4P76.js +0 -20
- package/esm/__chunks/FFKFVMIE.js +0 -167
- package/esm/__chunks/FL7AILGH.js +0 -133
- package/esm/__chunks/FNXUONAV.js +0 -110
- package/esm/__chunks/G4NJHFFU.js +0 -320
- package/esm/__chunks/HJSXC6HP.js +0 -117
- package/esm/__chunks/IEOGAQYI.js +0 -46
- package/esm/__chunks/IZFGBYGE.js +0 -34
- package/esm/__chunks/J34UVKLA.js +0 -26
- package/esm/__chunks/JZPBBBIG.js +0 -74
- package/esm/__chunks/KWUJP5MG.js +0 -135
- package/esm/__chunks/M35URMT4.js +0 -313
- package/esm/__chunks/NF3M2L6C.js +0 -81
- package/esm/__chunks/O3CCA76Q.js +0 -22
- package/esm/__chunks/PNPPDYKC.js +0 -299
- package/esm/__chunks/QFXN4EHM.js +0 -393
- package/esm/__chunks/QKDDLIWD.js +0 -146
- package/esm/__chunks/QSE66AKY.js +0 -208
- package/esm/__chunks/QUF7PS4R.js +0 -18
- package/esm/__chunks/S7IJPJ4R.js +0 -126
- package/esm/__chunks/SD3E3EPH.js +0 -163
- package/esm/__chunks/SJXQJ7RS.js +0 -92
- package/esm/__chunks/SNCKIAOR.js +0 -0
- package/esm/__chunks/T3TTUHTW.js +0 -30
- package/esm/__chunks/TIOVE6HR.js +0 -0
- package/esm/__chunks/TXKMEIDQ.js +0 -0
- package/esm/__chunks/U7HAE2RF.js +0 -288
- package/esm/__chunks/UXWY7BYE.js +0 -63
- package/esm/__chunks/VKAKISRG.js +0 -192
- package/esm/__chunks/WD2YR6I7.js +0 -0
- package/esm/__chunks/WOZFZKFY.js +0 -0
- package/esm/__chunks/XI7GZDE2.js +0 -0
- package/esm/__chunks/XOUWDB3T.js +0 -249
- package/esm/__chunks/XQN2TA4S.js +0 -23
- package/esm/__chunks/XXK32TIM.js +0 -16
- package/esm/__chunks/YGWTVPZE.js +0 -538
- package/esm/__chunks/YRG7PT33.js +0 -127
- package/esm/__chunks/ZHKVJO2U.js +0 -47
- package/esm/__chunks/ZO55YUSY.js +0 -9
- package/esm/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.js +0 -28
- package/esm/commands/aws/iam/policies/sts-federation.js +0 -19
- package/esm/commands/aws/iam/policies/user-admins-deny-list.js +0 -183
- package/esm/commands/aws/iam/policies/user-admins-deny-regions-list.js +0 -49
- package/esm/commands/aws/iam/policies/user-admins-self-service-iam.js +0 -64
- package/esm/commands/aws/iam/policies/user-admins-write-list.js +0 -125
package/esm/__chunks/FL7AILGH.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CHANNEL_TEXT_MAP,
|
|
3
|
-
ICON_SIZE_MAP
|
|
4
|
-
} from "./6G4PXXKF.js";
|
|
5
|
-
|
|
6
|
-
// src/commands/icons/utils.js
|
|
7
|
-
import { execSync } from "child_process";
|
|
8
|
-
import { existsSync } from "fs";
|
|
9
|
-
import { join, resolve } from "path";
|
|
10
|
-
import chalk from "chalk";
|
|
11
|
-
function checkDependencies(verbose = false) {
|
|
12
|
-
if (verbose) {
|
|
13
|
-
console.log(chalk.blue("\n\u{1F50D} Checking dependencies..."));
|
|
14
|
-
}
|
|
15
|
-
try {
|
|
16
|
-
execSync("which magick", { stdio: "pipe" });
|
|
17
|
-
if (verbose) {
|
|
18
|
-
console.log(chalk.green(" \u2713 ImageMagick is installed"));
|
|
19
|
-
}
|
|
20
|
-
} catch {
|
|
21
|
-
throw new Error(
|
|
22
|
-
"ImageMagick is not installed. Please install it (brew install imagemagick) and try again."
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function validateBaseIcons(baseDir, iconTypes, verbose = false) {
|
|
27
|
-
if (verbose) {
|
|
28
|
-
console.log(chalk.blue("\n\u{1F4C1} Validating base icons..."));
|
|
29
|
-
}
|
|
30
|
-
const resolvedDir = resolve(baseDir);
|
|
31
|
-
if (!existsSync(resolvedDir)) {
|
|
32
|
-
throw new Error(`Input directory does not exist: ${resolvedDir}`);
|
|
33
|
-
}
|
|
34
|
-
const missingIcons = [];
|
|
35
|
-
for (const iconType of iconTypes) {
|
|
36
|
-
const iconPath = join(resolvedDir, `${iconType}.png`);
|
|
37
|
-
if (!existsSync(iconPath)) {
|
|
38
|
-
missingIcons.push(`${iconType}.png`);
|
|
39
|
-
} else if (verbose) {
|
|
40
|
-
console.log(chalk.green(` \u2713 Found: ${iconType}.png`));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (missingIcons.length > 0) {
|
|
44
|
-
throw new Error(
|
|
45
|
-
`Missing base icons in ${resolvedDir}: ${missingIcons.join(", ")}`
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function generateIcon(options) {
|
|
50
|
-
const { baseDir, channel, iconType, verbose } = options;
|
|
51
|
-
const resolvedDir = resolve(baseDir);
|
|
52
|
-
const inputFile = join(resolvedDir, `${iconType}.png`);
|
|
53
|
-
const outputFile = join(resolvedDir, `${iconType}-${channel}.png`);
|
|
54
|
-
const size = ICON_SIZE_MAP[
|
|
55
|
-
/** @type {keyof typeof ICON_SIZE_MAP} */
|
|
56
|
-
iconType
|
|
57
|
-
] || 378;
|
|
58
|
-
const text = CHANNEL_TEXT_MAP[
|
|
59
|
-
/** @type {keyof typeof CHANNEL_TEXT_MAP} */
|
|
60
|
-
channel
|
|
61
|
-
] || channel.toUpperCase().slice(0, 3);
|
|
62
|
-
const command = [
|
|
63
|
-
"magick",
|
|
64
|
-
`"${inputFile}"`,
|
|
65
|
-
`-pointsize ${size}`,
|
|
66
|
-
"-fill white",
|
|
67
|
-
"-gravity center",
|
|
68
|
-
"-font Arial-Black",
|
|
69
|
-
"-stroke black",
|
|
70
|
-
"-strokewidth 5",
|
|
71
|
-
`-draw "rotate -45 text 0,0 '${text}'"`,
|
|
72
|
-
`"${outputFile}"`
|
|
73
|
-
].join(" ");
|
|
74
|
-
if (verbose) {
|
|
75
|
-
console.log(chalk.gray(` Command: ${command}`));
|
|
76
|
-
}
|
|
77
|
-
try {
|
|
78
|
-
execSync(command, { stdio: verbose ? "inherit" : "pipe" });
|
|
79
|
-
return outputFile;
|
|
80
|
-
} catch (error) {
|
|
81
|
-
throw new Error(
|
|
82
|
-
`Failed to generate ${iconType}-${channel}.png: ${error instanceof Error ? error.message : String(error)}`
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
function generateAllIcons(options) {
|
|
87
|
-
const { baseDir, channels, iconTypes, verbose } = options;
|
|
88
|
-
const success = [];
|
|
89
|
-
const failed = [];
|
|
90
|
-
const totalIcons = channels.length * iconTypes.length;
|
|
91
|
-
let current = 0;
|
|
92
|
-
if (verbose) {
|
|
93
|
-
console.log(chalk.blue(`
|
|
94
|
-
\u{1F3A8} Generating ${totalIcons} icon(s)...`));
|
|
95
|
-
}
|
|
96
|
-
for (const channel of channels) {
|
|
97
|
-
for (const iconType of iconTypes) {
|
|
98
|
-
current++;
|
|
99
|
-
const iconName = `${iconType}-${channel}.png`;
|
|
100
|
-
if (verbose) {
|
|
101
|
-
console.log(
|
|
102
|
-
chalk.blue(`
|
|
103
|
-
[${current}/${totalIcons}] Generating ${iconName}...`)
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
try {
|
|
107
|
-
const outputPath = generateIcon({
|
|
108
|
-
baseDir,
|
|
109
|
-
channel,
|
|
110
|
-
iconType,
|
|
111
|
-
verbose
|
|
112
|
-
});
|
|
113
|
-
success.push(outputPath);
|
|
114
|
-
console.log(chalk.green(` \u2713 Generated: ${iconName}`));
|
|
115
|
-
} catch (error) {
|
|
116
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
117
|
-
failed.push({ icon: iconName, error: errorMessage });
|
|
118
|
-
console.log(chalk.red(` \u2717 Failed: ${iconName}`));
|
|
119
|
-
if (verbose) {
|
|
120
|
-
console.log(chalk.red(` ${errorMessage}`));
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return { success, failed };
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export {
|
|
129
|
-
checkDependencies,
|
|
130
|
-
validateBaseIcons,
|
|
131
|
-
generateIcon,
|
|
132
|
-
generateAllIcons
|
|
133
|
-
};
|
package/esm/__chunks/FNXUONAV.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
// src/commands/aws/utils/exec-aws.js
|
|
2
|
-
import { spawnSync } from "child_process";
|
|
3
|
-
import chalk from "chalk";
|
|
4
|
-
var AwsCliError = class extends Error {
|
|
5
|
-
/**
|
|
6
|
-
* @param {string} message
|
|
7
|
-
* @param {string | null} [code]
|
|
8
|
-
*/
|
|
9
|
-
constructor(message, code = null) {
|
|
10
|
-
super(message);
|
|
11
|
-
this.name = "AwsCliError";
|
|
12
|
-
this.code = code;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
function parseAwsErrorCode(stderr) {
|
|
16
|
-
const match = /\(([A-Za-z.]+)\)/.exec(stderr);
|
|
17
|
-
return match?.[1] ?? null;
|
|
18
|
-
}
|
|
19
|
-
function requireCommands(commands) {
|
|
20
|
-
const missing = commands.filter((command) => {
|
|
21
|
-
const result = spawnSync("which", [command], { stdio: "pipe" });
|
|
22
|
-
return result.status !== 0;
|
|
23
|
-
});
|
|
24
|
-
if (missing.length > 0) {
|
|
25
|
-
throw new Error(
|
|
26
|
-
`Required command(s) not found on PATH: ${missing.join(", ")}`
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function runAws(params) {
|
|
31
|
-
const {
|
|
32
|
-
profile,
|
|
33
|
-
region,
|
|
34
|
-
args,
|
|
35
|
-
expectJson = true,
|
|
36
|
-
verbose = false,
|
|
37
|
-
env
|
|
38
|
-
} = params;
|
|
39
|
-
const finalArgs = [];
|
|
40
|
-
if (profile) finalArgs.push("--profile", profile);
|
|
41
|
-
if (region) finalArgs.push("--region", region);
|
|
42
|
-
finalArgs.push("--no-cli-pager", ...args);
|
|
43
|
-
if (expectJson) finalArgs.push("--output", "json");
|
|
44
|
-
return spawnAws("aws", finalArgs, { expectJson, verbose, env });
|
|
45
|
-
}
|
|
46
|
-
function runAwsVault(params) {
|
|
47
|
-
const {
|
|
48
|
-
profile,
|
|
49
|
-
args,
|
|
50
|
-
duration = "15m",
|
|
51
|
-
expectJson = true,
|
|
52
|
-
verbose = false
|
|
53
|
-
} = params;
|
|
54
|
-
const awsArgs = ["--no-cli-pager", ...args];
|
|
55
|
-
if (expectJson) awsArgs.push("--output", "json");
|
|
56
|
-
const finalArgs = [
|
|
57
|
-
"exec",
|
|
58
|
-
profile,
|
|
59
|
-
"--duration",
|
|
60
|
-
duration,
|
|
61
|
-
"--",
|
|
62
|
-
"aws",
|
|
63
|
-
...awsArgs
|
|
64
|
-
];
|
|
65
|
-
return spawnAws("aws-vault", finalArgs, { expectJson, verbose });
|
|
66
|
-
}
|
|
67
|
-
function spawnAws(command, args, options) {
|
|
68
|
-
const { expectJson, verbose, env } = options;
|
|
69
|
-
if (verbose) {
|
|
70
|
-
console.log(chalk.gray(` Executing: ${command} ${args.join(" ")}`));
|
|
71
|
-
}
|
|
72
|
-
const result = spawnSync(command, args, {
|
|
73
|
-
encoding: "utf-8",
|
|
74
|
-
env: env ? { ...process.env, ...env } : process.env
|
|
75
|
-
});
|
|
76
|
-
if (result.error) {
|
|
77
|
-
throw new AwsCliError(result.error.message);
|
|
78
|
-
}
|
|
79
|
-
if (result.status !== 0) {
|
|
80
|
-
const stderr = (result.stderr || result.stdout || "").trim();
|
|
81
|
-
const message = stderr || `Command failed: ${command} ${args.join(" ")}`;
|
|
82
|
-
throw new AwsCliError(message, parseAwsErrorCode(stderr));
|
|
83
|
-
}
|
|
84
|
-
const stdout = (result.stdout ?? "").trim();
|
|
85
|
-
if (!expectJson) {
|
|
86
|
-
return stdout;
|
|
87
|
-
}
|
|
88
|
-
if (!stdout) {
|
|
89
|
-
return {};
|
|
90
|
-
}
|
|
91
|
-
return JSON.parse(stdout);
|
|
92
|
-
}
|
|
93
|
-
function getCallerIdentity(params) {
|
|
94
|
-
const { profile, region, verbose } = params;
|
|
95
|
-
return runAws({
|
|
96
|
-
profile,
|
|
97
|
-
region,
|
|
98
|
-
args: ["sts", "get-caller-identity"],
|
|
99
|
-
verbose
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export {
|
|
104
|
-
AwsCliError,
|
|
105
|
-
parseAwsErrorCode,
|
|
106
|
-
requireCommands,
|
|
107
|
-
runAws,
|
|
108
|
-
runAwsVault,
|
|
109
|
-
getCallerIdentity
|
|
110
|
-
};
|
package/esm/__chunks/G4NJHFFU.js
DELETED
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
findCnameConflicts,
|
|
3
|
-
findHostedZone,
|
|
4
|
-
formatValues,
|
|
5
|
-
getRecordSetsAtName,
|
|
6
|
-
hostedZoneLabel,
|
|
7
|
-
listHostedZones,
|
|
8
|
-
normalizeRecordValue,
|
|
9
|
-
planRecordChange,
|
|
10
|
-
resolveRecordName,
|
|
11
|
-
upsertResourceRecordSet,
|
|
12
|
-
withoutTrailingDot
|
|
13
|
-
} from "./33UYMUQD.js";
|
|
14
|
-
import {
|
|
15
|
-
DEFAULT_TTL,
|
|
16
|
-
RECORD_TYPES,
|
|
17
|
-
addRecordOptionsSchema
|
|
18
|
-
} from "./IEOGAQYI.js";
|
|
19
|
-
import {
|
|
20
|
-
AwsCliError,
|
|
21
|
-
getCallerIdentity,
|
|
22
|
-
requireCommands
|
|
23
|
-
} from "./FNXUONAV.js";
|
|
24
|
-
import {
|
|
25
|
-
resolveProfile
|
|
26
|
-
} from "./5GIUAFXL.js";
|
|
27
|
-
import {
|
|
28
|
-
prompt,
|
|
29
|
-
promptChoice,
|
|
30
|
-
promptYesNo
|
|
31
|
-
} from "./ZHKVJO2U.js";
|
|
32
|
-
|
|
33
|
-
// src/commands/aws/route53/add-record/handler.js
|
|
34
|
-
import chalk from "chalk";
|
|
35
|
-
import { ZodError } from "zod";
|
|
36
|
-
async function resolveHostedZone(params) {
|
|
37
|
-
const { profile, zoneOption, verbose } = params;
|
|
38
|
-
const zones = listHostedZones({ profile, verbose });
|
|
39
|
-
if (zones.length === 0) {
|
|
40
|
-
throw new Error("No Route53 hosted zones found for this profile.");
|
|
41
|
-
}
|
|
42
|
-
if (zoneOption) {
|
|
43
|
-
const match = findHostedZone({ zones, zoneInput: zoneOption });
|
|
44
|
-
if (!match) {
|
|
45
|
-
throw new Error(
|
|
46
|
-
`No hosted zone matching "${zoneOption}". Available: ${zones.map((z) => withoutTrailingDot(z.name)).join(", ")}`
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
return match;
|
|
50
|
-
}
|
|
51
|
-
const index = await promptChoice({
|
|
52
|
-
message: "Choose a hosted zone:",
|
|
53
|
-
options: zones.map((zone) => hostedZoneLabel(zone))
|
|
54
|
-
});
|
|
55
|
-
const chosen = zones[index];
|
|
56
|
-
if (!chosen) {
|
|
57
|
-
throw new Error("No hosted zone selected");
|
|
58
|
-
}
|
|
59
|
-
return chosen;
|
|
60
|
-
}
|
|
61
|
-
async function resolveRecordType(typeOption) {
|
|
62
|
-
if (typeOption) {
|
|
63
|
-
return typeOption.toUpperCase();
|
|
64
|
-
}
|
|
65
|
-
const index = await promptChoice({
|
|
66
|
-
message: "Choose a record type:",
|
|
67
|
-
options: RECORD_TYPES
|
|
68
|
-
});
|
|
69
|
-
const chosen = RECORD_TYPES[index];
|
|
70
|
-
if (!chosen) {
|
|
71
|
-
throw new Error("No record type selected");
|
|
72
|
-
}
|
|
73
|
-
return chosen;
|
|
74
|
-
}
|
|
75
|
-
async function resolveName(params) {
|
|
76
|
-
const { nameOption, zoneName } = params;
|
|
77
|
-
let input = nameOption;
|
|
78
|
-
if (!input) {
|
|
79
|
-
input = await prompt(
|
|
80
|
-
`Record name (relative to ${withoutTrailingDot(zoneName)}, or FQDN; @ for apex): `
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
if (!input) {
|
|
84
|
-
throw new Error("Record name is required");
|
|
85
|
-
}
|
|
86
|
-
return resolveRecordName({ nameInput: input, zoneName });
|
|
87
|
-
}
|
|
88
|
-
async function resolveValue(params) {
|
|
89
|
-
const { valueOption, type } = params;
|
|
90
|
-
let input = valueOption;
|
|
91
|
-
if (!input) {
|
|
92
|
-
const hint = type === "CNAME" ? " (e.g. target.example.com.)" : type === "TXT" ? " (quotes added if omitted)" : "";
|
|
93
|
-
input = await prompt(`Record value${hint}: `);
|
|
94
|
-
}
|
|
95
|
-
if (!input) {
|
|
96
|
-
throw new Error("Record value is required");
|
|
97
|
-
}
|
|
98
|
-
return normalizeRecordValue({ type, value: input });
|
|
99
|
-
}
|
|
100
|
-
async function resolveChangeMode(params) {
|
|
101
|
-
const { existing, type } = params;
|
|
102
|
-
if (type === "CNAME" || existing.values.length <= 1) {
|
|
103
|
-
return "replace";
|
|
104
|
-
}
|
|
105
|
-
console.log("");
|
|
106
|
-
console.log(
|
|
107
|
-
chalk.yellow(
|
|
108
|
-
`Existing ${type} record has ${existing.values.length} values:${formatValues(existing.values)}`
|
|
109
|
-
)
|
|
110
|
-
);
|
|
111
|
-
const append = await promptYesNo({
|
|
112
|
-
message: "Add to the existing values instead of replacing them?",
|
|
113
|
-
defaultYes: false
|
|
114
|
-
});
|
|
115
|
-
return append ? "append" : "replace";
|
|
116
|
-
}
|
|
117
|
-
async function addRecordCommand(options) {
|
|
118
|
-
try {
|
|
119
|
-
const {
|
|
120
|
-
profile: profileOption,
|
|
121
|
-
zone: zoneOption,
|
|
122
|
-
type: typeOption,
|
|
123
|
-
name: nameOption,
|
|
124
|
-
value: valueOption,
|
|
125
|
-
ttl: ttlOption,
|
|
126
|
-
yes,
|
|
127
|
-
dryRun,
|
|
128
|
-
verbose
|
|
129
|
-
} = addRecordOptionsSchema.parse(options);
|
|
130
|
-
const profile = await resolveProfile({ profile: profileOption });
|
|
131
|
-
if (!profile) {
|
|
132
|
-
console.error(chalk.red("Error: pass --profile or set AWS_PROFILE."));
|
|
133
|
-
process.exit(1);
|
|
134
|
-
}
|
|
135
|
-
requireCommands(["aws"]);
|
|
136
|
-
const identity = getCallerIdentity({ profile, verbose });
|
|
137
|
-
console.log("Caller:");
|
|
138
|
-
console.log(` Account: ${identity.Account}`);
|
|
139
|
-
console.log(` Arn: ${identity.Arn}`);
|
|
140
|
-
console.log("");
|
|
141
|
-
const zone = await resolveHostedZone({
|
|
142
|
-
profile,
|
|
143
|
-
zoneOption,
|
|
144
|
-
verbose
|
|
145
|
-
});
|
|
146
|
-
console.log(`Hosted zone: ${hostedZoneLabel(zone)}`);
|
|
147
|
-
console.log("");
|
|
148
|
-
const type = await resolveRecordType(typeOption);
|
|
149
|
-
const name = await resolveName({ nameOption, zoneName: zone.name });
|
|
150
|
-
const value = await resolveValue({ valueOption, type });
|
|
151
|
-
const ttl = ttlOption ?? DEFAULT_TTL;
|
|
152
|
-
console.log("");
|
|
153
|
-
console.log("Proposed record:");
|
|
154
|
-
console.log(` Name: ${withoutTrailingDot(name)}`);
|
|
155
|
-
console.log(` Type: ${type}`);
|
|
156
|
-
console.log(` TTL: ${ttl}`);
|
|
157
|
-
console.log(` Value: ${value}`);
|
|
158
|
-
console.log("");
|
|
159
|
-
const existingSets = getRecordSetsAtName({
|
|
160
|
-
profile,
|
|
161
|
-
hostedZoneId: zone.id,
|
|
162
|
-
name,
|
|
163
|
-
verbose
|
|
164
|
-
});
|
|
165
|
-
const existing = existingSets.find((set) => set.type === type) ?? null;
|
|
166
|
-
const conflicts = findCnameConflicts({ existingSets, type });
|
|
167
|
-
if (conflicts.length > 0) {
|
|
168
|
-
console.error(
|
|
169
|
-
chalk.red(
|
|
170
|
-
`\u274C Conflict: cannot add a ${type} record at ${withoutTrailingDot(name)}.`
|
|
171
|
-
)
|
|
172
|
-
);
|
|
173
|
-
console.error("");
|
|
174
|
-
console.error(
|
|
175
|
-
chalk.yellow(
|
|
176
|
-
"Route53 does not allow a CNAME and any other record type to coexist at the same name. Conflicting record(s) already exist:"
|
|
177
|
-
)
|
|
178
|
-
);
|
|
179
|
-
for (const conflict of conflicts) {
|
|
180
|
-
console.error(
|
|
181
|
-
` ${conflict.type} ${withoutTrailingDot(conflict.name)}${formatValues(
|
|
182
|
-
conflict.isAlias ? ["(alias)"] : conflict.values
|
|
183
|
-
)}`
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
console.error("");
|
|
187
|
-
console.error(
|
|
188
|
-
chalk.yellow(
|
|
189
|
-
"Remove the conflicting record, then re-create the one you wanted:"
|
|
190
|
-
)
|
|
191
|
-
);
|
|
192
|
-
const zoneName = withoutTrailingDot(zone.name);
|
|
193
|
-
const displayName = withoutTrailingDot(name);
|
|
194
|
-
const quotedValue = /^[A-Za-z0-9._:@/-]+$/.test(value) ? value : `"${value}"`;
|
|
195
|
-
const ttlFlag = ttl === DEFAULT_TTL ? "" : ` --ttl ${ttl}`;
|
|
196
|
-
let step = 1;
|
|
197
|
-
for (const conflict of conflicts) {
|
|
198
|
-
console.error(
|
|
199
|
-
chalk.cyan(
|
|
200
|
-
` ${step++}. mtn aws route53 remove-record -z ${zoneName} -t ${conflict.type} -n ${displayName}`
|
|
201
|
-
)
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
console.error(
|
|
205
|
-
chalk.cyan(
|
|
206
|
-
` ${step}. mtn aws route53 add-record -z ${zoneName} -t ${type} -n ${displayName} --value ${quotedValue}${ttlFlag}`
|
|
207
|
-
)
|
|
208
|
-
);
|
|
209
|
-
process.exit(1);
|
|
210
|
-
}
|
|
211
|
-
if (existing?.isAlias) {
|
|
212
|
-
console.log(
|
|
213
|
-
chalk.yellow(
|
|
214
|
-
"An ALIAS record already exists at this name + type. Continuing will replace it with a standard record set."
|
|
215
|
-
)
|
|
216
|
-
);
|
|
217
|
-
console.log("");
|
|
218
|
-
} else if (existing) {
|
|
219
|
-
console.log(
|
|
220
|
-
chalk.yellow(
|
|
221
|
-
`Existing ${type} record at ${withoutTrailingDot(name)}:${formatValues(existing.values)}`
|
|
222
|
-
)
|
|
223
|
-
);
|
|
224
|
-
if (existing.ttl !== void 0) {
|
|
225
|
-
console.log(` TTL: ${existing.ttl}`);
|
|
226
|
-
}
|
|
227
|
-
console.log("");
|
|
228
|
-
} else {
|
|
229
|
-
console.log(
|
|
230
|
-
chalk.green(
|
|
231
|
-
`No existing ${type} record at ${withoutTrailingDot(name)}.`
|
|
232
|
-
)
|
|
233
|
-
);
|
|
234
|
-
console.log("");
|
|
235
|
-
}
|
|
236
|
-
let mode = "replace";
|
|
237
|
-
if (existing && !existing.isAlias && existing.values.length > 0) {
|
|
238
|
-
mode = await resolveChangeMode({ existing, type });
|
|
239
|
-
}
|
|
240
|
-
const plan = planRecordChange({ existing, newValue: value, mode });
|
|
241
|
-
console.log(plan.summary);
|
|
242
|
-
console.log("");
|
|
243
|
-
if (plan.action === "noop") {
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
if (plan.action === "overwrite" || plan.action === "append") {
|
|
247
|
-
console.log("Final values that will be written:");
|
|
248
|
-
for (const finalValue of plan.finalValues) {
|
|
249
|
-
console.log(` - ${finalValue}`);
|
|
250
|
-
}
|
|
251
|
-
console.log("");
|
|
252
|
-
}
|
|
253
|
-
if (dryRun) {
|
|
254
|
-
console.log(chalk.cyan("Dry run \u2014 no changes made."));
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
if (!yes) {
|
|
258
|
-
const confirmed = await promptYesNo({
|
|
259
|
-
message: plan.action === "create" ? "Create this record?" : plan.action === "append" ? "Add this value to the existing record?" : "Overwrite the existing record?",
|
|
260
|
-
defaultYes: false
|
|
261
|
-
});
|
|
262
|
-
if (!confirmed) {
|
|
263
|
-
console.log("Aborted.");
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
const changeInfo = upsertResourceRecordSet({
|
|
268
|
-
profile,
|
|
269
|
-
hostedZoneId: zone.id,
|
|
270
|
-
name,
|
|
271
|
-
type,
|
|
272
|
-
ttl: existing?.ttl ?? ttl,
|
|
273
|
-
values: plan.finalValues,
|
|
274
|
-
verbose
|
|
275
|
-
});
|
|
276
|
-
console.log("");
|
|
277
|
-
console.log(
|
|
278
|
-
chalk.green(
|
|
279
|
-
`Done. ${plan.action === "create" ? "Created" : plan.action === "append" ? "Updated (appended)" : "Updated (overwrote)"} ${type} ${withoutTrailingDot(name)}.`
|
|
280
|
-
)
|
|
281
|
-
);
|
|
282
|
-
if (changeInfo?.Id) {
|
|
283
|
-
console.log(` Change ID: ${changeInfo.Id}`);
|
|
284
|
-
console.log(` Status: ${changeInfo.Status ?? "PENDING"}`);
|
|
285
|
-
}
|
|
286
|
-
} catch (error) {
|
|
287
|
-
if (error instanceof ZodError) {
|
|
288
|
-
console.error(chalk.red("\n\u274C Invalid command options:"));
|
|
289
|
-
error.errors.forEach((err) => {
|
|
290
|
-
console.error(chalk.red(` ${err.path.join(".")}: ${err.message}`));
|
|
291
|
-
});
|
|
292
|
-
process.exit(1);
|
|
293
|
-
}
|
|
294
|
-
const verbose = (
|
|
295
|
-
/** @type {any} */
|
|
296
|
-
options?.verbose || false
|
|
297
|
-
);
|
|
298
|
-
console.error(chalk.red("\n\u274C add-record failed:"));
|
|
299
|
-
if (error instanceof AwsCliError || error instanceof Error) {
|
|
300
|
-
console.error(chalk.red(` ${error.message}`));
|
|
301
|
-
if (verbose && error.stack) {
|
|
302
|
-
console.error(chalk.gray("\nStack trace:"));
|
|
303
|
-
console.error(chalk.gray(error.stack));
|
|
304
|
-
}
|
|
305
|
-
} else {
|
|
306
|
-
console.error(chalk.red(` ${String(error)}`));
|
|
307
|
-
}
|
|
308
|
-
console.error(
|
|
309
|
-
chalk.yellow("\n\u{1F4A1} Use --verbose for detailed error information\n")
|
|
310
|
-
);
|
|
311
|
-
process.exit(1);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
export {
|
|
316
|
-
resolveHostedZone,
|
|
317
|
-
resolveRecordType,
|
|
318
|
-
resolveName,
|
|
319
|
-
addRecordCommand
|
|
320
|
-
};
|
package/esm/__chunks/HJSXC6HP.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
checkDependencies,
|
|
3
|
-
generateAllIcons,
|
|
4
|
-
validateBaseIcons
|
|
5
|
-
} from "./FL7AILGH.js";
|
|
6
|
-
import {
|
|
7
|
-
iconsCommandMetadata,
|
|
8
|
-
iconsCommandOptionsSchema
|
|
9
|
-
} from "./6G4PXXKF.js";
|
|
10
|
-
|
|
11
|
-
// src/commands/icons/handler.js
|
|
12
|
-
import chalk from "chalk";
|
|
13
|
-
import { ZodError } from "zod";
|
|
14
|
-
async function iconsCommand(options) {
|
|
15
|
-
try {
|
|
16
|
-
const validatedOptions = iconsCommandOptionsSchema.parse(options);
|
|
17
|
-
if (validatedOptions.help) {
|
|
18
|
-
console.log(chalk.bold(`
|
|
19
|
-
Usage: mtn icons <input> [options]`));
|
|
20
|
-
console.log(chalk.gray(iconsCommandMetadata.description));
|
|
21
|
-
console.log(chalk.bold("\nOptions:"));
|
|
22
|
-
Object.entries(iconsCommandOptionsSchema.shape).forEach(
|
|
23
|
-
([key, fieldSchema]) => {
|
|
24
|
-
if (key === "input") return;
|
|
25
|
-
const description = fieldSchema.description || "No description available";
|
|
26
|
-
const optionMeta = (
|
|
27
|
-
/** @type {any} */
|
|
28
|
-
iconsCommandMetadata.options[key]
|
|
29
|
-
);
|
|
30
|
-
const defaultValue = optionMeta?.default ?? false;
|
|
31
|
-
const alias = optionMeta?.alias ? chalk.cyan(`, -${optionMeta.alias}`) : "";
|
|
32
|
-
console.log(
|
|
33
|
-
chalk.cyan(` --${key}`) + alias + ` ${description} (default: ${defaultValue})`
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
console.log("");
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const { input, channels, iconTypes, verbose } = validatedOptions;
|
|
41
|
-
if (verbose) {
|
|
42
|
-
console.log(chalk.blue("\n\u{1F4F1} Icon Generation"));
|
|
43
|
-
console.log(chalk.gray(` Input directory: ${input}`));
|
|
44
|
-
console.log(chalk.gray(` Channels: ${channels.join(", ")}`));
|
|
45
|
-
console.log(chalk.gray(` Icon types: ${iconTypes.join(", ")}`));
|
|
46
|
-
}
|
|
47
|
-
checkDependencies(verbose);
|
|
48
|
-
validateBaseIcons(input, iconTypes, verbose);
|
|
49
|
-
const result = generateAllIcons({
|
|
50
|
-
baseDir: input,
|
|
51
|
-
channels,
|
|
52
|
-
iconTypes,
|
|
53
|
-
verbose
|
|
54
|
-
});
|
|
55
|
-
console.log(chalk.bold("\n\u{1F4CA} Summary:"));
|
|
56
|
-
console.log(
|
|
57
|
-
chalk.green(
|
|
58
|
-
` \u2713 Successfully generated: ${result.success.length} icon(s)`
|
|
59
|
-
)
|
|
60
|
-
);
|
|
61
|
-
if (result.failed.length > 0) {
|
|
62
|
-
console.log(chalk.red(` \u2717 Failed: ${result.failed.length} icon(s)`));
|
|
63
|
-
result.failed.forEach(({ icon, error }) => {
|
|
64
|
-
console.log(chalk.red(` - ${icon}: ${error}`));
|
|
65
|
-
});
|
|
66
|
-
process.exit(1);
|
|
67
|
-
}
|
|
68
|
-
console.log(chalk.green(`
|
|
69
|
-
\u2705 All icons generated successfully!`));
|
|
70
|
-
} catch (error) {
|
|
71
|
-
if (error instanceof ZodError) {
|
|
72
|
-
console.error(chalk.red(`
|
|
73
|
-
\u274C Invalid command options:`));
|
|
74
|
-
error.errors.forEach((err) => {
|
|
75
|
-
console.error(chalk.red(` ${err.path.join(".")}: ${err.message}`));
|
|
76
|
-
});
|
|
77
|
-
process.exit(1);
|
|
78
|
-
}
|
|
79
|
-
const verbose = (
|
|
80
|
-
/** @type {any} */
|
|
81
|
-
options?.verbose || false
|
|
82
|
-
);
|
|
83
|
-
console.error(chalk.red(`
|
|
84
|
-
\u274C Icon generation failed:`));
|
|
85
|
-
if (error instanceof Error) {
|
|
86
|
-
console.error(chalk.red(` ${error.message}`));
|
|
87
|
-
if (verbose && error.stack) {
|
|
88
|
-
console.error(chalk.gray("\nStack trace:"));
|
|
89
|
-
console.error(chalk.gray(error.stack));
|
|
90
|
-
}
|
|
91
|
-
} else {
|
|
92
|
-
console.error(chalk.red(` ${String(error)}`));
|
|
93
|
-
}
|
|
94
|
-
console.error(chalk.yellow("\n\u{1F4A1} Troubleshooting tips:"));
|
|
95
|
-
console.error(
|
|
96
|
-
chalk.yellow(
|
|
97
|
-
" \u2022 Ensure ImageMagick is installed (brew install imagemagick)"
|
|
98
|
-
)
|
|
99
|
-
);
|
|
100
|
-
console.error(
|
|
101
|
-
chalk.yellow(
|
|
102
|
-
" \u2022 Make sure icon.png and adaptive-icon.png exist in the input directory"
|
|
103
|
-
)
|
|
104
|
-
);
|
|
105
|
-
console.error(
|
|
106
|
-
chalk.yellow(" \u2022 Verify the input directory path is correct")
|
|
107
|
-
);
|
|
108
|
-
console.error(
|
|
109
|
-
chalk.yellow(" \u2022 Use --verbose for detailed error information\n")
|
|
110
|
-
);
|
|
111
|
-
process.exit(1);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export {
|
|
116
|
-
iconsCommand
|
|
117
|
-
};
|