creatium 0.1.17 → 0.2.2
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/LICENSE +21 -676
- package/README.md +6 -10
- package/dist/index.d.mts +881 -0
- package/dist/index.d.ts +881 -0
- package/dist/{main.mjs → index.mjs} +330 -1080
- package/dist/shared/creatium.v0AbQ44Q.mjs +5912 -0
- package/dist/utils.d.mts +1013 -0
- package/dist/utils.d.ts +1013 -0
- package/dist/utils.mjs +2 -0
- package/package.json +17 -29
- package/dist/main.cjs +0 -2061
- package/dist/main.d.cts +0 -1672
- package/dist/main.d.mts +0 -1672
- package/dist/main.d.ts +0 -1672
package/dist/main.d.ts
DELETED
|
@@ -1,1672 +0,0 @@
|
|
|
1
|
-
import * as cli_table3 from 'cli-table3';
|
|
2
|
-
import { TableConstructorOptions } from 'cli-table3';
|
|
3
|
-
import { boxen } from '@visulima/boxen';
|
|
4
|
-
import columnify from 'columnify';
|
|
5
|
-
import * as _clack_prompts from '@clack/prompts';
|
|
6
|
-
import * as _clack_core from '@clack/core';
|
|
7
|
-
import * as fs from 'fs';
|
|
8
|
-
import { writeFile as writeFile$1, readFile as readFile$1 } from 'node:fs/promises';
|
|
9
|
-
import glob from 'tiny-glob';
|
|
10
|
-
import { homedir } from 'node:os';
|
|
11
|
-
import { fileURLToPath } from 'node:url';
|
|
12
|
-
import { Options as Options$1 } from 'yargs';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Any type
|
|
16
|
-
* Same as `any` type. Used only for prevent ts errors
|
|
17
|
-
*/
|
|
18
|
-
type Any = any;
|
|
19
|
-
/**
|
|
20
|
-
* Values of Object
|
|
21
|
-
*/
|
|
22
|
-
type ObjectValues<Values> = Values[keyof Values];
|
|
23
|
-
/**
|
|
24
|
-
* Prettify your type for better readability
|
|
25
|
-
*/
|
|
26
|
-
type Prettify<T> = {
|
|
27
|
-
[K in keyof T]: T[K];
|
|
28
|
-
} & {};
|
|
29
|
-
type ObjectToArray<T extends Record<string, Any>, Key extends string = 'type'> = {
|
|
30
|
-
[K in keyof T]: T[K] & {
|
|
31
|
-
[k in Key]: K;
|
|
32
|
-
};
|
|
33
|
-
}[keyof T][];
|
|
34
|
-
|
|
35
|
-
type Response<V> = Promise<V> | V;
|
|
36
|
-
|
|
37
|
-
type TableData = string[][];
|
|
38
|
-
type BoxOpts = Parameters<typeof boxen>[1];
|
|
39
|
-
type ColumnOpts = columnify.GlobalOptions;
|
|
40
|
-
type ColumnData = Record<string, unknown> | Record<string, unknown>[];
|
|
41
|
-
/**
|
|
42
|
-
* Generates a text-based table from the provided data array.
|
|
43
|
-
*
|
|
44
|
-
* @param {TableData} data - The data to display in the table.
|
|
45
|
-
* @param {TableOpts} [options] - Optional configuration options for the table.
|
|
46
|
-
* @returns {string} - The text-based table.
|
|
47
|
-
* @see https://www.npmjs.com/package/table
|
|
48
|
-
* @example
|
|
49
|
-
* const data = [
|
|
50
|
-
* ['Name', 'Age', 'Country'],
|
|
51
|
-
* ['John', 30, 'USA'],
|
|
52
|
-
* ['Alice', 25, 'UK'],
|
|
53
|
-
* ['Bob', 35, 'Canada'],
|
|
54
|
-
* ];
|
|
55
|
-
* const tableText = table(data);
|
|
56
|
-
* console.log(tableText);
|
|
57
|
-
*/
|
|
58
|
-
declare const table: (data: TableData, options?: TableConstructorOptions) => string;
|
|
59
|
-
/**
|
|
60
|
-
* Creates a styled box around the provided text.
|
|
61
|
-
*
|
|
62
|
-
* @param {string} text - The text to display inside the box.
|
|
63
|
-
* @param {BoxOpts} [options] - Optional configuration options for the box.
|
|
64
|
-
* @returns {string} - The text with the styled box around it.
|
|
65
|
-
* @see https://www.npmjs.com/package/boxen
|
|
66
|
-
* @example
|
|
67
|
-
* const boxedText = box('This is a boxed text', { padding: 1 });
|
|
68
|
-
* console.log(boxedText);
|
|
69
|
-
*/
|
|
70
|
-
declare const box: (text: string, options?: BoxOpts) => string;
|
|
71
|
-
/**
|
|
72
|
-
* Formats data into aligned columns for better readability.
|
|
73
|
-
*
|
|
74
|
-
* @param {ColumnData} data - The data to format into columns.
|
|
75
|
-
* @param {ColumnOpts} [options] - Optional configuration options for column formatting.
|
|
76
|
-
* @returns {string} - The text with the data formatted into columns.
|
|
77
|
-
* @see https://www.npmjs.com/package/columnify
|
|
78
|
-
* @example
|
|
79
|
-
* // data for columns
|
|
80
|
-
* const data = [
|
|
81
|
-
* {
|
|
82
|
-
* name: 'mod1',
|
|
83
|
-
* description: 'some description which happens to be far larger than the max',
|
|
84
|
-
* version: '0.0.1',
|
|
85
|
-
* },
|
|
86
|
-
* {
|
|
87
|
-
* name: 'module-two',
|
|
88
|
-
* description: 'another description larger than the max',
|
|
89
|
-
* version: '0.2.0',
|
|
90
|
-
* }
|
|
91
|
-
* ];
|
|
92
|
-
*
|
|
93
|
-
* // set columns with custom config
|
|
94
|
-
* const columnText = columns(data, {
|
|
95
|
-
* showHeaders: false,
|
|
96
|
-
* minWidth: 20,
|
|
97
|
-
* config: {
|
|
98
|
-
* description: {
|
|
99
|
-
* maxWidth: 30
|
|
100
|
-
* }
|
|
101
|
-
* }
|
|
102
|
-
* });
|
|
103
|
-
*
|
|
104
|
-
* // print columns
|
|
105
|
-
* console.log(columnText);
|
|
106
|
-
*/
|
|
107
|
-
declare const columns: <Data extends ColumnData>(data: Data, options?: ColumnOpts) => string;
|
|
108
|
-
|
|
109
|
-
type GradientColors = string[] | {
|
|
110
|
-
color: string;
|
|
111
|
-
pos: number;
|
|
112
|
-
}[];
|
|
113
|
-
type GradientOpts = {
|
|
114
|
-
/**
|
|
115
|
-
The gradient can be generated using RGB or HSV interpolation. HSV usually produces brighter colors. Interpolation can be set to rgb for RGB interpolation, orhsv for HSV interpolation.
|
|
116
|
-
Defaults to rgb. Case insentitive.
|
|
117
|
-
*/
|
|
118
|
-
interpolation?: 'rgb' | 'hsv';
|
|
119
|
-
/**
|
|
120
|
-
Used only in the case of HSV interpolation.
|
|
121
|
-
Because hue can be considered as a circle, there are two ways to go from a color to another color.
|
|
122
|
-
HsvSpin can be either short or long, depending on if you want to take the shortest or the longest way between two colors.
|
|
123
|
-
Defaults to short. Case insensitive.
|
|
124
|
-
*/
|
|
125
|
-
hsvSpin?: 'short' | 'long';
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
declare const promptLineMethods: {
|
|
129
|
-
readonly message: "message";
|
|
130
|
-
readonly info: "info";
|
|
131
|
-
readonly success: "success";
|
|
132
|
-
readonly step: "step";
|
|
133
|
-
readonly warn: "warn";
|
|
134
|
-
readonly warning: "warning";
|
|
135
|
-
readonly error: "error";
|
|
136
|
-
};
|
|
137
|
-
type PromptLineMethod = typeof promptLineMethods[keyof typeof promptLineMethods];
|
|
138
|
-
/**
|
|
139
|
-
* NUMBER.
|
|
140
|
-
*
|
|
141
|
-
*/
|
|
142
|
-
type NumberParams = Prettify<_clack_prompts.TextOptions & {
|
|
143
|
-
errorText?: string;
|
|
144
|
-
}>;
|
|
145
|
-
/**
|
|
146
|
-
* Parameters of the `table` function from the `@dovenv/utils` module.
|
|
147
|
-
*
|
|
148
|
-
* [See module](https://clippo.pigeonposse.com/guide/utils/style#table).
|
|
149
|
-
*/
|
|
150
|
-
type TableParams = Parameters<typeof table>;
|
|
151
|
-
/**
|
|
152
|
-
* Parameters of the `columns` function from the `@dovenv/utils` module.
|
|
153
|
-
*
|
|
154
|
-
* [See module](https://clippo.pigeonposse.com/guide/utils/styles#columns).
|
|
155
|
-
*/
|
|
156
|
-
type ColumnsParams = Parameters<typeof columns>;
|
|
157
|
-
/**
|
|
158
|
-
* Parameters of the `box` function from the `@dovenv/utils` module.
|
|
159
|
-
*
|
|
160
|
-
* [See module](https://clippo.pigeonposse.com/guide/utils/styles#box).
|
|
161
|
-
*/
|
|
162
|
-
type BoxParams = Parameters<typeof box>;
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Prompt for number type.
|
|
166
|
-
*
|
|
167
|
-
* @param {NumberParams} opts - NumberOptions.
|
|
168
|
-
* @returns {Promise<number | symbol>} - Promise resolving the answer.
|
|
169
|
-
* @example
|
|
170
|
-
* const age = await number({
|
|
171
|
-
* message: 'What is your age?',
|
|
172
|
-
* errorText: 'Failed getting age',
|
|
173
|
-
* });
|
|
174
|
-
* console.log(age)
|
|
175
|
-
*/
|
|
176
|
-
declare function number(opts: NumberParams): Promise<number | symbol>;
|
|
177
|
-
|
|
178
|
-
declare const resolvePath: (...paths: string[]) => string;
|
|
179
|
-
declare const relativePath: (from: string, to: string) => string;
|
|
180
|
-
declare const getExtName: (path: string) => string;
|
|
181
|
-
declare const getDirName: (path: string) => string;
|
|
182
|
-
declare const getBaseName: (path: string, suffix?: string) => string;
|
|
183
|
-
declare const isAbsolutePath: (path: string) => boolean;
|
|
184
|
-
declare const normalizePath: (path: string) => string;
|
|
185
|
-
|
|
186
|
-
declare const writeFile: typeof writeFile$1;
|
|
187
|
-
/**
|
|
188
|
-
* Find files and directories using glob patterns.
|
|
189
|
-
*
|
|
190
|
-
* @example const paths = await getPaths(['*', '!src']);
|
|
191
|
-
* console.log(paths);
|
|
192
|
-
*/
|
|
193
|
-
declare const getPaths: typeof glob;
|
|
194
|
-
/**
|
|
195
|
-
* Checks if two file paths are equal after normalization.
|
|
196
|
-
* Normalization ensures that differences like trailing slashes or redundant path segments are ignored.
|
|
197
|
-
*
|
|
198
|
-
* ---
|
|
199
|
-
*
|
|
200
|
-
* @param {string} path1 - The first file path to compare.
|
|
201
|
-
* @param {string} path2 - The second file path to compare.
|
|
202
|
-
* @returns {boolean} `true` if the paths are equal, `false` otherwise.
|
|
203
|
-
*/
|
|
204
|
-
declare const arePathsEqual: (path1: string, path2: string) => boolean;
|
|
205
|
-
/**
|
|
206
|
-
* Check if a string is a valid path.
|
|
207
|
-
*
|
|
208
|
-
* @param {string} str - The string to test.
|
|
209
|
-
* @returns {boolean} True if the string is a valid path.
|
|
210
|
-
* @example
|
|
211
|
-
* isPath('..') // true
|
|
212
|
-
* isPath('foo bar') // false
|
|
213
|
-
* isPath('C:\\') // true
|
|
214
|
-
* isPath('foo\\bar') // true
|
|
215
|
-
* isPath('foo/bar') // true
|
|
216
|
-
* isPath('foo bar/baz') // false
|
|
217
|
-
*/
|
|
218
|
-
declare const isPath: (str: string) => boolean;
|
|
219
|
-
/**
|
|
220
|
-
* Creates a directory if it does not exist.
|
|
221
|
-
*
|
|
222
|
-
* @param {string} path - Path to the directory to create.
|
|
223
|
-
* @returns {Promise<void>} - A promise that resolves when the directory has been created.
|
|
224
|
-
* @example
|
|
225
|
-
* await ensureDir('./path/to/directory')
|
|
226
|
-
*/
|
|
227
|
-
declare const ensureDir: (path: string) => Promise<void>;
|
|
228
|
-
/**
|
|
229
|
-
* Reads the contents of a directory.
|
|
230
|
-
*
|
|
231
|
-
* @param {string} path - Path to the directory to read.
|
|
232
|
-
* @returns {Promise<import('node:fs').Dirent[]>} - A promise that resolves to an array of {@link https://nodejs.org/api/fs.html#class-fs-dirent | fs.Dirent} objects.
|
|
233
|
-
* @example
|
|
234
|
-
* const dirItems = await readDir('./path/to/directory')
|
|
235
|
-
*/
|
|
236
|
-
declare const readDir: (path: string) => Promise<fs.Dirent<string>[]>;
|
|
237
|
-
/**
|
|
238
|
-
* Gets the file names in a directory and filters them by extension.
|
|
239
|
-
*
|
|
240
|
-
* @param {object} props - Function props.
|
|
241
|
-
* @param {string} props.path - Path to the directory.
|
|
242
|
-
* @param {string[]} props.extensions - Array of extensions to filter by, e.g., ['.md', '.txt'].
|
|
243
|
-
* @returns {Promise<string[]>} - A promise that resolves with an array of file names without extensions.
|
|
244
|
-
*/
|
|
245
|
-
declare function getFilteredFileNames({ path, extensions, }: {
|
|
246
|
-
path: string;
|
|
247
|
-
extensions: string[];
|
|
248
|
-
}): Promise<string[]>;
|
|
249
|
-
/**
|
|
250
|
-
* Gets the current directory.
|
|
251
|
-
*
|
|
252
|
-
* @param {string} [path] - An optional path to resolve the directory from.
|
|
253
|
-
* @returns {string} - The current directory.
|
|
254
|
-
* @example getCurrentDir()
|
|
255
|
-
*/
|
|
256
|
-
declare const getCurrentDir: (path?: string) => string;
|
|
257
|
-
/**
|
|
258
|
-
* Joins path segments.
|
|
259
|
-
*
|
|
260
|
-
* @param {...string} paths - Path segments to join.
|
|
261
|
-
* @returns {string} - The joined path.
|
|
262
|
-
* @example joinPath('user', 'pigeonposse')
|
|
263
|
-
*/
|
|
264
|
-
declare function joinPath(...paths: string[]): string;
|
|
265
|
-
/**
|
|
266
|
-
* Resolves path segments into an absolute path.
|
|
267
|
-
*
|
|
268
|
-
* @param {...string} paths - Path segments to resolve.
|
|
269
|
-
* @returns {string} - The resolved absolute path.
|
|
270
|
-
*/
|
|
271
|
-
declare const getAbsolutePath: (...paths: string[]) => string;
|
|
272
|
-
/**
|
|
273
|
-
* Validates and resolves a path with home directory replacement.
|
|
274
|
-
*
|
|
275
|
-
* @param {string} path - The path to validate and resolve.
|
|
276
|
-
* @returns {string} - The validated and resolved absolute path.
|
|
277
|
-
* @example
|
|
278
|
-
* import { validateHomeDir } from '@dovenv/utils'
|
|
279
|
-
*
|
|
280
|
-
* const path = validateHomeDir('~/Documents')
|
|
281
|
-
*
|
|
282
|
-
* console.log(path) // returns: /users/{username}/Documents
|
|
283
|
-
*
|
|
284
|
-
* const path = validateHomeDir('/Home')
|
|
285
|
-
*
|
|
286
|
-
* console.log(path) // returns same: /Home
|
|
287
|
-
*/
|
|
288
|
-
declare function validateHomeDir(path: string): string;
|
|
289
|
-
/**
|
|
290
|
-
* Reads the content of a file at the specified path.
|
|
291
|
-
*
|
|
292
|
-
* @param {string} path - The path of the file to read.
|
|
293
|
-
* @returns {Promise<string | Buffer>} - A promise that resolves to the content of the file as a string or buffer.
|
|
294
|
-
* @throws {Error} If an error occurs while reading the file.
|
|
295
|
-
* @example import { readFile } from '@dovenv/utils'
|
|
296
|
-
*
|
|
297
|
-
* try {
|
|
298
|
-
* const content = await readFile('./example.txt');
|
|
299
|
-
* console.log(content);
|
|
300
|
-
* } catch (error) {
|
|
301
|
-
* console.error('Error reading file:', error);
|
|
302
|
-
* }
|
|
303
|
-
*/
|
|
304
|
-
declare const readFile: typeof readFile$1;
|
|
305
|
-
/**
|
|
306
|
-
* Removes a directory and its contents if it exists.
|
|
307
|
-
*
|
|
308
|
-
* @param {string} path - The path of the directory to remove.
|
|
309
|
-
* @throws {Error} If an error occurs while removing the directory.
|
|
310
|
-
* @example import { removeDir } from '@dovenv/utils'
|
|
311
|
-
*
|
|
312
|
-
* try {
|
|
313
|
-
* await removeDir('./my/path')
|
|
314
|
-
* } catch (e) {
|
|
315
|
-
* console.log(e)
|
|
316
|
-
* }
|
|
317
|
-
*/
|
|
318
|
-
declare function removeDir(path: string): Promise<void>;
|
|
319
|
-
/**
|
|
320
|
-
* Removes a directory and its contents if it exists.
|
|
321
|
-
*
|
|
322
|
-
* @param {string} path - The path of the directory to remove.
|
|
323
|
-
* @throws {Error} If an error occurs while removing the directory.
|
|
324
|
-
* @example import { removeDirIfExist } from '@dovenv/utils'
|
|
325
|
-
*
|
|
326
|
-
* await removeDirIfExist('./my/path')
|
|
327
|
-
*/
|
|
328
|
-
declare function removeDirIfExist(path: string): Promise<void>;
|
|
329
|
-
/**
|
|
330
|
-
* Removes a file or directory if it exists.
|
|
331
|
-
*
|
|
332
|
-
* @param {string} path - The path of the file or directory to remove.
|
|
333
|
-
* @throws {Error} If an error occurs while removing the file or directory.
|
|
334
|
-
* @example
|
|
335
|
-
* try {
|
|
336
|
-
* await removePathIfExist('./my/path')
|
|
337
|
-
* } catch (e) {
|
|
338
|
-
* console.log(e)
|
|
339
|
-
* }
|
|
340
|
-
*/
|
|
341
|
-
declare function removePathIfExist(path: string): Promise<void>;
|
|
342
|
-
/**
|
|
343
|
-
* Removes a file if it exists.
|
|
344
|
-
*
|
|
345
|
-
* @param {string} path - The path of the file to remove.
|
|
346
|
-
* @throws {Error} If an error occurs while removing the file.
|
|
347
|
-
* @example
|
|
348
|
-
* try {
|
|
349
|
-
* await removeFile('./my/path')
|
|
350
|
-
* } catch (e) {
|
|
351
|
-
* console.log(e)
|
|
352
|
-
* }
|
|
353
|
-
*/
|
|
354
|
-
declare function removeFileIfExist(path: string): Promise<void>;
|
|
355
|
-
/**
|
|
356
|
-
* Removes a file.
|
|
357
|
-
*
|
|
358
|
-
* @param {string} path - The path of the file to remove.
|
|
359
|
-
* @throws {Error} If an error occurs while removing the file.
|
|
360
|
-
* @example
|
|
361
|
-
* try {
|
|
362
|
-
* await removeFile('./my/path')
|
|
363
|
-
* } catch (e) {
|
|
364
|
-
* console.log(e)
|
|
365
|
-
* }
|
|
366
|
-
*/
|
|
367
|
-
declare function removeFile(path: string): Promise<void>;
|
|
368
|
-
/**
|
|
369
|
-
* Checks if the given path points to a directory.
|
|
370
|
-
*
|
|
371
|
-
* @param {string} path - The path to check.
|
|
372
|
-
* @returns {Promise<boolean>} - A promise that resolves to true if the path points to a directory, otherwise false.
|
|
373
|
-
* @example import { isDirectory } from '@dovenv/utils'
|
|
374
|
-
*
|
|
375
|
-
* const isDir = await isDirectory('./my/path')
|
|
376
|
-
*/
|
|
377
|
-
declare function isDirectory(path: string): Promise<boolean>;
|
|
378
|
-
/**
|
|
379
|
-
* Creates a directory at the specified path.
|
|
380
|
-
*
|
|
381
|
-
* @param {string} path - The path of the directory to create.
|
|
382
|
-
* @throws {Error} If an error occurs while creating the directory.
|
|
383
|
-
* @example import { createDir } from '@dovenv/utils'
|
|
384
|
-
* await createDir('./my/dir')
|
|
385
|
-
*/
|
|
386
|
-
declare function createDir(path: string): Promise<void>;
|
|
387
|
-
/**
|
|
388
|
-
* Checks if a directory exists at the specified path.
|
|
389
|
-
*
|
|
390
|
-
* @param {string} path - The path to check.
|
|
391
|
-
* @returns {Promise<boolean>} - A promise that resolves to true if a directory exists at the specified path, otherwise false.
|
|
392
|
-
* @example import { existsDir } from '@dovenv/utils'
|
|
393
|
-
* const exist = await existsDir('./my/dir')
|
|
394
|
-
*/
|
|
395
|
-
declare function existsDir(path: string): Promise<boolean>;
|
|
396
|
-
/**
|
|
397
|
-
* Checks if a file exists at the specified path.
|
|
398
|
-
*
|
|
399
|
-
* @param {string} path - The path to the file.
|
|
400
|
-
* @returns {Promise<boolean>} - A promise that resolves to true if the file exists, otherwise false.
|
|
401
|
-
* @throws {Error} If an error occurs while checking the existence of the file.
|
|
402
|
-
* @example import { existsFile } from '@dovenv/utils'
|
|
403
|
-
*
|
|
404
|
-
* const existPKG = await existsFile('./package.json')
|
|
405
|
-
*/
|
|
406
|
-
declare function existsFile(path: string): Promise<boolean>;
|
|
407
|
-
/**
|
|
408
|
-
* Writes content to a file at the specified path.
|
|
409
|
-
*
|
|
410
|
-
* @param {string} path - The path of the file to write to.
|
|
411
|
-
* @param {string | Buffer} content - The content to write to the file.
|
|
412
|
-
* @throws {Error} If an error occurs while writing to the file.
|
|
413
|
-
* @example import { writeFileContent } from '@dovenv/utils'
|
|
414
|
-
*
|
|
415
|
-
* await writeFileContent('./greetFile.txt', 'Hello')
|
|
416
|
-
*/
|
|
417
|
-
declare function writeFileContent(path: string, content: string | Buffer): Promise<void>;
|
|
418
|
-
/**
|
|
419
|
-
* Checks if a file or directory exists at the specified path.
|
|
420
|
-
*
|
|
421
|
-
* @param {string} path - The path to check.
|
|
422
|
-
* @returns {Promise<boolean>} - A promise that resolves to true if a file or directory exists at the specified path, otherwise false.
|
|
423
|
-
* @throws {Error} If an error occurs while checking the existence of the path.
|
|
424
|
-
* @example import { existsPath } from '@dovenv/utils'
|
|
425
|
-
*
|
|
426
|
-
* const existPKG = await existsPath('./package.json')
|
|
427
|
-
*/
|
|
428
|
-
declare function existsPath(path: string): Promise<boolean>;
|
|
429
|
-
/**
|
|
430
|
-
* Copy a file from input path to output path.
|
|
431
|
-
*
|
|
432
|
-
* @param {{input: string, output: string}} options - Options object with input and output paths.
|
|
433
|
-
* @returns {Promise<void>} - Resolves when the file has been copied.
|
|
434
|
-
* @throws {Error} If there is an error copying the file.
|
|
435
|
-
* @example import { copyFile } from '@dovenv/utils'
|
|
436
|
-
*
|
|
437
|
-
* const copyResult = await copyFile({
|
|
438
|
-
* input : '/path/to/source.txt',
|
|
439
|
-
* output: '/path/to/destination.txt',
|
|
440
|
-
* })
|
|
441
|
-
*/
|
|
442
|
-
declare const copyFile: ({ input, output, }: {
|
|
443
|
-
input: string;
|
|
444
|
-
output: string;
|
|
445
|
-
}) => Promise<void>;
|
|
446
|
-
type CopyDirOptions = {
|
|
447
|
-
input: string;
|
|
448
|
-
output: string;
|
|
449
|
-
};
|
|
450
|
-
/**
|
|
451
|
-
* Copy a directory from input path to output path.
|
|
452
|
-
*
|
|
453
|
-
* @param {{input: string, output: string}} options - Options object with input and output paths.
|
|
454
|
-
* @returns {Promise<void>} - Resolves when the directory has been copied.
|
|
455
|
-
* @throws {Error} If there is an error copying the directory.
|
|
456
|
-
* @example
|
|
457
|
-
*
|
|
458
|
-
* const copyResult = await copyDir({
|
|
459
|
-
* input : '/path/to/sourceDir',
|
|
460
|
-
* output: '/path/to/destinationDir',
|
|
461
|
-
* })
|
|
462
|
-
*/
|
|
463
|
-
declare const copyDir: ({ input, output, }: CopyDirOptions) => Promise<void>;
|
|
464
|
-
/**
|
|
465
|
-
* Creates a symbolic link from the input path to the output path.
|
|
466
|
-
*
|
|
467
|
-
* @param {{input: string, output: string}} options - Options object with input and output paths.
|
|
468
|
-
* @returns {Promise<void>} - Resolves when the symbolic link has been created.
|
|
469
|
-
* @throws {Error} If there is an error creating the symbolic link.
|
|
470
|
-
* @example import { createSymlink } from '@dovenv/utils'
|
|
471
|
-
*
|
|
472
|
-
* const symlinkResult = await createSymlink({
|
|
473
|
-
* input : '/path/to/source',
|
|
474
|
-
* output: '/path/to/destination',
|
|
475
|
-
* })
|
|
476
|
-
*/
|
|
477
|
-
declare const createSymlink: ({ input, output, }: {
|
|
478
|
-
input: string;
|
|
479
|
-
output: string;
|
|
480
|
-
}) => Promise<void>;
|
|
481
|
-
|
|
482
|
-
declare const getHomeDir: typeof homedir;
|
|
483
|
-
/**
|
|
484
|
-
* Returns the path to the operating system's temporary directory.
|
|
485
|
-
*
|
|
486
|
-
* @returns {string} The path to the operating system's temporary directory.
|
|
487
|
-
*/
|
|
488
|
-
declare const getTempDir: () => string;
|
|
489
|
-
/**
|
|
490
|
-
* Determines the operating system.
|
|
491
|
-
*
|
|
492
|
-
* @returns {'windows' | 'macos' | 'linux' | 'unknown'} - The operating system. Possible values are 'linux', 'macos', or 'windows'.
|
|
493
|
-
*/
|
|
494
|
-
declare const getPlatform: () => Promise<"windows" | "macos" | "linux" | "unknown">;
|
|
495
|
-
/**
|
|
496
|
-
* Returns the operating system CPU architecture.
|
|
497
|
-
*
|
|
498
|
-
* @returns {'arm64' | 'x64' | 'unknown'} - The operating system CPU architecture.
|
|
499
|
-
*/
|
|
500
|
-
declare function getArch(): 'arm64' | 'x64' | 'unknown';
|
|
501
|
-
|
|
502
|
-
declare const getSystemEnvPaths: ({ name, suffix, }: {
|
|
503
|
-
name: string;
|
|
504
|
-
suffix?: string;
|
|
505
|
-
}) => {
|
|
506
|
-
data: string;
|
|
507
|
-
config: string;
|
|
508
|
-
cache: string;
|
|
509
|
-
log: string;
|
|
510
|
-
temp: string;
|
|
511
|
-
};
|
|
512
|
-
|
|
513
|
-
type CacheOptions<Values extends Record<string, unknown>> = {
|
|
514
|
-
/**
|
|
515
|
-
* Project name for search cache.
|
|
516
|
-
* You can reuse the same cache for multiple instances.
|
|
517
|
-
*/
|
|
518
|
-
projectName: string;
|
|
519
|
-
/**
|
|
520
|
-
* Identifier for the values.
|
|
521
|
-
*/
|
|
522
|
-
id: string;
|
|
523
|
-
/**
|
|
524
|
-
* Cache Default Values.
|
|
525
|
-
*/
|
|
526
|
-
values: Values;
|
|
527
|
-
/**
|
|
528
|
-
* Directory to save cache file.
|
|
529
|
-
* Default: System default user config directory.
|
|
530
|
-
* You most likely don't need this. Please don't use it unless you really have to.
|
|
531
|
-
*/
|
|
532
|
-
cwd?: string;
|
|
533
|
-
/**
|
|
534
|
-
* Suffix for cache directory.
|
|
535
|
-
*/
|
|
536
|
-
suffix?: string;
|
|
537
|
-
};
|
|
538
|
-
/**
|
|
539
|
-
* Creates a caching mechanism for storing and retrieving values.
|
|
540
|
-
*
|
|
541
|
-
* @param {object} opts - Parameters for configuring the cache.
|
|
542
|
-
* @returns {object} - An object with methods to interact with the cache.
|
|
543
|
-
* @throws {Error} If the cache value is unexpected or not found.
|
|
544
|
-
* @example
|
|
545
|
-
*
|
|
546
|
-
* const { get, set } = await cache({
|
|
547
|
-
* projectName: 'myApp',
|
|
548
|
-
* id: 'userSettings',
|
|
549
|
-
* values: {
|
|
550
|
-
* theme: 'dark',
|
|
551
|
-
* language: 'en'
|
|
552
|
-
* },
|
|
553
|
-
* });
|
|
554
|
-
*
|
|
555
|
-
* // Set a new value in the cache
|
|
556
|
-
* set({ theme: 'light' });
|
|
557
|
-
*
|
|
558
|
-
* // Retrieve a value from the cache
|
|
559
|
-
* const theme = get('theme');
|
|
560
|
-
* console.log(theme); // Output: 'light'
|
|
561
|
-
*
|
|
562
|
-
* // Retrieve all cached values
|
|
563
|
-
* const allValues = get();
|
|
564
|
-
* console.log(allValues); // Output: { theme: 'light', language: 'en' }
|
|
565
|
-
*
|
|
566
|
-
* // Handle unexpected cache value
|
|
567
|
-
* try {
|
|
568
|
-
* const nonExistentValue = get('nonExistent');
|
|
569
|
-
* } catch (error) {
|
|
570
|
-
* console.error('Error:', error.message); // Output: Cache value is unexpected: nonExistent
|
|
571
|
-
* }
|
|
572
|
-
*/
|
|
573
|
-
declare const cache: <Values extends Record<string, unknown>>(opts: CacheOptions<Values>) => Promise<{
|
|
574
|
-
/**
|
|
575
|
-
* The default values for the cache.
|
|
576
|
-
*/
|
|
577
|
-
defaultValues: Values;
|
|
578
|
-
/**
|
|
579
|
-
* Retrieve a value from the cache.
|
|
580
|
-
*
|
|
581
|
-
* @example
|
|
582
|
-
* const theme = get('theme');
|
|
583
|
-
* console.log(theme); // Output: 'light'
|
|
584
|
-
*/
|
|
585
|
-
get: <ID extends string | undefined = undefined>(v?: ID) => Promise<ID extends keyof Values ? Values[ID] : ID extends string ? undefined : Values>;
|
|
586
|
-
/**
|
|
587
|
-
* Updates the cache with the provided values.
|
|
588
|
-
*
|
|
589
|
-
* Merges the existing cached values with the new partial values and updates the cache.
|
|
590
|
-
*/
|
|
591
|
-
set: (obj: Partial<Values>) => Promise<void>;
|
|
592
|
-
/**
|
|
593
|
-
* Resets the cache to its default values.
|
|
594
|
-
*
|
|
595
|
-
* @example
|
|
596
|
-
* reset();
|
|
597
|
-
*/
|
|
598
|
-
reset: () => Promise<void>;
|
|
599
|
-
/**
|
|
600
|
-
* The path to the cache file.
|
|
601
|
-
*/
|
|
602
|
-
path: string;
|
|
603
|
-
}>;
|
|
604
|
-
|
|
605
|
-
type CommonObj = Record<string, unknown> | Record<string, unknown>[] | unknown[];
|
|
606
|
-
declare const getObjectFromJSONFile: <Res extends CommonObj = CommonObj>(path: string) => Promise<Res>;
|
|
607
|
-
|
|
608
|
-
/**
|
|
609
|
-
* Finds the closest package.json by traversing up the directory tree.
|
|
610
|
-
*
|
|
611
|
-
* @param {string} [startDir] - Directory to start searching from.
|
|
612
|
-
* @returns {string} Absolute path to the closest package.json.
|
|
613
|
-
* @throws {Error} If no package.json is found.
|
|
614
|
-
*/
|
|
615
|
-
declare const getClosestPackageJson: (startDir?: string) => Promise<string>;
|
|
616
|
-
/**
|
|
617
|
-
* Finds the closest package directory by traversing up the directory tree.
|
|
618
|
-
*
|
|
619
|
-
* @param {string} [startDir] - Directory to start searching from.
|
|
620
|
-
* @returns {string} Absolute path to the closest package directory.
|
|
621
|
-
*/
|
|
622
|
-
declare const getClosestPackageDir: (startDir?: string) => Promise<string>;
|
|
623
|
-
|
|
624
|
-
type _sys_CommonObj = CommonObj;
|
|
625
|
-
declare const _sys_arePathsEqual: typeof arePathsEqual;
|
|
626
|
-
declare const _sys_cache: typeof cache;
|
|
627
|
-
declare const _sys_copyDir: typeof copyDir;
|
|
628
|
-
declare const _sys_copyFile: typeof copyFile;
|
|
629
|
-
declare const _sys_createDir: typeof createDir;
|
|
630
|
-
declare const _sys_createSymlink: typeof createSymlink;
|
|
631
|
-
declare const _sys_ensureDir: typeof ensureDir;
|
|
632
|
-
declare const _sys_existsDir: typeof existsDir;
|
|
633
|
-
declare const _sys_existsFile: typeof existsFile;
|
|
634
|
-
declare const _sys_existsPath: typeof existsPath;
|
|
635
|
-
declare const _sys_fileURLToPath: typeof fileURLToPath;
|
|
636
|
-
declare const _sys_getAbsolutePath: typeof getAbsolutePath;
|
|
637
|
-
declare const _sys_getArch: typeof getArch;
|
|
638
|
-
declare const _sys_getBaseName: typeof getBaseName;
|
|
639
|
-
declare const _sys_getClosestPackageDir: typeof getClosestPackageDir;
|
|
640
|
-
declare const _sys_getClosestPackageJson: typeof getClosestPackageJson;
|
|
641
|
-
declare const _sys_getCurrentDir: typeof getCurrentDir;
|
|
642
|
-
declare const _sys_getDirName: typeof getDirName;
|
|
643
|
-
declare const _sys_getExtName: typeof getExtName;
|
|
644
|
-
declare const _sys_getFilteredFileNames: typeof getFilteredFileNames;
|
|
645
|
-
declare const _sys_getHomeDir: typeof getHomeDir;
|
|
646
|
-
declare const _sys_getObjectFromJSONFile: typeof getObjectFromJSONFile;
|
|
647
|
-
declare const _sys_getPaths: typeof getPaths;
|
|
648
|
-
declare const _sys_getPlatform: typeof getPlatform;
|
|
649
|
-
declare const _sys_getSystemEnvPaths: typeof getSystemEnvPaths;
|
|
650
|
-
declare const _sys_getTempDir: typeof getTempDir;
|
|
651
|
-
declare const _sys_isAbsolutePath: typeof isAbsolutePath;
|
|
652
|
-
declare const _sys_isDirectory: typeof isDirectory;
|
|
653
|
-
declare const _sys_isPath: typeof isPath;
|
|
654
|
-
declare const _sys_joinPath: typeof joinPath;
|
|
655
|
-
declare const _sys_normalizePath: typeof normalizePath;
|
|
656
|
-
declare const _sys_readDir: typeof readDir;
|
|
657
|
-
declare const _sys_readFile: typeof readFile;
|
|
658
|
-
declare const _sys_relativePath: typeof relativePath;
|
|
659
|
-
declare const _sys_removeDir: typeof removeDir;
|
|
660
|
-
declare const _sys_removeDirIfExist: typeof removeDirIfExist;
|
|
661
|
-
declare const _sys_removeFile: typeof removeFile;
|
|
662
|
-
declare const _sys_removeFileIfExist: typeof removeFileIfExist;
|
|
663
|
-
declare const _sys_removePathIfExist: typeof removePathIfExist;
|
|
664
|
-
declare const _sys_resolvePath: typeof resolvePath;
|
|
665
|
-
declare const _sys_validateHomeDir: typeof validateHomeDir;
|
|
666
|
-
declare const _sys_writeFile: typeof writeFile;
|
|
667
|
-
declare const _sys_writeFileContent: typeof writeFileContent;
|
|
668
|
-
declare namespace _sys {
|
|
669
|
-
export { type _sys_CommonObj as CommonObj, _sys_arePathsEqual as arePathsEqual, _sys_cache as cache, _sys_copyDir as copyDir, _sys_copyFile as copyFile, _sys_createDir as createDir, _sys_createSymlink as createSymlink, _sys_ensureDir as ensureDir, _sys_existsDir as existsDir, _sys_existsFile as existsFile, _sys_existsPath as existsPath, _sys_fileURLToPath as fileURLToPath, _sys_getAbsolutePath as getAbsolutePath, _sys_getArch as getArch, _sys_getBaseName as getBaseName, _sys_getClosestPackageDir as getClosestPackageDir, _sys_getClosestPackageJson as getClosestPackageJson, _sys_getCurrentDir as getCurrentDir, _sys_getDirName as getDirName, _sys_getExtName as getExtName, _sys_getFilteredFileNames as getFilteredFileNames, _sys_getHomeDir as getHomeDir, _sys_getObjectFromJSONFile as getObjectFromJSONFile, _sys_getPaths as getPaths, _sys_getPlatform as getPlatform, _sys_getSystemEnvPaths as getSystemEnvPaths, _sys_getTempDir as getTempDir, _sys_isAbsolutePath as isAbsolutePath, _sys_isDirectory as isDirectory, _sys_isPath as isPath, _sys_joinPath as joinPath, _sys_normalizePath as normalizePath, _sys_readDir as readDir, _sys_readFile as readFile, _sys_relativePath as relativePath, _sys_removeDir as removeDir, _sys_removeDirIfExist as removeDirIfExist, _sys_removeFile as removeFile, _sys_removeFileIfExist as removeFileIfExist, _sys_removePathIfExist as removePathIfExist, _sys_resolvePath as resolvePath, _sys_validateHomeDir as validateHomeDir, _sys_writeFile as writeFile, _sys_writeFileContent as writeFileContent };
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
/** System functions */
|
|
673
|
-
declare const sys: typeof _sys;
|
|
674
|
-
/** Prompt functions */
|
|
675
|
-
declare const prompt: {
|
|
676
|
-
table: (opts: {
|
|
677
|
-
value: TableParams[0];
|
|
678
|
-
opts?: TableParams[1];
|
|
679
|
-
type?: PromptLineMethod;
|
|
680
|
-
}) => void;
|
|
681
|
-
columns: (opts: {
|
|
682
|
-
value: ColumnsParams[0];
|
|
683
|
-
opts?: ColumnsParams[1];
|
|
684
|
-
type?: PromptLineMethod;
|
|
685
|
-
}) => void;
|
|
686
|
-
box: (opts: {
|
|
687
|
-
value: BoxParams[0];
|
|
688
|
-
opts?: BoxParams[1];
|
|
689
|
-
type?: PromptLineMethod;
|
|
690
|
-
}) => void;
|
|
691
|
-
number: typeof number;
|
|
692
|
-
isCancel: typeof _clack_core.isCancel;
|
|
693
|
-
updateSettings: typeof _clack_core.updateSettings;
|
|
694
|
-
cancel: (message?: string) => void;
|
|
695
|
-
confirm: (opts: _clack_prompts.ConfirmOptions) => Promise<boolean | symbol>;
|
|
696
|
-
group: <T>(prompts: _clack_prompts.PromptGroup<T>, opts?: _clack_prompts.PromptGroupOptions<T> | undefined) => Promise<{ [P in keyof _clack_prompts.PromptGroupAwaitedReturn<T>]: _clack_prompts.PromptGroupAwaitedReturn<T>[P]; }>;
|
|
697
|
-
groupMultiselect: <Value>(opts: _clack_prompts.GroupMultiSelectOptions<Value>) => Promise<symbol | Value[]>;
|
|
698
|
-
intro: (title?: string) => void;
|
|
699
|
-
log: {
|
|
700
|
-
message: (message?: string, { symbol }?: _clack_prompts.LogMessageOptions) => void;
|
|
701
|
-
info: (message: string) => void;
|
|
702
|
-
success: (message: string) => void;
|
|
703
|
-
step: (message: string) => void;
|
|
704
|
-
warn: (message: string) => void;
|
|
705
|
-
warning: (message: string) => void;
|
|
706
|
-
error: (message: string) => void;
|
|
707
|
-
};
|
|
708
|
-
multiselect: <Value>(opts: _clack_prompts.MultiSelectOptions<Value>) => Promise<symbol | Value[]>;
|
|
709
|
-
note: (message?: string, title?: string) => void;
|
|
710
|
-
outro: (message?: string) => void;
|
|
711
|
-
password: (opts: _clack_prompts.PasswordOptions) => Promise<string | symbol>;
|
|
712
|
-
select: <Value>(opts: _clack_prompts.SelectOptions<Value>) => Promise<symbol | Value>;
|
|
713
|
-
selectKey: <Value extends string>(opts: _clack_prompts.SelectOptions<Value>) => Promise<symbol | Value>;
|
|
714
|
-
spinner: ({ indicator }?: _clack_prompts.SpinnerOptions) => {
|
|
715
|
-
start: (msg?: string) => void;
|
|
716
|
-
stop: (msg?: string, code?: number) => void;
|
|
717
|
-
message: (msg?: string) => void;
|
|
718
|
-
};
|
|
719
|
-
stream: {
|
|
720
|
-
message: (iterable: Iterable<string> | AsyncIterable<string>, { symbol }?: _clack_prompts.LogMessageOptions) => Promise<void>;
|
|
721
|
-
info: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
|
|
722
|
-
success: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
|
|
723
|
-
step: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
|
|
724
|
-
warn: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
|
|
725
|
-
warning: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
|
|
726
|
-
error: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
|
|
727
|
-
};
|
|
728
|
-
tasks: (tasks: _clack_prompts.Task[]) => Promise<void>;
|
|
729
|
-
text: (opts: _clack_prompts.TextOptions) => Promise<string | symbol>;
|
|
730
|
-
};
|
|
731
|
-
/** Environment functions */
|
|
732
|
-
declare const env: {
|
|
733
|
-
isBrowser: boolean;
|
|
734
|
-
isWebWorker: boolean;
|
|
735
|
-
isNode: boolean;
|
|
736
|
-
isJsDom: boolean;
|
|
737
|
-
isDeno: boolean;
|
|
738
|
-
isBun: boolean;
|
|
739
|
-
};
|
|
740
|
-
/** Style functions */
|
|
741
|
-
declare const style: {
|
|
742
|
-
color: Record<"black" | "blackBright" | "blue" | "blueBright" | "cyan" | "cyanBright" | "gray" | "green" | "greenBright" | "grey" | "magenta" | "magentaBright" | "red" | "redBright" | "white" | "whiteBright" | "yellow" | "yellowBright" | "bgBlack" | "bgBlackBright" | "bgBlue" | "bgBlueBright" | "bgCyan" | "bgCyanBright" | "bgGray" | "bgGreen" | "bgGreenBright" | "bgGrey" | "bgMagenta" | "bgMagentaBright" | "bgRed" | "bgRedBright" | "bgWhite" | "bgWhiteBright" | "bgYellow" | "bgYellowBright" | "blink" | "bold" | "dim" | "doubleunderline" | "framed" | "hidden" | "inverse" | "italic" | "overlined" | "reset" | "strikethrough" | "underline", (v: string) => string>;
|
|
743
|
-
gradient: (txt: string, colors: GradientColors, opts?: GradientOpts) => string;
|
|
744
|
-
box: (text: string, options?: BoxOpts) => string;
|
|
745
|
-
columns: <Data extends ColumnData>(data: Data, options?: ColumnOpts) => string;
|
|
746
|
-
table: (data: TableData, options?: cli_table3.TableConstructorOptions) => string;
|
|
747
|
-
line: ({ title, lineChar, align, }: {
|
|
748
|
-
title?: string;
|
|
749
|
-
lineChar?: string;
|
|
750
|
-
align?: "left" | "center" | "right";
|
|
751
|
-
}) => string;
|
|
752
|
-
};
|
|
753
|
-
|
|
754
|
-
declare const ___shared_utils_env: typeof env;
|
|
755
|
-
declare const ___shared_utils_prompt: typeof prompt;
|
|
756
|
-
declare const ___shared_utils_style: typeof style;
|
|
757
|
-
declare const ___shared_utils_sys: typeof sys;
|
|
758
|
-
declare namespace ___shared_utils {
|
|
759
|
-
export { ___shared_utils_env as env, ___shared_utils_prompt as prompt, ___shared_utils_style as style, ___shared_utils_sys as sys };
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
type OptionSuper = {
|
|
763
|
-
/** Key of the option */
|
|
764
|
-
/** Description of the option */
|
|
765
|
-
desc: string;
|
|
766
|
-
};
|
|
767
|
-
type OptionCommon = OptionSuper & {
|
|
768
|
-
/**
|
|
769
|
-
* If is not set. Desc value will be used
|
|
770
|
-
*/
|
|
771
|
-
promptMsg?: string;
|
|
772
|
-
/** Alias of the option */
|
|
773
|
-
alias?: string[];
|
|
774
|
-
};
|
|
775
|
-
type OptionCommonWithPlaceholder<V> = Prettify<OptionCommon & {
|
|
776
|
-
/**
|
|
777
|
-
* Value that will be used as placeholder in prompt.
|
|
778
|
-
*/
|
|
779
|
-
placeholderValue?: V;
|
|
780
|
-
}>;
|
|
781
|
-
type CliOption = Prettify<Options$1 & {
|
|
782
|
-
desc: string;
|
|
783
|
-
}>;
|
|
784
|
-
type CliOptionType = Exclude<NonNullable<CliOption['type']>, 'count'>;
|
|
785
|
-
/**
|
|
786
|
-
* Core interface
|
|
787
|
-
*
|
|
788
|
-
* @template V
|
|
789
|
-
*/
|
|
790
|
-
type CoreInterface<V = string> = {
|
|
791
|
-
/**
|
|
792
|
-
* Validate value.
|
|
793
|
-
*
|
|
794
|
-
* Used to validate initial value in prompt method
|
|
795
|
-
*/
|
|
796
|
-
validateInitialValue: (data: {
|
|
797
|
-
/** Show success message */
|
|
798
|
-
showSuccess?: boolean;
|
|
799
|
-
/** Show error message */
|
|
800
|
-
showError?: boolean;
|
|
801
|
-
}) => Promise<V | undefined>;
|
|
802
|
-
/**
|
|
803
|
-
* Method to set the cli option
|
|
804
|
-
*
|
|
805
|
-
* @returns {Promise<CliOption | undefined>}
|
|
806
|
-
*/
|
|
807
|
-
cmd: () => Promise<CliOption | undefined>;
|
|
808
|
-
/**
|
|
809
|
-
* Method to set the prompt for the option
|
|
810
|
-
*
|
|
811
|
-
* @returns {Promise<V>}
|
|
812
|
-
*/
|
|
813
|
-
prompt: () => Promise<V>;
|
|
814
|
-
};
|
|
815
|
-
declare class Core<Config extends OptionSuper = OptionCommon, V = string> {
|
|
816
|
-
config: Prettify<Config>;
|
|
817
|
-
_utils: typeof ___shared_utils;
|
|
818
|
-
/** On cancel callback */
|
|
819
|
-
_onCancel: () => Promise<void>;
|
|
820
|
-
/** After the prompt is set */
|
|
821
|
-
afterPrompt: (<V>(value: V) => Promise<V>) | undefined;
|
|
822
|
-
/** Enable debug MODE */
|
|
823
|
-
debugMode: boolean;
|
|
824
|
-
/**
|
|
825
|
-
* Set initial value.
|
|
826
|
-
* For example if you want to prioritize a cli flag.
|
|
827
|
-
*
|
|
828
|
-
* @default undefined
|
|
829
|
-
*/
|
|
830
|
-
initialValue: V | undefined;
|
|
831
|
-
protected _type: Record<CliOptionType, CliOptionType>;
|
|
832
|
-
constructor(config: Prettify<Config>);
|
|
833
|
-
protected _text: {
|
|
834
|
-
initialValueSuccess: (t: string, v: string) => string;
|
|
835
|
-
initialValueError: (v?: string) => string;
|
|
836
|
-
};
|
|
837
|
-
getPromptHooked(): Promise<any>;
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
type Value$5 = string | number;
|
|
841
|
-
type OptionSelect<V extends Value$5 = Value$5> = OptionCommonWithPlaceholder<V> & {
|
|
842
|
-
/** Set the options of select */
|
|
843
|
-
options: {
|
|
844
|
-
[key in V]: {
|
|
845
|
-
/** Visible name of the option */
|
|
846
|
-
name: string;
|
|
847
|
-
/** Description of the option. Used in cli prompt */
|
|
848
|
-
desc?: string;
|
|
849
|
-
};
|
|
850
|
-
};
|
|
851
|
-
};
|
|
852
|
-
declare class Select<V extends Value$5 = Value$5> extends Core<OptionSelect<V>, V> implements CoreInterface<Value$5> {
|
|
853
|
-
cmd(): Promise<CliOption>;
|
|
854
|
-
validateInitialValue(data?: {
|
|
855
|
-
showSuccess?: boolean;
|
|
856
|
-
showError?: boolean;
|
|
857
|
-
}): Promise<V | undefined>;
|
|
858
|
-
prompt(): Promise<string>;
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
declare const SELECT_BASE_OPTS: {
|
|
862
|
-
readonly NONE: "none";
|
|
863
|
-
};
|
|
864
|
-
type OptionNone = typeof SELECT_BASE_OPTS['NONE'];
|
|
865
|
-
type OptionsValue = {
|
|
866
|
-
/** Visible name of the option */
|
|
867
|
-
name?: string;
|
|
868
|
-
/** Description of the option. Used in cli prompt */
|
|
869
|
-
desc?: string;
|
|
870
|
-
};
|
|
871
|
-
type SelectBaseOptions<Value extends string = string> = Partial<Omit<OptionSelect<Value>, 'options'>> & {
|
|
872
|
-
/**
|
|
873
|
-
* Select only specific options by key.
|
|
874
|
-
*
|
|
875
|
-
* Minimum 2 option.
|
|
876
|
-
*
|
|
877
|
-
* @example ['yarn', 'pnpm']
|
|
878
|
-
*/
|
|
879
|
-
onlyOptions?: [Exclude<Value, OptionNone>, Exclude<Value, OptionNone>, ...Exclude<Value, OptionNone>[]];
|
|
880
|
-
/** Change the options values by key */
|
|
881
|
-
options?: {
|
|
882
|
-
[key in Value]?: OptionsValue;
|
|
883
|
-
};
|
|
884
|
-
};
|
|
885
|
-
|
|
886
|
-
/** Text editor values used in `openEditor` option. */
|
|
887
|
-
declare const TEXT_EDITOR: {
|
|
888
|
-
readonly VSCODE: "code";
|
|
889
|
-
readonly SUBLIME: "subl";
|
|
890
|
-
readonly WEBSTORM: "webstorm";
|
|
891
|
-
readonly NONE: "none";
|
|
892
|
-
};
|
|
893
|
-
type TextEditor = ObjectValues<typeof TEXT_EDITOR>;
|
|
894
|
-
type OptionEditor = SelectBaseOptions<TextEditor>;
|
|
895
|
-
declare class Editor extends Select<TextEditor> {
|
|
896
|
-
constructor(config: OptionEditor);
|
|
897
|
-
validateInitialValue(data?: {
|
|
898
|
-
showSuccess?: boolean;
|
|
899
|
-
showError?: boolean;
|
|
900
|
-
}): Promise<TextEditor | undefined>;
|
|
901
|
-
prompt(): Promise<TextEditor>;
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
/** installer values used in `install` option. */
|
|
905
|
-
declare const INSTALLER: {
|
|
906
|
-
readonly NONE: "none";
|
|
907
|
-
readonly DENO: "deno";
|
|
908
|
-
readonly BUN: "bun";
|
|
909
|
-
readonly NPM: "npm";
|
|
910
|
-
readonly PNPM: "pnpm";
|
|
911
|
-
readonly YARN: "yarn";
|
|
912
|
-
};
|
|
913
|
-
type Installer = ObjectValues<typeof INSTALLER>;
|
|
914
|
-
type OptionInstall = SelectBaseOptions<Installer>;
|
|
915
|
-
declare class Install extends Select<Installer> {
|
|
916
|
-
constructor(config: OptionInstall);
|
|
917
|
-
validateInitialValue(data?: {
|
|
918
|
-
showSuccess?: boolean;
|
|
919
|
-
showError?: boolean;
|
|
920
|
-
}): Promise<Installer | undefined>;
|
|
921
|
-
prompt(): Promise<Installer>;
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
/** Object of the CREATIUM types */
|
|
925
|
-
declare const OPTION: {
|
|
926
|
-
readonly array: "array";
|
|
927
|
-
readonly select: "select";
|
|
928
|
-
readonly multiselect: "multiselect";
|
|
929
|
-
readonly boolean: "boolean";
|
|
930
|
-
readonly number: "number";
|
|
931
|
-
readonly text: "text";
|
|
932
|
-
readonly void: "void";
|
|
933
|
-
readonly output: "output";
|
|
934
|
-
readonly name: "name";
|
|
935
|
-
readonly template: "template";
|
|
936
|
-
readonly install: "install";
|
|
937
|
-
readonly openEditor: "openEditor";
|
|
938
|
-
readonly path: "path";
|
|
939
|
-
};
|
|
940
|
-
|
|
941
|
-
type Value$4 = string[];
|
|
942
|
-
type OptionArray = OptionCommonWithPlaceholder<Value$4> & {
|
|
943
|
-
/**
|
|
944
|
-
* Separator for value strings.
|
|
945
|
-
*
|
|
946
|
-
* @default ','
|
|
947
|
-
*/
|
|
948
|
-
separator?: string;
|
|
949
|
-
};
|
|
950
|
-
declare class Array extends Core<OptionArray, Value$4> implements CoreInterface<Value$4> {
|
|
951
|
-
#private;
|
|
952
|
-
cmd(): Promise<CliOption>;
|
|
953
|
-
validateInitialValue(data?: {
|
|
954
|
-
showSuccess?: boolean;
|
|
955
|
-
showError?: boolean;
|
|
956
|
-
}): Promise<Value$4 | undefined>;
|
|
957
|
-
prompt(): Promise<string[]>;
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
type Value$3 = boolean;
|
|
961
|
-
type OptionBoolean = OptionCommonWithPlaceholder<Value$3>;
|
|
962
|
-
declare class Boolean extends Core<OptionBoolean, Value$3> implements CoreInterface<Value$3> {
|
|
963
|
-
cmd(): Promise<CliOption>;
|
|
964
|
-
validateInitialValue(data?: {
|
|
965
|
-
showSuccess?: boolean;
|
|
966
|
-
showError?: boolean;
|
|
967
|
-
}): Promise<boolean | undefined>;
|
|
968
|
-
prompt(): Promise<boolean>;
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
type Value$2 = string;
|
|
972
|
-
type OptionMultiselect<V extends Value$2 = Value$2> = OptionCommonWithPlaceholder<V[]> & {
|
|
973
|
-
/** Set the options of multiselect */
|
|
974
|
-
options: {
|
|
975
|
-
[key in V]: {
|
|
976
|
-
/** Visible name of the option */
|
|
977
|
-
name: string;
|
|
978
|
-
/** Description of the option. Used in cli prompt */
|
|
979
|
-
desc?: string;
|
|
980
|
-
};
|
|
981
|
-
};
|
|
982
|
-
};
|
|
983
|
-
declare class Multiselect<V extends Value$2 = Value$2> extends Core<OptionMultiselect<V>, V[]> implements CoreInterface<V[]> {
|
|
984
|
-
cmd(): Promise<CliOption>;
|
|
985
|
-
validateInitialValue(data?: {
|
|
986
|
-
showSuccess?: boolean;
|
|
987
|
-
showError?: boolean;
|
|
988
|
-
}): Promise<V[] | undefined>;
|
|
989
|
-
prompt(): Promise<string[]>;
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
type Value$1 = number;
|
|
993
|
-
type OptionNumber = OptionCommonWithPlaceholder<Value$1>;
|
|
994
|
-
declare class Number extends Core<OptionNumber, Value$1> implements CoreInterface<Value$1> {
|
|
995
|
-
cmd(): Promise<CliOption>;
|
|
996
|
-
validateInitialValue(data?: {
|
|
997
|
-
showSuccess?: boolean;
|
|
998
|
-
showError?: boolean;
|
|
999
|
-
}): Promise<number | undefined>;
|
|
1000
|
-
prompt(): Promise<number>;
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
type Value = string;
|
|
1004
|
-
type OptionText = OptionCommonWithPlaceholder<Value>;
|
|
1005
|
-
declare class Text extends Core<OptionText, Value> implements CoreInterface<Value> {
|
|
1006
|
-
cmd(): Promise<CliOption>;
|
|
1007
|
-
validateInitialValue(data?: {
|
|
1008
|
-
showSuccess?: boolean;
|
|
1009
|
-
showError?: boolean;
|
|
1010
|
-
}): Promise<string | undefined>;
|
|
1011
|
-
prompt(): Promise<string>;
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
type OptionVoid = OptionSuper & {
|
|
1015
|
-
fn: () => Response<void>;
|
|
1016
|
-
};
|
|
1017
|
-
declare class Void extends Core<OptionVoid, void> implements CoreInterface<void> {
|
|
1018
|
-
cmd(): Promise<undefined>;
|
|
1019
|
-
validateInitialValue(): Promise<undefined>;
|
|
1020
|
-
prompt(): Promise<void>;
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
type OptionName = Partial<Name['config']>;
|
|
1024
|
-
declare class Name extends Text {
|
|
1025
|
-
constructor(config: OptionName);
|
|
1026
|
-
validateInitialValue(data?: {
|
|
1027
|
-
showSuccess?: boolean;
|
|
1028
|
-
showError?: boolean;
|
|
1029
|
-
}): Promise<string | undefined>;
|
|
1030
|
-
prompt(): Promise<string>;
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
declare const PATH_TYPE: {
|
|
1034
|
-
folder: string;
|
|
1035
|
-
file: string;
|
|
1036
|
-
};
|
|
1037
|
-
type PathType = typeof PATH_TYPE[keyof typeof PATH_TYPE];
|
|
1038
|
-
type OptionPath = Partial<Path['config']> & {
|
|
1039
|
-
/**
|
|
1040
|
-
* Set path type
|
|
1041
|
-
*
|
|
1042
|
-
* @default 'file'
|
|
1043
|
-
*/
|
|
1044
|
-
pathType?: PathType;
|
|
1045
|
-
/**
|
|
1046
|
-
* Set if you want to check if path exists or not.
|
|
1047
|
-
*
|
|
1048
|
-
* @default false
|
|
1049
|
-
*/
|
|
1050
|
-
exists?: boolean;
|
|
1051
|
-
};
|
|
1052
|
-
declare class Path extends Text {
|
|
1053
|
-
#private;
|
|
1054
|
-
constructor(config: OptionPath);
|
|
1055
|
-
validateInitialValue(data?: {
|
|
1056
|
-
showSuccess?: boolean;
|
|
1057
|
-
showError?: boolean;
|
|
1058
|
-
}): Promise<string | undefined>;
|
|
1059
|
-
prompt(): Promise<string>;
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
type OptionOutput = Partial<Omit<Path['config'], 'pathType' | 'exists'>>;
|
|
1063
|
-
declare class Output extends Path {
|
|
1064
|
-
constructor(config: OptionOutput);
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
|
-
type OptionTemplate = Partial<Omit<Select['config'], 'options'>> & {
|
|
1068
|
-
options: {
|
|
1069
|
-
[key: string]: {
|
|
1070
|
-
/**
|
|
1071
|
-
* Input for download
|
|
1072
|
-
* Could be an directory
|
|
1073
|
-
*/
|
|
1074
|
-
input: string;
|
|
1075
|
-
/**
|
|
1076
|
-
* Name of the template.
|
|
1077
|
-
* If not set, the name of the template will be the key of the template
|
|
1078
|
-
*/
|
|
1079
|
-
name?: string;
|
|
1080
|
-
/**
|
|
1081
|
-
* Description of the template.
|
|
1082
|
-
*/
|
|
1083
|
-
desc?: string;
|
|
1084
|
-
};
|
|
1085
|
-
};
|
|
1086
|
-
};
|
|
1087
|
-
declare class Template extends Select<keyof OptionTemplate['options']> {
|
|
1088
|
-
constructor(config: OptionTemplate);
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
type Options = {
|
|
1092
|
-
/**Array of values*/
|
|
1093
|
-
[OPTION.array]: OptionArray;
|
|
1094
|
-
/**Single selection option*/
|
|
1095
|
-
[OPTION.select]: OptionSelect;
|
|
1096
|
-
/**Multiple selection option*/
|
|
1097
|
-
[OPTION.multiselect]: OptionMultiselect;
|
|
1098
|
-
/**Boolean option (true/false)*/
|
|
1099
|
-
[OPTION.boolean]: OptionBoolean;
|
|
1100
|
-
/**Numeric input*/
|
|
1101
|
-
[OPTION.number]: OptionNumber;
|
|
1102
|
-
/**Text input*/
|
|
1103
|
-
[OPTION.text]: OptionText;
|
|
1104
|
-
/**Void option (no value)*/
|
|
1105
|
-
[OPTION.void]: OptionVoid;
|
|
1106
|
-
/** Options for path*/
|
|
1107
|
-
[OPTION.path]: OptionPath;
|
|
1108
|
-
/**Input for download*/
|
|
1109
|
-
[OPTION.output]: OptionOutput;
|
|
1110
|
-
/**Name of the project
|
|
1111
|
-
* @default filename(output)*/
|
|
1112
|
-
[OPTION.name]: OptionName;
|
|
1113
|
-
/**Templates*/
|
|
1114
|
-
[OPTION.template]: OptionTemplate;
|
|
1115
|
-
/**Package manager to install dependencies*/
|
|
1116
|
-
[OPTION.install]: OptionInstall;
|
|
1117
|
-
/** Open project in a text editor if exist */
|
|
1118
|
-
[OPTION.openEditor]: OptionEditor;
|
|
1119
|
-
};
|
|
1120
|
-
type OptionsClasses = {
|
|
1121
|
-
/** Class for handling array options */
|
|
1122
|
-
[OPTION.array]: typeof Array;
|
|
1123
|
-
/** Class for handling select options */
|
|
1124
|
-
[OPTION.select]: typeof Select;
|
|
1125
|
-
/** Class for handling multiselect options */
|
|
1126
|
-
[OPTION.multiselect]: typeof Multiselect;
|
|
1127
|
-
/** Class for handling boolean options */
|
|
1128
|
-
[OPTION.boolean]: typeof Boolean;
|
|
1129
|
-
/** Class for handling number options */
|
|
1130
|
-
[OPTION.number]: typeof Number;
|
|
1131
|
-
/** Class for handling text options */
|
|
1132
|
-
[OPTION.text]: typeof Text;
|
|
1133
|
-
/** Class for handling void options */
|
|
1134
|
-
[OPTION.void]: typeof Void;
|
|
1135
|
-
/** Options for path*/
|
|
1136
|
-
[OPTION.path]: typeof Path;
|
|
1137
|
-
/** Class for handling output options */
|
|
1138
|
-
[OPTION.output]: typeof Output;
|
|
1139
|
-
/** Class for handling name options */
|
|
1140
|
-
[OPTION.name]: typeof Name;
|
|
1141
|
-
/** Class for handling template options */
|
|
1142
|
-
[OPTION.template]: typeof Template;
|
|
1143
|
-
/** Class for handling install options */
|
|
1144
|
-
[OPTION.install]: typeof Install;
|
|
1145
|
-
/** Class for handling openEditor options */
|
|
1146
|
-
[OPTION.openEditor]: typeof Editor;
|
|
1147
|
-
};
|
|
1148
|
-
type OptionsParams = Prettify<Record<string, ObjectToArray<Options>[number]>>;
|
|
1149
|
-
type GetPromptValue<K extends keyof OptionsClasses> = Prettify<'prompt' extends keyof OptionsClasses[K]['prototype'] ? Awaited<ReturnType<OptionsClasses[K]['prototype']['prompt']>> : never>;
|
|
1150
|
-
|
|
1151
|
-
type HookParams = {
|
|
1152
|
-
/** Values passed to the prompt */
|
|
1153
|
-
values?: {
|
|
1154
|
-
[x: string]: unknown;
|
|
1155
|
-
};
|
|
1156
|
-
};
|
|
1157
|
-
type CreateTemplateOpts = {
|
|
1158
|
-
/** Set the input path or the template key */
|
|
1159
|
-
input?: string;
|
|
1160
|
-
/** Set the output path */
|
|
1161
|
-
output?: string;
|
|
1162
|
-
/** Set the name of the template */
|
|
1163
|
-
name?: string;
|
|
1164
|
-
/** Set the installer */
|
|
1165
|
-
install?: Installer;
|
|
1166
|
-
/**
|
|
1167
|
-
* Open editor
|
|
1168
|
-
*/
|
|
1169
|
-
openEditor?: TextEditor;
|
|
1170
|
-
/**
|
|
1171
|
-
* Add consts to use in your templates.
|
|
1172
|
-
*
|
|
1173
|
-
*/
|
|
1174
|
-
consts?: Record<string, string>;
|
|
1175
|
-
};
|
|
1176
|
-
type ValuesSimple = Prettify<Omit<CreateTemplateOpts, 'consts' | 'input' | 'output'> & Required<Pick<CreateTemplateOpts, 'output' | 'input'>>>;
|
|
1177
|
-
type Config = {
|
|
1178
|
-
/**
|
|
1179
|
-
* Set name of you project
|
|
1180
|
-
*/
|
|
1181
|
-
name: string;
|
|
1182
|
-
/**
|
|
1183
|
-
* Set version of you current project
|
|
1184
|
-
* Used in for the updater notifications.
|
|
1185
|
-
*/
|
|
1186
|
-
version: string;
|
|
1187
|
-
/**
|
|
1188
|
-
* Use cache
|
|
1189
|
-
*
|
|
1190
|
-
* @default true
|
|
1191
|
-
*/
|
|
1192
|
-
cache?: boolean;
|
|
1193
|
-
/**
|
|
1194
|
-
* Use updater
|
|
1195
|
-
*
|
|
1196
|
-
* @default false
|
|
1197
|
-
*/
|
|
1198
|
-
updater?: boolean;
|
|
1199
|
-
/** Set custom function foor when user cancels the process */
|
|
1200
|
-
onCancel?: ((data: HookParams) => Response<void>) | false;
|
|
1201
|
-
/** Set custom intro */
|
|
1202
|
-
intro?: ((data: HookParams) => Response<void>) | false;
|
|
1203
|
-
/** Set custom outro */
|
|
1204
|
-
outro?: ((data: HookParams) => Response<void>) | false;
|
|
1205
|
-
/**
|
|
1206
|
-
* Set you prompts config
|
|
1207
|
-
*/
|
|
1208
|
-
prompt: OptionsParams;
|
|
1209
|
-
/**
|
|
1210
|
-
* hooks for
|
|
1211
|
-
*/
|
|
1212
|
-
hooks?: {
|
|
1213
|
-
beforePrompt?: <D extends HookParams>(data: D) => Response<D | undefined>;
|
|
1214
|
-
afterPrompt?: <D extends HookParams>(data: D) => Response<D | undefined>;
|
|
1215
|
-
};
|
|
1216
|
-
};
|
|
1217
|
-
type ConfigSimple = Prettify<Omit<Config, 'prompt' | 'hooks'> & {
|
|
1218
|
-
/** Set your prompt options */
|
|
1219
|
-
opts?: {
|
|
1220
|
-
/** Active/deactivate the name prompt */
|
|
1221
|
-
[OPTION.name]?: boolean;
|
|
1222
|
-
/**
|
|
1223
|
-
* Active/deactivate the install prompt
|
|
1224
|
-
* Also, You can set the installators that you want to use.
|
|
1225
|
-
*/
|
|
1226
|
-
[OPTION.install]?: false | Options['install']['onlyOptions'];
|
|
1227
|
-
/**
|
|
1228
|
-
* Active/deactivate the openEditor prompt.
|
|
1229
|
-
* Also, You can set the editors that you want to use.
|
|
1230
|
-
*/
|
|
1231
|
-
[OPTION.openEditor]?: false | Options['openEditor']['onlyOptions'];
|
|
1232
|
-
};
|
|
1233
|
-
/** Set your template ooptions */
|
|
1234
|
-
templates: Options['template']['options'];
|
|
1235
|
-
/**
|
|
1236
|
-
* Add consts to use in your templates.
|
|
1237
|
-
*/
|
|
1238
|
-
consts?: CreateTemplateOpts['consts'];
|
|
1239
|
-
}>;
|
|
1240
|
-
type CliOpts = {
|
|
1241
|
-
/**
|
|
1242
|
-
* Arguments to pass to the command
|
|
1243
|
-
*
|
|
1244
|
-
* @default process.argv.slice(2)
|
|
1245
|
-
*/
|
|
1246
|
-
args?: string[];
|
|
1247
|
-
/**
|
|
1248
|
-
* Hide the first two arguments
|
|
1249
|
-
*
|
|
1250
|
-
* @default false
|
|
1251
|
-
*/
|
|
1252
|
-
hideBin?: boolean;
|
|
1253
|
-
};
|
|
1254
|
-
type CreateOpts = CliOpts & {
|
|
1255
|
-
/**
|
|
1256
|
-
* Options for activate cli.
|
|
1257
|
-
*
|
|
1258
|
-
* @default true
|
|
1259
|
-
*/
|
|
1260
|
-
activeCli?: boolean;
|
|
1261
|
-
};
|
|
1262
|
-
|
|
1263
|
-
type ParamFn = (arg: string) => Promise<string>;
|
|
1264
|
-
type ParamsValue = string | number | Record<string, unknown> | unknown[] | unknown;
|
|
1265
|
-
type Params = Record<string, ParamsValue>;
|
|
1266
|
-
type Props = {
|
|
1267
|
-
/** Content to be replaced */
|
|
1268
|
-
content: string;
|
|
1269
|
-
/**
|
|
1270
|
-
* Parameters
|
|
1271
|
-
*
|
|
1272
|
-
* @example
|
|
1273
|
-
* const params = {
|
|
1274
|
-
* name: 'Antonio',
|
|
1275
|
-
* lastName : 'Resines'
|
|
1276
|
-
* }
|
|
1277
|
-
*/
|
|
1278
|
-
params: Params;
|
|
1279
|
-
/**
|
|
1280
|
-
* Transform parameters insde placeholders.
|
|
1281
|
-
*
|
|
1282
|
-
* @example
|
|
1283
|
-
* const transform = async ( param: string ) => {
|
|
1284
|
-
* if ( param === 'url' ) return 'https://pigeonposse.com',
|
|
1285
|
-
* else if ( param === 'http://pigeonposse.com' ) return 'https://pigeonposse.com'
|
|
1286
|
-
* return param
|
|
1287
|
-
* }
|
|
1288
|
-
*/
|
|
1289
|
-
transform?: ParamFn;
|
|
1290
|
-
/** Options */
|
|
1291
|
-
opts?: {
|
|
1292
|
-
/**
|
|
1293
|
-
* Throw an error if a placeholder is not found.
|
|
1294
|
-
*
|
|
1295
|
-
* @default false
|
|
1296
|
-
*/
|
|
1297
|
-
throw?: boolean;
|
|
1298
|
-
/**
|
|
1299
|
-
* Throw an error if a parameter is not found.
|
|
1300
|
-
*
|
|
1301
|
-
* @default
|
|
1302
|
-
* {
|
|
1303
|
-
* prefix : '{{',
|
|
1304
|
-
* suffix : '}}',
|
|
1305
|
-
* }
|
|
1306
|
-
*/
|
|
1307
|
-
mark?: {
|
|
1308
|
-
prefix: string;
|
|
1309
|
-
suffix: string;
|
|
1310
|
-
};
|
|
1311
|
-
};
|
|
1312
|
-
};
|
|
1313
|
-
/**
|
|
1314
|
-
* Replace placeholders in a string with their corresponding values.
|
|
1315
|
-
*
|
|
1316
|
-
* The function takes a string with placeholders, an object with parameter values,
|
|
1317
|
-
* and an optional custom parameter function.
|
|
1318
|
-
*
|
|
1319
|
-
* The function returns a Promise that resolves to the string with all placeholders
|
|
1320
|
-
* replaced.
|
|
1321
|
-
*
|
|
1322
|
-
* @param {Props} props - Props for the function.
|
|
1323
|
-
* @param {Props['content']} props.content - The string with placeholders.
|
|
1324
|
-
* @param {Props['params']} props.params - An object with parameter values.
|
|
1325
|
-
* @param {Props['transform']} [props.transform] - An optional custom parameter function.
|
|
1326
|
-
* @param {Props['opts']} [props.opts] - Options to customize the behavior of the function.
|
|
1327
|
-
* @returns {Promise<string>} - A Promise that resolves to the string with all placeholders replaced.
|
|
1328
|
-
*/
|
|
1329
|
-
declare const replacePlaceholders: (props: Props) => Promise<string>;
|
|
1330
|
-
|
|
1331
|
-
type GetPromptValues<C extends Config> = Prettify<{
|
|
1332
|
-
[K in keyof C['prompt']]?: Prettify<(C['prompt'][K] extends {
|
|
1333
|
-
type: infer T;
|
|
1334
|
-
} ? T extends keyof OptionsClasses ? GetPromptValue<T> : never : never)>;
|
|
1335
|
-
}>;
|
|
1336
|
-
|
|
1337
|
-
/**
|
|
1338
|
-
* Customizable class of `Creatium` for create project templates (CLI and Library).
|
|
1339
|
-
*
|
|
1340
|
-
* @template C
|
|
1341
|
-
* @example
|
|
1342
|
-
* //////////////// core.js ///////////////////
|
|
1343
|
-
*
|
|
1344
|
-
* export const core = new CreatiumCore({
|
|
1345
|
-
* name: 'My Project',
|
|
1346
|
-
* version: '1.0.0',
|
|
1347
|
-
* prompts: {
|
|
1348
|
-
* ...
|
|
1349
|
-
* },
|
|
1350
|
-
* ...
|
|
1351
|
-
* })
|
|
1352
|
-
*
|
|
1353
|
-
* //////////////// bin.js ///////////////////
|
|
1354
|
-
*
|
|
1355
|
-
* import { core } from './core.js'
|
|
1356
|
-
* const res = await core.cli()
|
|
1357
|
-
* // do something with res...
|
|
1358
|
-
* await core.createTemplate( res )
|
|
1359
|
-
*
|
|
1360
|
-
* //////////////// lib.js ///////////////////
|
|
1361
|
-
*
|
|
1362
|
-
* import { core } from './core.js'
|
|
1363
|
-
* export const create = async (args) => {
|
|
1364
|
-
* const res = await core.build( args )
|
|
1365
|
-
* // do something with res...
|
|
1366
|
-
* await core.createTemplate( res )
|
|
1367
|
-
* }
|
|
1368
|
-
*/
|
|
1369
|
-
declare class CreatiumCore<C extends Config = Config> {
|
|
1370
|
-
#private;
|
|
1371
|
-
utils: typeof ___shared_utils;
|
|
1372
|
-
config: C;
|
|
1373
|
-
constructor(config: C);
|
|
1374
|
-
/** Force debug mode */
|
|
1375
|
-
set debugMode(value: boolean);
|
|
1376
|
-
/**
|
|
1377
|
-
* Shows a notification if the current package is outdated.
|
|
1378
|
-
*
|
|
1379
|
-
* **information**: If this 'custom' function is provided, the default
|
|
1380
|
-
* notification will not be shown.
|
|
1381
|
-
*
|
|
1382
|
-
* @returns {Promise<boolean>} - A promise that resolves when the notification has finished.
|
|
1383
|
-
*/
|
|
1384
|
-
updateNotify(): Promise<boolean>;
|
|
1385
|
-
/**
|
|
1386
|
-
* Cancels the current process and exits with code 0.
|
|
1387
|
-
*
|
|
1388
|
-
* If a `message` is provided, it will be displayed in the console.
|
|
1389
|
-
* If `onCancel` is set in the config, it will be called with the current data.
|
|
1390
|
-
* If `onCancel` is not set, a default message will be displayed.
|
|
1391
|
-
*
|
|
1392
|
-
* @param {string} [message] - The message to display before exiting.
|
|
1393
|
-
*/
|
|
1394
|
-
cancel(message?: string): Promise<void>;
|
|
1395
|
-
/**
|
|
1396
|
-
* Intro prompt line.
|
|
1397
|
-
*
|
|
1398
|
-
* If the parameter `message` is provided, it will be used as the intro message.
|
|
1399
|
-
* If the `intro` option is a function, it will be called with the `this.#data` as the argument.
|
|
1400
|
-
* If the `intro` option is undefined, the default intro message will be used.
|
|
1401
|
-
*
|
|
1402
|
-
* @param {string} [message] - The intro message.
|
|
1403
|
-
*/
|
|
1404
|
-
intro(message?: string): Promise<void>;
|
|
1405
|
-
/**
|
|
1406
|
-
* Outro prompt line.
|
|
1407
|
-
*
|
|
1408
|
-
* If the parameter `message` is provided, it will be used as the outro message.
|
|
1409
|
-
* If the `outro` option is a function, it will be called with the `this.#data` as the argument.
|
|
1410
|
-
* If the `outro` option is undefined, the default outro message will be used.
|
|
1411
|
-
*
|
|
1412
|
-
* @param {string} [message] - The outro message.
|
|
1413
|
-
*/
|
|
1414
|
-
outro(message?: string): Promise<void>;
|
|
1415
|
-
/**
|
|
1416
|
-
* Copy a directory from input path to output path.
|
|
1417
|
-
*
|
|
1418
|
-
* @param {object} data - Options object with input and output paths.
|
|
1419
|
-
* @param {string} data.input - The path to the directory to copy.
|
|
1420
|
-
* @param {string} data.output - The path to the destination directory.
|
|
1421
|
-
* @returns {Promise<void>} - Resolves when the directory has been copied.
|
|
1422
|
-
* @example
|
|
1423
|
-
*
|
|
1424
|
-
* const copyResult = await core.copyDir({
|
|
1425
|
-
* input : '/path/to/sourceDir',
|
|
1426
|
-
* output: '/path/to/destinationDir',
|
|
1427
|
-
* })
|
|
1428
|
-
*/
|
|
1429
|
-
copyDir(data: {
|
|
1430
|
-
input: string;
|
|
1431
|
-
output: string;
|
|
1432
|
-
}): Promise<void>;
|
|
1433
|
-
/**
|
|
1434
|
-
* Installs the project with the given package manager.
|
|
1435
|
-
*
|
|
1436
|
-
* @param {object} [options] - The options to install.
|
|
1437
|
-
* @param {Installer} [options.installer] - The package manager to use for the installation.
|
|
1438
|
-
* @param {string} [options.input] - The path to the folder. If not provided, the current directory is used.
|
|
1439
|
-
* @returns {Promise<void>}
|
|
1440
|
-
* @example
|
|
1441
|
-
* await core.install( {
|
|
1442
|
-
* installer : 'pnpm',
|
|
1443
|
-
* input : 'my/project/path',
|
|
1444
|
-
* } )
|
|
1445
|
-
*/
|
|
1446
|
-
install({ installer, input, }?: {
|
|
1447
|
-
installer?: Installer;
|
|
1448
|
-
input?: string;
|
|
1449
|
-
}): Promise<void>;
|
|
1450
|
-
/**
|
|
1451
|
-
* Open the project in the given editor.
|
|
1452
|
-
*
|
|
1453
|
-
* @param {object} params - The parameters for opening the editor.
|
|
1454
|
-
* @param {TextEditor} params.editor - The editor to open the project in.
|
|
1455
|
-
* @param {string} params.input - The input path. If not provided, the current directory is used.
|
|
1456
|
-
* @returns {Promise<void>}
|
|
1457
|
-
* @example
|
|
1458
|
-
* await core.openEditor( {
|
|
1459
|
-
* editor : 'vscode',
|
|
1460
|
-
* input : 'my/project/path',
|
|
1461
|
-
* })
|
|
1462
|
-
*/
|
|
1463
|
-
openEditor({ editor, input, }?: {
|
|
1464
|
-
editor?: TextEditor;
|
|
1465
|
-
input?: string;
|
|
1466
|
-
}): Promise<void>;
|
|
1467
|
-
/**
|
|
1468
|
-
* Replaces placeholders in files within the specified directory.
|
|
1469
|
-
*
|
|
1470
|
-
* This function searches for files in the provided input directory and replaces
|
|
1471
|
-
* placeholders within those files using the specified parameters. The placeholders
|
|
1472
|
-
* in the content are replaced with values from the `params` object.
|
|
1473
|
-
*
|
|
1474
|
-
* @param {object} args - The arguments object.
|
|
1475
|
-
* @param {string} [args.input] - The directory path containing files with placeholders.
|
|
1476
|
-
* @param {object} [args.params] - An object containing key-value pairs for replacing placeholders.
|
|
1477
|
-
* @returns {Promise<void>} A Promise that resolves once all placeholders have been replaced.
|
|
1478
|
-
* @example
|
|
1479
|
-
* await core.replacePlaceholders( {
|
|
1480
|
-
* input : 'my/project/path',
|
|
1481
|
-
* params : { consts: { version: '1.0.0' }, prompt: { name: 'My Project' } },
|
|
1482
|
-
* })
|
|
1483
|
-
*/
|
|
1484
|
-
replacePlaceholders({ input, params, inputOpts, }?: {
|
|
1485
|
-
input?: string;
|
|
1486
|
-
params?: Parameters<typeof replacePlaceholders>[0]['params'];
|
|
1487
|
-
inputOpts?: Parameters<typeof getPaths>[1];
|
|
1488
|
-
}): Promise<void>;
|
|
1489
|
-
/**
|
|
1490
|
-
* Return the input path of a template by name or path.
|
|
1491
|
-
*
|
|
1492
|
-
* @param {string} [input] - The name of the template or the path to the template.
|
|
1493
|
-
* @returns {Promise<string | undefined>} The input path of the template or undefined if not found.
|
|
1494
|
-
* @example
|
|
1495
|
-
* // with template path
|
|
1496
|
-
* const input = await core.getTemplateInput( { input : 'my/template/path' } )
|
|
1497
|
-
* @example
|
|
1498
|
-
* // With template key
|
|
1499
|
-
* // template key must be specified in the config prompt secction.
|
|
1500
|
-
* const input = await core.getTemplateInput( { input : 'templateKey' )
|
|
1501
|
-
*/
|
|
1502
|
-
getTemplateInput({ input }?: {
|
|
1503
|
-
input?: string;
|
|
1504
|
-
}): Promise<string | undefined>;
|
|
1505
|
-
/**
|
|
1506
|
-
* Create a new project template.
|
|
1507
|
-
*
|
|
1508
|
-
* @param {CreateTemplateOpts} values - The values to create the template.
|
|
1509
|
-
* @returns {Promise<void>} - A promise that resolves when the template is created.
|
|
1510
|
-
* @example
|
|
1511
|
-
* // basic usage
|
|
1512
|
-
* await core.createTemplate( { input : 'my/template/path', output : 'my/project/path' } )
|
|
1513
|
-
* @example
|
|
1514
|
-
* // custom usage
|
|
1515
|
-
* await core.createTemplate( {
|
|
1516
|
-
* input : 'my/template/path',
|
|
1517
|
-
* output : 'my/project/path',
|
|
1518
|
-
* install : 'pnpm',
|
|
1519
|
-
* open : 'vscode',
|
|
1520
|
-
* consts : {
|
|
1521
|
-
* version : '1.0.0',
|
|
1522
|
-
* header : '// Template generated by Creatium. a project from PigeonPosse',
|
|
1523
|
-
* },
|
|
1524
|
-
* } )
|
|
1525
|
-
*/
|
|
1526
|
-
createTemplate(values: CreateTemplateOpts): Promise<void>;
|
|
1527
|
-
/**
|
|
1528
|
-
* Initialize the CLI and executes the callback function passed in the config.
|
|
1529
|
-
*
|
|
1530
|
-
* @param {GetPromptValues<C>} [values] - The values to override the CLI prompts. If not set, the CLI prompts will be executed.
|
|
1531
|
-
* @param {CreateOpts} [opts] - The options to pass to the CLI.
|
|
1532
|
-
* @returns The result of the callback function.
|
|
1533
|
-
*/
|
|
1534
|
-
build(values?: Prettify<GetPromptValues<C>>, opts?: CreateOpts): Promise<{ [K_1 in keyof C["prompt"]]?: ((C["prompt"][K_1] extends {
|
|
1535
|
-
type: infer T_2;
|
|
1536
|
-
} ? T_2 extends keyof OptionsClasses ? ("prompt" extends keyof OptionsClasses[T_2]["prototype"] ? Awaited<ReturnType<OptionsClasses[T_2]["prototype"]["prompt"]>> : never) extends infer T_7 ? { [K_3 in keyof T_7]: ("prompt" extends keyof OptionsClasses[T_2]["prototype"] ? Awaited<ReturnType<OptionsClasses[T_2]["prototype"]["prompt"]>> : never)[K_3]; } : never : never : never) extends infer T_5 ? { [K_2 in keyof T_5]: (C["prompt"][K_1] extends {
|
|
1537
|
-
type: infer T_2;
|
|
1538
|
-
} ? T_2 extends keyof OptionsClasses ? ("prompt" extends keyof OptionsClasses[T_2]["prototype"] ? Awaited<ReturnType<OptionsClasses[T_2]["prototype"]["prompt"]>> : never) extends infer T_6 ? { [K_3 in keyof T_6]: ("prompt" extends keyof OptionsClasses[T_2]["prototype"] ? Awaited<ReturnType<OptionsClasses[T_2]["prototype"]["prompt"]>> : never)[K_3]; } : never : never : never)[K_2]; } : never) | undefined; } extends infer T ? { [K in keyof T]: { [K_1 in keyof C["prompt"]]?: ((C["prompt"][K_1] extends {
|
|
1539
|
-
type: infer T_2;
|
|
1540
|
-
} ? T_2 extends keyof OptionsClasses ? ("prompt" extends keyof OptionsClasses[T_2]["prototype"] ? Awaited<ReturnType<OptionsClasses[T_2]["prototype"]["prompt"]>> : never) extends infer T_4 ? { [K_3 in keyof T_4]: ("prompt" extends keyof OptionsClasses[T_2]["prototype"] ? Awaited<ReturnType<OptionsClasses[T_2]["prototype"]["prompt"]>> : never)[K_3]; } : never : never : never) extends infer T_1 ? { [K_2 in keyof T_1]: (C["prompt"][K_1] extends {
|
|
1541
|
-
type: infer T_2;
|
|
1542
|
-
} ? T_2 extends keyof OptionsClasses ? ("prompt" extends keyof OptionsClasses[T_2]["prototype"] ? Awaited<ReturnType<OptionsClasses[T_2]["prototype"]["prompt"]>> : never) extends infer T_3 ? { [K_3 in keyof T_3]: ("prompt" extends keyof OptionsClasses[T_2]["prototype"] ? Awaited<ReturnType<OptionsClasses[T_2]["prototype"]["prompt"]>> : never)[K_3]; } : never : never : never)[K_2]; } : never) | undefined; }[K]; } : never>;
|
|
1543
|
-
/**
|
|
1544
|
-
* Initializes and executes the command-line interface (CLI) process.
|
|
1545
|
-
*
|
|
1546
|
-
* @param {CliOpts} [props] - Optional CLI options to configure the initialization process.
|
|
1547
|
-
* @returns A promise resolving to the prompt values obtained after executing the CLI.
|
|
1548
|
-
* @example
|
|
1549
|
-
* // simple usage
|
|
1550
|
-
* await core.cli()
|
|
1551
|
-
* @example
|
|
1552
|
-
* // custom usage
|
|
1553
|
-
* await core.cli( { args : process.argv.slice( 4), hideBin : false } )
|
|
1554
|
-
*/
|
|
1555
|
-
cli(props?: CliOpts): Promise<{ [K_1 in keyof C["prompt"]]?: ((C["prompt"][K_1] extends {
|
|
1556
|
-
type: infer T_2;
|
|
1557
|
-
} ? T_2 extends keyof OptionsClasses ? ("prompt" extends keyof OptionsClasses[T_2]["prototype"] ? Awaited<ReturnType<OptionsClasses[T_2]["prototype"]["prompt"]>> : never) extends infer T_7 ? { [K_3 in keyof T_7]: ("prompt" extends keyof OptionsClasses[T_2]["prototype"] ? Awaited<ReturnType<OptionsClasses[T_2]["prototype"]["prompt"]>> : never)[K_3]; } : never : never : never) extends infer T_5 ? { [K_2 in keyof T_5]: (C["prompt"][K_1] extends {
|
|
1558
|
-
type: infer T_2;
|
|
1559
|
-
} ? T_2 extends keyof OptionsClasses ? ("prompt" extends keyof OptionsClasses[T_2]["prototype"] ? Awaited<ReturnType<OptionsClasses[T_2]["prototype"]["prompt"]>> : never) extends infer T_6 ? { [K_3 in keyof T_6]: ("prompt" extends keyof OptionsClasses[T_2]["prototype"] ? Awaited<ReturnType<OptionsClasses[T_2]["prototype"]["prompt"]>> : never)[K_3]; } : never : never : never)[K_2]; } : never) | undefined; } extends infer T ? { [K in keyof T]: { [K_1 in keyof C["prompt"]]?: ((C["prompt"][K_1] extends {
|
|
1560
|
-
type: infer T_2;
|
|
1561
|
-
} ? T_2 extends keyof OptionsClasses ? ("prompt" extends keyof OptionsClasses[T_2]["prototype"] ? Awaited<ReturnType<OptionsClasses[T_2]["prototype"]["prompt"]>> : never) extends infer T_4 ? { [K_3 in keyof T_4]: ("prompt" extends keyof OptionsClasses[T_2]["prototype"] ? Awaited<ReturnType<OptionsClasses[T_2]["prototype"]["prompt"]>> : never)[K_3]; } : never : never : never) extends infer T_1 ? { [K_2 in keyof T_1]: (C["prompt"][K_1] extends {
|
|
1562
|
-
type: infer T_2;
|
|
1563
|
-
} ? T_2 extends keyof OptionsClasses ? ("prompt" extends keyof OptionsClasses[T_2]["prototype"] ? Awaited<ReturnType<OptionsClasses[T_2]["prototype"]["prompt"]>> : never) extends infer T_3 ? { [K_3 in keyof T_3]: ("prompt" extends keyof OptionsClasses[T_2]["prototype"] ? Awaited<ReturnType<OptionsClasses[T_2]["prototype"]["prompt"]>> : never)[K_3]; } : never : never : never)[K_2]; } : never) | undefined; }[K]; } : never>;
|
|
1564
|
-
}
|
|
1565
|
-
|
|
1566
|
-
/**
|
|
1567
|
-
* Class of `Creatium` for create project templates (CLI and Library).
|
|
1568
|
-
*
|
|
1569
|
-
* @example
|
|
1570
|
-
* //////////////// core.js ///////////////////
|
|
1571
|
-
*
|
|
1572
|
-
* import { Creatium } from 'creatium'
|
|
1573
|
-
* export const core = new Creatium({
|
|
1574
|
-
* name: 'My Project',
|
|
1575
|
-
* version: '1.0.0',
|
|
1576
|
-
* templates: {
|
|
1577
|
-
* ...
|
|
1578
|
-
* },
|
|
1579
|
-
* })
|
|
1580
|
-
*
|
|
1581
|
-
* //////////////// bin.js ///////////////////
|
|
1582
|
-
*
|
|
1583
|
-
* import { core } from './core.js'
|
|
1584
|
-
* core.cli()
|
|
1585
|
-
*
|
|
1586
|
-
* //////////////// lib.js ///////////////////
|
|
1587
|
-
*
|
|
1588
|
-
* import { core } from './core.js'
|
|
1589
|
-
* export const create = core.build
|
|
1590
|
-
*/
|
|
1591
|
-
declare class Creatium {
|
|
1592
|
-
#private;
|
|
1593
|
-
protected options: ConfigSimple;
|
|
1594
|
-
protected config: {
|
|
1595
|
-
prompt: {
|
|
1596
|
-
openEditor?: {
|
|
1597
|
-
type: "openEditor";
|
|
1598
|
-
onlyOptions: ["code" | "subl" | "webstorm", "code" | "subl" | "webstorm", ...("code" | "subl" | "webstorm")[]] | undefined;
|
|
1599
|
-
} | undefined;
|
|
1600
|
-
install?: {
|
|
1601
|
-
type: "install";
|
|
1602
|
-
onlyOptions: ["deno" | "bun" | "npm" | "pnpm" | "yarn", "deno" | "bun" | "npm" | "pnpm" | "yarn", ...("deno" | "bun" | "npm" | "pnpm" | "yarn")[]] | undefined;
|
|
1603
|
-
} | undefined;
|
|
1604
|
-
input: {
|
|
1605
|
-
type: "template";
|
|
1606
|
-
options: {
|
|
1607
|
-
[key: string]: {
|
|
1608
|
-
input: string;
|
|
1609
|
-
name?: string;
|
|
1610
|
-
desc?: string;
|
|
1611
|
-
};
|
|
1612
|
-
};
|
|
1613
|
-
};
|
|
1614
|
-
name?: {
|
|
1615
|
-
type: "name";
|
|
1616
|
-
} | undefined;
|
|
1617
|
-
output: {
|
|
1618
|
-
type: "output";
|
|
1619
|
-
};
|
|
1620
|
-
};
|
|
1621
|
-
name: string;
|
|
1622
|
-
version: string;
|
|
1623
|
-
cache?: boolean | undefined;
|
|
1624
|
-
updater?: boolean | undefined;
|
|
1625
|
-
onCancel?: ((data: HookParams) => Response<void>) | false | undefined;
|
|
1626
|
-
intro?: ((data: HookParams) => Response<void>) | false | undefined;
|
|
1627
|
-
outro?: ((data: HookParams) => Response<void>) | false | undefined;
|
|
1628
|
-
};
|
|
1629
|
-
constructor(options: ConfigSimple);
|
|
1630
|
-
/**
|
|
1631
|
-
* A simplified version of the `build` method from the main class.
|
|
1632
|
-
*
|
|
1633
|
-
* @param {ValuesSimple} [values] - The values to override the CLI prompts. If not set, the CLI prompts will be executed.
|
|
1634
|
-
* @param {CreateOpts} [opts] - The options to pass to the CLI.
|
|
1635
|
-
* @returns {Promise<ValuesSimple>} A promise resolving to the prompt values obtained after executing the CLI.
|
|
1636
|
-
* @example
|
|
1637
|
-
* // simple usage
|
|
1638
|
-
* await core.build()
|
|
1639
|
-
* @example
|
|
1640
|
-
* // custom usage
|
|
1641
|
-
* await core.build( { args : process.argv.slice(4), hideBin : false } )
|
|
1642
|
-
*/
|
|
1643
|
-
build(values?: ValuesSimple, opts?: CreateOpts): Promise<{
|
|
1644
|
-
openEditor?: undefined;
|
|
1645
|
-
install?: undefined;
|
|
1646
|
-
input?: string | undefined;
|
|
1647
|
-
name?: undefined;
|
|
1648
|
-
output?: string | undefined;
|
|
1649
|
-
}>;
|
|
1650
|
-
/**
|
|
1651
|
-
* A simplified version of the `cli` method from the main class.
|
|
1652
|
-
* Initializes and executes the command-line interface (CLI) process.
|
|
1653
|
-
*
|
|
1654
|
-
* @param {CliOpts} [props] - Optional CLI options to configure the initialization process.
|
|
1655
|
-
* @returns {Promise<ValuesSimple>} A promise resolving to the prompt values obtained after executing the CLI.
|
|
1656
|
-
* @example
|
|
1657
|
-
* // simple usage
|
|
1658
|
-
* await core.cli()
|
|
1659
|
-
* @example
|
|
1660
|
-
* // custom usage
|
|
1661
|
-
* await core.cli( { args : process.argv.slice(4), hideBin : false } )
|
|
1662
|
-
*/
|
|
1663
|
-
cli(props?: CliOpts): Promise<{
|
|
1664
|
-
openEditor?: undefined;
|
|
1665
|
-
install?: undefined;
|
|
1666
|
-
input?: string | undefined;
|
|
1667
|
-
name?: undefined;
|
|
1668
|
-
output?: string | undefined;
|
|
1669
|
-
}>;
|
|
1670
|
-
}
|
|
1671
|
-
|
|
1672
|
-
export { type CliOpts, type Config, type CreateOpts, type CreateTemplateOpts, Creatium, CreatiumCore, INSTALLER, OPTION, TEXT_EDITOR, env, prompt, style, sys };
|