simple-scaffold 1.1.0 → 1.1.1

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
@@ -1,4 +1,13 @@
1
- # Simple Scaffold
1
+ <h1 align="center">Simple Scaffold</h1>
2
+
3
+ <h2 align="center">
4
+
5
+ [GitHub](https://github.com/chenasraf/simple-scaffold) |
6
+ [Documentation](https://casraf.blog/simple-scaffold) |
7
+ [NPM](https://npmjs.com/package/simple-scaffold) |
8
+ [casraf.blog](https://casraf.blog)
9
+
10
+ </h2>
2
11
 
3
12
  Simple Scaffold allows you to generate any set of files in the easiest way possible with simple commands.
4
13
 
@@ -14,28 +23,27 @@ other custom data) inside the paths or contents of the files using Handlebars.js
14
23
  <details>
15
24
  <summary>Table of contents</summary>
16
25
 
17
- - [Simple Scaffold](#simple-scaffold)
18
- - [Install](#install)
19
- - [Use as a command line tool](#use-as-a-command-line-tool)
20
- - [Command Line Options](#command-line-options)
21
- - [Use in Node.js](#use-in-nodejs)
22
- - [Node-specific options](#node-specific-options)
23
- - [Preparing files](#preparing-files)
24
- - [Template files](#template-files)
25
- - [Variable/token replacement](#variabletoken-replacement)
26
+ - [Install](#install)
27
+ - [Command Line Interface (CLI)](#command-line-interface-cli)
28
+ - [Available flags](#available-flags)
29
+ - [Node module](#node-module)
30
+ - [Node-specific options](#node-specific-options)
31
+ - [Preparing files](#preparing-files)
32
+ - [Template files](#template-files)
33
+ - [Variable/token replacement](#variabletoken-replacement)
34
+ - [Helpers](#helpers)
26
35
  - [Built-in Helpers](#built-in-helpers)
27
36
  - [Capitalization Helpers](#capitalization-helpers)
28
37
  - [Date helpers](#date-helpers)
29
38
  - [Custom Helpers](#custom-helpers)
30
- - [Examples](#examples)
39
+ - [Examples](#examples)
40
+ - [Run](#run)
31
41
  - [Command Example](#command-example)
32
- - [Example Scaffold Input](#example-scaffold-input)
33
- - [Input Directory structure](#input-directory-structure)
34
- - [Contents of `project/scaffold/{{Name}}.jsx`](#contents-of-projectscaffoldnamejsx)
35
- - [Example Scaffold Output](#example-scaffold-output)
36
- - [Output directory structure](#output-directory-structure)
37
- - [Contents of `project/scaffold/MyComponent/MyComponent.jsx`](#contents-of-projectscaffoldmycomponentmycomponentjsx)
38
- - [Contributing](#contributing)
42
+ - [Node Module Example](#node-module-example)
43
+ - [Files](#files)
44
+ - [Input](#input)
45
+ - [Output](#output)
46
+ - [Contributing](#contributing)
39
47
 
40
48
  </details>
41
49
 
@@ -54,11 +62,15 @@ yarn [global] add simple-scaffold
54
62
  npx simple-scaffold@latest <...args>
55
63
  ```
56
64
 
57
- ## Use as a command line tool
65
+ ## Command Line Interface (CLI)
58
66
 
59
- ### Command Line Options
67
+ ### Available flags
60
68
 
61
- ```plaintext
69
+ The following is the help text from the `simple-scaffold` binary. To see this and more
70
+ information anytime, add the `-h` or `--help` flag to your call, e.g.
71
+ `npx simple-scaffold@latest -h`.
72
+
73
+ ```text
62
74
  Usage: simple-scaffold [options]
63
75
 
64
76
  Create structured files based on templates.
@@ -67,26 +79,26 @@ Options:
67
79
 
68
80
  --help|-h Display help information
69
81
 
70
- --name|-n Name to be passed to the generated files. {{name}} and
71
- {{Name}} inside contents and file names will be replaced
72
- accordingly.
82
+ --name|-n Name to be passed to the generated files. {{name}}
83
+ and {{Name}} inside contents and file names will be
84
+ replaced accordingly.
73
85
 
74
86
  --output|-o Path to output to. If --create-sub-folder is enabled,
75
87
  the subfolder will be created inside this path.
76
88
  (default: current dir)
77
89
 
78
- --templates|-t Template files to use as input. You may provide multiple
79
- files, each of which can be a relative or absolute path, or a
80
- glob pattern for multiple file matching easily.
90
+ --templates|-t Template files to use as input. You may provide
91
+ multiple files, each of which can be a relative or
92
+ absolute path, or a glob pattern for multiple file
93
+ matching easily.
81
94
 
82
95
  --overwrite|-w Enable to override output files, even if they already
83
96
  exist. (default: false)
84
97
 
85
- --data|-d Add custom data to the templates. By default, only your
86
- app name is included.
98
+ --data|-d Add custom data to the templates. By default, only
99
+ your app name is included.
87
100
 
88
- --create-sub-folder|-s Create subfolder with the input name
89
- (default: false)
101
+ --create-sub-folder|-s Create subfolder with the input name (default: false)
90
102
 
91
103
  --sub-folder-name-helper|-sh Default helper to apply to subfolder name when using
92
104
  `--create-sub-folder true`.
@@ -101,9 +113,9 @@ Options:
101
113
  2)
102
114
 
103
115
  --dry-run|-dr Don't emit files. This is good for testing your
104
- scaffolds and making sure they don't fail, without having to
105
- write actual file contents or create directories.
106
- (default: false)
116
+ scaffolds and making sure they don't fail, without
117
+ having to write actual file contents or create
118
+ directories. (default: false)
107
119
  ```
108
120
 
109
121
  You can also add this as a script in your `package.json`:
@@ -116,7 +128,7 @@ You can also add this as a script in your `package.json`:
116
128
  }
117
129
  ```
118
130
 
119
- ## Use in Node.js
131
+ ## Node module
120
132
 
121
133
  You can also build the scaffold yourself, if you want to create more complex arguments or scaffold
122
134
  groups - simply pass a config object to the Scaffold function when you are ready to start.
@@ -174,8 +186,8 @@ Examples:
174
186
  | Input template | Files in template | Output path(s) |
175
187
  | ----------------------------- | ------------------------------------------------------ | ------------------------------------------------------------ |
176
188
  | `./templates/{{ name }}.txt` | `./templates/{{ name }}.txt` | `src/AppName.txt` |
177
- | `./templates/directory` | `outer/{{name}}.txt`,<br />`outer2/inner/{{name.txt}}` | `src/outer/AppName.txt`,<br />`src/outer2/inner/AppName.txt` |
178
- | `./templates/others/**/*.txt` | `outer/{{name}}.jpg`,<br />`outer2/inner/{{name.txt}}` | `src/outer2/inner/AppName.txt` |
189
+ | `./templates/directory` | `outer/{{name}}.txt`,<br />`outer2/inner/{{name}}.txt` | `src/outer/AppName.txt`,<br />`src/outer2/inner/AppName.txt` |
190
+ | `./templates/others/**/*.txt` | `outer/{{name}}.jpg`,<br />`outer2/inner/{{name}}.txt` | `src/outer2/inner/AppName.txt` |
179
191
 
180
192
  ### Variable/token replacement
181
193
 
@@ -197,7 +209,7 @@ npx simple-scaffold@latest \
197
209
 
198
210
  Will output a file with the path:
199
211
 
200
- ```plaintext
212
+ ```text
201
213
  <working_dir>/src/components/MyComponent.jsx
202
214
  ```
203
215
 
@@ -214,14 +226,16 @@ Your `data` will be pre-populated with the following:
214
226
  > [Handlebars.js Language Features](https://handlebarsjs.com/guide/#language-features) for more
215
227
  > information.
216
228
 
217
- ### Built-in Helpers
229
+ ### Helpers
230
+
231
+ #### Built-in Helpers
218
232
 
219
233
  Simple-Scaffold provides some built-in text transformation filters usable by handleBars.
220
234
 
221
235
  For example, you may use `{{ snakeCase name }}` inside a template file or filename, and it will
222
236
  replace `My Name` with `my_name` when producing the final value.
223
237
 
224
- #### Capitalization Helpers
238
+ ##### Capitalization Helpers
225
239
 
226
240
  | Helper name | Example code | Example output |
227
241
  | ------------ | ----------------------- | -------------- |
@@ -235,7 +249,7 @@ replace `My Name` with `my_name` when producing the final value.
235
249
  | `upperCase` | `{{ upperCase name }}` | MY NAME |
236
250
  | `lowerCase` | `{{ lowerCase name }}` | my name |
237
251
 
238
- #### Date helpers
252
+ ##### Date helpers
239
253
 
240
254
  | Helper name | Description | Example code | Example output |
241
255
  | -------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ------------------ |
@@ -265,7 +279,7 @@ Further details:
265
279
  - **The now helper** (for current time) takes the same arguments, minus the first one (`date`) as
266
280
  it is implicitly the current date.
267
281
 
268
- ### Custom Helpers
282
+ #### Custom Helpers
269
283
 
270
284
  You may also add your own custom helpers using the `helpers` options when using the JS API (rather
271
285
  than the CLI). The `helpers` option takes an object whose keys are helper names, and values are
@@ -285,7 +299,9 @@ All of the above helpers (built in and custom) will also be available to you whe
285
299
 
286
300
  ## Examples
287
301
 
288
- ### Command Example
302
+ ### Run
303
+
304
+ #### Command Example
289
305
 
290
306
  ```bash
291
307
  simple-scaffold MyComponent \
@@ -295,22 +311,37 @@ simple-scaffold MyComponent \
295
311
  MyComponent
296
312
  ```
297
313
 
298
- ### Example Scaffold Input
314
+ #### Node Module Example
299
315
 
300
- #### Input Directory structure
316
+ ```typescript
317
+ import Scaffold from 'simple-scaffold';
318
+
319
+ async function main() {
320
+ await Scaffold({
321
+ name: 'MyComponent',
322
+ templates: ['project/scaffold/**/*'],
323
+ output: ['src/components'],
324
+ data: {
325
+ className: 'myClassName',
326
+ },
327
+ });
328
+ console.log('Done.');
329
+ }
330
+ ```
301
331
 
302
- ```plaintext
303
- - project
304
- - scaffold
305
- - {{Name}}.js
306
- - src
307
- - components
308
- - ...
332
+ ### Files
333
+
334
+ #### Input
335
+
336
+ Input file path:
337
+
338
+ ```text
339
+ project → scaffold → {{Name}}.js → src → components
309
340
  ```
310
341
 
311
- #### Contents of `project/scaffold/{{Name}}.jsx`
342
+ Input file contents:
312
343
 
313
- ```typescriptreact
344
+ ```typescript
314
345
  import React from 'react'
315
346
 
316
347
  export default {{camelCase name}}: React.FC = (props) => {
@@ -320,32 +351,31 @@ export default {{camelCase name}}: React.FC = (props) => {
320
351
  }
321
352
  ```
322
353
 
323
- ### Example Scaffold Output
354
+ #### Output
324
355
 
325
- ### Output directory structure
356
+ Output file path:
326
357
 
327
- ```plaintext
328
- - project
329
- - src
330
- - components
331
- - MyComponent
332
- - MyComponent.js
333
- - ...
334
- ```
358
+ - With `createSubFolder = false` (default):
335
359
 
336
- With `createSubFolder = false`:
360
+ ```text
361
+ project → src → components → MyComponent.js
362
+ ```
337
363
 
338
- ```plaintext
339
- - project
340
- - src
341
- - components
342
- - MyComponent.js
343
- - ...
344
- ```
364
+ - With `createSubFolder = true`:
365
+
366
+ ```text
367
+ project → src → components → MyComponent → MyComponent.js
368
+ ```
369
+
370
+ - With `createSubFolder = true` and `subFolderNameHelper = 'upperCase'`:
345
371
 
346
- #### Contents of `project/scaffold/MyComponent/MyComponent.jsx`
372
+ ```text
373
+ project → src → components → MYCOMPONENT → MyComponent.js
374
+ ```
347
375
 
348
- ```typescriptreact
376
+ Output file contents:
377
+
378
+ ```typescript
349
379
  import React from 'react'
350
380
 
351
381
  export default MyComponent: React.FC = (props) => {
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "simple-scaffold",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "A simple command to generate any file structure, from single components to entire app boilerplates.",
5
+ "homepage": "https://casraf.blog/simple-scaffold",
5
6
  "repository": "https://github.com/chenasraf/simple-scaffold.git",
6
7
  "author": "Chen Asraf <inbox@casraf.com>",
7
8
  "license": "MIT",
@@ -43,11 +44,13 @@
43
44
  "@types/lodash": "^4.14.171",
44
45
  "@types/mock-fs": "^4.13.1",
45
46
  "@types/node": "^14.14.22",
47
+ "doc-theme": "file:./doc-theme",
46
48
  "jest": "^27.0.6",
47
49
  "mock-fs": "^5.0.0",
48
50
  "rimraf": "^3.0.2",
49
51
  "ts-jest": "^27.0.3",
50
52
  "ts-node": "^10.1.0",
53
+ "typedoc": "^0.22.15",
51
54
  "typescript": "^4.3.5"
52
55
  }
53
56
  }
package/scaffold.d.ts CHANGED
@@ -10,24 +10,23 @@ import { ScaffoldConfig } from "./types";
10
10
  * The contents and names will be replaced with the transformed values so you can use your original structure as a
11
11
  * boilerplate for other projects, components, modules, or even single files.
12
12
  *
13
+ * The files will maintain their structure, starting from the directory containing the template (or the template itself
14
+ * if it is already a directory), and will output from that directory into the directory defined by `config.output`.
15
+ *
13
16
  * #### Helpers
14
17
  * Helpers are functions you can use to transform your `{{ var }}` contents into other values without having to
15
- * pre-define the data and use a duplicated key. Common cases are transforming name-case format
16
- * (e.g. `MyName` &rarr; `my_name`), so these have been provided as defaults:
17
- *
18
- * | Helper name | Example code | Example output |
19
- * | ----------- | ----------------------- | -------------- |
20
- * | camelCase | `{{ camelCase name }}` | myName |
21
- * | snakeCase | `{{ snakeCase name }}` | my_name |
22
- * | startCase | `{{ startCase name }}` | My Name |
23
- * | kebabCase | `{{ kebabCase name }}` | my-name |
24
- * | hyphenCase | `{{ hyphenCase name }}` | my-name |
25
- * | pascalCase | `{{ pascalCase name }}` | MyName |
26
- * | upperCase | `{{ upperCase name }}` | MYNAME |
27
- * | lowerCase | `{{ lowerCase name }}` | myname |
18
+ * pre-define the data and use a duplicated key.
28
19
  *
29
20
  * Any functions you provide in `helpers` option will also be available to you to make custom formatting as you see fit
30
21
  * (for example, formatting a date)
22
+ *
23
+ * For available default values, see {@link DefaultHelperKeys}.
24
+ *
25
+ * @param {ScaffoldConfig} config The main configuration object
26
+ *
27
+ * @see {@link DefaultHelperKeys}
28
+ *
29
+ * @category Main
31
30
  */
32
- export declare function Scaffold({ ...options }: ScaffoldConfig): Promise<void>;
31
+ export declare function Scaffold(config: ScaffoldConfig): Promise<void>;
33
32
  export default Scaffold;
package/scaffold.js CHANGED
@@ -4,6 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Scaffold = void 0;
7
+ /**
8
+ * @module
9
+ * Simple Scaffold
10
+ *
11
+ * See [readme](README.md)
12
+ */
7
13
  const path_1 = __importDefault(require("path"));
8
14
  const utils_1 = require("./utils");
9
15
  const types_1 = require("./types");
@@ -18,43 +24,42 @@ const types_1 = require("./types");
18
24
  * The contents and names will be replaced with the transformed values so you can use your original structure as a
19
25
  * boilerplate for other projects, components, modules, or even single files.
20
26
  *
27
+ * The files will maintain their structure, starting from the directory containing the template (or the template itself
28
+ * if it is already a directory), and will output from that directory into the directory defined by `config.output`.
29
+ *
21
30
  * #### Helpers
22
31
  * Helpers are functions you can use to transform your `{{ var }}` contents into other values without having to
23
- * pre-define the data and use a duplicated key. Common cases are transforming name-case format
24
- * (e.g. `MyName` &rarr; `my_name`), so these have been provided as defaults:
25
- *
26
- * | Helper name | Example code | Example output |
27
- * | ----------- | ----------------------- | -------------- |
28
- * | camelCase | `{{ camelCase name }}` | myName |
29
- * | snakeCase | `{{ snakeCase name }}` | my_name |
30
- * | startCase | `{{ startCase name }}` | My Name |
31
- * | kebabCase | `{{ kebabCase name }}` | my-name |
32
- * | hyphenCase | `{{ hyphenCase name }}` | my-name |
33
- * | pascalCase | `{{ pascalCase name }}` | MyName |
34
- * | upperCase | `{{ upperCase name }}` | MYNAME |
35
- * | lowerCase | `{{ lowerCase name }}` | myname |
32
+ * pre-define the data and use a duplicated key.
36
33
  *
37
34
  * Any functions you provide in `helpers` option will also be available to you to make custom formatting as you see fit
38
35
  * (for example, formatting a date)
36
+ *
37
+ * For available default values, see {@link DefaultHelperKeys}.
38
+ *
39
+ * @param {ScaffoldConfig} config The main configuration object
40
+ *
41
+ * @see {@link DefaultHelperKeys}
42
+ *
43
+ * @category Main
39
44
  */
40
- async function Scaffold({ ...options }) {
45
+ async function Scaffold(config) {
41
46
  var _a;
42
- (_a = options.output) !== null && _a !== void 0 ? _a : (options.output = process.cwd());
43
- utils_1.registerHelpers(options);
47
+ (_a = config.output) !== null && _a !== void 0 ? _a : (config.output = process.cwd());
48
+ utils_1.registerHelpers(config);
44
49
  try {
45
- options.data = { name: options.name, Name: utils_1.pascalCase(options.name), ...options.data };
46
- utils_1.logInitStep(options);
47
- for (let _template of options.templates) {
50
+ config.data = { name: config.name, Name: utils_1.pascalCase(config.name), ...config.data };
51
+ utils_1.logInitStep(config);
52
+ for (let _template of config.templates) {
48
53
  try {
49
- const { nonGlobTemplate, origTemplate, isDirOrGlob, isGlob, template } = await utils_1.getTemplateGlobInfo(options, _template);
50
- const files = await utils_1.getFileList(options, template);
54
+ const { nonGlobTemplate, origTemplate, isDirOrGlob, isGlob, template } = await utils_1.getTemplateGlobInfo(config, _template);
55
+ const files = await utils_1.getFileList(config, template);
51
56
  for (const inputFilePath of files) {
52
57
  if (await utils_1.isDir(inputFilePath)) {
53
58
  continue;
54
59
  }
55
60
  const relPath = utils_1.makeRelativePath(path_1.default.dirname(utils_1.removeGlob(inputFilePath).replace(nonGlobTemplate, "")));
56
61
  const basePath = utils_1.getBasePath(relPath);
57
- utils_1.logInputFile(options, {
62
+ utils_1.logInputFile(config, {
58
63
  origTemplate,
59
64
  relPath,
60
65
  template,
@@ -64,7 +69,7 @@ async function Scaffold({ ...options }) {
64
69
  isDirOrGlob,
65
70
  isGlob,
66
71
  });
67
- await handleTemplateFile(options, options.data, {
72
+ await handleTemplateFile(config, {
68
73
  templatePath: inputFilePath,
69
74
  basePath,
70
75
  });
@@ -76,24 +81,24 @@ async function Scaffold({ ...options }) {
76
81
  }
77
82
  }
78
83
  catch (e) {
79
- utils_1.log(options, types_1.LogLevel.Error, e);
84
+ utils_1.log(config, types_1.LogLevel.Error, e);
80
85
  throw e;
81
86
  }
82
87
  }
83
88
  exports.Scaffold = Scaffold;
84
- async function handleTemplateFile(options, data, { templatePath, basePath }) {
89
+ async function handleTemplateFile(config, { templatePath, basePath }) {
85
90
  return new Promise(async (resolve, reject) => {
86
91
  var _a;
87
92
  try {
88
- const { inputPath, outputPathOpt, outputDir, outputPath, exists } = await utils_1.getTemplateFileInfo(options, data, {
93
+ const { inputPath, outputPathOpt, outputDir, outputPath, exists } = await utils_1.getTemplateFileInfo(config, {
89
94
  templatePath,
90
95
  basePath,
91
96
  });
92
- const overwrite = utils_1.getOptionValueForFile(options, inputPath, (_a = options.overwrite) !== null && _a !== void 0 ? _a : false);
93
- utils_1.log(options, types_1.LogLevel.Debug, `\nParsing ${templatePath}`, `\nBase path: ${basePath}`, `\nFull input path: ${inputPath}`, `\nOutput Path Opt: ${outputPathOpt}`, `\nFull output dir: ${outputDir}`, `\nFull output path: ${outputPath}`, `\n`);
94
- await utils_1.createDirIfNotExists(path_1.default.dirname(outputPath), options);
95
- utils_1.log(options, types_1.LogLevel.Info, `Writing to ${outputPath}`);
96
- await utils_1.copyFileTransformed(options, { exists, overwrite, outputPath, inputPath });
97
+ const overwrite = utils_1.getOptionValueForFile(config, inputPath, (_a = config.overwrite) !== null && _a !== void 0 ? _a : false);
98
+ utils_1.log(config, types_1.LogLevel.Debug, `\nParsing ${templatePath}`, `\nBase path: ${basePath}`, `\nFull input path: ${inputPath}`, `\nOutput Path Opt: ${outputPathOpt}`, `\nFull output dir: ${outputDir}`, `\nFull output path: ${outputPath}`, `\n`);
99
+ await utils_1.createDirIfNotExists(path_1.default.dirname(outputPath), config);
100
+ utils_1.log(config, types_1.LogLevel.Info, `Writing to ${outputPath}`);
101
+ await utils_1.copyFileTransformed(config, { exists, overwrite, outputPath, inputPath });
97
102
  resolve();
98
103
  }
99
104
  catch (e) {
package/scaffold.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../src/scaffold.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AAEvB,mCAiBgB;AAChB,mCAAkD;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACI,KAAK,UAAU,QAAQ,CAAC,EAAE,GAAG,OAAO,EAAkB;;IAC3D,MAAA,OAAO,CAAC,MAAM,oCAAd,OAAO,CAAC,MAAM,GAAK,OAAO,CAAC,GAAG,EAAE,EAAA;IAEhC,uBAAe,CAAC,OAAO,CAAC,CAAA;IACxB,IAAI;QACF,OAAO,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,kBAAU,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,CAAA;QACtF,mBAAW,CAAC,OAAO,CAAC,CAAA;QACpB,KAAK,IAAI,SAAS,IAAI,OAAO,CAAC,SAAS,EAAE;YACvC,IAAI;gBACF,MAAM,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,2BAAmB,CAChG,OAAO,EACP,SAAS,CACV,CAAA;gBACD,MAAM,KAAK,GAAG,MAAM,mBAAW,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;gBAClD,KAAK,MAAM,aAAa,IAAI,KAAK,EAAE;oBACjC,IAAI,MAAM,aAAK,CAAC,aAAa,CAAC,EAAE;wBAC9B,SAAQ;qBACT;oBACD,MAAM,OAAO,GAAG,wBAAgB,CAAC,cAAI,CAA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S,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,2BAAmB,CAAC,MAAM,EAAE;gBACpG,YAAY;gBACZ,QAAQ;aACT,CAAC,CAAA;YACF,MAAM,SAAS,GAAG,6BAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAA,MAAM,CAAC,SAAS,mCAAI,KAAK,CAAC,CAAA;YAErF,WAAG,CACD,MAAM,EACN,gBAAQ,CAAC,KAAK,EACd,aAAa,YAAY,EAAE,EAC3B,gBAAgB,QAAQ,EAAE,EAC1B,sBAAsB,SAAS,EAAE,EACjC,sBAAsB,aAAa,EAAE,EACrC,sBAAsB,SAAS,EAAE,EACjC,uBAAuB,UAAU,EAAE,EACnC,IAAI,CACL,CAAA;YAED,MAAM,4BAAoB,CAAC,cAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,CAAA;YAE5D,WAAG,CAAC,MAAM,EAAE,gBAAQ,CAAC,IAAI,EAAE,cAAc,UAAU,EAAE,CAAC,CAAA;YACtD,MAAM,2BAAmB,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAA;YAC/E,OAAO,EAAE,CAAA;SACV;QAAC,OAAO,CAAM,EAAE;YACf,iBAAS,CAAC,CAAC,CAAC,CAAA;YACZ,MAAM,CAAC,CAAC,CAAC,CAAA;SACV;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,kBAAe,QAAQ,CAAA"}
package/types.d.ts CHANGED
@@ -1,17 +1,13 @@
1
1
  /// <reference types="node" />
2
2
  import { HelperDelegate } from "handlebars/runtime";
3
- export declare enum LogLevel {
4
- None = 0,
5
- Debug = 1,
6
- Info = 2,
7
- Warning = 3,
8
- Error = 4
9
- }
10
- export declare type FileResponseFn<T> = (fullPath: string, basedir: string, basename: string) => T;
11
- export declare type FileResponse<T> = T | FileResponseFn<T>;
12
- export declare type DefaultHelperKeys = "camelCase" | "date" | "hyphenCase" | "kebabCase" | "lowerCase" | "now" | "pascalCase" | "snakeCase" | "startCase" | "upperCase";
13
- export declare type HelperKeys<T> = DefaultHelperKeys | T;
14
- export declare type Helper = HelperDelegate;
3
+ /**
4
+ * The config object for defining a scaffolding group.
5
+ *
6
+ * @see https://github.com/chenasraf/simple-scaffold#readme
7
+ * @see {@link DefaultHelperKeys}
8
+ *
9
+ * @category Config
10
+ */
15
11
  export interface ScaffoldConfig {
16
12
  /**
17
13
  * Name to be passed to the generated files. `{{name}}` and `{{Name}}` inside contents and file names will be replaced
@@ -20,39 +16,70 @@ export interface ScaffoldConfig {
20
16
  name: string;
21
17
  /**
22
18
  * Template files to use as input. You may provide multiple files, each of which can be a relative or absolute path,
23
- * or a glob pattern for multiple file matching easily. (default: current working directory)
19
+ * or a glob pattern for multiple file matching easily.
20
+ *
21
+ * @default Current working directory
24
22
  */
25
23
  templates: string[];
26
- /** Path to output to. If `createSubFolder` is `true`, the subfolder will be created inside this path. */
24
+ /**
25
+ * Path to output to. If `createSubFolder` is `true`, the subfolder will be created inside this path.
26
+ *
27
+ * May also be a {@link FileResponseHandler} which returns a new output path to override the default one.
28
+ *
29
+ * @see {@link FileResponse}
30
+ * @see {@link FileResponseHandler}
31
+ */
27
32
  output: FileResponse<string>;
28
33
  /**
29
- * Create subfolder with the input name (default: `false`)
34
+ * Whether to create subfolder with the input name.
35
+ *
36
+ * When `true`, you may also use {@link subFolderNameHelper} to determine a pre-process helper on
37
+ * the directory name.
38
+ *
39
+ * @default `false`
30
40
  */
31
41
  createSubFolder?: boolean;
32
42
  /**
33
43
  * Add custom data to the templates. By default, only your app name is included as `{{name}}` and `{{Name}}`.
44
+ *
45
+ * This can be any object that will be usable by Handlebars.
34
46
  */
35
- data?: Record<string, string>;
47
+ data?: Record<string, any>;
36
48
  /**
37
- * Enable to override output files, even if they already exist. (default: `false`)
49
+ * Enable to override output files, even if they already exist.
38
50
  *
39
51
  * You may supply a function to this option, which can take the arguments `(fullPath, baseDir, baseName)` and returns
40
52
  * a string, to return a dynamic path for each file.
53
+ *
54
+ * May also be a {@link FileResponseHandler} which returns a boolean value per file.
55
+ *
56
+ * @see {@link FileResponse}
57
+ * @see {@link FileResponseHandler}
58
+ *
59
+ * @default `false`
41
60
  */
42
61
  overwrite?: FileResponse<boolean>;
43
- /** Suppress output logs (Same as `verbose: 0` or `verbose: LogLevel.None`) */
62
+ /**
63
+ * Suppress output logs (Same as `verbose: 0` or `verbose: LogLevel.None`)
64
+ * @see {@link verbose}
65
+ */
44
66
  quiet?: boolean;
45
67
  /**
46
68
  * Determine amount of logs to display.
47
69
  *
48
70
  * The values are: `0 (none) | 1 (debug) | 2 (info) | 3 (warn) | 4 (error)`. The provided level will display messages
49
- * of the same level or higher. (default: `2 (info)`)
50
- * @see LogLevel
71
+ * of the same level or higher.
72
+ *
73
+ * @see {@link LogLevel}
74
+ *
75
+ * @default `2 (info)`
51
76
  */
52
77
  verbose?: LogLevel;
53
78
  /**
54
79
  * Don't emit files. This is good for testing your scaffolds and making sure they don't fail, without having to write
55
- * actual file contents or create directories. (default: `false`)
80
+ * actual file contents or create directories.
81
+ *
82
+ * @default `false`
56
83
  */
57
84
  dryRun?: boolean;
58
85
  /**
@@ -73,12 +100,19 @@ export interface ScaffoldConfig {
73
100
  * })
74
101
  * ```
75
102
  *
76
- * See the list of all the built-in available helpers, or how to define your own in the [readme](https://github.com/chenasraf/simple-scaffold#built-in-helpers).
103
+ * See {@link DefaultHelperKeys} for a list of all the built-in available helpers.
104
+ *
105
+ * @see https://github.com/chenasraf/simple-scaffold#helpers
106
+ * @see https://github.com/chenasraf/simple-scaffold#built-in-helpers
77
107
  */
78
108
  helpers?: Record<string, Helper>;
79
109
  /**
80
110
  * Default transformer to apply to subfolder name when using `createSubFolder: true`. Can be one of the default
81
- * helpers, or a custom one you provide to `helpers`. Defaults to `undefined`, which means no transformation is done.
111
+ * capitalization helpers, or a custom one you provide to `helpers`. Defaults to `undefined`, which means no transformation is done.
112
+ *
113
+ * @see {@link createSubFolder}
114
+ * @see {@link CapitalizationHelperKeys}
115
+ * @see {@link DefaultHelperKeys}
82
116
  */
83
117
  subFolderNameHelper?: DefaultHelperKeys | string;
84
118
  /**
@@ -92,11 +126,128 @@ export interface ScaffoldConfig {
92
126
  * @param rawContent The original template before token replacement
93
127
  * @param outputPath The final output path of the processed file
94
128
  *
95
- * @returns `String | Buffer | undefined` The final output of the file contents-only, after further modifications -
129
+ * @returns {Promise<String | Buffer | undefined> | String | Buffer | undefined} The final output of the file contents-only, after further modifications -
96
130
  * or `undefined` to use the original content (i.e. `content.toString()`)
97
131
  */
98
132
  beforeWrite?(content: Buffer, rawContent: Buffer, outputPath: string): string | Buffer | undefined | Promise<string | Buffer | undefined>;
99
133
  }
134
+ /**
135
+ * The names of the available helper functions that relate to text capitalization.
136
+ *
137
+ * These are available for `subfolderNameHelper`.
138
+ *
139
+ * | Helper name | Example code | Example output |
140
+ * | ------------ | ----------------------- | -------------- |
141
+ * | [None] | `{{ name }}` | my name |
142
+ * | `camelCase` | `{{ camelCase name }}` | myName |
143
+ * | `snakeCase` | `{{ snakeCase name }}` | my_name |
144
+ * | `startCase` | `{{ startCase name }}` | My Name |
145
+ * | `kebabCase` | `{{ kebabCase name }}` | my-name |
146
+ * | `hyphenCase` | `{{ hyphenCase name }}` | my-name |
147
+ * | `pascalCase` | `{{ pascalCase name }}` | MyName |
148
+ * | `upperCase` | `{{ upperCase name }}` | MY NAME |
149
+ * | `lowerCase` | `{{ lowerCase name }}` | my name |
150
+ *
151
+ * @see {@link ScaffoldConfig}
152
+ * @see {@link subFolderNameHelper}
153
+ * @see {@link DefaultHelperKeys}
154
+ *
155
+ * @category Helpers
156
+ */
157
+ export declare type CapitalizationHelperKeys = "camelCase" | "hyphenCase" | "kebabCase" | "lowerCase" | "pascalCase" | "snakeCase" | "startCase" | "upperCase";
158
+ /**
159
+ * The names of the available helper functions that relate to dates.
160
+ *
161
+ * | Helper name | Description | Example code | Example output |
162
+ * | -------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ------------------ |
163
+ * | `now` | Current date with format | `{{ now "yyyy-MM-dd HH:mm" }}` | `2042-01-01 15:00` |
164
+ * | `now` (with offset) | Current date with format, and with offset | `{{ now "yyyy-MM-dd HH:mm" -1 "hours" }}` | `2042-01-01 14:00` |
165
+ * | `date` | Custom date with format | `{{ date "2042-01-01T15:00:00Z" "yyyy-MM-dd HH:mm" }}` | `2042-01-01 15:00` |
166
+ * | `date` (with offset) | Custom date with format, and with offset | `{{ date "2042-01-01T15:00:00Z" "yyyy-MM-dd HH:mm" -1 "days" }}` | `2041-31-12 15:00` |
167
+ * | `date` (with date from `--data`) | Custom date with format, with data from the `data` config option | `{{ date myCustomDate "yyyy-MM-dd HH:mm" }}` | `2042-01-01 12:00` |
168
+ *
169
+ * @see {@link DefaultHelperKeys}
170
+ *
171
+ * @category Helpers
172
+ */
173
+ export declare type DateHelperKeys = "date" | "now";
174
+ /**
175
+ * The names of all the available helper functions in templates.
176
+ * Simple-Scaffold provides some built-in text transformation filters usable by handleBars.
177
+ *
178
+ * For example, you may use `{{ snakeCase name }}` inside a template file or filename, and it will
179
+ * replace `My Name` with `my_name` when producing the final value.
180
+ *
181
+ * @see {@link CapitalizationHelperKeys}
182
+ * @see {@link DateHelperKeys}
183
+ *
184
+ * @category Helpers
185
+ */
186
+ export declare type DefaultHelperKeys = CapitalizationHelperKeys | DateHelperKeys;
187
+ /**
188
+ * Helper function, see https://handlebarsjs.com/guide/#custom-helpers
189
+ *
190
+ * @category Helpers
191
+ */
192
+ export declare type Helper = HelperDelegate;
193
+ /**
194
+ * The amount of information to log when generating scaffold.
195
+ * When not `None`, the selected level will be the lowest level included.
196
+ *
197
+ * For example, level `Info` (2) will include `Info`, `Warning` and `Error`, but not `Debug`; and `Warning` will only
198
+ * show `Warning` and `Error`.
199
+ *
200
+ * @default `2 (info)`
201
+ *
202
+ * @category Logging
203
+ */
204
+ export declare enum LogLevel {
205
+ /** Silent output */
206
+ None = 0,
207
+ /** Debugging information. Very verbose and only recommended for troubleshooting. */
208
+ Debug = 1,
209
+ /**
210
+ * The regular level of logging. Major actions are logged to show the scaffold progress.
211
+ *
212
+ * @default
213
+ */
214
+ Info = 2,
215
+ /** Warnings such as when file fails to replace token values properly in template. */
216
+ Warning = 3,
217
+ /** Errors, such as missing files, bad replacement token syntax, or un-writable directories. */
218
+ Error = 4
219
+ }
220
+ /**
221
+ * A function that takes path information about file, and returns a value of type `T`
222
+ *
223
+ * @template T The return type for the function
224
+ * @param {string} fullPath The full path of the current file
225
+ * @param {string} basedir The directory containing the current file
226
+ * @param {string} basename The name of the file
227
+ *
228
+ * @returns {T} A return value
229
+ *
230
+ * @category Config
231
+ */
232
+ export declare type FileResponseHandler<T> = (fullPath: string, basedir: string, basename: string) => T;
233
+ /**
234
+ * Represents a response for file path information.
235
+ * Can either be:
236
+ *
237
+ * 1. `T` - static value
238
+ * 2. A function with the following signature which returns `T`:
239
+ * ```typescript
240
+ * (fullPath: string, basedir: string, basename: string) => T
241
+ * ```
242
+ *
243
+ * @typedef T The return type
244
+ *
245
+ * @see {@link FileResponseHandler}
246
+ *
247
+ * @category Config
248
+ * */
249
+ export declare type FileResponse<T> = T | FileResponseHandler<T>;
250
+ /** @internal */
100
251
  export interface ScaffoldCmdConfig {
101
252
  name: string;
102
253
  templates: string[];
package/types.js CHANGED
@@ -1,12 +1,32 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LogLevel = void 0;
4
+ /**
5
+ * The amount of information to log when generating scaffold.
6
+ * When not `None`, the selected level will be the lowest level included.
7
+ *
8
+ * For example, level `Info` (2) will include `Info`, `Warning` and `Error`, but not `Debug`; and `Warning` will only
9
+ * show `Warning` and `Error`.
10
+ *
11
+ * @default `2 (info)`
12
+ *
13
+ * @category Logging
14
+ */
4
15
  var LogLevel;
5
16
  (function (LogLevel) {
17
+ /** Silent output */
6
18
  LogLevel[LogLevel["None"] = 0] = "None";
19
+ /** Debugging information. Very verbose and only recommended for troubleshooting. */
7
20
  LogLevel[LogLevel["Debug"] = 1] = "Debug";
21
+ /**
22
+ * The regular level of logging. Major actions are logged to show the scaffold progress.
23
+ *
24
+ * @default
25
+ */
8
26
  LogLevel[LogLevel["Info"] = 2] = "Info";
27
+ /** Warnings such as when file fails to replace token values properly in template. */
9
28
  LogLevel[LogLevel["Warning"] = 3] = "Warning";
29
+ /** Errors, such as missing files, bad replacement token syntax, or un-writable directories. */
10
30
  LogLevel[LogLevel["Error"] = 4] = "Error";
11
31
  })(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
12
32
  //# sourceMappingURL=types.js.map
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAEA,IAAY,QAMX;AAND,WAAY,QAAQ;IAClB,uCAAQ,CAAA;IACR,yCAAS,CAAA;IACT,uCAAQ,CAAA;IACR,6CAAW,CAAA;IACX,yCAAS,CAAA;AACX,CAAC,EANW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAMnB"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AA4NA;;;;;;;;;;GAUG;AACH,IAAY,QAeX;AAfD,WAAY,QAAQ;IAClB,oBAAoB;IACpB,uCAAQ,CAAA;IACR,oFAAoF;IACpF,yCAAS,CAAA;IACT;;;;OAIG;IACH,uCAAQ,CAAA;IACR,qFAAqF;IACrF,6CAAW,CAAA;IACX,+FAA+F;IAC/F,yCAAS,CAAA;AACX,CAAC,EAfW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAenB"}
package/utils.d.ts CHANGED
@@ -7,12 +7,12 @@ export declare function nowHelper(formatString: string): string;
7
7
  export declare function nowHelper(formatString: string, durationDifference: number, durationType: keyof Duration): string;
8
8
  export declare function dateHelper(date: string, formatString: string): string;
9
9
  export declare function dateHelper(date: string, formatString: string, durationDifference: number, durationType: keyof Duration): string;
10
- export declare function registerHelpers(options: ScaffoldConfig): void;
10
+ export declare function registerHelpers(config: ScaffoldConfig): void;
11
11
  export declare function handleErr(err: NodeJS.ErrnoException | null): void;
12
- export declare function log(options: ScaffoldConfig, level: LogLevel, ...obj: any[]): void;
13
- export declare function createDirIfNotExists(dir: string, options: ScaffoldConfig): Promise<void>;
14
- export declare function getOptionValueForFile<T>(options: ScaffoldConfig, filePath: string, fn: FileResponse<T>, defaultValue?: T): T;
15
- export declare function handlebarsParse(options: ScaffoldConfig, templateBuffer: Buffer | string, { isPath }?: {
12
+ export declare function log(config: ScaffoldConfig, level: LogLevel, ...obj: any[]): void;
13
+ export declare function createDirIfNotExists(dir: string, config: ScaffoldConfig): Promise<void>;
14
+ export declare function getOptionValueForFile<T>(config: ScaffoldConfig, filePath: string, fn: FileResponse<T>, defaultValue?: T): T;
15
+ export declare function handlebarsParse(config: ScaffoldConfig, templateBuffer: Buffer | string, { isPath }?: {
16
16
  isPath?: boolean;
17
17
  }): Buffer;
18
18
  export declare function pathExists(filePath: string): Promise<boolean>;
@@ -21,7 +21,7 @@ export declare function isDir(path: string): Promise<boolean>;
21
21
  export declare function removeGlob(template: string): string;
22
22
  export declare function makeRelativePath(str: string): string;
23
23
  export declare function getBasePath(relPath: string): string;
24
- export declare function getFileList(options: ScaffoldConfig, template: string): Promise<string[]>;
24
+ export declare function getFileList(config: ScaffoldConfig, template: string): Promise<string[]>;
25
25
  export interface GlobInfo {
26
26
  nonGlobTemplate: string;
27
27
  origTemplate: string;
@@ -29,7 +29,7 @@ export interface GlobInfo {
29
29
  isGlob: boolean;
30
30
  template: string;
31
31
  }
32
- export declare function getTemplateGlobInfo(options: ScaffoldConfig, template: string): Promise<GlobInfo>;
32
+ export declare function getTemplateGlobInfo(config: ScaffoldConfig, template: string): Promise<GlobInfo>;
33
33
  export interface OutputFileInfo {
34
34
  inputPath: string;
35
35
  outputPathOpt: string;
@@ -37,18 +37,18 @@ export interface OutputFileInfo {
37
37
  outputPath: string;
38
38
  exists: boolean;
39
39
  }
40
- export declare function getTemplateFileInfo(options: ScaffoldConfig, data: Record<string, string>, { templatePath, basePath }: {
40
+ export declare function getTemplateFileInfo(config: ScaffoldConfig, { templatePath, basePath }: {
41
41
  templatePath: string;
42
42
  basePath: string;
43
43
  }): Promise<OutputFileInfo>;
44
- export declare function copyFileTransformed(options: ScaffoldConfig, { exists, overwrite, outputPath, inputPath, }: {
44
+ export declare function copyFileTransformed(config: ScaffoldConfig, { exists, overwrite, outputPath, inputPath, }: {
45
45
  exists: boolean;
46
46
  overwrite: boolean;
47
47
  outputPath: string;
48
48
  inputPath: string;
49
49
  }): Promise<void>;
50
- export declare function getOutputDir(options: ScaffoldConfig, outputPathOpt: string, basePath: string): string;
51
- export declare function logInputFile(options: ScaffoldConfig, { origTemplate, relPath, template, inputFilePath, nonGlobTemplate, basePath, isDirOrGlob, isGlob, }: {
50
+ export declare function getOutputDir(config: ScaffoldConfig, outputPathOpt: string, basePath: string): string;
51
+ export declare function logInputFile(config: ScaffoldConfig, { origTemplate, relPath, template, inputFilePath, nonGlobTemplate, basePath, isDirOrGlob, isGlob, }: {
52
52
  origTemplate: string;
53
53
  relPath: string;
54
54
  template: string;
@@ -58,4 +58,4 @@ export declare function logInputFile(options: ScaffoldConfig, { origTemplate, re
58
58
  isDirOrGlob: boolean;
59
59
  isGlob: boolean;
60
60
  }): void;
61
- export declare function logInitStep(options: ScaffoldConfig): void;
61
+ export declare function logInitStep(config: ScaffoldConfig): void;
package/utils.js CHANGED
@@ -53,10 +53,10 @@ function dateHelper(date, formatString, durationDifference, durationType) {
53
53
  return _dateHelper(dateFns.parseISO(date), formatString, durationDifference, durationType);
54
54
  }
55
55
  exports.dateHelper = dateHelper;
56
- function registerHelpers(options) {
57
- const _helpers = { ...exports.defaultHelpers, ...options.helpers };
56
+ function registerHelpers(config) {
57
+ const _helpers = { ...exports.defaultHelpers, ...config.helpers };
58
58
  for (const helperName in _helpers) {
59
- log(options, types_1.LogLevel.Debug, `Registering helper: ${helperName}`);
59
+ log(config, types_1.LogLevel.Debug, `Registering helper: ${helperName}`);
60
60
  handlebars_1.default.registerHelper(helperName, _helpers[helperName]);
61
61
  }
62
62
  }
@@ -66,9 +66,9 @@ function handleErr(err) {
66
66
  throw err;
67
67
  }
68
68
  exports.handleErr = handleErr;
69
- function log(options, level, ...obj) {
69
+ function log(config, level, ...obj) {
70
70
  var _a;
71
- if (options.quiet || options.verbose === types_1.LogLevel.None || level < ((_a = options.verbose) !== null && _a !== void 0 ? _a : types_1.LogLevel.Info)) {
71
+ if (config.quiet || config.verbose === types_1.LogLevel.None || level < ((_a = config.verbose) !== null && _a !== void 0 ? _a : types_1.LogLevel.Info)) {
72
72
  return;
73
73
  }
74
74
  const levelColor = {
@@ -88,14 +88,14 @@ function log(options, level, ...obj) {
88
88
  : chalkFn(i)));
89
89
  }
90
90
  exports.log = log;
91
- async function createDirIfNotExists(dir, options) {
91
+ async function createDirIfNotExists(dir, config) {
92
92
  const parentDir = path_1.default.dirname(dir);
93
93
  if (!(await pathExists(parentDir))) {
94
- await createDirIfNotExists(parentDir, options);
94
+ await createDirIfNotExists(parentDir, config);
95
95
  }
96
96
  if (!(await pathExists(dir))) {
97
97
  try {
98
- log(options, types_1.LogLevel.Debug, `Creating dir ${dir}`);
98
+ log(config, types_1.LogLevel.Debug, `Creating dir ${dir}`);
99
99
  await mkdir(dir);
100
100
  return;
101
101
  }
@@ -108,15 +108,15 @@ async function createDirIfNotExists(dir, options) {
108
108
  }
109
109
  }
110
110
  exports.createDirIfNotExists = createDirIfNotExists;
111
- function getOptionValueForFile(options, filePath, fn, defaultValue) {
111
+ function getOptionValueForFile(config, filePath, fn, defaultValue) {
112
112
  if (typeof fn !== "function") {
113
113
  return defaultValue !== null && defaultValue !== void 0 ? defaultValue : fn;
114
114
  }
115
- return fn(filePath, path_1.default.dirname(handlebarsParse(options, filePath, { isPath: true }).toString()), path_1.default.basename(handlebarsParse(options, filePath, { isPath: true }).toString()));
115
+ return fn(filePath, path_1.default.dirname(handlebarsParse(config, filePath, { isPath: true }).toString()), path_1.default.basename(handlebarsParse(config, filePath, { isPath: true }).toString()));
116
116
  }
117
117
  exports.getOptionValueForFile = getOptionValueForFile;
118
- function handlebarsParse(options, templateBuffer, { isPath = false } = {}) {
119
- const { data } = options;
118
+ function handlebarsParse(config, templateBuffer, { isPath = false } = {}) {
119
+ const { data } = config;
120
120
  try {
121
121
  let str = templateBuffer.toString();
122
122
  if (isPath) {
@@ -130,8 +130,8 @@ function handlebarsParse(options, templateBuffer, { isPath = false } = {}) {
130
130
  return Buffer.from(outputContents);
131
131
  }
132
132
  catch (e) {
133
- log(options, types_1.LogLevel.Debug, e);
134
- log(options, types_1.LogLevel.Warning, "Couldn't parse file with handlebars, returning original content");
133
+ log(config, types_1.LogLevel.Debug, e);
134
+ log(config, types_1.LogLevel.Warning, "Couldn't parse file with handlebars, returning original content");
135
135
  return Buffer.from(templateBuffer);
136
136
  }
137
137
  }
@@ -173,21 +173,21 @@ function getBasePath(relPath) {
173
173
  .replace(process.cwd(), "");
174
174
  }
175
175
  exports.getBasePath = getBasePath;
176
- async function getFileList(options, template) {
176
+ async function getFileList(config, template) {
177
177
  return (await util_1.promisify(glob_1.glob)(template, {
178
178
  dot: true,
179
- debug: options.verbose === types_1.LogLevel.Debug,
179
+ debug: config.verbose === types_1.LogLevel.Debug,
180
180
  nodir: true,
181
181
  })).map((f) => f.replace(/\//g, path_1.default.sep));
182
182
  }
183
183
  exports.getFileList = getFileList;
184
- async function getTemplateGlobInfo(options, template) {
184
+ async function getTemplateGlobInfo(config, template) {
185
185
  const isGlob = glob_1.glob.hasMagic(template);
186
- log(options, types_1.LogLevel.Debug, "before isDir", "isGlob:", isGlob, template);
186
+ log(config, types_1.LogLevel.Debug, "before isDir", "isGlob:", isGlob, template);
187
187
  let _template = template;
188
188
  const nonGlobTemplate = isGlob ? removeGlob(template) : template;
189
189
  const isDirOrGlob = isGlob ? true : await isDir(template);
190
- log(options, types_1.LogLevel.Debug, "after isDir", isDirOrGlob);
190
+ log(config, types_1.LogLevel.Debug, "after isDir", isDirOrGlob);
191
191
  const _shouldAddGlob = !isGlob && isDirOrGlob;
192
192
  const origTemplate = template;
193
193
  if (_shouldAddGlob) {
@@ -196,71 +196,71 @@ async function getTemplateGlobInfo(options, template) {
196
196
  return { nonGlobTemplate, origTemplate, isDirOrGlob, isGlob, template: _template };
197
197
  }
198
198
  exports.getTemplateGlobInfo = getTemplateGlobInfo;
199
- async function getTemplateFileInfo(options, data, { templatePath, basePath }) {
199
+ async function getTemplateFileInfo(config, { templatePath, basePath }) {
200
200
  const inputPath = path_1.default.resolve(process.cwd(), templatePath);
201
- const outputPathOpt = getOptionValueForFile(options, inputPath, options.output);
202
- const outputDir = getOutputDir(options, outputPathOpt, basePath);
203
- const outputPath = handlebarsParse(options, path_1.default.join(outputDir, path_1.default.basename(inputPath)), {
201
+ const outputPathOpt = getOptionValueForFile(config, inputPath, config.output);
202
+ const outputDir = getOutputDir(config, outputPathOpt, basePath);
203
+ const outputPath = handlebarsParse(config, path_1.default.join(outputDir, path_1.default.basename(inputPath)), {
204
204
  isPath: true,
205
205
  }).toString();
206
206
  const exists = await pathExists(outputPath);
207
207
  return { inputPath, outputPathOpt, outputDir, outputPath, exists };
208
208
  }
209
209
  exports.getTemplateFileInfo = getTemplateFileInfo;
210
- async function copyFileTransformed(options, { exists, overwrite, outputPath, inputPath, }) {
210
+ async function copyFileTransformed(config, { exists, overwrite, outputPath, inputPath, }) {
211
211
  var _a, _b;
212
212
  if (!exists || overwrite) {
213
213
  if (exists && overwrite) {
214
- log(options, types_1.LogLevel.Info, `File ${outputPath} exists, overwriting`);
214
+ log(config, types_1.LogLevel.Info, `File ${outputPath} exists, overwriting`);
215
215
  }
216
216
  const templateBuffer = await readFile(inputPath);
217
- const unprocessedOutputContents = handlebarsParse(options, templateBuffer);
218
- const finalOutputContents = ((_b = (await ((_a = options.beforeWrite) === null || _a === void 0 ? void 0 : _a.call(options, unprocessedOutputContents, templateBuffer, outputPath)))) !== null && _b !== void 0 ? _b : unprocessedOutputContents).toString();
219
- if (!options.dryRun) {
217
+ const unprocessedOutputContents = handlebarsParse(config, templateBuffer);
218
+ const finalOutputContents = ((_b = (await ((_a = config.beforeWrite) === null || _a === void 0 ? void 0 : _a.call(config, unprocessedOutputContents, templateBuffer, outputPath)))) !== null && _b !== void 0 ? _b : unprocessedOutputContents).toString();
219
+ if (!config.dryRun) {
220
220
  await writeFile(outputPath, finalOutputContents);
221
- log(options, types_1.LogLevel.Info, "Done.");
221
+ log(config, types_1.LogLevel.Info, "Done.");
222
222
  }
223
223
  else {
224
- log(options, types_1.LogLevel.Info, "Content output:");
225
- log(options, types_1.LogLevel.Info, finalOutputContents);
224
+ log(config, types_1.LogLevel.Info, "Content output:");
225
+ log(config, types_1.LogLevel.Info, finalOutputContents);
226
226
  }
227
227
  }
228
228
  else if (exists) {
229
- log(options, types_1.LogLevel.Info, `File ${outputPath} already exists, skipping`);
229
+ log(config, types_1.LogLevel.Info, `File ${outputPath} already exists, skipping`);
230
230
  }
231
231
  }
232
232
  exports.copyFileTransformed = copyFileTransformed;
233
- function getOutputDir(options, outputPathOpt, basePath) {
233
+ function getOutputDir(config, outputPathOpt, basePath) {
234
234
  return path_1.default.resolve(process.cwd(), ...[
235
235
  outputPathOpt,
236
236
  basePath,
237
- options.createSubFolder
238
- ? options.subFolderNameHelper
239
- ? handlebarsParse(options, `{{ ${options.subFolderNameHelper} name }}`).toString()
240
- : options.name
237
+ config.createSubFolder
238
+ ? config.subFolderNameHelper
239
+ ? handlebarsParse(config, `{{ ${config.subFolderNameHelper} name }}`).toString()
240
+ : config.name
241
241
  : undefined,
242
242
  ].filter(Boolean));
243
243
  }
244
244
  exports.getOutputDir = getOutputDir;
245
- function logInputFile(options, { origTemplate, relPath, template, inputFilePath, nonGlobTemplate, basePath, isDirOrGlob, isGlob, }) {
246
- log(options, types_1.LogLevel.Debug, `\nprocess.cwd(): ${process.cwd()}`, `\norigTemplate: ${origTemplate}`, `\nrelPath: ${relPath}`, `\ntemplate: ${template}`, `\ninputFilePath: ${inputFilePath}`, `\nnonGlobTemplate: ${nonGlobTemplate}`, `\nbasePath: ${basePath}`, `\nisDirOrGlob: ${isDirOrGlob}`, `\nisGlob: ${isGlob}`, `\n`);
245
+ function logInputFile(config, { origTemplate, relPath, template, inputFilePath, nonGlobTemplate, basePath, isDirOrGlob, isGlob, }) {
246
+ log(config, types_1.LogLevel.Debug, `\nprocess.cwd(): ${process.cwd()}`, `\norigTemplate: ${origTemplate}`, `\nrelPath: ${relPath}`, `\ntemplate: ${template}`, `\ninputFilePath: ${inputFilePath}`, `\nnonGlobTemplate: ${nonGlobTemplate}`, `\nbasePath: ${basePath}`, `\nisDirOrGlob: ${isDirOrGlob}`, `\nisGlob: ${isGlob}`, `\n`);
247
247
  }
248
248
  exports.logInputFile = logInputFile;
249
- function logInitStep(options) {
249
+ function logInitStep(config) {
250
250
  var _a;
251
- log(options, types_1.LogLevel.Debug, "Full config:", {
252
- name: options.name,
253
- templates: options.templates,
254
- output: options.output,
255
- createSubfolder: options.createSubFolder,
256
- data: options.data,
257
- overwrite: options.overwrite,
258
- quiet: options.quiet,
259
- subFolderTransformHelper: options.subFolderNameHelper,
260
- helpers: Object.keys((_a = options.helpers) !== null && _a !== void 0 ? _a : {}),
261
- verbose: `${options.verbose} (${Object.keys(types_1.LogLevel).find((k) => types_1.LogLevel[k] === options.verbose)})`,
251
+ log(config, types_1.LogLevel.Debug, "Full config:", {
252
+ name: config.name,
253
+ templates: config.templates,
254
+ output: config.output,
255
+ createSubfolder: config.createSubFolder,
256
+ data: config.data,
257
+ overwrite: config.overwrite,
258
+ quiet: config.quiet,
259
+ subFolderTransformHelper: config.subFolderNameHelper,
260
+ helpers: Object.keys((_a = config.helpers) !== null && _a !== void 0 ? _a : {}),
261
+ verbose: `${config.verbose} (${Object.keys(types_1.LogLevel).find((k) => types_1.LogLevel[k] === config.verbose)})`,
262
262
  });
263
- log(options, types_1.LogLevel.Info, "Data:", options.data);
263
+ log(config, types_1.LogLevel.Info, "Data:", config.data);
264
264
  }
265
265
  exports.logInitStep = logInitStep;
266
266
  //# sourceMappingURL=utils.js.map
package/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,yCAAgC;AAChC,mCAA2G;AAC3G,iEAAwC;AACxC,iEAAwC;AACxC,iEAAwC;AACxC,iEAAwC;AACxC,4DAAmC;AACnC,2BAA2C;AAC3C,kDAAyB;AACzB,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,aAAU,CAAA;AAC1C,uDAAgC;AAChC,6DAAsC;AACtC,iEAA0C;AAE1C,MAAM,OAAO,GAAG;IACd,GAAG,EAAE,aAAK;IACV,MAAM,EAAE,gBAAQ;IAChB,QAAQ,EAAE,kBAAU;CACrB,CAAA;AAED,+BAA2B;AAC3B,+BAAgC;AAChC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,aAAU,CAAA;AAE7B,QAAA,cAAc,GAAsC;IAC/D,SAAS,EAAT,mBAAS;IACT,SAAS,EAAT,mBAAS;IACT,SAAS,EAAT,mBAAS;IACT,SAAS,EAAT,mBAAS;IACT,UAAU,EAAE,mBAAS;IACrB,UAAU;IACV,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE;IACvC,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE;IACvC,GAAG,EAAE,SAAS;IACd,IAAI,EAAE,UAAU;CACjB,CAAA;AASD,SAAgB,WAAW,CACzB,IAAU,EACV,YAAoB,EACpB,kBAA2B,EAC3B,YAA6B;IAE7B,IAAI,YAAY,IAAI,kBAAkB,KAAK,SAAS,EAAE;QACpD,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,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