creatium 0.0.2 → 0.0.4
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/README.md +283 -145
- package/dist/main.d.mts +1342 -1
- package/dist/main.d.ts +1342 -1
- package/dist/main.mjs +1847 -1
- package/package.json +25 -5
- package/CHANGELOG.md +0 -10
- package/build.config.js +0 -9
- package/docs/index.md +0 -103
- package/examples/simple/bin.js +0 -27
- package/examples/simple/templates/js-project/main.js +0 -6
- package/examples/simple/templates/js-project/package.json +0 -4
- package/examples/simple/templates/ts-project/package.json +0 -4
- package/examples/simple/templates/ts-project/src/main.ts +0 -6
- package/src/main.ts +0 -1
- package/tsconfig.json +0 -6
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
[](https://medium.com/@pigeonposse)
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Build your create-bins quickly and easily
|
|
16
16
|
|
|
17
17
|
## Table of contents
|
|
18
18
|
|
|
@@ -35,9 +35,13 @@
|
|
|
35
35
|
- [CreateOpts](#createopts)
|
|
36
36
|
- [CreateTemplateOpts](#createtemplateopts)
|
|
37
37
|
- [Variables](#variables)
|
|
38
|
-
- [
|
|
38
|
+
- [env](#env)
|
|
39
|
+
- [IDE](#ide)
|
|
40
|
+
- [INSTALLER](#installer)
|
|
41
|
+
- [OPTION](#option)
|
|
39
42
|
- [prompt](#prompt)
|
|
40
|
-
|
|
43
|
+
- [style](#style)
|
|
44
|
+
- [sys](#sys)
|
|
41
45
|
- [👨💻 Development](#-development)
|
|
42
46
|
- [☕ Donate](#-donate)
|
|
43
47
|
- [📜 License](#-license)
|
|
@@ -177,6 +181,30 @@ Create a template folder with your templates.
|
|
|
177
181
|
|
|
178
182
|
#### Creatium
|
|
179
183
|
|
|
184
|
+
Class of `Creatium` for create project templates (CLI and Library).
|
|
185
|
+
|
|
186
|
+
##### Example
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
// ./main.js
|
|
190
|
+
export const core = new CreatiumPrompt({
|
|
191
|
+
name: 'My Project',
|
|
192
|
+
version: '1.0.0',
|
|
193
|
+
prompts: {
|
|
194
|
+
...
|
|
195
|
+
},
|
|
196
|
+
...
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
// ./bin.js
|
|
200
|
+
import { core } from './main.js'
|
|
201
|
+
core.cli()
|
|
202
|
+
|
|
203
|
+
// ./lib.js
|
|
204
|
+
import { core } from './main.js'
|
|
205
|
+
export const create = core.build
|
|
206
|
+
```
|
|
207
|
+
|
|
180
208
|
##### Constructors
|
|
181
209
|
|
|
182
210
|
###### new Creatium()
|
|
@@ -190,16 +218,16 @@ new Creatium(options: {
|
|
|
190
218
|
onCancel: false | (data: HookParams) => Response<void>;
|
|
191
219
|
opts: {
|
|
192
220
|
install: false | [
|
|
193
|
-
| "deno"
|
|
194
221
|
| "bun"
|
|
222
|
+
| "deno"
|
|
195
223
|
| "npm"
|
|
196
224
|
| "pnpm"
|
|
197
225
|
| "yarn",
|
|
198
|
-
| "deno"
|
|
199
226
|
| "bun"
|
|
227
|
+
| "deno"
|
|
200
228
|
| "npm"
|
|
201
229
|
| "pnpm"
|
|
202
|
-
| "yarn", ...("
|
|
230
|
+
| "yarn", ...("bun" | "deno" | "npm" | "pnpm" | "yarn")[]];
|
|
203
231
|
name: boolean;
|
|
204
232
|
openEditor: false | ["code" | "subl" | "webstorm", "code" | "subl" | "webstorm", ...("code" | "subl" | "webstorm")[]];
|
|
205
233
|
};
|
|
@@ -217,14 +245,14 @@ new Creatium(options: {
|
|
|
217
245
|
| `options` | `object` | - |
|
|
218
246
|
| `options.cache`? | `boolean` | Use cache **Default** `true` |
|
|
219
247
|
| `options.consts`? | `Record`\<`string`, `string`\> | Add consts to use in your templates. |
|
|
220
|
-
| `options.intro`? | `false` \| (`data`: `HookParams`) => `Response`\<`void`\> |
|
|
248
|
+
| `options.intro`? | `false` \| (`data`: `HookParams`) => `Response`\<`void`\> | Set custom intro |
|
|
221
249
|
| `options.name` | `string` | Set name of you project |
|
|
222
|
-
| `options.onCancel`? | `false` \| (`data`: `HookParams`) => `Response`\<`void`\> |
|
|
223
|
-
| `options.opts`? | `object` |
|
|
224
|
-
| `options.opts.install`? | `false` \| [ \| `"
|
|
225
|
-
| `options.opts.name`? | `boolean` |
|
|
226
|
-
| `options.opts.openEditor`? | `false` \| [`"code"` \| `"subl"` \| `"webstorm"`, `"code"` \| `"subl"` \| `"webstorm"`, ...("code" \| "subl" \| "webstorm")\[\]] |
|
|
227
|
-
| `options.outro`? | `false` \| (`data`: `HookParams`) => `Response`\<`void`\> |
|
|
250
|
+
| `options.onCancel`? | `false` \| (`data`: `HookParams`) => `Response`\<`void`\> | Set custom function foor when user cancels the process |
|
|
251
|
+
| `options.opts`? | `object` | Set your prompt options |
|
|
252
|
+
| `options.opts.install`? | `false` \| [ \| `"bun"` \| `"deno"` \| `"npm"` \| `"pnpm"` \| `"yarn"`, \| `"bun"` \| `"deno"` \| `"npm"` \| `"pnpm"` \| `"yarn"`, ...("bun" \| "deno" \| "npm" \| "pnpm" \| "yarn")\[\]] | Active/deactivate the install prompt Also, You can set the installators that you want to use. |
|
|
253
|
+
| `options.opts.name`? | `boolean` | Active/deactivate the name prompt |
|
|
254
|
+
| `options.opts.openEditor`? | `false` \| [`"code"` \| `"subl"` \| `"webstorm"`, `"code"` \| `"subl"` \| `"webstorm"`, ...("code" \| "subl" \| "webstorm")\[\]] | Active/deactivate the openEditor prompt. Also, You can set the editors that you want to use. |
|
|
255
|
+
| `options.outro`? | `false` \| (`data`: `HookParams`) => `Response`\<`void`\> | Set custom outro |
|
|
228
256
|
| `options.templates` | `object` | Set your template ooptions |
|
|
229
257
|
| `options.updater`? | `boolean` | Use updater **Default** `false` |
|
|
230
258
|
| `options.version` | `string` | Set version of you current project Used in for the updater notifications. |
|
|
@@ -356,18 +384,37 @@ await core.cli( { args : process.argv.slice(4), hideBin : false } )
|
|
|
356
384
|
|
|
357
385
|
#### CreatiumPrompt\<C\>
|
|
358
386
|
|
|
359
|
-
|
|
387
|
+
Customizable class of `Creatium` for create project templates (CLI and Library).
|
|
360
388
|
|
|
361
389
|
##### Example
|
|
362
390
|
|
|
363
391
|
```ts
|
|
392
|
+
//////////////// main.js ///////////////////
|
|
393
|
+
|
|
364
394
|
const core = new CreatiumPrompt({
|
|
365
395
|
name: 'My Project',
|
|
366
396
|
version: '1.0.0',
|
|
397
|
+
prompts: {
|
|
398
|
+
...
|
|
399
|
+
},
|
|
367
400
|
...
|
|
368
401
|
})
|
|
369
402
|
|
|
370
|
-
|
|
403
|
+
//////////////// bin.js ///////////////////
|
|
404
|
+
|
|
405
|
+
import { core } from './main.js'
|
|
406
|
+
const res = await core.cli()
|
|
407
|
+
// do something with res...
|
|
408
|
+
await core.createTemplate( res )
|
|
409
|
+
|
|
410
|
+
//////////////// lib.js ///////////////////
|
|
411
|
+
|
|
412
|
+
import { core } from './main.js'
|
|
413
|
+
export const create = async (args) => {
|
|
414
|
+
const res = await core.build( args )
|
|
415
|
+
// do something with res...
|
|
416
|
+
await core.createTemplate( res )
|
|
417
|
+
}
|
|
371
418
|
```
|
|
372
419
|
|
|
373
420
|
##### Type Parameters
|
|
@@ -421,7 +468,7 @@ new CreatiumPrompt<C>(config: C): CreatiumPrompt<C>
|
|
|
421
468
|
###### build()
|
|
422
469
|
|
|
423
470
|
```ts
|
|
424
|
-
build(values?: { [K in string | number | symbol]: { [K in string | number | symbol]: { [K in string | number | symbol]?: { [K in string | number | symbol]: ((...)[(...)] extends Object ? (...) extends (...) ? (...) : (...) : never)[K] } }[K] }[K] }, opts?: CreateOpts): Promise<{ [
|
|
471
|
+
build(values?: { [K in string | number | symbol]: { [K in string | number | symbol]: { [K in string | number | symbol]?: { [K in string | number | symbol]: ((...)[(...)] extends Object ? (...) extends (...) ? (...) : (...) : never)[K] } }[K] }[K] }, opts?: CreateOpts): Promise<{ [K in string | number | symbol]: { [K in string | number | symbol]?: { [K in string | number | symbol]: (C["prompt"][K] extends Object ? T extends keyof OptionsClasses ? { [K in (...) | (...) | (...)]: (...)[(...)] } : never : never)[K] } }[K] }>
|
|
425
472
|
```
|
|
426
473
|
|
|
427
474
|
Initialize the CLI and executes the callback function passed in the config.
|
|
@@ -435,14 +482,14 @@ Initialize the CLI and executes the callback function passed in the config.
|
|
|
435
482
|
|
|
436
483
|
###### Returns
|
|
437
484
|
|
|
438
|
-
`Promise`\<\{ \[K
|
|
485
|
+
`Promise`\<\{ \[K in string \| number \| symbol\]: \{ \[K in string \| number \| symbol\]?: \{ \[K in string \| number \| symbol\]: (C\["prompt"\]\[K\] extends Object ? T extends keyof OptionsClasses ? \{ \[K in (...) \| (...) \| (...)\]: (...)\[(...)\] \} : never : never)\[K\] \} \}\[K\] \}\>
|
|
439
486
|
|
|
440
487
|
The result of the callback function.
|
|
441
488
|
|
|
442
489
|
###### cli()
|
|
443
490
|
|
|
444
491
|
```ts
|
|
445
|
-
cli(props?: CliOpts): Promise<{ [
|
|
492
|
+
cli(props?: CliOpts): Promise<{ [K in string | number | symbol]: { [K in string | number | symbol]?: { [K in string | number | symbol]: (C["prompt"][K] extends Object ? T extends keyof OptionsClasses ? { [K in (...) | (...) | (...)]: (...)[(...)] } : never : never)[K] } }[K] }>
|
|
446
493
|
```
|
|
447
494
|
|
|
448
495
|
Initializes and executes the command-line interface (CLI) process.
|
|
@@ -455,7 +502,7 @@ Initializes and executes the command-line interface (CLI) process.
|
|
|
455
502
|
|
|
456
503
|
###### Returns
|
|
457
504
|
|
|
458
|
-
`Promise`\<\{ \[K
|
|
505
|
+
`Promise`\<\{ \[K in string \| number \| symbol\]: \{ \[K in string \| number \| symbol\]?: \{ \[K in string \| number \| symbol\]: (C\["prompt"\]\[K\] extends Object ? T extends keyof OptionsClasses ? \{ \[K in (...) \| (...) \| (...)\]: (...)\[(...)\] \} : never : never)\[K\] \} \}\[K\] \}\>
|
|
459
506
|
|
|
460
507
|
A promise resolving to the prompt values obtained after executing the CLI.
|
|
461
508
|
|
|
@@ -463,12 +510,12 @@ A promise resolving to the prompt values obtained after executing the CLI.
|
|
|
463
510
|
|
|
464
511
|
```ts
|
|
465
512
|
// simple usage
|
|
466
|
-
|
|
513
|
+
await core.cli()
|
|
467
514
|
```
|
|
468
515
|
|
|
469
516
|
```ts
|
|
470
517
|
// custom usage
|
|
471
|
-
|
|
518
|
+
await core.cli( { args : process.argv.slice( 4), hideBin : false } )
|
|
472
519
|
```
|
|
473
520
|
|
|
474
521
|
###### createTemplate()
|
|
@@ -517,37 +564,7 @@ await core.createTemplate( {
|
|
|
517
564
|
| Property | Type |
|
|
518
565
|
| ------ | ------ |
|
|
519
566
|
| `config` | `C` |
|
|
520
|
-
| `utils` |
|
|
521
|
-
| `utils.env` | *typeof* [`env`](namespaces/env.md) |
|
|
522
|
-
| `utils.prompt` | \{ `box`: (`opts`: \{ `opts`: `Options`; `type`: `PromptLineMethod`; `value`: `string`; \}) => `void`; `cancel`: (`message`?: `string`) => `void`; `columns`: (`opts`: \{ `opts`: `GlobalOptions`; `type`: `PromptLineMethod`; `value`: `ColumnData`; \}) => `void`; `confirm`: (`opts`: `ConfirmOptions`) => `Promise`\<`boolean` \| `symbol`\>; `group`: \<`T`\>(`prompts`: `PromptGroup`\<`T`\>, `opts`?: `PromptGroupOptions`\<`T`\>) => `Promise`\<\{ \[P in string \| number \| symbol\]: PromptGroupAwaitedReturn\<T\>\[P\] \}\>; `groupMultiselect`: \<`Value`\>(`opts`: `GroupMultiSelectOptions`\<`Value`\>) => `Promise`\<`symbol` \| `Value`[]\>; `intro`: (`title`?: `string`) => `void`; `isCancel`: (`value`: `unknown`) => `value is symbol`; `log`: \{ `error`: (`message`: `string`) => `void`; `info`: (`message`: `string`) => `void`; `message`: (`message`?: `string`, `__namedParameters`?: `LogMessageOptions`) => `void`; `step`: (`message`: `string`) => `void`; `success`: (`message`: `string`) => `void`; `warn`: (`message`: `string`) => `void`; `warning`: (`message`: `string`) => `void`; \}; `multiselect`: \<`Value`\>(`opts`: `MultiSelectOptions`\<`Value`\>) => `Promise`\<`symbol` \| `Value`[]\>; `note`: (`message`?: `string`, `title`?: `string`) => `void`; `number`: (`opts`: \{ `defaultValue`: `string`; `errorText`: `string`; `initialValue`: `string`; `message`: `string`; `placeholder`: `string`; `validate`: (`value`: `string`) => `string` \| `void`; \}) => `Promise`\<`number` \| `symbol`\>; `outro`: (`message`?: `string`) => `void`; `password`: (`opts`: `PasswordOptions`) => `Promise`\<`string` \| `symbol`\>; `select`: \<`Value`\>(`opts`: `SelectOptions`\<`Value`\>) => `Promise`\<`symbol` \| `Value`\>; `selectKey`: \<`Value`\>(`opts`: `SelectOptions`\<`Value`\>) => `Promise`\<`symbol` \| `Value`\>; `spinner`: () => \{ `message`: (`msg`?: `string`) => `void`; `start`: (`msg`?: `string`) => `void`; `stop`: (`msg`?: `string`, `code`?: `number`) => `void`; \}; `table`: (`opts`: \{ `opts`: `TableUserConfig`; `type`: `PromptLineMethod`; `value`: `TableData`; \}) => `void`; `tasks`: (`tasks`: `Task`[]) => `Promise`\<`void`\>; `text`: (`opts`: `TextOptions`) => `Promise`\<`string` \| `symbol`\>; \} |
|
|
523
|
-
| `utils.prompt.box` | (`opts`: \{ `opts`: `Options`; `type`: `PromptLineMethod`; `value`: `string`; \}) => `void` |
|
|
524
|
-
| `utils.prompt.cancel` | (`message`?: `string`) => `void` |
|
|
525
|
-
| `utils.prompt.columns` | (`opts`: \{ `opts`: `GlobalOptions`; `type`: `PromptLineMethod`; `value`: `ColumnData`; \}) => `void` |
|
|
526
|
-
| `utils.prompt.confirm` | (`opts`: `ConfirmOptions`) => `Promise`\<`boolean` \| `symbol`\> |
|
|
527
|
-
| `utils.prompt.group` | \<`T`\>(`prompts`: `PromptGroup`\<`T`\>, `opts`?: `PromptGroupOptions`\<`T`\>) => `Promise`\<\{ \[P in string \| number \| symbol\]: PromptGroupAwaitedReturn\<T\>\[P\] \}\> |
|
|
528
|
-
| `utils.prompt.groupMultiselect` | \<`Value`\>(`opts`: `GroupMultiSelectOptions`\<`Value`\>) => `Promise`\<`symbol` \| `Value`[]\> |
|
|
529
|
-
| `utils.prompt.intro` | (`title`?: `string`) => `void` |
|
|
530
|
-
| `utils.prompt.isCancel` | (`value`: `unknown`) => `value is symbol` |
|
|
531
|
-
| `utils.prompt.log` | \{ `error`: (`message`: `string`) => `void`; `info`: (`message`: `string`) => `void`; `message`: (`message`?: `string`, `__namedParameters`?: `LogMessageOptions`) => `void`; `step`: (`message`: `string`) => `void`; `success`: (`message`: `string`) => `void`; `warn`: (`message`: `string`) => `void`; `warning`: (`message`: `string`) => `void`; \} |
|
|
532
|
-
| `utils.prompt.log.error` | (`message`: `string`) => `void` |
|
|
533
|
-
| `utils.prompt.log.info` | (`message`: `string`) => `void` |
|
|
534
|
-
| `utils.prompt.log.message` | (`message`?: `string`, `__namedParameters`?: `LogMessageOptions`) => `void` |
|
|
535
|
-
| `utils.prompt.log.step` | (`message`: `string`) => `void` |
|
|
536
|
-
| `utils.prompt.log.success` | (`message`: `string`) => `void` |
|
|
537
|
-
| `utils.prompt.log.warn` | (`message`: `string`) => `void` |
|
|
538
|
-
| `utils.prompt.log.warning` | (`message`: `string`) => `void` |
|
|
539
|
-
| `utils.prompt.multiselect` | \<`Value`\>(`opts`: `MultiSelectOptions`\<`Value`\>) => `Promise`\<`symbol` \| `Value`[]\> |
|
|
540
|
-
| `utils.prompt.note` | (`message`?: `string`, `title`?: `string`) => `void` |
|
|
541
|
-
| `utils.prompt.number` | (`opts`: \{ `defaultValue`: `string`; `errorText`: `string`; `initialValue`: `string`; `message`: `string`; `placeholder`: `string`; `validate`: (`value`: `string`) => `string` \| `void`; \}) => `Promise`\<`number` \| `symbol`\> |
|
|
542
|
-
| `utils.prompt.outro` | (`message`?: `string`) => `void` |
|
|
543
|
-
| `utils.prompt.password` | (`opts`: `PasswordOptions`) => `Promise`\<`string` \| `symbol`\> |
|
|
544
|
-
| `utils.prompt.select` | \<`Value`\>(`opts`: `SelectOptions`\<`Value`\>) => `Promise`\<`symbol` \| `Value`\> |
|
|
545
|
-
| `utils.prompt.selectKey` | \<`Value`\>(`opts`: `SelectOptions`\<`Value`\>) => `Promise`\<`symbol` \| `Value`\> |
|
|
546
|
-
| `utils.prompt.spinner` | () => \{ `message`: (`msg`?: `string`) => `void`; `start`: (`msg`?: `string`) => `void`; `stop`: (`msg`?: `string`, `code`?: `number`) => `void`; \} |
|
|
547
|
-
| `utils.prompt.table` | (`opts`: \{ `opts`: `TableUserConfig`; `type`: `PromptLineMethod`; `value`: `TableData`; \}) => `void` |
|
|
548
|
-
| `utils.prompt.tasks` | (`tasks`: `Task`[]) => `Promise`\<`void`\> |
|
|
549
|
-
| `utils.prompt.text` | (`opts`: `TextOptions`) => `Promise`\<`string` \| `symbol`\> |
|
|
550
|
-
| `utils.style` | *typeof* [`style`](namespaces/style.md) |
|
|
567
|
+
| `utils` | `__module` |
|
|
551
568
|
|
|
552
569
|
### Type Aliases
|
|
553
570
|
|
|
@@ -596,10 +613,10 @@ type Config: {
|
|
|
596
613
|
| `hooks`? | \{ `afterPrompt`: \<`D`\>(`data`: `D`) => `Response`\<`D` \| `undefined`\>; `beforePrompt`: \<`D`\>(`data`: `D`) => `Response`\<`D` \| `undefined`\>; \} | hooks for |
|
|
597
614
|
| `hooks.afterPrompt`? | \<`D`\>(`data`: `D`) => `Response`\<`D` \| `undefined`\> | - |
|
|
598
615
|
| `hooks.beforePrompt`? | \<`D`\>(`data`: `D`) => `Response`\<`D` \| `undefined`\> | - |
|
|
599
|
-
| `intro`? | (`data`: `HookParams`) => `Response`\<`void`\> \| `false` |
|
|
616
|
+
| `intro`? | (`data`: `HookParams`) => `Response`\<`void`\> \| `false` | Set custom intro |
|
|
600
617
|
| `name` | `string` | Set name of you project |
|
|
601
|
-
| `onCancel`? | (`data`: `HookParams`) => `Response`\<`void`\> \| `false` |
|
|
602
|
-
| `outro`? | (`data`: `HookParams`) => `Response`\<`void`\> \| `false` |
|
|
618
|
+
| `onCancel`? | (`data`: `HookParams`) => `Response`\<`void`\> \| `false` | Set custom function foor when user cancels the process |
|
|
619
|
+
| `outro`? | (`data`: `HookParams`) => `Response`\<`void`\> \| `false` | Set custom outro |
|
|
603
620
|
| `prompt` | `OptionsParams` | Set you prompts config |
|
|
604
621
|
| `updater`? | `boolean` | Use updater **Default** `false` |
|
|
605
622
|
| `version` | `string` | Set version of you current project Used in for the updater notifications. |
|
|
@@ -648,45 +665,121 @@ type CreateTemplateOpts: {
|
|
|
648
665
|
|
|
649
666
|
### Variables
|
|
650
667
|
|
|
651
|
-
####
|
|
668
|
+
#### env
|
|
652
669
|
|
|
653
670
|
```ts
|
|
654
|
-
const
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
output: "output";
|
|
663
|
-
path: "path";
|
|
664
|
-
select: "select";
|
|
665
|
-
template: "template";
|
|
666
|
-
text: "text";
|
|
667
|
-
void: "void";
|
|
668
|
-
};
|
|
671
|
+
const env: {
|
|
672
|
+
isBrowser: boolean;
|
|
673
|
+
isBun: boolean;
|
|
674
|
+
isDeno: boolean;
|
|
675
|
+
isJsDom: boolean;
|
|
676
|
+
isNode: boolean;
|
|
677
|
+
isWebWorker: boolean;
|
|
678
|
+
} = _env;
|
|
669
679
|
```
|
|
670
680
|
|
|
671
|
-
|
|
681
|
+
Environment functions
|
|
672
682
|
|
|
673
683
|
##### Type declaration
|
|
674
684
|
|
|
675
685
|
| Name | Type |
|
|
676
686
|
| ------ | ------ |
|
|
677
|
-
| `
|
|
678
|
-
| `
|
|
679
|
-
| `
|
|
680
|
-
| `
|
|
681
|
-
| `
|
|
682
|
-
| `
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
687
|
+
| `isBrowser` | `boolean` |
|
|
688
|
+
| `isBun` | `boolean` |
|
|
689
|
+
| `isDeno` | `boolean` |
|
|
690
|
+
| `isJsDom` | `boolean` |
|
|
691
|
+
| `isNode` | `boolean` |
|
|
692
|
+
| `isWebWorker` | `boolean` |
|
|
693
|
+
|
|
694
|
+
***
|
|
695
|
+
|
|
696
|
+
#### IDE
|
|
697
|
+
|
|
698
|
+
```ts
|
|
699
|
+
const IDE: {
|
|
700
|
+
NONE: 'none';
|
|
701
|
+
SUBLIME: 'subl';
|
|
702
|
+
VSCODE: 'code';
|
|
703
|
+
WEBSTORM: 'webstorm';
|
|
704
|
+
};
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
##### Type declaration
|
|
708
|
+
|
|
709
|
+
| Name | Type | Default value |
|
|
710
|
+
| ------ | ------ | ------ |
|
|
711
|
+
| `NONE` | `"none"` | 'none' |
|
|
712
|
+
| `SUBLIME` | `"subl"` | 'subl' |
|
|
713
|
+
| `VSCODE` | `"code"` | 'code' |
|
|
714
|
+
| `WEBSTORM` | `"webstorm"` | 'webstorm' |
|
|
715
|
+
|
|
716
|
+
***
|
|
717
|
+
|
|
718
|
+
#### INSTALLER
|
|
719
|
+
|
|
720
|
+
```ts
|
|
721
|
+
const INSTALLER: {
|
|
722
|
+
BUN: 'bun';
|
|
723
|
+
DENO: 'deno';
|
|
724
|
+
NONE: 'none';
|
|
725
|
+
NPM: 'npm';
|
|
726
|
+
PNPM: 'pnpm';
|
|
727
|
+
YARN: 'yarn';
|
|
728
|
+
};
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
##### Type declaration
|
|
732
|
+
|
|
733
|
+
| Name | Type | Default value |
|
|
734
|
+
| ------ | ------ | ------ |
|
|
735
|
+
| `BUN` | `"bun"` | 'bun' |
|
|
736
|
+
| `DENO` | `"deno"` | 'deno' |
|
|
737
|
+
| `NONE` | `"none"` | 'none' |
|
|
738
|
+
| `NPM` | `"npm"` | 'npm' |
|
|
739
|
+
| `PNPM` | `"pnpm"` | 'pnpm' |
|
|
740
|
+
| `YARN` | `"yarn"` | 'yarn' |
|
|
741
|
+
|
|
742
|
+
***
|
|
743
|
+
|
|
744
|
+
#### OPTION
|
|
745
|
+
|
|
746
|
+
```ts
|
|
747
|
+
const OPTION: {
|
|
748
|
+
array: 'array';
|
|
749
|
+
boolean: 'boolean';
|
|
750
|
+
install: 'install';
|
|
751
|
+
multiselect: 'multiselect';
|
|
752
|
+
name: 'name';
|
|
753
|
+
number: 'number';
|
|
754
|
+
openEditor: 'openEditor';
|
|
755
|
+
output: 'output';
|
|
756
|
+
path: 'path';
|
|
757
|
+
select: 'select';
|
|
758
|
+
template: 'template';
|
|
759
|
+
text: 'text';
|
|
760
|
+
void: 'void';
|
|
761
|
+
};
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
Object of the CREATIUM types
|
|
765
|
+
|
|
766
|
+
##### Type declaration
|
|
767
|
+
|
|
768
|
+
| Name | Type | Default value |
|
|
769
|
+
| ------ | ------ | ------ |
|
|
770
|
+
| `array` | `"array"` | 'array' |
|
|
771
|
+
| `boolean` | `"boolean"` | 'boolean' |
|
|
772
|
+
| `install` | `"install"` | 'install' |
|
|
773
|
+
| `multiselect` | `"multiselect"` | 'multiselect' |
|
|
774
|
+
| `name` | `"name"` | 'name' |
|
|
775
|
+
| `number` | `"number"` | 'number' |
|
|
776
|
+
| `openEditor` | `"openEditor"` | 'openEditor' |
|
|
777
|
+
| `output` | `"output"` | 'output' |
|
|
778
|
+
| `path` | `"path"` | 'path' |
|
|
779
|
+
| `select` | `"select"` | 'select' |
|
|
780
|
+
| `template` | `"template"` | 'template' |
|
|
781
|
+
| `text` | `"text"` | 'text' |
|
|
782
|
+
| `void` | `"void"` | 'void' |
|
|
690
783
|
|
|
691
784
|
***
|
|
692
785
|
|
|
@@ -695,89 +788,134 @@ Object of the CREATIUM types
|
|
|
695
788
|
```ts
|
|
696
789
|
const prompt: {
|
|
697
790
|
box: (opts: {
|
|
698
|
-
opts:
|
|
791
|
+
opts: Options;
|
|
699
792
|
type: PromptLineMethod;
|
|
700
|
-
value:
|
|
793
|
+
value: string;
|
|
701
794
|
}) => void;
|
|
702
|
-
cancel: (message?: string) => void;
|
|
703
795
|
columns: (opts: {
|
|
704
|
-
opts:
|
|
796
|
+
opts: GlobalOptions;
|
|
705
797
|
type: PromptLineMethod;
|
|
706
|
-
value:
|
|
798
|
+
value: ColumnData;
|
|
707
799
|
}) => void;
|
|
708
|
-
confirm: (opts: _clack_prompts.ConfirmOptions) => Promise<boolean | symbol>;
|
|
709
|
-
group: <T>(prompts: _clack_prompts.PromptGroup<T>, opts?: _clack_prompts.PromptGroupOptions<T>) => Promise<{ [P in keyof _clack_prompts.PromptGroupAwaitedReturn<T>]: _clack_prompts.PromptGroupAwaitedReturn<T>[P] }>;
|
|
710
|
-
groupMultiselect: <Value>(opts: _clack_prompts.GroupMultiSelectOptions<Value>) => Promise<symbol | Value[]>;
|
|
711
|
-
intro: (title?: string) => void;
|
|
712
|
-
isCancel: typeof _clack_prompts.isCancel;
|
|
713
800
|
log: {
|
|
714
801
|
error: (message: string) => void;
|
|
715
802
|
info: (message: string) => void;
|
|
716
|
-
message: (message?: string, { symbol }?:
|
|
803
|
+
message: (message?: string, { symbol }?: LogMessageOptions) => void;
|
|
717
804
|
step: (message: string) => void;
|
|
718
805
|
success: (message: string) => void;
|
|
719
806
|
warn: (message: string) => void;
|
|
720
807
|
warning: (message: string) => void;
|
|
721
808
|
};
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
809
|
+
number: (opts: {
|
|
810
|
+
defaultValue: string;
|
|
811
|
+
errorText: string;
|
|
812
|
+
initialValue: string;
|
|
813
|
+
message: string;
|
|
814
|
+
placeholder: string;
|
|
815
|
+
validate: (value: string) => string | void;
|
|
816
|
+
}) => Promise<number | symbol>;
|
|
817
|
+
table: (opts: {
|
|
818
|
+
opts: TableUserConfig;
|
|
819
|
+
type: PromptLineMethod;
|
|
820
|
+
value: TableData;
|
|
821
|
+
}) => void;
|
|
822
|
+
cancel: void;
|
|
823
|
+
confirm: Promise<boolean | symbol>;
|
|
824
|
+
group: Promise<{ [P in string | number | symbol]: PromptGroupAwaitedReturn<T>[P] }>;
|
|
825
|
+
groupMultiselect: Promise<symbol | Value[]>;
|
|
826
|
+
intro: void;
|
|
827
|
+
isCancel: value is symbol;
|
|
828
|
+
multiselect: Promise<symbol | Value[]>;
|
|
829
|
+
note: void;
|
|
830
|
+
outro: void;
|
|
831
|
+
password: Promise<string | symbol>;
|
|
832
|
+
select: Promise<symbol | Value>;
|
|
833
|
+
selectKey: Promise<symbol | Value>;
|
|
834
|
+
spinner: {
|
|
730
835
|
message: (msg?: string) => void;
|
|
731
836
|
start: (msg?: string) => void;
|
|
732
837
|
stop: (msg?: string, code?: number) => void;
|
|
733
838
|
};
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
value: TableParams[0];
|
|
738
|
-
}) => void;
|
|
739
|
-
tasks: (tasks: _clack_prompts.Task[]) => Promise<void>;
|
|
740
|
-
text: (opts: _clack_prompts.TextOptions) => Promise<string | symbol>;
|
|
741
|
-
};
|
|
839
|
+
tasks: Promise<void>;
|
|
840
|
+
text: Promise<string | symbol>;
|
|
841
|
+
} = _prompt;
|
|
742
842
|
```
|
|
743
843
|
|
|
844
|
+
Prompt functions
|
|
845
|
+
|
|
846
|
+
##### Type declaration
|
|
847
|
+
|
|
848
|
+
| Name | Type | Description |
|
|
849
|
+
| ------ | ------ | ------ |
|
|
850
|
+
| `box` | (`opts`: \{ `opts`: `Options`; `type`: `PromptLineMethod`; `value`: `string`; \}) => `void` | - |
|
|
851
|
+
| `columns` | (`opts`: \{ `opts`: `GlobalOptions`; `type`: `PromptLineMethod`; `value`: `ColumnData`; \}) => `void` | - |
|
|
852
|
+
| `log` | \{ `error`: (`message`: `string`) => `void`; `info`: (`message`: `string`) => `void`; `message`: (`message`?: `string`, `{ symbol }`?: `LogMessageOptions`) => `void`; `step`: (`message`: `string`) => `void`; `success`: (`message`: `string`) => `void`; `warn`: (`message`: `string`) => `void`; `warning`: (`message`: `string`) => `void`; \} | - |
|
|
853
|
+
| `log.error` | (`message`: `string`) => `void` | - |
|
|
854
|
+
| `log.info` | (`message`: `string`) => `void` | - |
|
|
855
|
+
| `log.message` | (`message`?: `string`, `{ symbol }`?: `LogMessageOptions`) => `void` | - |
|
|
856
|
+
| `log.step` | (`message`: `string`) => `void` | - |
|
|
857
|
+
| `log.success` | (`message`: `string`) => `void` | - |
|
|
858
|
+
| `log.warn` | (`message`: `string`) => `void` | - |
|
|
859
|
+
| `log.warning` | (`message`: `string`) => `void` | alias for `log.warn()`. |
|
|
860
|
+
| `number` | (`opts`: \{ `defaultValue`: `string`; `errorText`: `string`; `initialValue`: `string`; `message`: `string`; `placeholder`: `string`; `validate`: (`value`: `string`) => `string` \| `void`; \}) => `Promise`\<`number` \| `symbol`\> | - |
|
|
861
|
+
| `table` | (`opts`: \{ `opts`: `TableUserConfig`; `type`: `PromptLineMethod`; `value`: `TableData`; \}) => `void` | - |
|
|
862
|
+
| `cancel()` | `void` | - |
|
|
863
|
+
| `confirm()` | `Promise`\<`boolean` \| `symbol`\> | - |
|
|
864
|
+
| `group()` | `Promise`\<\{ \[P in string \| number \| symbol\]: PromptGroupAwaitedReturn\<T\>\[P\] \}\> | Define a group of prompts to be displayed and return a results of objects within the group |
|
|
865
|
+
| `groupMultiselect()` | `Promise`\<`symbol` \| `Value`[]\> | - |
|
|
866
|
+
| `intro()` | `void` | - |
|
|
867
|
+
| `isCancel()` | `value is symbol` | - |
|
|
868
|
+
| `multiselect()` | `Promise`\<`symbol` \| `Value`[]\> | - |
|
|
869
|
+
| `note()` | `void` | - |
|
|
870
|
+
| `outro()` | `void` | - |
|
|
871
|
+
| `password()` | `Promise`\<`string` \| `symbol`\> | - |
|
|
872
|
+
| `select()` | `Promise`\<`symbol` \| `Value`\> | - |
|
|
873
|
+
| `selectKey()` | `Promise`\<`symbol` \| `Value`\> | - |
|
|
874
|
+
| `spinner()` | \{ `message`: (`msg`?: `string`) => `void`; `start`: (`msg`?: `string`) => `void`; `stop`: (`msg`?: `string`, `code`?: `number`) => `void`; \} | - |
|
|
875
|
+
| `tasks()` | `Promise`\<`void`\> | Define a group of tasks to be executed |
|
|
876
|
+
| `text()` | `Promise`\<`string` \| `symbol`\> | - |
|
|
877
|
+
|
|
878
|
+
***
|
|
879
|
+
|
|
880
|
+
#### style
|
|
881
|
+
|
|
882
|
+
```ts
|
|
883
|
+
const style: {
|
|
884
|
+
box: (text: string, options?: Options) => string;
|
|
885
|
+
color: ChalkInstance;
|
|
886
|
+
columns: <Data>(data: Data, options?: GlobalOptions) => string;
|
|
887
|
+
gradient: (txt: string, colors: GradientColors, opts?: GradientOpts) => string;
|
|
888
|
+
line: (__namedParameters: {
|
|
889
|
+
align: 'center';
|
|
890
|
+
lineChar: '⎯';
|
|
891
|
+
title: string;
|
|
892
|
+
}) => string;
|
|
893
|
+
table: (data: TableData, options?: TableUserConfig) => string;
|
|
894
|
+
} = _style;
|
|
895
|
+
```
|
|
896
|
+
|
|
897
|
+
Style functions
|
|
898
|
+
|
|
744
899
|
##### Type declaration
|
|
745
900
|
|
|
746
901
|
| Name | Type |
|
|
747
902
|
| ------ | ------ |
|
|
748
|
-
| `box` | (`
|
|
749
|
-
| `
|
|
750
|
-
| `columns` | (`
|
|
751
|
-
| `
|
|
752
|
-
| `
|
|
753
|
-
| `
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
| `multiselect` | \<`Value`\>(`opts`: `_clack_prompts.MultiSelectOptions`\<`Value`\>) => `Promise`\<`symbol` \| `Value`[]\> |
|
|
765
|
-
| `note` | (`message`?: `string`, `title`?: `string`) => `void` |
|
|
766
|
-
| `number` | *typeof* `number` |
|
|
767
|
-
| `outro` | (`message`?: `string`) => `void` |
|
|
768
|
-
| `password` | (`opts`: `_clack_prompts.PasswordOptions`) => `Promise`\<`string` \| `symbol`\> |
|
|
769
|
-
| `select` | \<`Value`\>(`opts`: `_clack_prompts.SelectOptions`\<`Value`\>) => `Promise`\<`symbol` \| `Value`\> |
|
|
770
|
-
| `selectKey` | \<`Value`\>(`opts`: `_clack_prompts.SelectOptions`\<`Value`\>) => `Promise`\<`symbol` \| `Value`\> |
|
|
771
|
-
| `spinner` | () => \{ `message`: (`msg`?: `string`) => `void`; `start`: (`msg`?: `string`) => `void`; `stop`: (`msg`?: `string`, `code`?: `number`) => `void`; \} |
|
|
772
|
-
| `table` | (`opts`: \{ `opts`: `TableParams`\[`1`\]; `type`: `PromptLineMethod`; `value`: `TableParams`\[`0`\]; \}) => `void` |
|
|
773
|
-
| `tasks` | (`tasks`: `_clack_prompts.Task`[]) => `Promise`\<`void`\> |
|
|
774
|
-
| `text` | (`opts`: `_clack_prompts.TextOptions`) => `Promise`\<`string` \| `symbol`\> |
|
|
775
|
-
|
|
776
|
-
### Namespaces
|
|
777
|
-
|
|
778
|
-
- [env](namespaces/env.md)
|
|
779
|
-
- [style](namespaces/style.md)
|
|
780
|
-
- [sys](namespaces/sys.md)
|
|
903
|
+
| `box` | (`text`: `string`, `options`?: `Options`) => `string` |
|
|
904
|
+
| `color` | `ChalkInstance` |
|
|
905
|
+
| `columns` | \<`Data`\>(`data`: `Data`, `options`?: `GlobalOptions`) => `string` |
|
|
906
|
+
| `gradient` | (`txt`: `string`, `colors`: `GradientColors`, `opts`?: `GradientOpts`) => `string` |
|
|
907
|
+
| `line` | (`__namedParameters`: \{ `align`: `'center'`; `lineChar`: `'⎯'`; `title`: `string`; \}) => `string` |
|
|
908
|
+
| `table` | (`data`: `TableData`, `options`?: `TableUserConfig`) => `string` |
|
|
909
|
+
|
|
910
|
+
***
|
|
911
|
+
|
|
912
|
+
#### sys
|
|
913
|
+
|
|
914
|
+
```ts
|
|
915
|
+
const sys: __module = _sys;
|
|
916
|
+
```
|
|
917
|
+
|
|
918
|
+
System functions
|
|
781
919
|
|
|
782
920
|
|
|
783
921
|
***
|