creatium 0.1.5 → 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 CHANGED
@@ -27,10 +27,6 @@ Demo of the `creatium` library:
27
27
 
28
28
  ![demo](https://github.com/pigeonposse/creatium/raw/main/docs/public/example.gif)
29
29
 
30
- ## 📄 Description
31
-
32
- Build your create-bins quickly and easily
33
-
34
30
  ## Table of contents
35
31
 
36
32
  - [🤔 What is it `creatium`?](#-what-is-it-creatium)
@@ -38,88 +34,20 @@ Build your create-bins quickly and easily
38
34
  - [🔑 Installation](#-installation)
39
35
  - [🚀 Usage](#-usage)
40
36
  - [Simple use case](#simple-use-case)
41
- - [Project structure](#project-structure)
42
- - [src/core.js](#srccorejs)
43
- - [src/bin.js](#srcbinjs)
44
- - [src/lib.js](#srclibjs)
45
- - [package.json](#packagejson)
46
- - [Data (templates)](#data-templates)
47
- - [Execute](#execute)
48
37
  - [Advanced use case](#advanced-use-case)
49
- - [Project structure](#project-structure)
50
- - [src/core.js](#srccorejs)
51
- - [src/bin.js](#srcbinjs)
52
- - [src/lib.js](#srclibjs)
53
- - [package.json](#packagejson)
54
- - [Data (templates & partials)](#data-templates--partials)
55
- - [Execute](#execute)
56
38
  - [Api documentation](#api-documentation)
57
39
  - [Classes](#classes)
58
- - [Creatium](#creatium)
59
- - [CreatiumCore\<C\>](#creatiumcorec)
60
40
  - [Type Aliases](#type-aliases)
61
- - [CliOpts](#cliopts)
62
- - [Config](#config)
63
- - [CreateOpts](#createopts)
64
- - [CreateTemplateOpts](#createtemplateopts)
65
41
  - [Variables](#variables)
66
- - [env](#env)
67
- - [INSTALLER](#installer)
68
- - [OPTION](#option)
69
- - [prompt](#prompt)
70
- - [style](#style)
71
- - [sys](#sys)
72
- - [TEXT\_EDITOR](#text_editor)
73
42
  - [👨‍💻 Development](#-development)
74
43
  - [☕ Donate](#-donate)
75
44
  - [📜 License](#-license)
76
45
  - [🐦 About us](#-about-us)
77
46
 
78
47
 
48
+ ## 📄 Description
79
49
 
80
- ## Table of contents
81
-
82
- - [🤔 What is it `creatium`?](#-what-is-it-creatium)
83
- - [📄 Description](#-description)
84
- - [🔑 Installation](#-installation)
85
- - [🚀 Usage](#-usage)
86
- - [Simple use case](#simple-use-case)
87
- - [Project structure](#project-structure)
88
- - [src/core.js](#srccorejs)
89
- - [src/bin.js](#srcbinjs)
90
- - [src/lib.js](#srclibjs)
91
- - [package.json](#packagejson)
92
- - [Data (templates)](#data-templates)
93
- - [Execute](#execute)
94
- - [Advanced use case](#advanced-use-case)
95
- - [Project structure](#project-structure)
96
- - [src/core.js](#srccorejs)
97
- - [src/bin.js](#srcbinjs)
98
- - [src/lib.js](#srclibjs)
99
- - [package.json](#packagejson)
100
- - [Data (templates & partials)](#data-templates--partials)
101
- - [Execute](#execute)
102
- - [Api documentation](#api-documentation)
103
- - [Classes](#classes)
104
- - [Creatium](#creatium)
105
- - [CreatiumCore\<C\>](#creatiumcorec)
106
- - [Type Aliases](#type-aliases)
107
- - [CliOpts](#cliopts)
108
- - [Config](#config)
109
- - [CreateOpts](#createopts)
110
- - [CreateTemplateOpts](#createtemplateopts)
111
- - [Variables](#variables)
112
- - [env](#env)
113
- - [INSTALLER](#installer)
114
- - [OPTION](#option)
115
- - [prompt](#prompt)
116
- - [style](#style)
117
- - [sys](#sys)
118
- - [TEXT\_EDITOR](#text_editor)
119
- - [👨‍💻 Development](#-development)
120
- - [☕ Donate](#-donate)
121
- - [📜 License](#-license)
122
- - [🐦 About us](#-about-us)
50
+ Build your create-bins quickly and easily
123
51
 
124
52
 
125
53
  ## 🔑 Installation
@@ -1139,6 +1067,7 @@ If the `outro` option is undefined, the default outro message will be used.
1139
1067
  ```ts
1140
1068
  replacePlaceholders(args: {
1141
1069
  input: string;
1070
+ inputOpts: Options;
1142
1071
  params: Params;
1143
1072
  }): Promise<void>
1144
1073
  ```
@@ -1155,6 +1084,7 @@ in the content are replaced with values from the `params` object.
1155
1084
  | ------ | ------ | ------ |
1156
1085
  | `args` | `object` | The arguments object. |
1157
1086
  | `args.input`? | `string` | The directory path containing files with placeholders. |
1087
+ | `args.inputOpts`? | `Options` | - |
1158
1088
  | `args.params`? | `Params` | An object containing key-value pairs for replacing placeholders. |
1159
1089
 
1160
1090
  ###### Returns
@@ -1168,7 +1098,7 @@ A Promise that resolves once all placeholders have been replaced.
1168
1098
  ```ts
1169
1099
  await core.replacePlaceholders( {
1170
1100
  input : 'my/project/path',
1171
- params : { placeholder1: 'value1', placeholder2: 'value2' },
1101
+ params : { consts: { version: '1.0.0' }, prompt: { name: 'My Project' } },
1172
1102
  })
1173
1103
  ```
1174
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 : { placeholder1: 'value1', placeholder2: 'value2' },
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 : { placeholder1: 'value1', placeholder2: 'value2' },
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.outro(message);
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 : { placeholder1: 'value1', placeholder2: 'value2' },
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], { onlyFiles: true });
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.5",
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.1",
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.8.2",
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.4"
50
+ "@creatium/repo-config": "0.1.6"
51
51
  },
52
52
  "publishConfig": {
53
53
  "access": "public",