creatium 0.1.6 → 0.1.7
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 -1
- 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
|
@@ -1067,6 +1067,7 @@ If the `outro` option is undefined, the default outro message will be used.
|
|
|
1067
1067
|
```ts
|
|
1068
1068
|
replacePlaceholders(args: {
|
|
1069
1069
|
input: string;
|
|
1070
|
+
inputOpts: Options;
|
|
1070
1071
|
params: Params;
|
|
1071
1072
|
}): Promise<void>
|
|
1072
1073
|
```
|
|
@@ -1083,6 +1084,7 @@ in the content are replaced with values from the `params` object.
|
|
|
1083
1084
|
| ------ | ------ | ------ |
|
|
1084
1085
|
| `args` | `object` | The arguments object. |
|
|
1085
1086
|
| `args.input`? | `string` | The directory path containing files with placeholders. |
|
|
1087
|
+
| `args.inputOpts`? | `Options` | - |
|
|
1086
1088
|
| `args.params`? | `Params` | An object containing key-value pairs for replacing placeholders. |
|
|
1087
1089
|
|
|
1088
1090
|
###### Returns
|
|
@@ -1096,7 +1098,7 @@ A Promise that resolves once all placeholders have been replaced.
|
|
|
1096
1098
|
```ts
|
|
1097
1099
|
await core.replacePlaceholders( {
|
|
1098
1100
|
input : 'my/project/path',
|
|
1099
|
-
params : {
|
|
1101
|
+
params : { consts: { version: '1.0.0' }, prompt: { name: 'My Project' } },
|
|
1100
1102
|
})
|
|
1101
1103
|
```
|
|
1102
1104
|
|
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.7",
|
|
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.6"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public",
|