@mtndev/cli 0.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/cjs/__chunks/4SFWHCB3.cjs +133 -0
- package/cjs/__chunks/B2KFW7T7.cjs +1 -0
- package/cjs/__chunks/EMMC33QA.cjs +401 -0
- package/cjs/__chunks/FEZT3HUT.cjs +52 -0
- package/cjs/__chunks/INFOPAHN.cjs +117 -0
- package/cjs/__chunks/J36P6UNE.cjs +75 -0
- package/cjs/__chunks/LQMP4ZKY.cjs +22 -0
- package/cjs/__chunks/NIMXXHJQ.cjs +92 -0
- package/cjs/__chunks/WNJ3ZYLI.cjs +1 -0
- package/cjs/__chunks/YCCIX4ZQ.cjs +100 -0
- package/cjs/commands/doppler/handler.cjs +9 -0
- package/cjs/commands/doppler/handler.d.ts +5 -0
- package/cjs/commands/doppler/index.cjs +41 -0
- package/cjs/commands/doppler/index.d.ts +3 -0
- package/cjs/commands/doppler/schema.cjs +8 -0
- package/cjs/commands/doppler/schema.d.ts +50 -0
- package/cjs/commands/doppler/utils/exec.cjs +12 -0
- package/cjs/commands/doppler/utils/exec.d.ts +52 -0
- package/cjs/commands/doppler/utils.cjs +30 -0
- package/cjs/commands/doppler/utils.d.ts +69 -0
- package/cjs/commands/icons/handler.cjs +8 -0
- package/cjs/commands/icons/handler.d.ts +5 -0
- package/cjs/commands/icons/index.cjs +31 -0
- package/cjs/commands/icons/index.d.ts +3 -0
- package/cjs/commands/icons/schema.cjs +16 -0
- package/cjs/commands/icons/schema.d.ts +86 -0
- package/cjs/commands/icons/utils.cjs +13 -0
- package/cjs/commands/icons/utils.d.ts +52 -0
- package/cjs/commands/index.cjs +84 -0
- package/cjs/commands/index.d.ts +2 -0
- package/cjs/commands/schema.cjs +8 -0
- package/cjs/commands/schema.d.ts +26 -0
- package/cjs/index.cjs +5 -0
- package/cjs/index.d.ts +2 -0
- package/esm/__chunks/46HGXFME.js +0 -0
- package/esm/__chunks/6G4PXXKF.js +75 -0
- package/esm/__chunks/FL7AILGH.js +133 -0
- package/esm/__chunks/HJSXC6HP.js +117 -0
- package/esm/__chunks/O262GK4B.js +401 -0
- package/esm/__chunks/OXGTO4KT.js +22 -0
- package/esm/__chunks/QSRTFPAA.js +100 -0
- package/esm/__chunks/SJXQJ7RS.js +92 -0
- package/esm/__chunks/SNCKIAOR.js +0 -0
- package/esm/__chunks/XPAQNFHZ.js +52 -0
- package/esm/commands/doppler/handler.d.ts +5 -0
- package/esm/commands/doppler/handler.js +9 -0
- package/esm/commands/doppler/index.d.ts +3 -0
- package/esm/commands/doppler/index.js +41 -0
- package/esm/commands/doppler/schema.d.ts +50 -0
- package/esm/commands/doppler/schema.js +8 -0
- package/esm/commands/doppler/utils/exec.d.ts +52 -0
- package/esm/commands/doppler/utils/exec.js +12 -0
- package/esm/commands/doppler/utils.d.ts +69 -0
- package/esm/commands/doppler/utils.js +30 -0
- package/esm/commands/icons/handler.d.ts +5 -0
- package/esm/commands/icons/handler.js +8 -0
- package/esm/commands/icons/index.d.ts +3 -0
- package/esm/commands/icons/index.js +31 -0
- package/esm/commands/icons/schema.d.ts +86 -0
- package/esm/commands/icons/schema.js +16 -0
- package/esm/commands/icons/utils.d.ts +52 -0
- package/esm/commands/icons/utils.js +13 -0
- package/esm/commands/index.d.ts +2 -0
- package/esm/commands/index.js +84 -0
- package/esm/commands/schema.d.ts +26 -0
- package/esm/commands/schema.js +8 -0
- package/esm/index.d.ts +2 -0
- package/esm/index.js +5 -0
- package/package.json +59 -0
- package/utils/input/package.json +8 -0
- package/utils/package/package.json +8 -0
- package/utils/validation/package.json +8 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execute a doppler command and return the result
|
|
3
|
+
* @param {string[]} args - Command arguments
|
|
4
|
+
* @param {'string' | 'json'} parser - How to parse the output
|
|
5
|
+
* @param {boolean} silent - Suppress output
|
|
6
|
+
* @param {boolean} verbose - Show verbose output
|
|
7
|
+
* @returns {string | any}
|
|
8
|
+
*/
|
|
9
|
+
export function execDoppler(args: string[], parser?: "string" | "json", silent?: boolean, verbose?: boolean): string | any;
|
|
10
|
+
/**
|
|
11
|
+
* Check if doppler CLI is installed and configured
|
|
12
|
+
* @param {boolean} verbose - Show verbose output
|
|
13
|
+
*/
|
|
14
|
+
export function checkDependencies(verbose?: boolean): void;
|
|
15
|
+
/**
|
|
16
|
+
* Get list of configurations based on environment parameter
|
|
17
|
+
* @param {string} environment - Environment name ('all', 'dev', 'stg', 'prd', etc.)
|
|
18
|
+
* @param {boolean} verbose - Show verbose output
|
|
19
|
+
* @returns {string[]}
|
|
20
|
+
*/
|
|
21
|
+
export function getConfigs(environment: string, verbose?: boolean): string[];
|
|
22
|
+
/**
|
|
23
|
+
* Normalize escape sequences in file content
|
|
24
|
+
* @param {string} content - File content
|
|
25
|
+
* @returns {string}
|
|
26
|
+
*/
|
|
27
|
+
export function normalizeEscapeSequences(content: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Create a unified diff between two strings
|
|
30
|
+
* @param {string} oldContent - Original content
|
|
31
|
+
* @param {string} newContent - New content
|
|
32
|
+
* @returns {string[]}
|
|
33
|
+
*/
|
|
34
|
+
export function createDiff(oldContent: string, newContent: string): string[];
|
|
35
|
+
/**
|
|
36
|
+
* Prompt user for confirmation
|
|
37
|
+
* @param {string} message - Prompt message
|
|
38
|
+
* @returns {Promise<boolean>}
|
|
39
|
+
*/
|
|
40
|
+
export function promptConfirmation(message: string): Promise<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* Download configurations from Doppler
|
|
43
|
+
* @param {{
|
|
44
|
+
* verbose: boolean;
|
|
45
|
+
* environment: string;
|
|
46
|
+
* }} options - Options for downloading configurations
|
|
47
|
+
*/
|
|
48
|
+
export function downloadConfigs(options: {
|
|
49
|
+
verbose: boolean;
|
|
50
|
+
environment: string;
|
|
51
|
+
}): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Upload configurations to Doppler
|
|
54
|
+
* @param {{
|
|
55
|
+
* environment: string;
|
|
56
|
+
* verbose: boolean;
|
|
57
|
+
* }} options - Options for uploading configurations
|
|
58
|
+
*/
|
|
59
|
+
export function uploadConfigs(options: {
|
|
60
|
+
environment: string;
|
|
61
|
+
verbose: boolean;
|
|
62
|
+
}): Promise<void>;
|
|
63
|
+
export type VerbosityLevel = import("./utils/exec.js").VerbosityLevel;
|
|
64
|
+
export type ExecOptions = import("./utils/exec.js").ExecOptions;
|
|
65
|
+
import { exec } from "./utils/exec.js";
|
|
66
|
+
import { execString } from "./utils/exec.js";
|
|
67
|
+
import { execJson } from "./utils/exec.js";
|
|
68
|
+
import { execNumber } from "./utils/exec.js";
|
|
69
|
+
export { exec, execString, execJson, execNumber };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _INFOPAHNcjs = require('../../__chunks/INFOPAHN.cjs');
|
|
4
|
+
require('../../__chunks/4SFWHCB3.cjs');
|
|
5
|
+
require('../../__chunks/J36P6UNE.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.iconsCommand = _INFOPAHNcjs.iconsCommand;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../__chunks/B2KFW7T7.cjs');
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _INFOPAHNcjs = require('../../__chunks/INFOPAHN.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _4SFWHCB3cjs = require('../../__chunks/4SFWHCB3.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _J36P6UNEcjs = require('../../__chunks/J36P6UNE.cjs');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
exports.CHANNELS = _J36P6UNEcjs.CHANNELS; exports.CHANNEL_TEXT_MAP = _J36P6UNEcjs.CHANNEL_TEXT_MAP; exports.ICON_SIZE_MAP = _J36P6UNEcjs.ICON_SIZE_MAP; exports.ICON_TYPES = _J36P6UNEcjs.ICON_TYPES; exports.checkDependencies = _4SFWHCB3cjs.checkDependencies; exports.generateAllIcons = _4SFWHCB3cjs.generateAllIcons; exports.generateIcon = _4SFWHCB3cjs.generateIcon; exports.iconsCommand = _INFOPAHNcjs.iconsCommand; exports.iconsCommandMetadata = _J36P6UNEcjs.iconsCommandMetadata; exports.iconsCommandOptionsSchema = _J36P6UNEcjs.iconsCommandOptionsSchema; exports.validateBaseIcons = _4SFWHCB3cjs.validateBaseIcons;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _J36P6UNEcjs = require('../../__chunks/J36P6UNE.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
exports.CHANNELS = _J36P6UNEcjs.CHANNELS; exports.CHANNEL_TEXT_MAP = _J36P6UNEcjs.CHANNEL_TEXT_MAP; exports.ICON_SIZE_MAP = _J36P6UNEcjs.ICON_SIZE_MAP; exports.ICON_TYPES = _J36P6UNEcjs.ICON_TYPES; exports.iconsCommandMetadata = _J36P6UNEcjs.iconsCommandMetadata; exports.iconsCommandOptionsSchema = _J36P6UNEcjs.iconsCommandOptionsSchema;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Available channels for icon generation
|
|
3
|
+
*/
|
|
4
|
+
export const CHANNELS: string[];
|
|
5
|
+
/**
|
|
6
|
+
* Available icon types
|
|
7
|
+
*/
|
|
8
|
+
export const ICON_TYPES: string[];
|
|
9
|
+
export namespace CHANNEL_TEXT_MAP {
|
|
10
|
+
let dev: string;
|
|
11
|
+
let local: string;
|
|
12
|
+
let staging: string;
|
|
13
|
+
let test: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Icon type to point size mapping
|
|
17
|
+
*/
|
|
18
|
+
export const ICON_SIZE_MAP: {
|
|
19
|
+
"adaptive-icon": number;
|
|
20
|
+
icon: number;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Zod schema for icons command options
|
|
24
|
+
*/
|
|
25
|
+
export const iconsCommandOptionsSchema: z.ZodObject<{
|
|
26
|
+
input: z.ZodString;
|
|
27
|
+
channels: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<["dev", "local", "staging", "test"]>, "many">>>;
|
|
28
|
+
iconTypes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<["icon", "adaptive-icon"]>, "many">>>;
|
|
29
|
+
verbose: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
30
|
+
help: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
verbose: boolean;
|
|
33
|
+
help: boolean;
|
|
34
|
+
input: string;
|
|
35
|
+
channels: ("dev" | "staging" | "test" | "local")[];
|
|
36
|
+
iconTypes: ("icon" | "adaptive-icon")[];
|
|
37
|
+
}, {
|
|
38
|
+
input: string;
|
|
39
|
+
verbose?: boolean | undefined;
|
|
40
|
+
help?: boolean | undefined;
|
|
41
|
+
channels?: ("dev" | "staging" | "test" | "local")[] | undefined;
|
|
42
|
+
iconTypes?: ("icon" | "adaptive-icon")[] | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
export namespace iconsCommandMetadata {
|
|
45
|
+
let name: string;
|
|
46
|
+
let description: string;
|
|
47
|
+
namespace options {
|
|
48
|
+
namespace input {
|
|
49
|
+
let description_1: string | undefined;
|
|
50
|
+
export { description_1 as description };
|
|
51
|
+
export let required: boolean;
|
|
52
|
+
}
|
|
53
|
+
namespace channels {
|
|
54
|
+
let description_2: string | undefined;
|
|
55
|
+
export { description_2 as description };
|
|
56
|
+
let _default: string;
|
|
57
|
+
export { _default as default };
|
|
58
|
+
export let alias: string;
|
|
59
|
+
}
|
|
60
|
+
namespace iconTypes {
|
|
61
|
+
let description_3: string | undefined;
|
|
62
|
+
export { description_3 as description };
|
|
63
|
+
let _default_1: string;
|
|
64
|
+
export { _default_1 as default };
|
|
65
|
+
let alias_1: string;
|
|
66
|
+
export { alias_1 as alias };
|
|
67
|
+
}
|
|
68
|
+
namespace verbose {
|
|
69
|
+
let description_4: string | undefined;
|
|
70
|
+
export { description_4 as description };
|
|
71
|
+
let _default_2: boolean;
|
|
72
|
+
export { _default_2 as default };
|
|
73
|
+
let alias_2: string;
|
|
74
|
+
export { alias_2 as alias };
|
|
75
|
+
}
|
|
76
|
+
namespace help {
|
|
77
|
+
let description_5: string | undefined;
|
|
78
|
+
export { description_5 as description };
|
|
79
|
+
let _default_3: boolean;
|
|
80
|
+
export { _default_3 as default };
|
|
81
|
+
let alias_3: string;
|
|
82
|
+
export { alias_3 as alias };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
import { z } from "zod";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _4SFWHCB3cjs = require('../../__chunks/4SFWHCB3.cjs');
|
|
7
|
+
require('../../__chunks/J36P6UNE.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
exports.checkDependencies = _4SFWHCB3cjs.checkDependencies; exports.generateAllIcons = _4SFWHCB3cjs.generateAllIcons; exports.generateIcon = _4SFWHCB3cjs.generateIcon; exports.validateBaseIcons = _4SFWHCB3cjs.validateBaseIcons;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if ImageMagick is installed
|
|
3
|
+
* @param {boolean} verbose - Show verbose output
|
|
4
|
+
* @throws {Error} If ImageMagick is not installed
|
|
5
|
+
*/
|
|
6
|
+
export function checkDependencies(verbose?: boolean): void;
|
|
7
|
+
/**
|
|
8
|
+
* Validate that required base icons exist
|
|
9
|
+
* @param {string} baseDir - Base directory containing icons
|
|
10
|
+
* @param {string[]} iconTypes - Icon types to validate
|
|
11
|
+
* @param {boolean} verbose - Show verbose output
|
|
12
|
+
* @throws {Error} If required icons are missing
|
|
13
|
+
*/
|
|
14
|
+
export function validateBaseIcons(baseDir: string, iconTypes: string[], verbose?: boolean): void;
|
|
15
|
+
/**
|
|
16
|
+
* Generate a single icon with channel overlay
|
|
17
|
+
* @param {{
|
|
18
|
+
* baseDir: string;
|
|
19
|
+
* channel: string;
|
|
20
|
+
* iconType: string;
|
|
21
|
+
* verbose: boolean;
|
|
22
|
+
* }} options - Generation options
|
|
23
|
+
* @returns {string} Path to generated icon
|
|
24
|
+
*/
|
|
25
|
+
export function generateIcon(options: {
|
|
26
|
+
baseDir: string;
|
|
27
|
+
channel: string;
|
|
28
|
+
iconType: string;
|
|
29
|
+
verbose: boolean;
|
|
30
|
+
}): string;
|
|
31
|
+
/**
|
|
32
|
+
* Generate all icons for specified channels and types
|
|
33
|
+
* @param {{
|
|
34
|
+
* baseDir: string;
|
|
35
|
+
* channels: string[];
|
|
36
|
+
* iconTypes: string[];
|
|
37
|
+
* verbose: boolean;
|
|
38
|
+
* }} options - Generation options
|
|
39
|
+
* @returns {{ success: string[]; failed: { icon: string; error: string }[] }}
|
|
40
|
+
*/
|
|
41
|
+
export function generateAllIcons(options: {
|
|
42
|
+
baseDir: string;
|
|
43
|
+
channels: string[];
|
|
44
|
+
iconTypes: string[];
|
|
45
|
+
verbose: boolean;
|
|
46
|
+
}): {
|
|
47
|
+
success: string[];
|
|
48
|
+
failed: {
|
|
49
|
+
icon: string;
|
|
50
|
+
error: string;
|
|
51
|
+
}[];
|
|
52
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
3
|
+
|
|
4
|
+
var _LQMP4ZKYcjs = require('../__chunks/LQMP4ZKY.cjs');
|
|
5
|
+
require('../__chunks/B2KFW7T7.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _INFOPAHNcjs = require('../__chunks/INFOPAHN.cjs');
|
|
9
|
+
require('../__chunks/4SFWHCB3.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _J36P6UNEcjs = require('../__chunks/J36P6UNE.cjs');
|
|
13
|
+
require('../__chunks/WNJ3ZYLI.cjs');
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _YCCIX4ZQcjs = require('../__chunks/YCCIX4ZQ.cjs');
|
|
17
|
+
require('../__chunks/EMMC33QA.cjs');
|
|
18
|
+
require('../__chunks/NIMXXHJQ.cjs');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var _FEZT3HUTcjs = require('../__chunks/FEZT3HUT.cjs');
|
|
22
|
+
|
|
23
|
+
// src/commands/index.js
|
|
24
|
+
var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
|
|
25
|
+
var _commander = require('commander');
|
|
26
|
+
function displayWelcomeMessage() {
|
|
27
|
+
console.log(_chalk2.default.bold.blue("\n\u{1F680} @mtndev/cli"));
|
|
28
|
+
console.log(_chalk2.default.gray(` ${_LQMP4ZKYcjs.globalCommandsMetadata.description}
|
|
29
|
+
`));
|
|
30
|
+
}
|
|
31
|
+
displayWelcomeMessage();
|
|
32
|
+
_commander.program.name(_LQMP4ZKYcjs.globalCommandsMetadata.name).description(_LQMP4ZKYcjs.globalCommandsMetadata.description).version(_LQMP4ZKYcjs.globalCommandsMetadata.version).option(
|
|
33
|
+
`-${_LQMP4ZKYcjs.globalCommandsMetadata.options.verbose.alias}, --verbose`,
|
|
34
|
+
_LQMP4ZKYcjs.globalCommandsMetadata.options.verbose.description,
|
|
35
|
+
_LQMP4ZKYcjs.globalCommandsMetadata.options.verbose.default
|
|
36
|
+
);
|
|
37
|
+
_commander.program.command("doppler <action>").description(_FEZT3HUTcjs.dopplerCommandMetadata.description).option(
|
|
38
|
+
`-${_FEZT3HUTcjs.dopplerCommandMetadata.options.environment.alias}, --environment <env>`,
|
|
39
|
+
_FEZT3HUTcjs.dopplerCommandMetadata.options.environment.description,
|
|
40
|
+
_FEZT3HUTcjs.dopplerCommandMetadata.options.environment.default
|
|
41
|
+
).option(
|
|
42
|
+
`-${_FEZT3HUTcjs.dopplerCommandMetadata.options.help.alias}, --help`,
|
|
43
|
+
_FEZT3HUTcjs.dopplerCommandMetadata.options.help.description,
|
|
44
|
+
_FEZT3HUTcjs.dopplerCommandMetadata.options.help.default
|
|
45
|
+
).action(async (action, options, cmd) => {
|
|
46
|
+
const globalOptions = _optionalChain([cmd, 'access', _ => _.parent, 'optionalAccess', _2 => _2.opts, 'call', _3 => _3()]) || {};
|
|
47
|
+
await _YCCIX4ZQcjs.dopplerCommand.call(void 0, {
|
|
48
|
+
action,
|
|
49
|
+
environment: options.environment,
|
|
50
|
+
verbose: globalOptions.verbose,
|
|
51
|
+
help: options.help
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
_commander.program.command("icons <input>").description(_J36P6UNEcjs.iconsCommandMetadata.description).option(
|
|
55
|
+
`-${_J36P6UNEcjs.iconsCommandMetadata.options.channels.alias}, --channels <channels>`,
|
|
56
|
+
_J36P6UNEcjs.iconsCommandMetadata.options.channels.description,
|
|
57
|
+
_J36P6UNEcjs.iconsCommandMetadata.options.channels.default
|
|
58
|
+
).option(
|
|
59
|
+
`-${_J36P6UNEcjs.iconsCommandMetadata.options.iconTypes.alias}, --icon-types <types>`,
|
|
60
|
+
_J36P6UNEcjs.iconsCommandMetadata.options.iconTypes.description,
|
|
61
|
+
_J36P6UNEcjs.iconsCommandMetadata.options.iconTypes.default
|
|
62
|
+
).option(
|
|
63
|
+
`-${_J36P6UNEcjs.iconsCommandMetadata.options.help.alias}, --help`,
|
|
64
|
+
_J36P6UNEcjs.iconsCommandMetadata.options.help.description,
|
|
65
|
+
_J36P6UNEcjs.iconsCommandMetadata.options.help.default
|
|
66
|
+
).action(async (input, options, cmd) => {
|
|
67
|
+
const globalOptions = _optionalChain([cmd, 'access', _4 => _4.parent, 'optionalAccess', _5 => _5.opts, 'call', _6 => _6()]) || {};
|
|
68
|
+
const channels = typeof options.channels === "string" ? options.channels.split(",").map((c) => c.trim()) : options.channels;
|
|
69
|
+
const iconTypes = typeof options.iconTypes === "string" ? options.iconTypes.split(",").map((t) => t.trim()) : options.iconTypes;
|
|
70
|
+
await _INFOPAHNcjs.iconsCommand.call(void 0, {
|
|
71
|
+
input,
|
|
72
|
+
channels,
|
|
73
|
+
iconTypes,
|
|
74
|
+
verbose: globalOptions.verbose,
|
|
75
|
+
help: options.help
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
_commander.program.on("command:*", () => {
|
|
79
|
+
_commander.program.help();
|
|
80
|
+
});
|
|
81
|
+
if (process.argv.length <= 2) {
|
|
82
|
+
_commander.program.help();
|
|
83
|
+
}
|
|
84
|
+
_commander.program.parse();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _LQMP4ZKYcjs = require('../__chunks/LQMP4ZKY.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.globalCommandsMetadata = _LQMP4ZKYcjs.globalCommandsMetadata; exports.globalOptionsSchema = _LQMP4ZKYcjs.globalOptionsSchema;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for global command options
|
|
3
|
+
* These options are available across all commands
|
|
4
|
+
*/
|
|
5
|
+
export const globalOptionsSchema: z.ZodObject<{
|
|
6
|
+
verbose: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
verbose?: boolean | undefined;
|
|
9
|
+
}, {
|
|
10
|
+
verbose?: boolean | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
export namespace globalCommandsMetadata {
|
|
13
|
+
let name: string;
|
|
14
|
+
let version: string;
|
|
15
|
+
let description: string;
|
|
16
|
+
namespace options {
|
|
17
|
+
namespace verbose {
|
|
18
|
+
let description_1: string | undefined;
|
|
19
|
+
export { description_1 as description };
|
|
20
|
+
let _default: boolean;
|
|
21
|
+
export { _default as default };
|
|
22
|
+
export let alias: string;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
import { z } from "zod";
|
package/cjs/index.cjs
ADDED
package/cjs/index.d.ts
ADDED
|
File without changes
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// src/commands/icons/schema.js
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var CHANNELS = ["dev", "staging", "test"];
|
|
4
|
+
var ICON_TYPES = ["icon", "adaptive-icon"];
|
|
5
|
+
var CHANNEL_TEXT_MAP = {
|
|
6
|
+
dev: "DEV",
|
|
7
|
+
local: "LOC",
|
|
8
|
+
staging: "STG",
|
|
9
|
+
test: "TST"
|
|
10
|
+
};
|
|
11
|
+
var ICON_SIZE_MAP = {
|
|
12
|
+
"adaptive-icon": 250,
|
|
13
|
+
icon: 378
|
|
14
|
+
};
|
|
15
|
+
var iconsCommandOptionsSchema = z.object({
|
|
16
|
+
input: z.string().describe(
|
|
17
|
+
"Path to the input image directory containing icon.png and adaptive-icon.png"
|
|
18
|
+
),
|
|
19
|
+
channels: z.array(z.enum(["dev", "local", "staging", "test"])).optional().default(["dev", "local", "staging", "test"]).describe("Channels to generate icons for"),
|
|
20
|
+
iconTypes: z.array(z.enum(["icon", "adaptive-icon"])).optional().default(["icon", "adaptive-icon"]).describe("Icon types to generate"),
|
|
21
|
+
verbose: z.boolean().optional().default(false).describe("Enable verbose logging for detailed error information"),
|
|
22
|
+
help: z.boolean().optional().default(false).describe("Display help for command")
|
|
23
|
+
});
|
|
24
|
+
var iconsCommandMetadata = {
|
|
25
|
+
name: "icons",
|
|
26
|
+
description: `Generate app channel version icons with overlay text
|
|
27
|
+
|
|
28
|
+
This command generates icon variants for different app channels (dev, local, staging, test)
|
|
29
|
+
by overlaying text on base icon images using ImageMagick.
|
|
30
|
+
|
|
31
|
+
Requirements:
|
|
32
|
+
\u2022 ImageMagick must be installed (brew install imagemagick)
|
|
33
|
+
\u2022 Base icons (icon.png, adaptive-icon.png) must exist in the input directory
|
|
34
|
+
|
|
35
|
+
Examples:
|
|
36
|
+
$ mtn icons ./apps/my-app/assets # Generate all channel icons
|
|
37
|
+
$ mtn icons ./assets -c dev,staging # Generate only dev and staging icons
|
|
38
|
+
$ mtn icons ./assets -t icon # Generate only standard icons
|
|
39
|
+
$ mtn icons ./assets -v # Verbose output`,
|
|
40
|
+
options: {
|
|
41
|
+
input: {
|
|
42
|
+
description: iconsCommandOptionsSchema.shape.input.description,
|
|
43
|
+
required: true
|
|
44
|
+
},
|
|
45
|
+
channels: {
|
|
46
|
+
description: iconsCommandOptionsSchema.shape.channels.description,
|
|
47
|
+
default: "dev,local,staging,test",
|
|
48
|
+
alias: "c"
|
|
49
|
+
},
|
|
50
|
+
iconTypes: {
|
|
51
|
+
description: iconsCommandOptionsSchema.shape.iconTypes.description,
|
|
52
|
+
default: "icon,adaptive-icon",
|
|
53
|
+
alias: "t"
|
|
54
|
+
},
|
|
55
|
+
verbose: {
|
|
56
|
+
description: iconsCommandOptionsSchema.shape.verbose.description,
|
|
57
|
+
default: false,
|
|
58
|
+
alias: "v"
|
|
59
|
+
},
|
|
60
|
+
help: {
|
|
61
|
+
description: iconsCommandOptionsSchema.shape.help.description,
|
|
62
|
+
default: false,
|
|
63
|
+
alias: "h"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export {
|
|
69
|
+
CHANNELS,
|
|
70
|
+
ICON_TYPES,
|
|
71
|
+
CHANNEL_TEXT_MAP,
|
|
72
|
+
ICON_SIZE_MAP,
|
|
73
|
+
iconsCommandOptionsSchema,
|
|
74
|
+
iconsCommandMetadata
|
|
75
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
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
|
+
};
|