creatium 0.1.6 → 0.1.8
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 +3 -11
- package/dist/main.d.mts +3 -2
- package/dist/main.d.ts +3 -2
- package/dist/main.mjs +12 -6
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -683,7 +683,6 @@ await core.cli()
|
|
|
683
683
|
await core.cli( { args : process.argv.slice(4), hideBin : false } )
|
|
684
684
|
```
|
|
685
685
|
|
|
686
|
-
***
|
|
687
686
|
|
|
688
687
|
#### CreatiumCore\<C\>
|
|
689
688
|
|
|
@@ -1067,6 +1066,7 @@ If the `outro` option is undefined, the default outro message will be used.
|
|
|
1067
1066
|
```ts
|
|
1068
1067
|
replacePlaceholders(args: {
|
|
1069
1068
|
input: string;
|
|
1069
|
+
inputOpts: Options;
|
|
1070
1070
|
params: Params;
|
|
1071
1071
|
}): Promise<void>
|
|
1072
1072
|
```
|
|
@@ -1083,6 +1083,7 @@ in the content are replaced with values from the `params` object.
|
|
|
1083
1083
|
| ------ | ------ | ------ |
|
|
1084
1084
|
| `args` | `object` | The arguments object. |
|
|
1085
1085
|
| `args.input`? | `string` | The directory path containing files with placeholders. |
|
|
1086
|
+
| `args.inputOpts`? | `Options` | - |
|
|
1086
1087
|
| `args.params`? | `Params` | An object containing key-value pairs for replacing placeholders. |
|
|
1087
1088
|
|
|
1088
1089
|
###### Returns
|
|
@@ -1096,7 +1097,7 @@ A Promise that resolves once all placeholders have been replaced.
|
|
|
1096
1097
|
```ts
|
|
1097
1098
|
await core.replacePlaceholders( {
|
|
1098
1099
|
input : 'my/project/path',
|
|
1099
|
-
params : {
|
|
1100
|
+
params : { consts: { version: '1.0.0' }, prompt: { name: 'My Project' } },
|
|
1100
1101
|
})
|
|
1101
1102
|
```
|
|
1102
1103
|
|
|
@@ -1170,7 +1171,6 @@ type CliOpts: {
|
|
|
1170
1171
|
| `args`? | `string`[] | Arguments to pass to the command **Default** `process.argv.slice(2)` |
|
|
1171
1172
|
| `hideBin`? | `boolean` | Hide the first two arguments **Default** `false` |
|
|
1172
1173
|
|
|
1173
|
-
***
|
|
1174
1174
|
|
|
1175
1175
|
#### Config
|
|
1176
1176
|
|
|
@@ -1207,7 +1207,6 @@ type Config: {
|
|
|
1207
1207
|
| `updater`? | `boolean` | Use updater **Default** `false` |
|
|
1208
1208
|
| `version` | `string` | Set version of you current project Used in for the updater notifications. |
|
|
1209
1209
|
|
|
1210
|
-
***
|
|
1211
1210
|
|
|
1212
1211
|
#### CreateOpts
|
|
1213
1212
|
|
|
@@ -1223,7 +1222,6 @@ type CreateOpts: CliOpts & {
|
|
|
1223
1222
|
| ------ | ------ | ------ |
|
|
1224
1223
|
| `activeCli`? | `boolean` | Options for activate cli. **Default** `true` |
|
|
1225
1224
|
|
|
1226
|
-
***
|
|
1227
1225
|
|
|
1228
1226
|
#### CreateTemplateOpts
|
|
1229
1227
|
|
|
@@ -1277,7 +1275,6 @@ Environment functions
|
|
|
1277
1275
|
| `isNode` | `boolean` |
|
|
1278
1276
|
| `isWebWorker` | `boolean` |
|
|
1279
1277
|
|
|
1280
|
-
***
|
|
1281
1278
|
|
|
1282
1279
|
#### INSTALLER
|
|
1283
1280
|
|
|
@@ -1305,7 +1302,6 @@ installer values used in `install` option.
|
|
|
1305
1302
|
| `PNPM` | `"pnpm"` | 'pnpm' |
|
|
1306
1303
|
| `YARN` | `"yarn"` | 'yarn' |
|
|
1307
1304
|
|
|
1308
|
-
***
|
|
1309
1305
|
|
|
1310
1306
|
#### OPTION
|
|
1311
1307
|
|
|
@@ -1347,7 +1343,6 @@ Object of the CREATIUM types
|
|
|
1347
1343
|
| `text` | `"text"` | 'text' |
|
|
1348
1344
|
| `void` | `"void"` | 'void' |
|
|
1349
1345
|
|
|
1350
|
-
***
|
|
1351
1346
|
|
|
1352
1347
|
#### prompt
|
|
1353
1348
|
|
|
@@ -1441,7 +1436,6 @@ Prompt functions
|
|
|
1441
1436
|
| `tasks()` | `Promise`\<`void`\> | Define a group of tasks to be executed |
|
|
1442
1437
|
| `text()` | `Promise`\<`string` \| `symbol`\> | - |
|
|
1443
1438
|
|
|
1444
|
-
***
|
|
1445
1439
|
|
|
1446
1440
|
#### style
|
|
1447
1441
|
|
|
@@ -1473,7 +1467,6 @@ Style functions
|
|
|
1473
1467
|
| `line` | (`__namedParameters`: \{ `align`: `'center'`; `lineChar`: `'⎯'`; `title`: `string`; \}) => `string` |
|
|
1474
1468
|
| `table` | (`data`: `TableData`, `options`?: `TableUserConfig`) => `string` |
|
|
1475
1469
|
|
|
1476
|
-
***
|
|
1477
1470
|
|
|
1478
1471
|
#### sys
|
|
1479
1472
|
|
|
@@ -1483,7 +1476,6 @@ const sys: __module = _sys;
|
|
|
1483
1476
|
|
|
1484
1477
|
System functions
|
|
1485
1478
|
|
|
1486
|
-
***
|
|
1487
1479
|
|
|
1488
1480
|
#### TEXT\_EDITOR
|
|
1489
1481
|
|
package/dist/main.d.mts
CHANGED
|
@@ -1395,12 +1395,13 @@ declare class CreatiumCore<C extends Config = Config> {
|
|
|
1395
1395
|
* @example
|
|
1396
1396
|
* await core.replacePlaceholders( {
|
|
1397
1397
|
* input : 'my/project/path',
|
|
1398
|
-
* params : {
|
|
1398
|
+
* params : { consts: { version: '1.0.0' }, prompt: { name: 'My Project' } },
|
|
1399
1399
|
* })
|
|
1400
1400
|
*/
|
|
1401
|
-
replacePlaceholders({ input, params, }?: {
|
|
1401
|
+
replacePlaceholders({ input, params, inputOpts, }?: {
|
|
1402
1402
|
input?: string;
|
|
1403
1403
|
params?: Parameters<typeof replacePlaceholders>[0]['params'];
|
|
1404
|
+
inputOpts?: Parameters<typeof getPaths>[1];
|
|
1404
1405
|
}): Promise<void>;
|
|
1405
1406
|
/**
|
|
1406
1407
|
* Return the input path of a template by name or path.
|
package/dist/main.d.ts
CHANGED
|
@@ -1395,12 +1395,13 @@ declare class CreatiumCore<C extends Config = Config> {
|
|
|
1395
1395
|
* @example
|
|
1396
1396
|
* await core.replacePlaceholders( {
|
|
1397
1397
|
* input : 'my/project/path',
|
|
1398
|
-
* params : {
|
|
1398
|
+
* params : { consts: { version: '1.0.0' }, prompt: { name: 'My Project' } },
|
|
1399
1399
|
* })
|
|
1400
1400
|
*/
|
|
1401
|
-
replacePlaceholders({ input, params, }?: {
|
|
1401
|
+
replacePlaceholders({ input, params, inputOpts, }?: {
|
|
1402
1402
|
input?: string;
|
|
1403
1403
|
params?: Parameters<typeof replacePlaceholders>[0]['params'];
|
|
1404
|
+
inputOpts?: Parameters<typeof getPaths>[1];
|
|
1404
1405
|
}): Promise<void>;
|
|
1405
1406
|
/**
|
|
1406
1407
|
* Return the input path of a template by name or path.
|
package/dist/main.mjs
CHANGED
|
@@ -1586,7 +1586,7 @@ class CreatiumCore {
|
|
|
1586
1586
|
*/
|
|
1587
1587
|
async intro(message) {
|
|
1588
1588
|
if (message)
|
|
1589
|
-
this.utils.prompt.
|
|
1589
|
+
this.utils.prompt.intro(message);
|
|
1590
1590
|
else if (typeof this.config.intro === "function")
|
|
1591
1591
|
await this.config.intro(__privateGet$1(this, _data) || {});
|
|
1592
1592
|
else if (this.config.intro === void 0) {
|
|
@@ -1604,12 +1604,14 @@ class CreatiumCore {
|
|
|
1604
1604
|
* @param {string} [message] The outro message.
|
|
1605
1605
|
*/
|
|
1606
1606
|
async outro(message) {
|
|
1607
|
+
this.utils.prompt.log.step("");
|
|
1607
1608
|
if (message)
|
|
1608
1609
|
this.utils.prompt.outro(message);
|
|
1609
1610
|
else if (typeof this.config.outro === "function" && __privateGet$1(this, _data))
|
|
1610
1611
|
await this.config.outro(__privateGet$1(this, _data));
|
|
1611
|
-
else if (this.config.outro === void 0)
|
|
1612
|
+
else if (this.config.outro === void 0) {
|
|
1612
1613
|
this.utils.prompt.outro("Successfully completed \u{1F308}");
|
|
1614
|
+
}
|
|
1613
1615
|
}
|
|
1614
1616
|
/**
|
|
1615
1617
|
* Copy a directory from input path to output path.
|
|
@@ -1718,12 +1720,13 @@ class CreatiumCore {
|
|
|
1718
1720
|
* @example
|
|
1719
1721
|
* await core.replacePlaceholders( {
|
|
1720
1722
|
* input : 'my/project/path',
|
|
1721
|
-
* params : {
|
|
1723
|
+
* params : { consts: { version: '1.0.0' }, prompt: { name: 'My Project' } },
|
|
1722
1724
|
* })
|
|
1723
1725
|
*/
|
|
1724
1726
|
async replacePlaceholders({
|
|
1725
1727
|
input,
|
|
1726
|
-
params
|
|
1728
|
+
params,
|
|
1729
|
+
inputOpts
|
|
1727
1730
|
} = {}) {
|
|
1728
1731
|
if (!input)
|
|
1729
1732
|
input = __privateGet$1(this, _cwd);
|
|
@@ -1741,7 +1744,11 @@ class CreatiumCore {
|
|
|
1741
1744
|
return void 0;
|
|
1742
1745
|
}
|
|
1743
1746
|
};
|
|
1744
|
-
const paths = await getPaths([input], {
|
|
1747
|
+
const paths = await getPaths([input], {
|
|
1748
|
+
onlyFiles: true,
|
|
1749
|
+
dot: true,
|
|
1750
|
+
...inputOpts || {}
|
|
1751
|
+
});
|
|
1745
1752
|
console.debug({ templatePaths: paths });
|
|
1746
1753
|
for (const path of paths) {
|
|
1747
1754
|
const content = await getContent(path);
|
|
@@ -1845,7 +1852,6 @@ class CreatiumCore {
|
|
|
1845
1852
|
input: data.output,
|
|
1846
1853
|
editor: openEditor
|
|
1847
1854
|
});
|
|
1848
|
-
this.utils.prompt.log.step("");
|
|
1849
1855
|
await this.outro();
|
|
1850
1856
|
} catch (e) {
|
|
1851
1857
|
const error = e instanceof Error ? e.message : e?.toString();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "creatium",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Build your create-bins quickly and easily",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/pigeonposse/creatium/issues",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"boxen": "8.0.1",
|
|
35
35
|
"chalk": "5.3.0",
|
|
36
36
|
"columnify": "1.6.0",
|
|
37
|
-
"conf": "13.0
|
|
37
|
+
"conf": "13.1.0",
|
|
38
38
|
"deepmerge-ts": "7.1.3",
|
|
39
39
|
"globby": "14.0.2",
|
|
40
40
|
"gradient-string": "3.0.0",
|
|
41
41
|
"string-width": "7.2.0",
|
|
42
|
-
"table": "6.
|
|
42
|
+
"table": "6.9.0",
|
|
43
43
|
"update-notifier": "7.3.1",
|
|
44
44
|
"yargs": "17.7.2"
|
|
45
45
|
},
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@types/columnify": "1.5.4",
|
|
48
48
|
"@types/update-notifier": "6.0.8",
|
|
49
49
|
"@types/yargs": "17.0.33",
|
|
50
|
-
"@creatium/repo-config": "0.1.
|
|
50
|
+
"@creatium/repo-config": "0.1.7"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public",
|