@qlover/scripts-context 0.0.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/dist/cjs/index.d.ts +504 -0
- package/dist/cjs/index.js +1 -0
- package/dist/es/index.d.ts +504 -0
- package/dist/es/index.js +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
import * as _commitlint_types from '@commitlint/types';
|
|
2
|
+
import { Logger } from '@qlover/fe-utils';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration search options interface
|
|
6
|
+
* @interface
|
|
7
|
+
* @description
|
|
8
|
+
* Significance: Defines the configuration structure for ConfigSearch initialization
|
|
9
|
+
* Core idea: Centralize configuration search parameters
|
|
10
|
+
* Main function: Type-safe configuration options
|
|
11
|
+
* Main purpose: Standardize configuration initialization
|
|
12
|
+
* Example:
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const options: ConfigSearchOptions = {
|
|
15
|
+
* name: 'myapp',
|
|
16
|
+
* searchPlaces: ['myapp.config.js'],
|
|
17
|
+
* defaultConfig: { port: 3000 }
|
|
18
|
+
* };
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
interface ConfigSearchOptions {
|
|
22
|
+
/** Base name for configuration files */
|
|
23
|
+
name: string;
|
|
24
|
+
/** Custom search locations for config files */
|
|
25
|
+
searchPlaces?: string[];
|
|
26
|
+
/** Default configuration object */
|
|
27
|
+
defaultConfig?: Record<string, unknown>;
|
|
28
|
+
/** Custom loaders for different file types */
|
|
29
|
+
loaders?: Record<string, (filepath: string) => unknown>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Search options interface for configuration retrieval
|
|
33
|
+
* @interface
|
|
34
|
+
* @description
|
|
35
|
+
* Significance: Defines options for configuration search operation
|
|
36
|
+
* Core idea: Control configuration file search behavior
|
|
37
|
+
* Main function: Customize search parameters
|
|
38
|
+
* Main purpose: Flexible configuration loading
|
|
39
|
+
* Example:
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const searchOptions: SearchOptions = {
|
|
42
|
+
* file: 'custom.config.js',
|
|
43
|
+
* dir: '/path/to/project'
|
|
44
|
+
* };
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
interface SearchOptions {
|
|
48
|
+
/** Specific configuration file to load */
|
|
49
|
+
file?: string | false;
|
|
50
|
+
/** Directory to search in */
|
|
51
|
+
dir?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Configuration search utility class
|
|
55
|
+
* @class
|
|
56
|
+
* @description
|
|
57
|
+
* Significance: Manages configuration file discovery and loading
|
|
58
|
+
* Core idea: Unified configuration management
|
|
59
|
+
* Main function: Search and load configuration from various sources
|
|
60
|
+
* Main purpose: Provide consistent configuration access
|
|
61
|
+
* Example:
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const configSearch = new ConfigSearch({
|
|
64
|
+
* name: 'myapp',
|
|
65
|
+
* defaultConfig: { port: 3000 }
|
|
66
|
+
* });
|
|
67
|
+
* const config = configSearch.config;
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
declare class ConfigSearch {
|
|
71
|
+
private name;
|
|
72
|
+
private searchPlaces;
|
|
73
|
+
private _config;
|
|
74
|
+
private loaders?;
|
|
75
|
+
private searchCache?;
|
|
76
|
+
/**
|
|
77
|
+
* Creates a ConfigSearch instance
|
|
78
|
+
* @param options - Configuration search options
|
|
79
|
+
* @throws Error if neither name nor searchPlaces is provided
|
|
80
|
+
* @description
|
|
81
|
+
* Significance: Initializes configuration search environment
|
|
82
|
+
* Core idea: Setup configuration search parameters
|
|
83
|
+
* Main function: Create search instance with options
|
|
84
|
+
* Main purpose: Prepare for configuration discovery
|
|
85
|
+
* Example:
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const search = new ConfigSearch({
|
|
88
|
+
* name: 'myapp',
|
|
89
|
+
* defaultConfig: { debug: true }
|
|
90
|
+
* });
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
constructor(options: ConfigSearchOptions);
|
|
94
|
+
/**
|
|
95
|
+
* Get effective configuration
|
|
96
|
+
* @returns Merged configuration object
|
|
97
|
+
* @description
|
|
98
|
+
* Significance: Provides access to final configuration
|
|
99
|
+
* Core idea: Merge default and discovered configurations
|
|
100
|
+
* Main function: Retrieve effective configuration
|
|
101
|
+
* Main purpose: Access complete configuration
|
|
102
|
+
* Example:
|
|
103
|
+
* ```typescript
|
|
104
|
+
* const config = configSearch.config;
|
|
105
|
+
* console.log(config.debug); // true
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
get config(): Record<string, unknown>;
|
|
109
|
+
/**
|
|
110
|
+
* Get search locations
|
|
111
|
+
* @returns Array of search locations
|
|
112
|
+
* @description
|
|
113
|
+
* Significance: Exposes configuration search paths
|
|
114
|
+
* Core idea: Provide transparency in search process
|
|
115
|
+
* Main function: Return search locations
|
|
116
|
+
* Main purpose: Debug and verify search paths
|
|
117
|
+
* Example:
|
|
118
|
+
* ```typescript
|
|
119
|
+
* const places = configSearch.getSearchPlaces();
|
|
120
|
+
* // ['package.json', 'myapp.config.js', ...]
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
getSearchPlaces(): string[];
|
|
124
|
+
/**
|
|
125
|
+
* Get configuration from specific location
|
|
126
|
+
* @param options - Search options
|
|
127
|
+
* @returns Configuration object
|
|
128
|
+
* @throws Error if configuration file is invalid
|
|
129
|
+
* @description
|
|
130
|
+
* Significance: Load configuration from specific location
|
|
131
|
+
* Core idea: Flexible configuration loading
|
|
132
|
+
* Main function: Load and validate configuration
|
|
133
|
+
* Main purpose: Custom configuration loading
|
|
134
|
+
* Example:
|
|
135
|
+
* ```typescript
|
|
136
|
+
* const config = configSearch.get({
|
|
137
|
+
* file: 'custom.config.js',
|
|
138
|
+
* dir: process.cwd()
|
|
139
|
+
* });
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
get(options?: SearchOptions): Record<string, unknown>;
|
|
143
|
+
/**
|
|
144
|
+
* Search for configuration with caching
|
|
145
|
+
* @returns Cached configuration object
|
|
146
|
+
* @description
|
|
147
|
+
* Significance: Provides cached configuration access
|
|
148
|
+
* Core idea: Cache configuration for performance
|
|
149
|
+
* Main function: Search and cache configuration
|
|
150
|
+
* Main purpose: Optimize repeated access
|
|
151
|
+
* Example:
|
|
152
|
+
* ```typescript
|
|
153
|
+
* const config = configSearch.search();
|
|
154
|
+
* // Subsequent calls use cached result
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
search(): Record<string, unknown>;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
declare const defaultFeConfig: FeConfig;
|
|
161
|
+
type FeConfig = {
|
|
162
|
+
/**
|
|
163
|
+
* Run `fe-clean-branch` to exclude branches
|
|
164
|
+
*
|
|
165
|
+
* @default ["master", "develop", "main"]
|
|
166
|
+
*/
|
|
167
|
+
protectedBranches?: string[];
|
|
168
|
+
/**
|
|
169
|
+
* Run `fe-clean` to includes files
|
|
170
|
+
*
|
|
171
|
+
* @default ["dist","node_modules","yarn.lock","package-lock.json",".eslintcache","*.log"]
|
|
172
|
+
*/
|
|
173
|
+
cleanFiles?: string[];
|
|
174
|
+
/**
|
|
175
|
+
* Use author name when create merge PR
|
|
176
|
+
*
|
|
177
|
+
* @default `package.json -> autor`
|
|
178
|
+
*/
|
|
179
|
+
author?: string | {
|
|
180
|
+
name?: string;
|
|
181
|
+
email?: string;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Use repo info when create merge PR
|
|
185
|
+
*
|
|
186
|
+
* @default `package.json -> repository`
|
|
187
|
+
*/
|
|
188
|
+
repository?: string | {
|
|
189
|
+
url?: string;
|
|
190
|
+
[key: string]: unknown;
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* commitlint config
|
|
194
|
+
*
|
|
195
|
+
* @default { "extends": ["@commitlint/config-conventional"] }
|
|
196
|
+
*/
|
|
197
|
+
commitlint?: _commitlint_types.UserConfig;
|
|
198
|
+
/**
|
|
199
|
+
* config of CI release
|
|
200
|
+
*
|
|
201
|
+
* scripts release
|
|
202
|
+
*/
|
|
203
|
+
release?: FeReleaseConfig;
|
|
204
|
+
/**
|
|
205
|
+
* @default ['.env.local', '.env']
|
|
206
|
+
*/
|
|
207
|
+
envOrder?: string[];
|
|
208
|
+
};
|
|
209
|
+
type FeReleaseConfig = {
|
|
210
|
+
/**
|
|
211
|
+
* The path to publish the package
|
|
212
|
+
*
|
|
213
|
+
* @default ''
|
|
214
|
+
*/
|
|
215
|
+
publishPath?: string;
|
|
216
|
+
/**
|
|
217
|
+
* Whether to automatically merge PR when creating and publishing
|
|
218
|
+
*
|
|
219
|
+
* @default true
|
|
220
|
+
*/
|
|
221
|
+
autoMergeReleasePR?: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* PR auto merged type
|
|
224
|
+
*
|
|
225
|
+
* @default squash
|
|
226
|
+
*/
|
|
227
|
+
autoMergeType?: 'merge' | 'squash' | 'rebase';
|
|
228
|
+
/**
|
|
229
|
+
* Create the branch name of PR when publishing
|
|
230
|
+
*
|
|
231
|
+
* @default ${env}-${branch}-${tagName}
|
|
232
|
+
*/
|
|
233
|
+
branchName?: string;
|
|
234
|
+
/**
|
|
235
|
+
* Create a title for publishing PR
|
|
236
|
+
*
|
|
237
|
+
* @default [${pkgName} Release] Branch:${branch}, Tag:${tagName}, Env:${env}
|
|
238
|
+
*/
|
|
239
|
+
PRTitle?: string;
|
|
240
|
+
/**
|
|
241
|
+
* Create a body for publishing PR
|
|
242
|
+
*
|
|
243
|
+
* @default This PR includes version bump to ${tagName}
|
|
244
|
+
*/
|
|
245
|
+
PRBody?: string;
|
|
246
|
+
/**
|
|
247
|
+
* Create a label for publishing PR
|
|
248
|
+
*/
|
|
249
|
+
label?: {
|
|
250
|
+
/**
|
|
251
|
+
* hex color string
|
|
252
|
+
*
|
|
253
|
+
* @default `1A7F37`
|
|
254
|
+
*/
|
|
255
|
+
color?: string;
|
|
256
|
+
/**
|
|
257
|
+
* @default `Label for version update PRs`
|
|
258
|
+
*/
|
|
259
|
+
description?: string;
|
|
260
|
+
/**
|
|
261
|
+
* @default `CI-Release`
|
|
262
|
+
*/
|
|
263
|
+
name?: string;
|
|
264
|
+
};
|
|
265
|
+
/**
|
|
266
|
+
* @default `changes:${name}`
|
|
267
|
+
*/
|
|
268
|
+
changePackagesLabel?: string;
|
|
269
|
+
/**
|
|
270
|
+
* @default `[]`
|
|
271
|
+
*/
|
|
272
|
+
packagesDirectories?: string[];
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
declare class ScriptsLogger extends Logger {
|
|
276
|
+
/**
|
|
277
|
+
* @override
|
|
278
|
+
* @param {string} value
|
|
279
|
+
* @returns {string}
|
|
280
|
+
*/
|
|
281
|
+
prefix(value: string): string;
|
|
282
|
+
obtrusive(title: string): void;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Configuration interface for Shell class
|
|
287
|
+
* @interface
|
|
288
|
+
*/
|
|
289
|
+
interface ShellConfig {
|
|
290
|
+
/** Whether to run in dry-run mode */
|
|
291
|
+
isDryRun?: boolean;
|
|
292
|
+
/** Logger instance */
|
|
293
|
+
log: Logger;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Options for shell execution
|
|
297
|
+
* @interface
|
|
298
|
+
*/
|
|
299
|
+
interface ShellExecOptions {
|
|
300
|
+
/**
|
|
301
|
+
* Whether to suppress output to the console
|
|
302
|
+
*/
|
|
303
|
+
silent?: boolean;
|
|
304
|
+
/**
|
|
305
|
+
* Environment variables to be passed to the command
|
|
306
|
+
*/
|
|
307
|
+
env?: Record<string, string>;
|
|
308
|
+
/**
|
|
309
|
+
* Result to return when in dry-run mode
|
|
310
|
+
*/
|
|
311
|
+
dryRunResult?: unknown;
|
|
312
|
+
/**
|
|
313
|
+
* Whether to perform a dry run
|
|
314
|
+
* Overrides shell config.isDryRun if set
|
|
315
|
+
*/
|
|
316
|
+
dryRun?: boolean;
|
|
317
|
+
/**
|
|
318
|
+
* Whether to use external command execution
|
|
319
|
+
*/
|
|
320
|
+
external?: boolean;
|
|
321
|
+
/**
|
|
322
|
+
* Template context for command string interpolation
|
|
323
|
+
*/
|
|
324
|
+
context?: Record<string, unknown>;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Metadata for command execution
|
|
328
|
+
* @interface
|
|
329
|
+
*/
|
|
330
|
+
interface ExecMeta {
|
|
331
|
+
/** Whether the command is executed externally */
|
|
332
|
+
isExternal: boolean;
|
|
333
|
+
/** Whether the command result is cached */
|
|
334
|
+
isCached?: boolean;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Shell class for command execution
|
|
338
|
+
* @class
|
|
339
|
+
* @description Provides methods for executing shell commands with caching and templating support
|
|
340
|
+
*/
|
|
341
|
+
declare class Shell {
|
|
342
|
+
config: ShellConfig;
|
|
343
|
+
private cache;
|
|
344
|
+
/**
|
|
345
|
+
* Creates a new Shell instance
|
|
346
|
+
* @param config - Shell configuration
|
|
347
|
+
* @param cache - Command cache map
|
|
348
|
+
*/
|
|
349
|
+
constructor(config: ShellConfig, cache?: Map<string, Promise<string>>);
|
|
350
|
+
/**
|
|
351
|
+
* Gets the logger instance
|
|
352
|
+
*/
|
|
353
|
+
get logger(): Logger;
|
|
354
|
+
/**
|
|
355
|
+
* Formats a template string with context
|
|
356
|
+
* @param template - Template string
|
|
357
|
+
* @param context - Context object for template interpolation
|
|
358
|
+
* @returns Formatted string
|
|
359
|
+
*/
|
|
360
|
+
static format(template?: string, context?: Record<string, unknown>): string;
|
|
361
|
+
/**
|
|
362
|
+
* Formats a template string with context and error handling
|
|
363
|
+
* @param template - Template string
|
|
364
|
+
* @param context - Context object for template interpolation
|
|
365
|
+
* @returns Formatted string
|
|
366
|
+
* @throws Error if template formatting fails
|
|
367
|
+
*/
|
|
368
|
+
format(template?: string, context?: Record<string, unknown>): string;
|
|
369
|
+
/**
|
|
370
|
+
* Executes a command with options
|
|
371
|
+
* @param command - Command string or array
|
|
372
|
+
* @param options - Execution options
|
|
373
|
+
* @returns Promise resolving to command output
|
|
374
|
+
*/
|
|
375
|
+
exec(command: string | string[], options?: ShellExecOptions): Promise<string>;
|
|
376
|
+
/**
|
|
377
|
+
* Executes a command silently
|
|
378
|
+
* @param command - Command string or array
|
|
379
|
+
* @param options - Execution options
|
|
380
|
+
* @returns Promise resolving to command output
|
|
381
|
+
*/
|
|
382
|
+
run(command: string | string[], options?: ShellExecOptions): Promise<string>;
|
|
383
|
+
/**
|
|
384
|
+
* Executes a formatted command with caching
|
|
385
|
+
* @param command - Formatted command string or array
|
|
386
|
+
* @param options - Execution options
|
|
387
|
+
* @returns Promise resolving to command output
|
|
388
|
+
*/
|
|
389
|
+
execFormattedCommand(command: string | string[], options?: ShellExecOptions): Promise<string>;
|
|
390
|
+
/**
|
|
391
|
+
* Executes a string command using shelljs
|
|
392
|
+
* @param command - Command string
|
|
393
|
+
* @param options - Execution options
|
|
394
|
+
* @returns Promise resolving to command output
|
|
395
|
+
*/
|
|
396
|
+
execStringCommand(command: string, options: ShellExecOptions): Promise<string>;
|
|
397
|
+
/**
|
|
398
|
+
* Executes a command with arguments using execa
|
|
399
|
+
* @param command - Command array
|
|
400
|
+
* @param options - Execution options
|
|
401
|
+
* @param meta - Execution metadata
|
|
402
|
+
* @returns Promise resolving to command output
|
|
403
|
+
*/
|
|
404
|
+
execWithArguments(command: string[], options: ShellExecOptions, meta: ExecMeta): Promise<string>;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Create a new ConfigSearch instance with fe configuration
|
|
409
|
+
* @param feConfig - Custom fe configuration
|
|
410
|
+
* @returns ConfigSearch instance
|
|
411
|
+
* @description
|
|
412
|
+
* Significance: Creates configuration search utility
|
|
413
|
+
* Core idea: Merge default and custom configurations
|
|
414
|
+
* Main function: Initialize configuration search
|
|
415
|
+
* Main purpose: Provide configuration discovery
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* ```typescript
|
|
419
|
+
* const configSearch = getFeConfigSearch({ debug: true });
|
|
420
|
+
* ```
|
|
421
|
+
*/
|
|
422
|
+
declare function getFeConfigSearch(feConfig?: Record<string, unknown>): ConfigSearch;
|
|
423
|
+
/**
|
|
424
|
+
* Options interface for FeScriptContext
|
|
425
|
+
* @interface
|
|
426
|
+
* @description
|
|
427
|
+
* Significance: Defines script execution context options
|
|
428
|
+
* Core idea: Centralize script execution configuration
|
|
429
|
+
* Main function: Type-safe context options
|
|
430
|
+
* Main purpose: Configure script execution environment
|
|
431
|
+
*
|
|
432
|
+
* @example
|
|
433
|
+
* ```typescript
|
|
434
|
+
* const options: FeScriptContextOptions<T> = {
|
|
435
|
+
* logger: new ScriptsLogger(),
|
|
436
|
+
* dryRun: true
|
|
437
|
+
* };
|
|
438
|
+
* ```
|
|
439
|
+
*/
|
|
440
|
+
interface FeScriptContextOptions<T> {
|
|
441
|
+
/** Custom logger instance */
|
|
442
|
+
logger?: ScriptsLogger;
|
|
443
|
+
/** Shell instance for command execution */
|
|
444
|
+
shell?: Shell;
|
|
445
|
+
/** Custom fe configuration */
|
|
446
|
+
feConfig?: Record<string, unknown>;
|
|
447
|
+
/** Whether to perform dry run */
|
|
448
|
+
dryRun?: boolean;
|
|
449
|
+
/** Enable verbose logging */
|
|
450
|
+
verbose?: boolean;
|
|
451
|
+
/** Additional script-specific options */
|
|
452
|
+
options?: T;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Script execution context class
|
|
456
|
+
* @class
|
|
457
|
+
* @description
|
|
458
|
+
* Significance: Manages script execution environment
|
|
459
|
+
* Core idea: Provide unified context for script execution
|
|
460
|
+
* Main function: Initialize and maintain script context
|
|
461
|
+
* Main purpose: Standardize script execution environment
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
* ```typescript
|
|
465
|
+
* const context = new FeScriptContext<MyOptions>({
|
|
466
|
+
* dryRun: true,
|
|
467
|
+
* verbose: true
|
|
468
|
+
* });
|
|
469
|
+
* ```
|
|
470
|
+
*/
|
|
471
|
+
declare class FeScriptContext<T = unknown> {
|
|
472
|
+
/** Logger instance */
|
|
473
|
+
readonly logger: ScriptsLogger;
|
|
474
|
+
/** Shell instance */
|
|
475
|
+
readonly shell: Shell;
|
|
476
|
+
/** Fe configuration */
|
|
477
|
+
readonly feConfig: FeConfig;
|
|
478
|
+
/** Dry run flag */
|
|
479
|
+
readonly dryRun: boolean;
|
|
480
|
+
/** Verbose logging flag */
|
|
481
|
+
readonly verbose: boolean;
|
|
482
|
+
/** Script-specific options */
|
|
483
|
+
options: T;
|
|
484
|
+
/**
|
|
485
|
+
* Creates a FeScriptContext instance
|
|
486
|
+
*
|
|
487
|
+
* @description
|
|
488
|
+
* Significance: Initializes script execution context
|
|
489
|
+
* Core idea: Setup execution environment
|
|
490
|
+
* Main function: Create context with options
|
|
491
|
+
* Main purpose: Prepare script execution environment
|
|
492
|
+
*
|
|
493
|
+
* @example
|
|
494
|
+
* ```typescript
|
|
495
|
+
* const context = new FeScriptContext({
|
|
496
|
+
* dryRun: true,
|
|
497
|
+
* options: { branch: 'main' }
|
|
498
|
+
* });
|
|
499
|
+
* ```
|
|
500
|
+
*/
|
|
501
|
+
constructor(scriptsOptions?: FeScriptContextOptions<T>);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
export { ConfigSearch, type ConfigSearchOptions, type FeConfig, type FeReleaseConfig, FeScriptContext, type FeScriptContextOptions, ScriptsLogger, Shell, type ShellConfig, type ShellExecOptions, defaultFeConfig, getFeConfigSearch };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var r,n,t,e,o,u,i,c,a,f,s,l,p,v,h,g,b,y,d,j,m=require("cosmiconfig"),O=require("merge"),_=require("@qlover/fe-utils"),w=require("chalk"),x=require("shelljs"),P="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function $(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function S(){if(n)return r;n=1;var t="object"==typeof P&&P&&P.Object===Object&&P;return r=t}function R(){if(e)return t;e=1;var r=S(),n="object"==typeof self&&self&&self.Object===Object&&self,o=r||n||Function("return this")();return t=o}function A(){if(u)return o;u=1;var r=R().Symbol;return o=r}function E(){if(c)return i;c=1;var r=A(),n=Object.prototype,t=n.hasOwnProperty,e=n.toString,o=r?r.toStringTag:void 0;return i=function(r){var n=t.call(r,o),u=r[o];try{r[o]=void 0;var i=!0}catch(r){}var c=e.call(r);return i&&(n?r[o]=u:delete r[o]),c}}function C(){if(f)return a;f=1;var r=Object.prototype.toString;return a=function(n){return r.call(n)}}function F(){if(l)return s;l=1;var r=A(),n=E(),t=C(),e=r?r.toStringTag:void 0;return s=function(r){return null==r?void 0===r?"[object Undefined]":"[object Null]":e&&e in Object(r)?n(r):t(r)}}function k(){if(v)return p;return v=1,p=function(r,n){return function(t){return r(n(t))}}}function T(){if(g)return h;g=1;var r=k()(Object.getPrototypeOf,Object);return h=r}function M(){if(y)return b;return y=1,b=function(r){return null!=r&&"object"==typeof r}}function q(){if(j)return d;j=1;var r=F(),n=T(),t=M(),e=Function.prototype,o=Object.prototype,u=e.toString,i=o.hasOwnProperty,c=u.call(Object);return d=function(e){if(!t(e)||"[object Object]"!=r(e))return!1;var o=n(e);if(null===o)return!0;var a=i.call(o,"constructor")&&o.constructor;return"function"==typeof a&&a instanceof a&&u.call(a)==c}}var D=$(q());class N{name;searchPlaces;_config;loaders;searchCache;constructor(r){const{name:n,searchPlaces:t,defaultConfig:e,loaders:o}=r;if(!n&&!t)throw new Error("searchPlaces or name is required");this.name=n,this.searchPlaces=t||function(r){const n=["json","js","ts","cjs","yaml","yml"];return["package.json",...n.map((n=>`${r}.${n}`)),...n.map((n=>`.${r}.${n}`))]}(n),this._config=e||{},this.loaders=o}get config(){return O({},this._config,this.search())}getSearchPlaces(){return this.searchPlaces}get(r={}){const{file:n,dir:t=process.cwd()}=r,e={};if(!1===n)return e;const o=m.cosmiconfigSync(this.name,{searchPlaces:this.searchPlaces,loaders:this.loaders}),u=n?o.load(n):o.search(t);if(u&&"string"==typeof u.config)throw new Error(`Invalid configuration file at ${u.filepath}`);return u&&D(u.config)?u.config:e}search(){return this.searchCache?this.searchCache:this.searchCache=this.get({})}}const B={protectedBranches:["master","develop","main"],cleanFiles:["dist","node_modules","yarn.lock","package-lock.json",".eslintcache","*.log"],commitlint:{extends:["@commitlint/config-conventional"]},release:{publishPath:"",autoMergeReleasePR:!1,autoMergeType:"squash",branchName:"release-${env}-${branch}-${tagName}",PRTitle:"[${pkgName} Release] Branch:${branch}, Tag:${tagName}, Env:${env}",PRBody:"## Publish Details\n\n- 🏷️ Version: ${tagName}\n- 🌲 Branch: ${branch}\n- 🔧 Environment: ${env}\n\n## Changelog\n\n${changelog}\n\n## Notes\n\n- [ ] Please check if the version number is correct\n- [ ] Please confirm all tests have passed\n- [ ] Please confirm the documentation has been updated\n\n> This PR is auto created by release process, please contact the frontend team if there are any questions.",label:{color:"1A7F37",description:"Release PR",name:"CI-Release"},packagesDirectories:[],changePackagesLabel:"changes:${name}"},envOrder:[".env.local",".env.production",".env"]};class U extends _.Logger{prefix(r){switch(r){case"INFO":return w.blue(r);case"WARN":return w.yellow(r);case"ERROR":return w.red(r);case"DEBUG":return w.gray(r);default:return r}}obtrusive(r){const n=w.bold(r);super.obtrusive(n)}}var I,L,W,V,G,z,J,H,K,Q,X,Y,Z,rr,nr,tr,er,or,ur,ir,cr,ar,fr,sr,lr,pr,vr,hr,gr,br,yr,dr,jr,mr,Or,_r,wr,xr,Pr,$r,Sr,Rr,Ar,Er;function Cr(){if(L)return I;L=1;var r=Object.prototype;return I=function(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||r)}}function Fr(){if(V)return W;V=1;var r=k()(Object.keys,Object);return W=r}function kr(){if(z)return G;z=1;var r=Cr(),n=Fr(),t=Object.prototype.hasOwnProperty;return G=function(e){if(!r(e))return n(e);var o=[];for(var u in Object(e))t.call(e,u)&&"constructor"!=u&&o.push(u);return o}}function Tr(){if(H)return J;return H=1,J=function(r){var n=typeof r;return null!=r&&("object"==n||"function"==n)}}function Mr(){if(Q)return K;Q=1;var r=F(),n=Tr();return K=function(t){if(!n(t))return!1;var e=r(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}}function qr(){if(Y)return X;Y=1;var r=R()["__core-js_shared__"];return X=r}function Dr(){if(rr)return Z;rr=1;var r,n=qr(),t=(r=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";return Z=function(r){return!!t&&t in r}}function Nr(){if(tr)return nr;tr=1;var r=Function.prototype.toString;return nr=function(n){if(null!=n){try{return r.call(n)}catch(r){}try{return n+""}catch(r){}}return""}}function Br(){if(or)return er;or=1;var r=Mr(),n=Dr(),t=Tr(),e=Nr(),o=/^\[object .+?Constructor\]$/,u=Function.prototype,i=Object.prototype,c=u.toString,a=i.hasOwnProperty,f=RegExp("^"+c.call(a).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return er=function(u){return!(!t(u)||n(u))&&(r(u)?f:o).test(e(u))}}function Ur(){if(ir)return ur;return ir=1,ur=function(r,n){return null==r?void 0:r[n]}}function Ir(){if(ar)return cr;ar=1;var r=Br(),n=Ur();return cr=function(t,e){var o=n(t,e);return r(o)?o:void 0}}function Lr(){if(sr)return fr;sr=1;var r=Ir()(R(),"DataView");return fr=r}function Wr(){if(pr)return lr;pr=1;var r=Ir()(R(),"Map");return lr=r}function Vr(){if(hr)return vr;hr=1;var r=Ir()(R(),"Promise");return vr=r}function Gr(){if(br)return gr;br=1;var r=Ir()(R(),"Set");return gr=r}function zr(){if(dr)return yr;dr=1;var r=Ir()(R(),"WeakMap");return yr=r}function Jr(){if(mr)return jr;mr=1;var r=Lr(),n=Wr(),t=Vr(),e=Gr(),o=zr(),u=F(),i=Nr(),c="[object Map]",a="[object Promise]",f="[object Set]",s="[object WeakMap]",l="[object DataView]",p=i(r),v=i(n),h=i(t),g=i(e),b=i(o),y=u;return(r&&y(new r(new ArrayBuffer(1)))!=l||n&&y(new n)!=c||t&&y(t.resolve())!=a||e&&y(new e)!=f||o&&y(new o)!=s)&&(y=function(r){var n=u(r),t="[object Object]"==n?r.constructor:void 0,e=t?i(t):"";if(e)switch(e){case p:return l;case v:return c;case h:return a;case g:return f;case b:return s}return n}),jr=y}function Hr(){if(_r)return Or;_r=1;var r=F(),n=M();return Or=function(t){return n(t)&&"[object Arguments]"==r(t)}}function Kr(){if(xr)return wr;xr=1;var r=Hr(),n=M(),t=Object.prototype,e=t.hasOwnProperty,o=t.propertyIsEnumerable,u=r(function(){return arguments}())?r:function(r){return n(r)&&e.call(r,"callee")&&!o.call(r,"callee")};return wr=u}function Qr(){if($r)return Pr;$r=1;var r=Array.isArray;return Pr=r}function Xr(){if(Rr)return Sr;Rr=1;return Sr=function(r){return"number"==typeof r&&r>-1&&r%1==0&&r<=9007199254740991}}function Yr(){if(Er)return Ar;Er=1;var r=Mr(),n=Xr();return Ar=function(t){return null!=t&&n(t.length)&&!r(t)}}var Zr,rn,nn,tn,en,on,un,cn={exports:{}};function an(){if(rn)return Zr;return rn=1,Zr=function(){return!1}}function fn(){return nn||(nn=1,function(r,n){var t=R(),e=an(),o=n&&!n.nodeType&&n,u=o&&r&&!r.nodeType&&r,i=u&&u.exports===o?t.Buffer:void 0,c=(i?i.isBuffer:void 0)||e;r.exports=c}(cn,cn.exports)),cn.exports}function sn(){if(en)return tn;en=1;var r=F(),n=Xr(),t=M(),e={};return e["[object Float32Array]"]=e["[object Float64Array]"]=e["[object Int8Array]"]=e["[object Int16Array]"]=e["[object Int32Array]"]=e["[object Uint8Array]"]=e["[object Uint8ClampedArray]"]=e["[object Uint16Array]"]=e["[object Uint32Array]"]=!0,e["[object Arguments]"]=e["[object Array]"]=e["[object ArrayBuffer]"]=e["[object Boolean]"]=e["[object DataView]"]=e["[object Date]"]=e["[object Error]"]=e["[object Function]"]=e["[object Map]"]=e["[object Number]"]=e["[object Object]"]=e["[object RegExp]"]=e["[object Set]"]=e["[object String]"]=e["[object WeakMap]"]=!1,tn=function(o){return t(o)&&n(o.length)&&!!e[r(o)]}}function ln(){if(un)return on;return un=1,on=function(r){return function(n){return r(n)}}}var pn,vn,hn,gn,bn,yn={exports:{}};function dn(){return pn||(pn=1,function(r,n){var t=S(),e=n&&!n.nodeType&&n,o=e&&r&&!r.nodeType&&r,u=o&&o.exports===e&&t.process,i=function(){try{var r=o&&o.require&&o.require("util").types;return r||u&&u.binding&&u.binding("util")}catch(r){}}();r.exports=i}(yn,yn.exports)),yn.exports}function jn(){if(hn)return vn;hn=1;var r=sn(),n=ln(),t=dn(),e=t&&t.isTypedArray,o=e?n(e):r;return vn=o}function mn(){if(bn)return gn;bn=1;var r=kr(),n=Jr(),t=Kr(),e=Qr(),o=Yr(),u=fn(),i=Cr(),c=jn(),a=Object.prototype.hasOwnProperty;return gn=function(f){if(null==f)return!0;if(o(f)&&(e(f)||"string"==typeof f||"function"==typeof f.splice||u(f)||c(f)||t(f)))return!f.length;var s=n(f);if("[object Map]"==s||"[object Set]"==s)return!f.size;if(i(f))return!r(f).length;for(var l in f)if(a.call(f,l))return!1;return!0}}var On,_n,wn,xn,Pn,$n,Sn,Rn,An,En,Cn,Fn,kn,Tn,Mn,qn,Dn,Nn,Bn,Un,In,Ln,Wn,Vn,Gn,zn,Jn,Hn,Kn,Qn,Xn,Yn,Zn,rt,nt,tt,et,ot,ut,it,ct,at,ft,st,lt,pt,vt,ht,gt,bt,yt,dt,jt,mt,Ot,_t,wt,xt,Pt,$t,St,Rt,At,Et,Ct,Ft,kt,Tt,Mt,qt,Dt,Nt,Bt,Ut,It,Lt,Wt,Vt,Gt,zt,Jt=$(mn());function Ht(){if(_n)return On;_n=1;var r=Ir(),n=function(){try{var n=r(Object,"defineProperty");return n({},"",{}),n}catch(r){}}();return On=n}function Kt(){if(xn)return wn;xn=1;var r=Ht();return wn=function(n,t,e){"__proto__"==t&&r?r(n,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):n[t]=e}}function Qt(){if($n)return Pn;return $n=1,Pn=function(r,n){return r===n||r!=r&&n!=n}}function Xt(){if(Rn)return Sn;Rn=1;var r=Kt(),n=Qt(),t=Object.prototype.hasOwnProperty;return Sn=function(e,o,u){var i=e[o];t.call(e,o)&&n(i,u)&&(void 0!==u||o in e)||r(e,o,u)}}function Yt(){if(En)return An;En=1;var r=Xt(),n=Kt();return An=function(t,e,o,u){var i=!o;o||(o={});for(var c=-1,a=e.length;++c<a;){var f=e[c],s=u?u(o[f],t[f],f,o,t):void 0;void 0===s&&(s=t[f]),i?n(o,f,s):r(o,f,s)}return o}}function Zt(){if(Fn)return Cn;return Fn=1,Cn=function(r){return r}}function re(){if(Tn)return kn;return Tn=1,kn=function(r,n,t){switch(t.length){case 0:return r.call(n);case 1:return r.call(n,t[0]);case 2:return r.call(n,t[0],t[1]);case 3:return r.call(n,t[0],t[1],t[2])}return r.apply(n,t)}}function ne(){if(qn)return Mn;qn=1;var r=re(),n=Math.max;return Mn=function(t,e,o){return e=n(void 0===e?t.length-1:e,0),function(){for(var u=arguments,i=-1,c=n(u.length-e,0),a=Array(c);++i<c;)a[i]=u[e+i];i=-1;for(var f=Array(e+1);++i<e;)f[i]=u[i];return f[e]=o(a),r(t,this,f)}},Mn}function te(){if(Nn)return Dn;return Nn=1,Dn=function(r){return function(){return r}}}function ee(){if(Un)return Bn;Un=1;var r=te(),n=Ht();return Bn=n?function(t,e){return n(t,"toString",{configurable:!0,enumerable:!1,value:r(e),writable:!0})}:Zt()}function oe(){if(Ln)return In;Ln=1;var r=Date.now;return In=function(n){var t=0,e=0;return function(){var o=r(),u=16-(o-e);if(e=o,u>0){if(++t>=800)return arguments[0]}else t=0;return n.apply(void 0,arguments)}},In}function ue(){if(Vn)return Wn;Vn=1;var r=ee(),n=oe()(r);return Wn=n}function ie(){if(zn)return Gn;zn=1;var r=Zt(),n=ne(),t=ue();return Gn=function(e,o){return t(n(e,o,r),e+"")}}function ce(){if(Hn)return Jn;Hn=1;var r=/^(?:0|[1-9]\d*)$/;return Jn=function(n,t){var e=typeof n;return!!(t=null==t?9007199254740991:t)&&("number"==e||"symbol"!=e&&r.test(n))&&n>-1&&n%1==0&&n<t}}function ae(){if(Qn)return Kn;Qn=1;var r=Qt(),n=Yr(),t=ce(),e=Tr();return Kn=function(o,u,i){if(!e(i))return!1;var c=typeof u;return!!("number"==c?n(i)&&t(u,i.length):"string"==c&&u in i)&&r(i[u],o)}}function fe(){if(Yn)return Xn;Yn=1;var r=ie(),n=ae();return Xn=function(t){return r((function(r,e){var o=-1,u=e.length,i=u>1?e[u-1]:void 0,c=u>2?e[2]:void 0;for(i=t.length>3&&"function"==typeof i?(u--,i):void 0,c&&n(e[0],e[1],c)&&(i=u<3?void 0:i,u=1),r=Object(r);++o<u;){var a=e[o];a&&t(r,a,o,i)}return r}))}}function se(){if(rt)return Zn;return rt=1,Zn=function(r,n){for(var t=-1,e=Array(r);++t<r;)e[t]=n(t);return e}}function le(){if(tt)return nt;tt=1;var r=se(),n=Kr(),t=Qr(),e=fn(),o=ce(),u=jn(),i=Object.prototype.hasOwnProperty;return nt=function(c,a){var f=t(c),s=!f&&n(c),l=!f&&!s&&e(c),p=!f&&!s&&!l&&u(c),v=f||s||l||p,h=v?r(c.length,String):[],g=h.length;for(var b in c)!a&&!i.call(c,b)||v&&("length"==b||l&&("offset"==b||"parent"==b)||p&&("buffer"==b||"byteLength"==b||"byteOffset"==b)||o(b,g))||h.push(b);return h}}function pe(){if(ot)return et;return ot=1,et=function(r){var n=[];if(null!=r)for(var t in Object(r))n.push(t);return n}}function ve(){if(it)return ut;it=1;var r=Tr(),n=Cr(),t=pe(),e=Object.prototype.hasOwnProperty;return ut=function(o){if(!r(o))return t(o);var u=n(o),i=[];for(var c in o)("constructor"!=c||!u&&e.call(o,c))&&i.push(c);return i}}function he(){if(at)return ct;at=1;var r=le(),n=ve(),t=Yr();return ct=function(e){return t(e)?r(e,!0):n(e)}}function ge(){if(st)return ft;st=1;var r=Yt(),n=fe(),t=he(),e=n((function(n,e,o,u){r(e,t(e),n,u)}));return ft=e}function be(){if(pt)return lt;pt=1;var r=F(),n=M(),t=q();return lt=function(e){if(!n(e))return!1;var o=r(e);return"[object Error]"==o||"[object DOMException]"==o||"string"==typeof e.message&&"string"==typeof e.name&&!t(e)}}function ye(){if(ht)return vt;ht=1;var r=re(),n=ie(),t=be(),e=n((function(n,e){try{return r(n,void 0,e)}catch(r){return t(r)?r:new Error(r)}}));return vt=e}function de(){if(bt)return gt;return bt=1,gt=function(r,n){for(var t=-1,e=null==r?0:r.length,o=Array(e);++t<e;)o[t]=n(r[t],t,r);return o}}function je(){if(dt)return yt;dt=1;var r=de();return yt=function(n,t){return r(t,(function(r){return n[r]}))}}function me(){if(mt)return jt;mt=1;var r=Qt(),n=Object.prototype,t=n.hasOwnProperty;return jt=function(e,o,u,i){return void 0===e||r(e,n[u])&&!t.call(i,u)?o:e}}function Oe(){if(_t)return Ot;_t=1;var r={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};return Ot=function(n){return"\\"+r[n]}}function _e(){if(xt)return wt;xt=1;var r=le(),n=kr(),t=Yr();return wt=function(e){return t(e)?r(e):n(e)}}function we(){if($t)return Pt;$t=1;return Pt=/<%=([\s\S]+?)%>/g}function xe(){if(Rt)return St;return Rt=1,St=function(r){return function(n){return null==r?void 0:r[n]}}}function Pe(){if(Et)return At;Et=1;var r=xe()({"&":"&","<":"<",">":">",'"':""","'":"'"});return At=r}function $e(){if(Ft)return Ct;Ft=1;var r=F(),n=M();return Ct=function(t){return"symbol"==typeof t||n(t)&&"[object Symbol]"==r(t)}}function Se(){if(Tt)return kt;Tt=1;var r=A(),n=de(),t=Qr(),e=$e(),o=r?r.prototype:void 0,u=o?o.toString:void 0;return kt=function r(o){if("string"==typeof o)return o;if(t(o))return n(o,r)+"";if(e(o))return u?u.call(o):"";var i=o+"";return"0"==i&&1/o==-1/0?"-0":i},kt}function Re(){if(qt)return Mt;qt=1;var r=Se();return Mt=function(n){return null==n?"":r(n)}}function Ae(){if(Nt)return Dt;Nt=1;var r=Pe(),n=Re(),t=/[&<>"']/g,e=RegExp(t.source);return Dt=function(o){return(o=n(o))&&e.test(o)?o.replace(t,r):o}}function Ee(){if(Ut)return Bt;Ut=1;return Bt=/<%-([\s\S]+?)%>/g}function Ce(){if(Lt)return It;Lt=1;return It=/<%([\s\S]+?)%>/g}function Fe(){if(Vt)return Wt;Vt=1;var r=Ae();return Wt={escape:Ee(),evaluate:Ce(),interpolate:we(),variable:"",imports:{_:{escape:r}}}}function ke(){if(zt)return Gt;zt=1;var r=ge(),n=ye(),t=je(),e=me(),o=Oe(),u=be(),i=ae(),c=_e(),a=we(),f=Fe(),s=Re(),l=/\b__p \+= '';/g,p=/\b(__p \+=) '' \+/g,v=/(__e\(.*?\)|\b__t\)) \+\n'';/g,h=/[()=,{}\[\]\/\s]/,g=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,b=/($^)/,y=/['\n\r\u2028\u2029\\]/g,d=Object.prototype.hasOwnProperty;return Gt=function(j,m,O){var _=f.imports._.templateSettings||f;O&&i(j,m,O)&&(m=void 0),j=s(j),m=r({},m,_,e);var w,x,P=r({},m.imports,_.imports,e),$=c(P),S=t(P,$),R=0,A=m.interpolate||b,E="__p += '",C=RegExp((m.escape||b).source+"|"+A.source+"|"+(A===a?g:b).source+"|"+(m.evaluate||b).source+"|$","g"),F=d.call(m,"sourceURL")?"//# sourceURL="+(m.sourceURL+"").replace(/\s/g," ")+"\n":"";j.replace(C,(function(r,n,t,e,u,i){return t||(t=e),E+=j.slice(R,i).replace(y,o),n&&(w=!0,E+="' +\n__e("+n+") +\n'"),u&&(x=!0,E+="';\n"+u+";\n__p += '"),t&&(E+="' +\n((__t = ("+t+")) == null ? '' : __t) +\n'"),R=i+r.length,r})),E+="';\n";var k=d.call(m,"variable")&&m.variable;if(k){if(h.test(k))throw new Error("Invalid `variable` option passed into `_.template`")}else E="with (obj) {\n"+E+"\n}\n";E=(x?E.replace(l,""):E).replace(p,"$1").replace(v,"$1;"),E="function("+(k||"obj")+") {\n"+(k?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(w?", __e = _.escape":"")+(x?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+E+"return __p\n}";var T=n((function(){return Function($,F+"return "+E).apply(void 0,S)}));if(T.source=E,u(T))throw T;return T}}var Te=$(ke());class Me{config;cache;constructor(r,n=new Map){this.config=r,this.cache=n}get logger(){return this.config.log}static format(r="",n={}){return Te(r)(n)}format(r="",n={}){try{return Me.format(r,n)}catch(t){throw this.logger.error(`Unable to render template with context:\n${r}\n${JSON.stringify(n)}`),this.logger.error(t),t}}exec(r,n={}){if(Jt(r))return Promise.resolve("");const{context:t,...e}=n;return"string"==typeof r?this.execFormattedCommand(this.format(r,t||{}),e):this.execFormattedCommand(r,e)}run(r,n={}){return this.exec(r,{silent:!0,...n})}async execFormattedCommand(r,n={}){const{dryRunResult:t,silent:e,external:o,dryRun:u}=n,i=void 0!==u?u:this.config.isDryRun,c=!0===o,a="string"==typeof r?r:r.join(" "),f=!c&&this.cache.has(a);if(e||this.logger.exec(r,{isExternal:c,isCached:f}),i)return Promise.resolve(t);if(f)return this.cache.get(a);const s="string"==typeof r?this.execStringCommand(r,n):this.execWithArguments(r,n,{isExternal:c});return c||this.cache.has(a)||this.cache.set(a,s),s}execStringCommand(r,n){return new Promise(((t,e)=>{x.exec(r,{async:!0,...n},((o,u,i)=>{u=u.toString().trimEnd(),0===o?t(u):(n.silent&&this.logger.error(r),e(new Error(i||u)))}))}))}async execWithArguments(r,n,t){const[e,...o]=r;return new Promise(((r,u)=>{x.exec(`${e} ${o.join(" ")}`,{async:!0,...n},((i,c,a)=>{if(0===i){const n=c.trim();this.logger.verbose(n,{isExternal:t.isExternal}),r(n)}else n.silent&&this.logger.error(`${e} ${o.join(" ")}`),u(new Error(a||c))}))}))}}function qe(r){return new N({name:"fe-config",defaultConfig:O({},B,r)})}exports.ConfigSearch=N,exports.FeScriptContext=class{logger;shell;feConfig;dryRun;verbose;options;constructor(r){const{logger:n,shell:t,feConfig:e,dryRun:o,verbose:u,options:i}=r||{};this.logger=n||new U({debug:u,dryRun:o}),this.shell=t||new Me({log:this.logger,isDryRun:o}),this.feConfig=qe(e).config,this.dryRun=!!o,this.verbose=!!u,this.options=i||{}}},exports.ScriptsLogger=U,exports.Shell=Me,exports.defaultFeConfig=B,exports.getFeConfigSearch=qe;
|
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
import * as _commitlint_types from '@commitlint/types';
|
|
2
|
+
import { Logger } from '@qlover/fe-utils';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration search options interface
|
|
6
|
+
* @interface
|
|
7
|
+
* @description
|
|
8
|
+
* Significance: Defines the configuration structure for ConfigSearch initialization
|
|
9
|
+
* Core idea: Centralize configuration search parameters
|
|
10
|
+
* Main function: Type-safe configuration options
|
|
11
|
+
* Main purpose: Standardize configuration initialization
|
|
12
|
+
* Example:
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const options: ConfigSearchOptions = {
|
|
15
|
+
* name: 'myapp',
|
|
16
|
+
* searchPlaces: ['myapp.config.js'],
|
|
17
|
+
* defaultConfig: { port: 3000 }
|
|
18
|
+
* };
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
interface ConfigSearchOptions {
|
|
22
|
+
/** Base name for configuration files */
|
|
23
|
+
name: string;
|
|
24
|
+
/** Custom search locations for config files */
|
|
25
|
+
searchPlaces?: string[];
|
|
26
|
+
/** Default configuration object */
|
|
27
|
+
defaultConfig?: Record<string, unknown>;
|
|
28
|
+
/** Custom loaders for different file types */
|
|
29
|
+
loaders?: Record<string, (filepath: string) => unknown>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Search options interface for configuration retrieval
|
|
33
|
+
* @interface
|
|
34
|
+
* @description
|
|
35
|
+
* Significance: Defines options for configuration search operation
|
|
36
|
+
* Core idea: Control configuration file search behavior
|
|
37
|
+
* Main function: Customize search parameters
|
|
38
|
+
* Main purpose: Flexible configuration loading
|
|
39
|
+
* Example:
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const searchOptions: SearchOptions = {
|
|
42
|
+
* file: 'custom.config.js',
|
|
43
|
+
* dir: '/path/to/project'
|
|
44
|
+
* };
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
interface SearchOptions {
|
|
48
|
+
/** Specific configuration file to load */
|
|
49
|
+
file?: string | false;
|
|
50
|
+
/** Directory to search in */
|
|
51
|
+
dir?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Configuration search utility class
|
|
55
|
+
* @class
|
|
56
|
+
* @description
|
|
57
|
+
* Significance: Manages configuration file discovery and loading
|
|
58
|
+
* Core idea: Unified configuration management
|
|
59
|
+
* Main function: Search and load configuration from various sources
|
|
60
|
+
* Main purpose: Provide consistent configuration access
|
|
61
|
+
* Example:
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const configSearch = new ConfigSearch({
|
|
64
|
+
* name: 'myapp',
|
|
65
|
+
* defaultConfig: { port: 3000 }
|
|
66
|
+
* });
|
|
67
|
+
* const config = configSearch.config;
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
declare class ConfigSearch {
|
|
71
|
+
private name;
|
|
72
|
+
private searchPlaces;
|
|
73
|
+
private _config;
|
|
74
|
+
private loaders?;
|
|
75
|
+
private searchCache?;
|
|
76
|
+
/**
|
|
77
|
+
* Creates a ConfigSearch instance
|
|
78
|
+
* @param options - Configuration search options
|
|
79
|
+
* @throws Error if neither name nor searchPlaces is provided
|
|
80
|
+
* @description
|
|
81
|
+
* Significance: Initializes configuration search environment
|
|
82
|
+
* Core idea: Setup configuration search parameters
|
|
83
|
+
* Main function: Create search instance with options
|
|
84
|
+
* Main purpose: Prepare for configuration discovery
|
|
85
|
+
* Example:
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const search = new ConfigSearch({
|
|
88
|
+
* name: 'myapp',
|
|
89
|
+
* defaultConfig: { debug: true }
|
|
90
|
+
* });
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
constructor(options: ConfigSearchOptions);
|
|
94
|
+
/**
|
|
95
|
+
* Get effective configuration
|
|
96
|
+
* @returns Merged configuration object
|
|
97
|
+
* @description
|
|
98
|
+
* Significance: Provides access to final configuration
|
|
99
|
+
* Core idea: Merge default and discovered configurations
|
|
100
|
+
* Main function: Retrieve effective configuration
|
|
101
|
+
* Main purpose: Access complete configuration
|
|
102
|
+
* Example:
|
|
103
|
+
* ```typescript
|
|
104
|
+
* const config = configSearch.config;
|
|
105
|
+
* console.log(config.debug); // true
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
get config(): Record<string, unknown>;
|
|
109
|
+
/**
|
|
110
|
+
* Get search locations
|
|
111
|
+
* @returns Array of search locations
|
|
112
|
+
* @description
|
|
113
|
+
* Significance: Exposes configuration search paths
|
|
114
|
+
* Core idea: Provide transparency in search process
|
|
115
|
+
* Main function: Return search locations
|
|
116
|
+
* Main purpose: Debug and verify search paths
|
|
117
|
+
* Example:
|
|
118
|
+
* ```typescript
|
|
119
|
+
* const places = configSearch.getSearchPlaces();
|
|
120
|
+
* // ['package.json', 'myapp.config.js', ...]
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
getSearchPlaces(): string[];
|
|
124
|
+
/**
|
|
125
|
+
* Get configuration from specific location
|
|
126
|
+
* @param options - Search options
|
|
127
|
+
* @returns Configuration object
|
|
128
|
+
* @throws Error if configuration file is invalid
|
|
129
|
+
* @description
|
|
130
|
+
* Significance: Load configuration from specific location
|
|
131
|
+
* Core idea: Flexible configuration loading
|
|
132
|
+
* Main function: Load and validate configuration
|
|
133
|
+
* Main purpose: Custom configuration loading
|
|
134
|
+
* Example:
|
|
135
|
+
* ```typescript
|
|
136
|
+
* const config = configSearch.get({
|
|
137
|
+
* file: 'custom.config.js',
|
|
138
|
+
* dir: process.cwd()
|
|
139
|
+
* });
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
get(options?: SearchOptions): Record<string, unknown>;
|
|
143
|
+
/**
|
|
144
|
+
* Search for configuration with caching
|
|
145
|
+
* @returns Cached configuration object
|
|
146
|
+
* @description
|
|
147
|
+
* Significance: Provides cached configuration access
|
|
148
|
+
* Core idea: Cache configuration for performance
|
|
149
|
+
* Main function: Search and cache configuration
|
|
150
|
+
* Main purpose: Optimize repeated access
|
|
151
|
+
* Example:
|
|
152
|
+
* ```typescript
|
|
153
|
+
* const config = configSearch.search();
|
|
154
|
+
* // Subsequent calls use cached result
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
search(): Record<string, unknown>;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
declare const defaultFeConfig: FeConfig;
|
|
161
|
+
type FeConfig = {
|
|
162
|
+
/**
|
|
163
|
+
* Run `fe-clean-branch` to exclude branches
|
|
164
|
+
*
|
|
165
|
+
* @default ["master", "develop", "main"]
|
|
166
|
+
*/
|
|
167
|
+
protectedBranches?: string[];
|
|
168
|
+
/**
|
|
169
|
+
* Run `fe-clean` to includes files
|
|
170
|
+
*
|
|
171
|
+
* @default ["dist","node_modules","yarn.lock","package-lock.json",".eslintcache","*.log"]
|
|
172
|
+
*/
|
|
173
|
+
cleanFiles?: string[];
|
|
174
|
+
/**
|
|
175
|
+
* Use author name when create merge PR
|
|
176
|
+
*
|
|
177
|
+
* @default `package.json -> autor`
|
|
178
|
+
*/
|
|
179
|
+
author?: string | {
|
|
180
|
+
name?: string;
|
|
181
|
+
email?: string;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Use repo info when create merge PR
|
|
185
|
+
*
|
|
186
|
+
* @default `package.json -> repository`
|
|
187
|
+
*/
|
|
188
|
+
repository?: string | {
|
|
189
|
+
url?: string;
|
|
190
|
+
[key: string]: unknown;
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* commitlint config
|
|
194
|
+
*
|
|
195
|
+
* @default { "extends": ["@commitlint/config-conventional"] }
|
|
196
|
+
*/
|
|
197
|
+
commitlint?: _commitlint_types.UserConfig;
|
|
198
|
+
/**
|
|
199
|
+
* config of CI release
|
|
200
|
+
*
|
|
201
|
+
* scripts release
|
|
202
|
+
*/
|
|
203
|
+
release?: FeReleaseConfig;
|
|
204
|
+
/**
|
|
205
|
+
* @default ['.env.local', '.env']
|
|
206
|
+
*/
|
|
207
|
+
envOrder?: string[];
|
|
208
|
+
};
|
|
209
|
+
type FeReleaseConfig = {
|
|
210
|
+
/**
|
|
211
|
+
* The path to publish the package
|
|
212
|
+
*
|
|
213
|
+
* @default ''
|
|
214
|
+
*/
|
|
215
|
+
publishPath?: string;
|
|
216
|
+
/**
|
|
217
|
+
* Whether to automatically merge PR when creating and publishing
|
|
218
|
+
*
|
|
219
|
+
* @default true
|
|
220
|
+
*/
|
|
221
|
+
autoMergeReleasePR?: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* PR auto merged type
|
|
224
|
+
*
|
|
225
|
+
* @default squash
|
|
226
|
+
*/
|
|
227
|
+
autoMergeType?: 'merge' | 'squash' | 'rebase';
|
|
228
|
+
/**
|
|
229
|
+
* Create the branch name of PR when publishing
|
|
230
|
+
*
|
|
231
|
+
* @default ${env}-${branch}-${tagName}
|
|
232
|
+
*/
|
|
233
|
+
branchName?: string;
|
|
234
|
+
/**
|
|
235
|
+
* Create a title for publishing PR
|
|
236
|
+
*
|
|
237
|
+
* @default [${pkgName} Release] Branch:${branch}, Tag:${tagName}, Env:${env}
|
|
238
|
+
*/
|
|
239
|
+
PRTitle?: string;
|
|
240
|
+
/**
|
|
241
|
+
* Create a body for publishing PR
|
|
242
|
+
*
|
|
243
|
+
* @default This PR includes version bump to ${tagName}
|
|
244
|
+
*/
|
|
245
|
+
PRBody?: string;
|
|
246
|
+
/**
|
|
247
|
+
* Create a label for publishing PR
|
|
248
|
+
*/
|
|
249
|
+
label?: {
|
|
250
|
+
/**
|
|
251
|
+
* hex color string
|
|
252
|
+
*
|
|
253
|
+
* @default `1A7F37`
|
|
254
|
+
*/
|
|
255
|
+
color?: string;
|
|
256
|
+
/**
|
|
257
|
+
* @default `Label for version update PRs`
|
|
258
|
+
*/
|
|
259
|
+
description?: string;
|
|
260
|
+
/**
|
|
261
|
+
* @default `CI-Release`
|
|
262
|
+
*/
|
|
263
|
+
name?: string;
|
|
264
|
+
};
|
|
265
|
+
/**
|
|
266
|
+
* @default `changes:${name}`
|
|
267
|
+
*/
|
|
268
|
+
changePackagesLabel?: string;
|
|
269
|
+
/**
|
|
270
|
+
* @default `[]`
|
|
271
|
+
*/
|
|
272
|
+
packagesDirectories?: string[];
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
declare class ScriptsLogger extends Logger {
|
|
276
|
+
/**
|
|
277
|
+
* @override
|
|
278
|
+
* @param {string} value
|
|
279
|
+
* @returns {string}
|
|
280
|
+
*/
|
|
281
|
+
prefix(value: string): string;
|
|
282
|
+
obtrusive(title: string): void;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Configuration interface for Shell class
|
|
287
|
+
* @interface
|
|
288
|
+
*/
|
|
289
|
+
interface ShellConfig {
|
|
290
|
+
/** Whether to run in dry-run mode */
|
|
291
|
+
isDryRun?: boolean;
|
|
292
|
+
/** Logger instance */
|
|
293
|
+
log: Logger;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Options for shell execution
|
|
297
|
+
* @interface
|
|
298
|
+
*/
|
|
299
|
+
interface ShellExecOptions {
|
|
300
|
+
/**
|
|
301
|
+
* Whether to suppress output to the console
|
|
302
|
+
*/
|
|
303
|
+
silent?: boolean;
|
|
304
|
+
/**
|
|
305
|
+
* Environment variables to be passed to the command
|
|
306
|
+
*/
|
|
307
|
+
env?: Record<string, string>;
|
|
308
|
+
/**
|
|
309
|
+
* Result to return when in dry-run mode
|
|
310
|
+
*/
|
|
311
|
+
dryRunResult?: unknown;
|
|
312
|
+
/**
|
|
313
|
+
* Whether to perform a dry run
|
|
314
|
+
* Overrides shell config.isDryRun if set
|
|
315
|
+
*/
|
|
316
|
+
dryRun?: boolean;
|
|
317
|
+
/**
|
|
318
|
+
* Whether to use external command execution
|
|
319
|
+
*/
|
|
320
|
+
external?: boolean;
|
|
321
|
+
/**
|
|
322
|
+
* Template context for command string interpolation
|
|
323
|
+
*/
|
|
324
|
+
context?: Record<string, unknown>;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Metadata for command execution
|
|
328
|
+
* @interface
|
|
329
|
+
*/
|
|
330
|
+
interface ExecMeta {
|
|
331
|
+
/** Whether the command is executed externally */
|
|
332
|
+
isExternal: boolean;
|
|
333
|
+
/** Whether the command result is cached */
|
|
334
|
+
isCached?: boolean;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Shell class for command execution
|
|
338
|
+
* @class
|
|
339
|
+
* @description Provides methods for executing shell commands with caching and templating support
|
|
340
|
+
*/
|
|
341
|
+
declare class Shell {
|
|
342
|
+
config: ShellConfig;
|
|
343
|
+
private cache;
|
|
344
|
+
/**
|
|
345
|
+
* Creates a new Shell instance
|
|
346
|
+
* @param config - Shell configuration
|
|
347
|
+
* @param cache - Command cache map
|
|
348
|
+
*/
|
|
349
|
+
constructor(config: ShellConfig, cache?: Map<string, Promise<string>>);
|
|
350
|
+
/**
|
|
351
|
+
* Gets the logger instance
|
|
352
|
+
*/
|
|
353
|
+
get logger(): Logger;
|
|
354
|
+
/**
|
|
355
|
+
* Formats a template string with context
|
|
356
|
+
* @param template - Template string
|
|
357
|
+
* @param context - Context object for template interpolation
|
|
358
|
+
* @returns Formatted string
|
|
359
|
+
*/
|
|
360
|
+
static format(template?: string, context?: Record<string, unknown>): string;
|
|
361
|
+
/**
|
|
362
|
+
* Formats a template string with context and error handling
|
|
363
|
+
* @param template - Template string
|
|
364
|
+
* @param context - Context object for template interpolation
|
|
365
|
+
* @returns Formatted string
|
|
366
|
+
* @throws Error if template formatting fails
|
|
367
|
+
*/
|
|
368
|
+
format(template?: string, context?: Record<string, unknown>): string;
|
|
369
|
+
/**
|
|
370
|
+
* Executes a command with options
|
|
371
|
+
* @param command - Command string or array
|
|
372
|
+
* @param options - Execution options
|
|
373
|
+
* @returns Promise resolving to command output
|
|
374
|
+
*/
|
|
375
|
+
exec(command: string | string[], options?: ShellExecOptions): Promise<string>;
|
|
376
|
+
/**
|
|
377
|
+
* Executes a command silently
|
|
378
|
+
* @param command - Command string or array
|
|
379
|
+
* @param options - Execution options
|
|
380
|
+
* @returns Promise resolving to command output
|
|
381
|
+
*/
|
|
382
|
+
run(command: string | string[], options?: ShellExecOptions): Promise<string>;
|
|
383
|
+
/**
|
|
384
|
+
* Executes a formatted command with caching
|
|
385
|
+
* @param command - Formatted command string or array
|
|
386
|
+
* @param options - Execution options
|
|
387
|
+
* @returns Promise resolving to command output
|
|
388
|
+
*/
|
|
389
|
+
execFormattedCommand(command: string | string[], options?: ShellExecOptions): Promise<string>;
|
|
390
|
+
/**
|
|
391
|
+
* Executes a string command using shelljs
|
|
392
|
+
* @param command - Command string
|
|
393
|
+
* @param options - Execution options
|
|
394
|
+
* @returns Promise resolving to command output
|
|
395
|
+
*/
|
|
396
|
+
execStringCommand(command: string, options: ShellExecOptions): Promise<string>;
|
|
397
|
+
/**
|
|
398
|
+
* Executes a command with arguments using execa
|
|
399
|
+
* @param command - Command array
|
|
400
|
+
* @param options - Execution options
|
|
401
|
+
* @param meta - Execution metadata
|
|
402
|
+
* @returns Promise resolving to command output
|
|
403
|
+
*/
|
|
404
|
+
execWithArguments(command: string[], options: ShellExecOptions, meta: ExecMeta): Promise<string>;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Create a new ConfigSearch instance with fe configuration
|
|
409
|
+
* @param feConfig - Custom fe configuration
|
|
410
|
+
* @returns ConfigSearch instance
|
|
411
|
+
* @description
|
|
412
|
+
* Significance: Creates configuration search utility
|
|
413
|
+
* Core idea: Merge default and custom configurations
|
|
414
|
+
* Main function: Initialize configuration search
|
|
415
|
+
* Main purpose: Provide configuration discovery
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* ```typescript
|
|
419
|
+
* const configSearch = getFeConfigSearch({ debug: true });
|
|
420
|
+
* ```
|
|
421
|
+
*/
|
|
422
|
+
declare function getFeConfigSearch(feConfig?: Record<string, unknown>): ConfigSearch;
|
|
423
|
+
/**
|
|
424
|
+
* Options interface for FeScriptContext
|
|
425
|
+
* @interface
|
|
426
|
+
* @description
|
|
427
|
+
* Significance: Defines script execution context options
|
|
428
|
+
* Core idea: Centralize script execution configuration
|
|
429
|
+
* Main function: Type-safe context options
|
|
430
|
+
* Main purpose: Configure script execution environment
|
|
431
|
+
*
|
|
432
|
+
* @example
|
|
433
|
+
* ```typescript
|
|
434
|
+
* const options: FeScriptContextOptions<T> = {
|
|
435
|
+
* logger: new ScriptsLogger(),
|
|
436
|
+
* dryRun: true
|
|
437
|
+
* };
|
|
438
|
+
* ```
|
|
439
|
+
*/
|
|
440
|
+
interface FeScriptContextOptions<T> {
|
|
441
|
+
/** Custom logger instance */
|
|
442
|
+
logger?: ScriptsLogger;
|
|
443
|
+
/** Shell instance for command execution */
|
|
444
|
+
shell?: Shell;
|
|
445
|
+
/** Custom fe configuration */
|
|
446
|
+
feConfig?: Record<string, unknown>;
|
|
447
|
+
/** Whether to perform dry run */
|
|
448
|
+
dryRun?: boolean;
|
|
449
|
+
/** Enable verbose logging */
|
|
450
|
+
verbose?: boolean;
|
|
451
|
+
/** Additional script-specific options */
|
|
452
|
+
options?: T;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Script execution context class
|
|
456
|
+
* @class
|
|
457
|
+
* @description
|
|
458
|
+
* Significance: Manages script execution environment
|
|
459
|
+
* Core idea: Provide unified context for script execution
|
|
460
|
+
* Main function: Initialize and maintain script context
|
|
461
|
+
* Main purpose: Standardize script execution environment
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
* ```typescript
|
|
465
|
+
* const context = new FeScriptContext<MyOptions>({
|
|
466
|
+
* dryRun: true,
|
|
467
|
+
* verbose: true
|
|
468
|
+
* });
|
|
469
|
+
* ```
|
|
470
|
+
*/
|
|
471
|
+
declare class FeScriptContext<T = unknown> {
|
|
472
|
+
/** Logger instance */
|
|
473
|
+
readonly logger: ScriptsLogger;
|
|
474
|
+
/** Shell instance */
|
|
475
|
+
readonly shell: Shell;
|
|
476
|
+
/** Fe configuration */
|
|
477
|
+
readonly feConfig: FeConfig;
|
|
478
|
+
/** Dry run flag */
|
|
479
|
+
readonly dryRun: boolean;
|
|
480
|
+
/** Verbose logging flag */
|
|
481
|
+
readonly verbose: boolean;
|
|
482
|
+
/** Script-specific options */
|
|
483
|
+
options: T;
|
|
484
|
+
/**
|
|
485
|
+
* Creates a FeScriptContext instance
|
|
486
|
+
*
|
|
487
|
+
* @description
|
|
488
|
+
* Significance: Initializes script execution context
|
|
489
|
+
* Core idea: Setup execution environment
|
|
490
|
+
* Main function: Create context with options
|
|
491
|
+
* Main purpose: Prepare script execution environment
|
|
492
|
+
*
|
|
493
|
+
* @example
|
|
494
|
+
* ```typescript
|
|
495
|
+
* const context = new FeScriptContext({
|
|
496
|
+
* dryRun: true,
|
|
497
|
+
* options: { branch: 'main' }
|
|
498
|
+
* });
|
|
499
|
+
* ```
|
|
500
|
+
*/
|
|
501
|
+
constructor(scriptsOptions?: FeScriptContextOptions<T>);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
export { ConfigSearch, type ConfigSearchOptions, type FeConfig, type FeReleaseConfig, FeScriptContext, type FeScriptContextOptions, ScriptsLogger, Shell, type ShellConfig, type ShellExecOptions, defaultFeConfig, getFeConfigSearch };
|
package/dist/es/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cosmiconfigSync as r}from"cosmiconfig";import n from"merge";import{Logger as t}from"@qlover/fe-utils";import e from"chalk";import o from"shelljs";var u,i,c,a,f,s,l,p,v,h,g,b,y,d,j,m,O,_,w,P,x="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function $(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function R(){if(i)return u;i=1;var r="object"==typeof x&&x&&x.Object===Object&&x;return u=r}function A(){if(a)return c;a=1;var r=R(),n="object"==typeof self&&self&&self.Object===Object&&self,t=r||n||Function("return this")();return c=t}function S(){if(s)return f;s=1;var r=A().Symbol;return f=r}function E(){if(p)return l;p=1;var r=S(),n=Object.prototype,t=n.hasOwnProperty,e=n.toString,o=r?r.toStringTag:void 0;return l=function(r){var n=t.call(r,o),u=r[o];try{r[o]=void 0;var i=!0}catch(r){}var c=e.call(r);return i&&(n?r[o]=u:delete r[o]),c}}function C(){if(h)return v;h=1;var r=Object.prototype.toString;return v=function(n){return r.call(n)}}function F(){if(b)return g;b=1;var r=S(),n=E(),t=C(),e=r?r.toStringTag:void 0;return g=function(r){return null==r?void 0===r?"[object Undefined]":"[object Null]":e&&e in Object(r)?n(r):t(r)}}function k(){if(d)return y;return d=1,y=function(r,n){return function(t){return r(n(t))}}}function T(){if(m)return j;m=1;var r=k()(Object.getPrototypeOf,Object);return j=r}function M(){if(_)return O;return _=1,O=function(r){return null!=r&&"object"==typeof r}}function D(){if(P)return w;P=1;var r=F(),n=T(),t=M(),e=Function.prototype,o=Object.prototype,u=e.toString,i=o.hasOwnProperty,c=u.call(Object);return w=function(e){if(!t(e)||"[object Object]"!=r(e))return!1;var o=n(e);if(null===o)return!0;var a=i.call(o,"constructor")&&o.constructor;return"function"==typeof a&&a instanceof a&&u.call(a)==c}}var N=$(D());class B{name;searchPlaces;_config;loaders;searchCache;constructor(r){const{name:n,searchPlaces:t,defaultConfig:e,loaders:o}=r;if(!n&&!t)throw new Error("searchPlaces or name is required");this.name=n,this.searchPlaces=t||function(r){const n=["json","js","ts","cjs","yaml","yml"];return["package.json",...n.map((n=>`${r}.${n}`)),...n.map((n=>`.${r}.${n}`))]}(n),this._config=e||{},this.loaders=o}get config(){return n({},this._config,this.search())}getSearchPlaces(){return this.searchPlaces}get(n={}){const{file:t,dir:e=process.cwd()}=n,o={};if(!1===t)return o;const u=r(this.name,{searchPlaces:this.searchPlaces,loaders:this.loaders}),i=t?u.load(t):u.search(e);if(i&&"string"==typeof i.config)throw new Error(`Invalid configuration file at ${i.filepath}`);return i&&N(i.config)?i.config:o}search(){return this.searchCache?this.searchCache:this.searchCache=this.get({})}}const U={protectedBranches:["master","develop","main"],cleanFiles:["dist","node_modules","yarn.lock","package-lock.json",".eslintcache","*.log"],commitlint:{extends:["@commitlint/config-conventional"]},release:{publishPath:"",autoMergeReleasePR:!1,autoMergeType:"squash",branchName:"release-${env}-${branch}-${tagName}",PRTitle:"[${pkgName} Release] Branch:${branch}, Tag:${tagName}, Env:${env}",PRBody:"## Publish Details\n\n- 🏷️ Version: ${tagName}\n- 🌲 Branch: ${branch}\n- 🔧 Environment: ${env}\n\n## Changelog\n\n${changelog}\n\n## Notes\n\n- [ ] Please check if the version number is correct\n- [ ] Please confirm all tests have passed\n- [ ] Please confirm the documentation has been updated\n\n> This PR is auto created by release process, please contact the frontend team if there are any questions.",label:{color:"1A7F37",description:"Release PR",name:"CI-Release"},packagesDirectories:[],changePackagesLabel:"changes:${name}"},envOrder:[".env.local",".env.production",".env"]};class I extends t{prefix(r){switch(r){case"INFO":return e.blue(r);case"WARN":return e.yellow(r);case"ERROR":return e.red(r);case"DEBUG":return e.gray(r);default:return r}}obtrusive(r){const n=e.bold(r);super.obtrusive(n)}}var q,W,L,V,G,z,J,H,K,Q,X,Y,Z,rr,nr,tr,er,or,ur,ir,cr,ar,fr,sr,lr,pr,vr,hr,gr,br,yr,dr,jr,mr,Or,_r,wr,Pr,xr,$r,Rr,Ar,Sr,Er;function Cr(){if(W)return q;W=1;var r=Object.prototype;return q=function(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||r)}}function Fr(){if(V)return L;V=1;var r=k()(Object.keys,Object);return L=r}function kr(){if(z)return G;z=1;var r=Cr(),n=Fr(),t=Object.prototype.hasOwnProperty;return G=function(e){if(!r(e))return n(e);var o=[];for(var u in Object(e))t.call(e,u)&&"constructor"!=u&&o.push(u);return o}}function Tr(){if(H)return J;return H=1,J=function(r){var n=typeof r;return null!=r&&("object"==n||"function"==n)}}function Mr(){if(Q)return K;Q=1;var r=F(),n=Tr();return K=function(t){if(!n(t))return!1;var e=r(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}}function Dr(){if(Y)return X;Y=1;var r=A()["__core-js_shared__"];return X=r}function Nr(){if(rr)return Z;rr=1;var r,n=Dr(),t=(r=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";return Z=function(r){return!!t&&t in r}}function Br(){if(tr)return nr;tr=1;var r=Function.prototype.toString;return nr=function(n){if(null!=n){try{return r.call(n)}catch(r){}try{return n+""}catch(r){}}return""}}function Ur(){if(or)return er;or=1;var r=Mr(),n=Nr(),t=Tr(),e=Br(),o=/^\[object .+?Constructor\]$/,u=Function.prototype,i=Object.prototype,c=u.toString,a=i.hasOwnProperty,f=RegExp("^"+c.call(a).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return er=function(u){return!(!t(u)||n(u))&&(r(u)?f:o).test(e(u))}}function Ir(){if(ir)return ur;return ir=1,ur=function(r,n){return null==r?void 0:r[n]}}function qr(){if(ar)return cr;ar=1;var r=Ur(),n=Ir();return cr=function(t,e){var o=n(t,e);return r(o)?o:void 0}}function Wr(){if(sr)return fr;sr=1;var r=qr()(A(),"DataView");return fr=r}function Lr(){if(pr)return lr;pr=1;var r=qr()(A(),"Map");return lr=r}function Vr(){if(hr)return vr;hr=1;var r=qr()(A(),"Promise");return vr=r}function Gr(){if(br)return gr;br=1;var r=qr()(A(),"Set");return gr=r}function zr(){if(dr)return yr;dr=1;var r=qr()(A(),"WeakMap");return yr=r}function Jr(){if(mr)return jr;mr=1;var r=Wr(),n=Lr(),t=Vr(),e=Gr(),o=zr(),u=F(),i=Br(),c="[object Map]",a="[object Promise]",f="[object Set]",s="[object WeakMap]",l="[object DataView]",p=i(r),v=i(n),h=i(t),g=i(e),b=i(o),y=u;return(r&&y(new r(new ArrayBuffer(1)))!=l||n&&y(new n)!=c||t&&y(t.resolve())!=a||e&&y(new e)!=f||o&&y(new o)!=s)&&(y=function(r){var n=u(r),t="[object Object]"==n?r.constructor:void 0,e=t?i(t):"";if(e)switch(e){case p:return l;case v:return c;case h:return a;case g:return f;case b:return s}return n}),jr=y}function Hr(){if(_r)return Or;_r=1;var r=F(),n=M();return Or=function(t){return n(t)&&"[object Arguments]"==r(t)}}function Kr(){if(Pr)return wr;Pr=1;var r=Hr(),n=M(),t=Object.prototype,e=t.hasOwnProperty,o=t.propertyIsEnumerable,u=r(function(){return arguments}())?r:function(r){return n(r)&&e.call(r,"callee")&&!o.call(r,"callee")};return wr=u}function Qr(){if($r)return xr;$r=1;var r=Array.isArray;return xr=r}function Xr(){if(Ar)return Rr;Ar=1;return Rr=function(r){return"number"==typeof r&&r>-1&&r%1==0&&r<=9007199254740991}}function Yr(){if(Er)return Sr;Er=1;var r=Mr(),n=Xr();return Sr=function(t){return null!=t&&n(t.length)&&!r(t)}}var Zr,rn,nn,tn,en,on,un,cn={exports:{}};function an(){if(rn)return Zr;return rn=1,Zr=function(){return!1}}function fn(){return nn||(nn=1,function(r,n){var t=A(),e=an(),o=n&&!n.nodeType&&n,u=o&&r&&!r.nodeType&&r,i=u&&u.exports===o?t.Buffer:void 0,c=(i?i.isBuffer:void 0)||e;r.exports=c}(cn,cn.exports)),cn.exports}function sn(){if(en)return tn;en=1;var r=F(),n=Xr(),t=M(),e={};return e["[object Float32Array]"]=e["[object Float64Array]"]=e["[object Int8Array]"]=e["[object Int16Array]"]=e["[object Int32Array]"]=e["[object Uint8Array]"]=e["[object Uint8ClampedArray]"]=e["[object Uint16Array]"]=e["[object Uint32Array]"]=!0,e["[object Arguments]"]=e["[object Array]"]=e["[object ArrayBuffer]"]=e["[object Boolean]"]=e["[object DataView]"]=e["[object Date]"]=e["[object Error]"]=e["[object Function]"]=e["[object Map]"]=e["[object Number]"]=e["[object Object]"]=e["[object RegExp]"]=e["[object Set]"]=e["[object String]"]=e["[object WeakMap]"]=!1,tn=function(o){return t(o)&&n(o.length)&&!!e[r(o)]}}function ln(){if(un)return on;return un=1,on=function(r){return function(n){return r(n)}}}var pn,vn,hn,gn,bn,yn={exports:{}};function dn(){return pn||(pn=1,r=yn,n=yn.exports,t=R(),e=n&&!n.nodeType&&n,o=e&&r&&!r.nodeType&&r,u=o&&o.exports===e&&t.process,i=function(){try{var r=o&&o.require&&o.require("util").types;return r||u&&u.binding&&u.binding("util")}catch(r){}}(),r.exports=i),yn.exports;var r,n,t,e,o,u,i}function jn(){if(hn)return vn;hn=1;var r=sn(),n=ln(),t=dn(),e=t&&t.isTypedArray,o=e?n(e):r;return vn=o}function mn(){if(bn)return gn;bn=1;var r=kr(),n=Jr(),t=Kr(),e=Qr(),o=Yr(),u=fn(),i=Cr(),c=jn(),a=Object.prototype.hasOwnProperty;return gn=function(f){if(null==f)return!0;if(o(f)&&(e(f)||"string"==typeof f||"function"==typeof f.splice||u(f)||c(f)||t(f)))return!f.length;var s=n(f);if("[object Map]"==s||"[object Set]"==s)return!f.size;if(i(f))return!r(f).length;for(var l in f)if(a.call(f,l))return!1;return!0}}var On,_n,wn,Pn,xn,$n,Rn,An,Sn,En,Cn,Fn,kn,Tn,Mn,Dn,Nn,Bn,Un,In,qn,Wn,Ln,Vn,Gn,zn,Jn,Hn,Kn,Qn,Xn,Yn,Zn,rt,nt,tt,et,ot,ut,it,ct,at,ft,st,lt,pt,vt,ht,gt,bt,yt,dt,jt,mt,Ot,_t,wt,Pt,xt,$t,Rt,At,St,Et,Ct,Ft,kt,Tt,Mt,Dt,Nt,Bt,Ut,It,qt,Wt,Lt,Vt,Gt,zt,Jt=$(mn());function Ht(){if(_n)return On;_n=1;var r=qr(),n=function(){try{var n=r(Object,"defineProperty");return n({},"",{}),n}catch(r){}}();return On=n}function Kt(){if(Pn)return wn;Pn=1;var r=Ht();return wn=function(n,t,e){"__proto__"==t&&r?r(n,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):n[t]=e}}function Qt(){if($n)return xn;return $n=1,xn=function(r,n){return r===n||r!=r&&n!=n}}function Xt(){if(An)return Rn;An=1;var r=Kt(),n=Qt(),t=Object.prototype.hasOwnProperty;return Rn=function(e,o,u){var i=e[o];t.call(e,o)&&n(i,u)&&(void 0!==u||o in e)||r(e,o,u)}}function Yt(){if(En)return Sn;En=1;var r=Xt(),n=Kt();return Sn=function(t,e,o,u){var i=!o;o||(o={});for(var c=-1,a=e.length;++c<a;){var f=e[c],s=u?u(o[f],t[f],f,o,t):void 0;void 0===s&&(s=t[f]),i?n(o,f,s):r(o,f,s)}return o}}function Zt(){if(Fn)return Cn;return Fn=1,Cn=function(r){return r}}function re(){if(Tn)return kn;return Tn=1,kn=function(r,n,t){switch(t.length){case 0:return r.call(n);case 1:return r.call(n,t[0]);case 2:return r.call(n,t[0],t[1]);case 3:return r.call(n,t[0],t[1],t[2])}return r.apply(n,t)}}function ne(){if(Dn)return Mn;Dn=1;var r=re(),n=Math.max;return Mn=function(t,e,o){return e=n(void 0===e?t.length-1:e,0),function(){for(var u=arguments,i=-1,c=n(u.length-e,0),a=Array(c);++i<c;)a[i]=u[e+i];i=-1;for(var f=Array(e+1);++i<e;)f[i]=u[i];return f[e]=o(a),r(t,this,f)}},Mn}function te(){if(Bn)return Nn;return Bn=1,Nn=function(r){return function(){return r}}}function ee(){if(In)return Un;In=1;var r=te(),n=Ht();return Un=n?function(t,e){return n(t,"toString",{configurable:!0,enumerable:!1,value:r(e),writable:!0})}:Zt()}function oe(){if(Wn)return qn;Wn=1;var r=Date.now;return qn=function(n){var t=0,e=0;return function(){var o=r(),u=16-(o-e);if(e=o,u>0){if(++t>=800)return arguments[0]}else t=0;return n.apply(void 0,arguments)}},qn}function ue(){if(Vn)return Ln;Vn=1;var r=ee(),n=oe()(r);return Ln=n}function ie(){if(zn)return Gn;zn=1;var r=Zt(),n=ne(),t=ue();return Gn=function(e,o){return t(n(e,o,r),e+"")}}function ce(){if(Hn)return Jn;Hn=1;var r=/^(?:0|[1-9]\d*)$/;return Jn=function(n,t){var e=typeof n;return!!(t=null==t?9007199254740991:t)&&("number"==e||"symbol"!=e&&r.test(n))&&n>-1&&n%1==0&&n<t}}function ae(){if(Qn)return Kn;Qn=1;var r=Qt(),n=Yr(),t=ce(),e=Tr();return Kn=function(o,u,i){if(!e(i))return!1;var c=typeof u;return!!("number"==c?n(i)&&t(u,i.length):"string"==c&&u in i)&&r(i[u],o)}}function fe(){if(Yn)return Xn;Yn=1;var r=ie(),n=ae();return Xn=function(t){return r((function(r,e){var o=-1,u=e.length,i=u>1?e[u-1]:void 0,c=u>2?e[2]:void 0;for(i=t.length>3&&"function"==typeof i?(u--,i):void 0,c&&n(e[0],e[1],c)&&(i=u<3?void 0:i,u=1),r=Object(r);++o<u;){var a=e[o];a&&t(r,a,o,i)}return r}))}}function se(){if(rt)return Zn;return rt=1,Zn=function(r,n){for(var t=-1,e=Array(r);++t<r;)e[t]=n(t);return e}}function le(){if(tt)return nt;tt=1;var r=se(),n=Kr(),t=Qr(),e=fn(),o=ce(),u=jn(),i=Object.prototype.hasOwnProperty;return nt=function(c,a){var f=t(c),s=!f&&n(c),l=!f&&!s&&e(c),p=!f&&!s&&!l&&u(c),v=f||s||l||p,h=v?r(c.length,String):[],g=h.length;for(var b in c)!a&&!i.call(c,b)||v&&("length"==b||l&&("offset"==b||"parent"==b)||p&&("buffer"==b||"byteLength"==b||"byteOffset"==b)||o(b,g))||h.push(b);return h}}function pe(){if(ot)return et;return ot=1,et=function(r){var n=[];if(null!=r)for(var t in Object(r))n.push(t);return n}}function ve(){if(it)return ut;it=1;var r=Tr(),n=Cr(),t=pe(),e=Object.prototype.hasOwnProperty;return ut=function(o){if(!r(o))return t(o);var u=n(o),i=[];for(var c in o)("constructor"!=c||!u&&e.call(o,c))&&i.push(c);return i}}function he(){if(at)return ct;at=1;var r=le(),n=ve(),t=Yr();return ct=function(e){return t(e)?r(e,!0):n(e)}}function ge(){if(st)return ft;st=1;var r=Yt(),n=fe(),t=he(),e=n((function(n,e,o,u){r(e,t(e),n,u)}));return ft=e}function be(){if(pt)return lt;pt=1;var r=F(),n=M(),t=D();return lt=function(e){if(!n(e))return!1;var o=r(e);return"[object Error]"==o||"[object DOMException]"==o||"string"==typeof e.message&&"string"==typeof e.name&&!t(e)}}function ye(){if(ht)return vt;ht=1;var r=re(),n=ie(),t=be(),e=n((function(n,e){try{return r(n,void 0,e)}catch(r){return t(r)?r:new Error(r)}}));return vt=e}function de(){if(bt)return gt;return bt=1,gt=function(r,n){for(var t=-1,e=null==r?0:r.length,o=Array(e);++t<e;)o[t]=n(r[t],t,r);return o}}function je(){if(dt)return yt;dt=1;var r=de();return yt=function(n,t){return r(t,(function(r){return n[r]}))}}function me(){if(mt)return jt;mt=1;var r=Qt(),n=Object.prototype,t=n.hasOwnProperty;return jt=function(e,o,u,i){return void 0===e||r(e,n[u])&&!t.call(i,u)?o:e}}function Oe(){if(_t)return Ot;_t=1;var r={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};return Ot=function(n){return"\\"+r[n]}}function _e(){if(Pt)return wt;Pt=1;var r=le(),n=kr(),t=Yr();return wt=function(e){return t(e)?r(e):n(e)}}function we(){if($t)return xt;$t=1;return xt=/<%=([\s\S]+?)%>/g}function Pe(){if(At)return Rt;return At=1,Rt=function(r){return function(n){return null==r?void 0:r[n]}}}function xe(){if(Et)return St;Et=1;var r=Pe()({"&":"&","<":"<",">":">",'"':""","'":"'"});return St=r}function $e(){if(Ft)return Ct;Ft=1;var r=F(),n=M();return Ct=function(t){return"symbol"==typeof t||n(t)&&"[object Symbol]"==r(t)}}function Re(){if(Tt)return kt;Tt=1;var r=S(),n=de(),t=Qr(),e=$e(),o=r?r.prototype:void 0,u=o?o.toString:void 0;return kt=function r(o){if("string"==typeof o)return o;if(t(o))return n(o,r)+"";if(e(o))return u?u.call(o):"";var i=o+"";return"0"==i&&1/o==-1/0?"-0":i},kt}function Ae(){if(Dt)return Mt;Dt=1;var r=Re();return Mt=function(n){return null==n?"":r(n)}}function Se(){if(Bt)return Nt;Bt=1;var r=xe(),n=Ae(),t=/[&<>"']/g,e=RegExp(t.source);return Nt=function(o){return(o=n(o))&&e.test(o)?o.replace(t,r):o}}function Ee(){if(It)return Ut;It=1;return Ut=/<%-([\s\S]+?)%>/g}function Ce(){if(Wt)return qt;Wt=1;return qt=/<%([\s\S]+?)%>/g}function Fe(){if(Vt)return Lt;Vt=1;var r=Se();return Lt={escape:Ee(),evaluate:Ce(),interpolate:we(),variable:"",imports:{_:{escape:r}}}}function ke(){if(zt)return Gt;zt=1;var r=ge(),n=ye(),t=je(),e=me(),o=Oe(),u=be(),i=ae(),c=_e(),a=we(),f=Fe(),s=Ae(),l=/\b__p \+= '';/g,p=/\b(__p \+=) '' \+/g,v=/(__e\(.*?\)|\b__t\)) \+\n'';/g,h=/[()=,{}\[\]\/\s]/,g=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,b=/($^)/,y=/['\n\r\u2028\u2029\\]/g,d=Object.prototype.hasOwnProperty;return Gt=function(j,m,O){var _=f.imports._.templateSettings||f;O&&i(j,m,O)&&(m=void 0),j=s(j),m=r({},m,_,e);var w,P,x=r({},m.imports,_.imports,e),$=c(x),R=t(x,$),A=0,S=m.interpolate||b,E="__p += '",C=RegExp((m.escape||b).source+"|"+S.source+"|"+(S===a?g:b).source+"|"+(m.evaluate||b).source+"|$","g"),F=d.call(m,"sourceURL")?"//# sourceURL="+(m.sourceURL+"").replace(/\s/g," ")+"\n":"";j.replace(C,(function(r,n,t,e,u,i){return t||(t=e),E+=j.slice(A,i).replace(y,o),n&&(w=!0,E+="' +\n__e("+n+") +\n'"),u&&(P=!0,E+="';\n"+u+";\n__p += '"),t&&(E+="' +\n((__t = ("+t+")) == null ? '' : __t) +\n'"),A=i+r.length,r})),E+="';\n";var k=d.call(m,"variable")&&m.variable;if(k){if(h.test(k))throw new Error("Invalid `variable` option passed into `_.template`")}else E="with (obj) {\n"+E+"\n}\n";E=(P?E.replace(l,""):E).replace(p,"$1").replace(v,"$1;"),E="function("+(k||"obj")+") {\n"+(k?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(w?", __e = _.escape":"")+(P?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+E+"return __p\n}";var T=n((function(){return Function($,F+"return "+E).apply(void 0,R)}));if(T.source=E,u(T))throw T;return T}}var Te=$(ke());class Me{config;cache;constructor(r,n=new Map){this.config=r,this.cache=n}get logger(){return this.config.log}static format(r="",n={}){return Te(r)(n)}format(r="",n={}){try{return Me.format(r,n)}catch(t){throw this.logger.error(`Unable to render template with context:\n${r}\n${JSON.stringify(n)}`),this.logger.error(t),t}}exec(r,n={}){if(Jt(r))return Promise.resolve("");const{context:t,...e}=n;return"string"==typeof r?this.execFormattedCommand(this.format(r,t||{}),e):this.execFormattedCommand(r,e)}run(r,n={}){return this.exec(r,{silent:!0,...n})}async execFormattedCommand(r,n={}){const{dryRunResult:t,silent:e,external:o,dryRun:u}=n,i=void 0!==u?u:this.config.isDryRun,c=!0===o,a="string"==typeof r?r:r.join(" "),f=!c&&this.cache.has(a);if(e||this.logger.exec(r,{isExternal:c,isCached:f}),i)return Promise.resolve(t);if(f)return this.cache.get(a);const s="string"==typeof r?this.execStringCommand(r,n):this.execWithArguments(r,n,{isExternal:c});return c||this.cache.has(a)||this.cache.set(a,s),s}execStringCommand(r,n){return new Promise(((t,e)=>{o.exec(r,{async:!0,...n},((o,u,i)=>{u=u.toString().trimEnd(),0===o?t(u):(n.silent&&this.logger.error(r),e(new Error(i||u)))}))}))}async execWithArguments(r,n,t){const[e,...u]=r;return new Promise(((r,i)=>{o.exec(`${e} ${u.join(" ")}`,{async:!0,...n},((o,c,a)=>{if(0===o){const n=c.trim();this.logger.verbose(n,{isExternal:t.isExternal}),r(n)}else n.silent&&this.logger.error(`${e} ${u.join(" ")}`),i(new Error(a||c))}))}))}}function De(r){return new B({name:"fe-config",defaultConfig:n({},U,r)})}class Ne{logger;shell;feConfig;dryRun;verbose;options;constructor(r){const{logger:n,shell:t,feConfig:e,dryRun:o,verbose:u,options:i}=r||{};this.logger=n||new I({debug:u,dryRun:o}),this.shell=t||new Me({log:this.logger,isDryRun:o}),this.feConfig=De(e).config,this.dryRun=!!o,this.verbose=!!u,this.options=i||{}}}export{B as ConfigSearch,Ne as FeScriptContext,I as ScriptsLogger,Me as Shell,U as defaultFeConfig,De as getFeConfigSearch};
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@qlover/scripts-context",
|
|
3
|
+
"description": "A scripts context for frontwork",
|
|
4
|
+
"version": "0.0.3",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"private": false,
|
|
7
|
+
"homepage": "https://github.com/qlover/fe-base/tree/master/packages/scripts-context#readme",
|
|
8
|
+
"author": "qlover",
|
|
9
|
+
"license": "ISC",
|
|
10
|
+
"main": "./dist/es/index.js",
|
|
11
|
+
"module": "./dist/es/index.js",
|
|
12
|
+
"types": "./dist/es/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": "./dist/es/index.js",
|
|
16
|
+
"require": "./dist/cjs/index.js",
|
|
17
|
+
"types": "./dist/es/index.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./cjs/*": "./dist/cjs/*",
|
|
20
|
+
"./es/*": "./dist/es/*",
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/qlover/fe-base.git",
|
|
26
|
+
"directory": "packages/scripts-context"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"package.json",
|
|
31
|
+
"README.md"
|
|
32
|
+
],
|
|
33
|
+
"keywords": [
|
|
34
|
+
"script",
|
|
35
|
+
"scripts-context"
|
|
36
|
+
],
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "rollup -c",
|
|
42
|
+
"test": "jest"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/shelljs": "^0.8.15",
|
|
46
|
+
"@qlover/fe-standard": "latest"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@qlover/fe-utils": "latest",
|
|
50
|
+
"chalk": "^5.3.0",
|
|
51
|
+
"cosmiconfig": "^9.0.0",
|
|
52
|
+
"lodash": "^4.17.21",
|
|
53
|
+
"shelljs": "^0.8.5",
|
|
54
|
+
"merge": "^2.1.1"
|
|
55
|
+
}
|
|
56
|
+
}
|