simple-scaffold 1.0.3 → 1.1.0-alpha.2

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,16 +1,45 @@
1
- # simple-scaffold
2
-
3
- Simple Scaffold allows you to create your structured files based on templates.
4
-
5
- Simply organize your commonly-created files in their original structure, and replace any variable
6
- values (such as component or app name) inside the paths or contents of the files with tokens to be
7
- populated upon scaffolding.
8
-
9
- Then, run Simple Scaffold and it will generate your files for you in the desired structure,
10
- with file names and contents that contain your dynamic information.
11
-
12
- It's a simple way to easily create reusable components, common class files to start writing from,
13
- or even entire app structures.
1
+ # Simple Scaffold
2
+
3
+ Simple Scaffold allows you to generate any set of files in the easiest way possible with simple commands.
4
+
5
+ It is completely framework agnostic so you can use it for anything from a few simple files to an
6
+ entire app boilerplate setup.
7
+
8
+ Simply organize your commonly-created files in their original structure, and running Simple Scaffold
9
+ will copy the files to the output path, while replacing values (such as component or app name, or
10
+ other custom data) inside the paths or contents of the files using Handlebars.js syntax.
11
+
12
+ <br />
13
+
14
+ <details>
15
+ <summary>Table of contents</summary>
16
+
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
+ - [Built-in Helpers](#built-in-helpers)
27
+ - [Capitalization Helpers](#capitalization-helpers)
28
+ - [Date helpers](#date-helpers)
29
+ - [Custom Helpers](#custom-helpers)
30
+ - [Examples](#examples)
31
+ - [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)
39
+
40
+ </details>
41
+
42
+ ---
14
43
 
15
44
  ## Install
16
45
 
@@ -22,7 +51,7 @@ npm install [-g] simple-scaffold
22
51
  # yarn
23
52
  yarn [global] add simple-scaffold
24
53
  # run without installing
25
- npx simple-scaffold <...args>
54
+ npx simple-scaffold@latest <...args>
26
55
  ```
27
56
 
28
57
  ## Use as a command line tool
@@ -81,10 +110,8 @@ You can also add this as a script in your `package.json`:
81
110
 
82
111
  ```json
83
112
  {
84
- ...
85
113
  "scripts": {
86
- ...
87
- "scaffold": "yarn simple-scaffold --templates scaffolds/component/**/* --output src/components --data '{\"myProp\": \"propName\", \"myVal\": \"123\"}'"
114
+ "scaffold": "npx simple-scaffold@latest -t scaffolds/component/**/* -o src/components -d '{\"myProp\": \"propName\", \"myVal\": 123}'"
88
115
  }
89
116
  }
90
117
  ```
@@ -109,30 +136,23 @@ const config = {
109
136
  },
110
137
  helpers: {
111
138
  twice: (text) => [text, text].join(" ")
112
- }
139
+ },
140
+ beforeWrite: (content, rawContent, outputPath) => content.toString().toUpperCase()
113
141
  }
114
142
 
115
143
  const scaffold = Scaffold(config)
116
144
  ```
117
145
 
118
- ### Additional Node.js options
119
-
120
- In addition to all the options available in the command line, there are some JS-specific options
121
- available:
146
+ ### Node-specific options
122
147
 
123
- 1. When `output` is used in Node directly, it may also be passed a function for each input file to
124
- output into a dynamic path:
148
+ In addition to all the options available in the command line, there are some Node/JS-specific
149
+ options available:
125
150
 
126
- ```typescript
127
- config.output = (fullPath, baseDir, baseName) => {
128
- console.log({ fullPath, baseDir, baseName })
129
- return path.resolve(baseDir, baseName)
130
- }
131
- ```
132
-
133
- 2. You may add custom `helpers` to your scaffolds. Helpers are simple `(string) => string` functions
134
- that transform your `data` variables into other values. See [Helpers](#helpers) for the list of
135
- default helpers, or add your own to be loaded into the template parser.
151
+ | Option | Type | Description |
152
+ | ------------- | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
153
+ | `output` | | In addition to being passed the same as CLI, it may also be passed a function for each input file to output into a dynamic path: `{ output: (fullPath, baseDir, baseName) => path.resolve(baseDir, baseName) }` |
154
+ | `helpers` | `Record<string, (string) => string>` | Helpers are simple functions that transform your `data` variables into other values. See [Helpers](#helpers) for the list of default helpers, or add your own to be loaded into the template parser. |
155
+ | `beforeWrite` | `(content: Buffer, rawContent: Buffer, outputPath: string) => String \| Buffer \| undefined` | Supply this function to override the final output contents of each of your files. The return value of this function will replace the output content of the respective file, which you may discriminate (if needed) using the `outputPath` argument. |
136
156
 
137
157
  ## Preparing files
138
158
 
@@ -140,6 +160,22 @@ available:
140
160
 
141
161
  Put your template files anywhere, and fill them with tokens for replacement.
142
162
 
163
+ Each template (not file) in the config array is parsed individually, and copied to the output
164
+ directory. If a single template path contains multiple files (e.g. if you use a folder path or a
165
+ glob pattern), the first directory up the tree of that template will become the base inside the
166
+ defined output path for that template, while copying files recursively and maintaining their
167
+ relative structure.
168
+
169
+ Examples:
170
+
171
+ > In the following examples, the config `name` is `AppName`, and the config `output` is `src`.
172
+
173
+ | Input template | Output path(s) |
174
+ | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
175
+ | `./templates/{{ name }}.txt` | `src/AppName.txt` |
176
+ | `./templates/directory` <br /><br /> Directory contents:<br /> <ol><li>`outer/{{name}}.txt`</li></li><li>`outer2/inner/{{name.txt}}`</li></ol> | `src/outer/AppName.txt`,<br />`src/outer2/inner/AppName.txt` |
177
+ | `./templates/others/**/*.txt` <br /><br /> Directory contents:<br /> <ol><li>`outer/{{name}}.jpg`</li></li><li>`outer2/inner/{{name.txt}}`</li></ol> | `src/outer2/inner/AppName.txt` |
178
+
143
179
  ### Variable/token replacement
144
180
 
145
181
  Scaffolding will replace `{{ varName }}` in both the file name and its contents and put the
@@ -148,37 +184,87 @@ transformed files in the output directory.
148
184
  The data available for the template parser is the data you pass to the `data` config option (or
149
185
  `--data` argument in CLI).
150
186
 
187
+ For example, using the following command:
188
+
189
+ ```bash
190
+ npx simple-scaffold@latest \
191
+ --templates templates/components/{{name}}.jsx \
192
+ --output src/components \
193
+ -create-sub-folder true \
194
+ MyComponent
195
+ ```
196
+
197
+ Will output a file with the path:
198
+
199
+ ```plaintext
200
+ <working_dir>/src/components/MyComponent.jsx
201
+ ```
202
+
203
+ The contents of the file will be transformed in a similar fashion.
204
+
151
205
  Your `data` will be pre-populated with the following:
152
206
 
153
207
  - `{{Name}}`: PascalCase of the component name
154
- - `{{name}}`: raw name of the component
208
+ - `{{name}}`: raw name of the component as you entered it
155
209
 
156
- > Simple-Scaffold uses [Handlebars.js](https://handlebarsjs.com/) for outputting the file contents,
157
- > see their documentation for more information on syntax.
210
+ > Simple-Scaffold uses [Handlebars.js](https://handlebarsjs.com/) for outputting the file contents.
158
211
  > Any `data` you add in the config will be available for use with their names wrapped in
159
- > `{{` and `}}`.
212
+ > `{{` and `}}`. Other Handlebars built-ins such as `each`, `if` and `with` are also supported, see
213
+ > [Handlebars.js Language Features](https://handlebarsjs.com/guide/#language-features) for more
214
+ > information.
160
215
 
161
- #### Helpers
216
+ ### Built-in Helpers
162
217
 
163
218
  Simple-Scaffold provides some built-in text transformation filters usable by handleBars.
164
219
 
165
220
  For example, you may use `{{ snakeCase name }}` inside a template file or filename, and it will
166
221
  replace `My Name` with `my_name` when producing the final value.
167
222
 
168
- Here are the built-in helpers available for use:
223
+ #### Capitalization Helpers
224
+
225
+ | Helper name | Example code | Example output |
226
+ | ------------ | ----------------------- | -------------- |
227
+ | [None] | `{{ name }}` | my name |
228
+ | `camelCase` | `{{ camelCase name }}` | myName |
229
+ | `snakeCase` | `{{ snakeCase name }}` | my_name |
230
+ | `startCase` | `{{ startCase name }}` | My Name |
231
+ | `kebabCase` | `{{ kebabCase name }}` | my-name |
232
+ | `hyphenCase` | `{{ hyphenCase name }}` | my-name |
233
+ | `pascalCase` | `{{ pascalCase name }}` | MyName |
234
+ | `upperCase` | `{{ upperCase name }}` | MY NAME |
235
+ | `lowerCase` | `{{ lowerCase name }}` | my name |
236
+
237
+ #### Date helpers
238
+
239
+ | Helper name | Description | Example code | Example output |
240
+ | -------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------- |
241
+ | `now` | Current date with format | `{{ now "yyyy-MM-dd HH:mm" }}` | 2042-01-01 15:00 |
242
+ | `now` (with offset) | Current date with format, and with offset | `{{ now "yyyy-MM-dd HH:mm" -1 "hours" }}` | 2042-01-01 14:00 |
243
+ | `date` | Custom date with format | `{{ date "2042-01-01T15:00:00Z" "yyyy-MM-dd HH:mm" }}` | 2042-01-01 15:00 |
244
+ | `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 |
245
+ | `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 |
169
246
 
170
- | Helper name | Example code | Example output |
171
- | ----------- | ----------------------- | -------------- |
172
- | camelCase | `{{ camelCase name }}` | myName |
173
- | snakeCase | `{{ snakeCase name }}` | my_name |
174
- | startCase | `{{ startCase name }}` | My Name |
175
- | kebabCase | `{{ kebabCase name }}` | my-name |
176
- | hyphenCase | `{{ hyphenCase name }}` | my-name |
177
- | pascalCase | `{{ pascalCase name }}` | MyName |
178
- | upperCase | `{{ upperCase name }}` | MYNAME |
179
- | lowerCase | `{{ lowerCase name }}` | myname |
247
+ Further details:
180
248
 
181
- > These helpers are available for any data property, not exclusive to `name`.
249
+ - We use [`date-fns`](https://date-fns.org/docs/) for parsing/manipulating the dates.
250
+ If you want more information on the date tokens to use, refer to
251
+ [their format documentation](https://date-fns.org/docs/format).
252
+
253
+ - The date helper format takes the following arguments:
254
+
255
+ ```typescript
256
+ (
257
+ date: string,
258
+ format: string,
259
+ offsetAmount?: number,
260
+ offsetType?: "years" | "months" | "weeks" | "days" | "hours" | "minutes" | "seconds"
261
+ )
262
+ ```
263
+
264
+ - **The now helper** (for current time) takes the same arguments, minus the first one (`date`) as
265
+ it is implicitly the current date.
266
+
267
+ ### Custom Helpers
182
268
 
183
269
  You may also add your own custom helpers using the `helpers` options when using the JS API (rather
184
270
  than the CLI). The `helpers` option takes an object whose keys are helper names, and values are
@@ -190,8 +276,8 @@ config.helpers = {
190
276
  }
191
277
  ```
192
278
 
193
- These helpers will also be available to you when using `subFolderNameHelper` or
194
- `--sub-folder-name-helper` as a possible value.
279
+ All of the above helpers (built in and custom) will also be available to you when using
280
+ `subFolderNameHelper` (`--sub-folder-name-helper`/`-sh`) as a possible value.
195
281
 
196
282
  ## Examples
197
283
 
@@ -220,12 +306,12 @@ simple-scaffold MyComponent \
220
306
 
221
307
  #### Contents of `project/scaffold/{{Name}}.jsx`
222
308
 
223
- ```js
224
- const React = require('react')
309
+ ```typescriptreact
310
+ import React from 'react'
225
311
 
226
- module.exports = function {{Name}}(props) {
312
+ export default {{camelCase ame}}: React.FC = (props) => {
227
313
  return (
228
- <div className="{{className}}">{{Name}} Component</div>
314
+ <div className="{{className}}">{{camelCase name}} Component</div>
229
315
  )
230
316
  }
231
317
  ```
@@ -255,10 +341,10 @@ With `createSubFolder = false`:
255
341
 
256
342
  #### Contents of `project/scaffold/MyComponent/MyComponent.jsx`
257
343
 
258
- ```js
259
- const React = require("react")
344
+ ```typescriptreact
345
+ import React from 'react'
260
346
 
261
- module.exports = function MyComponent(props) {
347
+ export default MyComponent: React.FC = (props) => {
262
348
  return (
263
349
  <div className="myClassName">MyComponent Component</div>
264
350
  )
@@ -267,6 +353,16 @@ module.exports = function MyComponent(props) {
267
353
 
268
354
  ## Contributing
269
355
 
356
+ I am developing this package on my free time, so any support, whether code, issues, or just stars
357
+ is very helpful to sustaining its life. If you would like to donate a bit to help keep the project
358
+ alive, I would be very thankful!
359
+
360
+ <a href='https://ko-fi.com/casraf' target='_blank'>
361
+ <img height='36' style='border:0px;height:36px;'
362
+ src='https://cdn.ko-fi.com/cdn/kofi1.png?v=3'
363
+ alt='Buy Me a Coffee at ko-fi.com' />
364
+ </a>
365
+
270
366
  I welcome any issues or pull requests on GitHub. If you find a bug, or would like a new feature,
271
367
  don't hesitate to open an appropriate issue and I will do my best to reply promptly.
272
368
 
package/package.json CHANGED
@@ -1,14 +1,25 @@
1
1
  {
2
2
  "name": "simple-scaffold",
3
- "version": "1.0.3",
3
+ "version": "1.1.0-alpha.2",
4
4
  "description": "Create files based on templates",
5
5
  "repository": "https://github.com/chenasraf/simple-scaffold.git",
6
6
  "author": "Chen Asraf <inbox@casraf.com>",
7
7
  "license": "MIT",
8
8
  "main": "index.js",
9
9
  "bin": "cmd.js",
10
+ "keywords": [
11
+ "javascript",
12
+ "cli",
13
+ "template",
14
+ "files",
15
+ "typescript",
16
+ "generator",
17
+ "scaffold",
18
+ "file",
19
+ "scaffolding"
20
+ ],
10
21
  "scripts": {
11
- "clean": "rm -rf dist/",
22
+ "clean": "rimraf dist/",
12
23
  "build": "yarn clean && tsc && chmod -R +x ./dist && cp ./package.json ./README.md ./dist/",
13
24
  "dev": "tsc --watch",
14
25
  "start": "node dist/scaffold.js",
@@ -19,6 +30,7 @@
19
30
  },
20
31
  "dependencies": {
21
32
  "chalk": "^4.1.2",
33
+ "date-fns": "^2.28.0",
22
34
  "glob": "^7.1.3",
23
35
  "handlebars": "^4.7.7",
24
36
  "lodash": "^4.17.21",
@@ -26,7 +38,6 @@
26
38
  "util.promisify": "^1.1.1"
27
39
  },
28
40
  "devDependencies": {
29
- "@types/args": "^3.0.1",
30
41
  "@types/glob": "^7.1.1",
31
42
  "@types/jest": "^26.0.24",
32
43
  "@types/lodash": "^4.14.171",
@@ -34,6 +45,7 @@
34
45
  "@types/node": "^14.14.22",
35
46
  "jest": "^27.0.6",
36
47
  "mock-fs": "^5.0.0",
48
+ "rimraf": "^3.0.2",
37
49
  "ts-jest": "^27.0.3",
38
50
  "ts-node": "^10.1.0",
39
51
  "typescript": "^4.3.5"
package/scaffold.js CHANGED
@@ -65,7 +65,10 @@ async function Scaffold({ ...options }) {
65
65
  isDirOrGlob,
66
66
  isGlob,
67
67
  });
68
- await handleTemplateFile(options, options.data, { templatePath: inputFilePath, basePath });
68
+ await handleTemplateFile(options, options.data, {
69
+ templatePath: inputFilePath,
70
+ basePath,
71
+ });
69
72
  }
70
73
  }
71
74
  catch (e) {
@@ -87,11 +90,11 @@ async function handleTemplateFile(options, data, { templatePath, basePath }) {
87
90
  templatePath,
88
91
  basePath,
89
92
  });
90
- const overwrite = utils_1.getOptionValueForFile(options, inputPath, data, (_a = options.overwrite) !== null && _a !== void 0 ? _a : false);
93
+ const overwrite = utils_1.getOptionValueForFile(options, inputPath, (_a = options.overwrite) !== null && _a !== void 0 ? _a : false);
91
94
  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`);
92
95
  await utils_1.createDirIfNotExists(path_1.default.dirname(outputPath), options);
93
96
  utils_1.log(options, types_1.LogLevel.Info, `Writing to ${outputPath}`);
94
- await utils_1.copyFileTransformed(options, data, { exists, overwrite, outputPath, inputPath });
97
+ await utils_1.copyFileTransformed(options, { exists, overwrite, outputPath, inputPath });
95
98
  resolve();
96
99
  }
97
100
  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,mCAkBgB;AAChB,mCAAkD;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACI,KAAK,UAAU,QAAQ,CAAC,EAAE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,WAAG,CACD,OAAO,EACP,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,OAAO,CAAC,CAAA;YAE7D,WAAG,CAAC,OAAO,EAAE,gBAAQ,CAAC,IAAI,EAAE,cAAc,UAAU,EAAE,CAAC,CAAA;YACvD,MAAM,2BAAmB,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAA;YAChF,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,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  export declare enum LogLevel {
2
3
  None = 0,
3
4
  Debug = 1,
@@ -7,9 +8,9 @@ export declare enum LogLevel {
7
8
  }
8
9
  export declare type FileResponseFn<T> = (fullPath: string, basedir: string, basename: string) => T;
9
10
  export declare type FileResponse<T> = T | FileResponseFn<T>;
10
- export declare type DefaultHelperKeys = "camelCase" | "snakeCase" | "startCase" | "kebabCase" | "hyphenCase" | "pascalCase" | "lowerCase" | "upperCase";
11
+ export declare type DefaultHelperKeys = "camelCase" | "date" | "hyphenCase" | "kebabCase" | "lowerCase" | "now" | "pascalCase" | "snakeCase" | "startCase" | "upperCase";
11
12
  export declare type HelperKeys<T> = DefaultHelperKeys | T;
12
- export declare type Helper = (text: string) => string;
13
+ export declare type Helper = Handlebars.HelperDelegate;
13
14
  export interface ScaffoldConfig {
14
15
  /**
15
16
  * Name to be passed to the generated files. `{{name}}` and `{{Name}}` inside contents and file names will be replaced
@@ -89,6 +90,21 @@ export interface ScaffoldConfig {
89
90
  * helpers, or a custom one you provide to `helpers`. Defaults to `undefined`, which means no transformation is done.
90
91
  */
91
92
  subFolderNameHelper?: DefaultHelperKeys | string;
93
+ /**
94
+ * This callback runs right before content is being written to the disk. If you supply this function, you may return
95
+ * a string that represents the final content of your file, you may process the content as you see fit. For example,
96
+ * you may run formatters on a file, fix output in edge-cases not supported by helpers or data, etc.
97
+ *
98
+ * If the return value of this function is `undefined`, the original content will be used.
99
+ *
100
+ * @param content The original template after token replacement
101
+ * @param rawContent The original template before token replacement
102
+ * @param outputPath The final output path of the processed file
103
+ *
104
+ * @returns `String | Buffer | undefined` The final output of the file contents-only, after further modifications -
105
+ * or `undefined` to use the original content (i.e. `content.toString()`)
106
+ */
107
+ beforeWrite?(content: Buffer, rawContent: Buffer, outputPath: string): string | Buffer | undefined;
92
108
  }
93
109
  export interface ScaffoldCmdConfig {
94
110
  name: string;
package/utils.d.ts CHANGED
@@ -1,14 +1,20 @@
1
1
  /// <reference types="node" />
2
2
  import { DefaultHelperKeys, FileResponse, Helper, LogLevel, ScaffoldConfig } from "./types";
3
3
  export declare const defaultHelpers: Record<DefaultHelperKeys, Helper>;
4
+ export declare function _dateHelper(date: Date, formatString: string): string;
5
+ export declare function _dateHelper(date: Date, formatString: string, durationDifference: number, durationType: keyof Duration): string;
6
+ export declare function nowHelper(formatString: string): string;
7
+ export declare function nowHelper(formatString: string, durationDifference: number, durationType: keyof Duration): string;
8
+ export declare function dateHelper(date: string, formatString: string): string;
9
+ export declare function dateHelper(date: string, formatString: string, durationDifference: number, durationType: keyof Duration): string;
4
10
  export declare function registerHelpers(options: ScaffoldConfig): void;
5
11
  export declare function handleErr(err: NodeJS.ErrnoException | null): void;
6
12
  export declare function log(options: ScaffoldConfig, level: LogLevel, ...obj: any[]): void;
7
13
  export declare function createDirIfNotExists(dir: string, options: ScaffoldConfig): Promise<void>;
8
- export declare function getOptionValueForFile<T>(options: ScaffoldConfig, filePath: string, data: Record<string, string>, fn: FileResponse<T>, defaultValue?: T): T;
14
+ export declare function getOptionValueForFile<T>(options: ScaffoldConfig, filePath: string, fn: FileResponse<T>, defaultValue?: T): T;
9
15
  export declare function handlebarsParse(options: ScaffoldConfig, templateBuffer: Buffer | string, { isPath }?: {
10
16
  isPath?: boolean;
11
- }): string | Buffer;
17
+ }): Buffer;
12
18
  export declare function pathExists(filePath: string): Promise<boolean>;
13
19
  export declare function pascalCase(s: string): string;
14
20
  export declare function isDir(path: string): Promise<boolean>;
@@ -36,13 +42,13 @@ export declare function getTemplateFileInfo(options: ScaffoldConfig, data: Recor
36
42
  templatePath: string;
37
43
  basePath: string;
38
44
  }): Promise<OutputFileInfo>;
39
- export declare function copyFileTransformed(options: ScaffoldConfig, data: Record<string, string>, { exists, overwrite, outputPath, inputPath, }: {
45
+ export declare function copyFileTransformed(options: ScaffoldConfig, { exists, overwrite, outputPath, inputPath, }: {
40
46
  exists: boolean;
41
47
  overwrite: boolean;
42
48
  outputPath: string;
43
49
  inputPath: string;
44
50
  }): Promise<void>;
45
- export declare function getOutputDir(options: ScaffoldConfig, data: Record<string, string>, outputPathOpt: string, basePath: string): string;
51
+ export declare function getOutputDir(options: ScaffoldConfig, outputPathOpt: string, basePath: string): string;
46
52
  export declare function logInputFile(options: ScaffoldConfig, { origTemplate, relPath, template, inputFilePath, nonGlobTemplate, basePath, isDirOrGlob, isGlob, }: {
47
53
  origTemplate: string;
48
54
  relPath: string;
package/utils.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.logInitStep = exports.logInputFile = exports.getOutputDir = exports.copyFileTransformed = exports.getTemplateFileInfo = exports.ensureFileExists = exports.getTemplateGlobInfo = exports.getFileList = exports.getBasePath = exports.makeRelativePath = exports.removeGlob = exports.isDir = exports.pascalCase = exports.pathExists = exports.handlebarsParse = exports.getOptionValueForFile = exports.createDirIfNotExists = exports.log = exports.handleErr = exports.registerHelpers = exports.defaultHelpers = void 0;
6
+ exports.logInitStep = exports.logInputFile = exports.getOutputDir = exports.copyFileTransformed = exports.getTemplateFileInfo = exports.ensureFileExists = exports.getTemplateGlobInfo = exports.getFileList = exports.getBasePath = exports.makeRelativePath = exports.removeGlob = exports.isDir = exports.pascalCase = exports.pathExists = exports.handlebarsParse = exports.getOptionValueForFile = exports.createDirIfNotExists = exports.log = exports.handleErr = exports.registerHelpers = exports.dateHelper = exports.nowHelper = exports._dateHelper = exports.defaultHelpers = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const constants_1 = require("constants");
9
9
  const types_1 = require("./types");
@@ -15,6 +15,14 @@ const handlebars_1 = __importDefault(require("handlebars"));
15
15
  const fs_1 = require("fs");
16
16
  const chalk_1 = __importDefault(require("chalk"));
17
17
  const { stat, access, mkdir } = fs_1.promises;
18
+ const add_1 = __importDefault(require("date-fns/add"));
19
+ const format_1 = __importDefault(require("date-fns/format"));
20
+ const parseISO_1 = __importDefault(require("date-fns/parseISO"));
21
+ const dateFns = {
22
+ add: add_1.default,
23
+ format: format_1.default,
24
+ parseISO: parseISO_1.default,
25
+ };
18
26
  const glob_1 = require("glob");
19
27
  const util_1 = require("util");
20
28
  const { readFile, writeFile } = fs_1.promises;
@@ -27,7 +35,24 @@ exports.defaultHelpers = {
27
35
  pascalCase,
28
36
  lowerCase: (text) => text.toLowerCase(),
29
37
  upperCase: (text) => text.toUpperCase(),
38
+ now: nowHelper,
39
+ date: dateHelper,
30
40
  };
41
+ function _dateHelper(date, formatString, durationDifference, durationType) {
42
+ if (durationType && durationDifference !== undefined) {
43
+ return dateFns.format(dateFns.add(date, { [durationType]: durationDifference }), formatString);
44
+ }
45
+ return dateFns.format(date, formatString);
46
+ }
47
+ exports._dateHelper = _dateHelper;
48
+ function nowHelper(formatString, durationDifference, durationType) {
49
+ return _dateHelper(new Date(), formatString, durationDifference, durationType);
50
+ }
51
+ exports.nowHelper = nowHelper;
52
+ function dateHelper(date, formatString, durationDifference, durationType) {
53
+ return _dateHelper(dateFns.parseISO(date), formatString, durationDifference, durationType);
54
+ }
55
+ exports.dateHelper = dateHelper;
31
56
  function registerHelpers(options) {
32
57
  const _helpers = { ...exports.defaultHelpers, ...options.helpers };
33
58
  for (const helperName in _helpers) {
@@ -83,7 +108,7 @@ async function createDirIfNotExists(dir, options) {
83
108
  }
84
109
  }
85
110
  exports.createDirIfNotExists = createDirIfNotExists;
86
- function getOptionValueForFile(options, filePath, data, fn, defaultValue) {
111
+ function getOptionValueForFile(options, filePath, fn, defaultValue) {
87
112
  if (typeof fn !== "function") {
88
113
  return defaultValue !== null && defaultValue !== void 0 ? defaultValue : fn;
89
114
  }
@@ -102,11 +127,12 @@ function handlebarsParse(options, templateBuffer, { isPath = false } = {}) {
102
127
  if (isPath && path_1.default.sep !== "/") {
103
128
  outputContents = outputContents.replace(/\//g, "\\");
104
129
  }
105
- return outputContents;
130
+ return Buffer.from(outputContents);
106
131
  }
107
- catch {
132
+ catch (e) {
133
+ log(options, types_1.LogLevel.Debug, e);
108
134
  log(options, types_1.LogLevel.Warning, "Couldn't parse file with handlebars, returning original content");
109
- return templateBuffer;
135
+ return Buffer.from(templateBuffer);
110
136
  }
111
137
  }
112
138
  exports.handlebarsParse = handlebarsParse;
@@ -182,8 +208,8 @@ async function ensureFileExists(template, isGlob) {
182
208
  exports.ensureFileExists = ensureFileExists;
183
209
  async function getTemplateFileInfo(options, data, { templatePath, basePath }) {
184
210
  const inputPath = path_1.default.resolve(process.cwd(), templatePath);
185
- const outputPathOpt = getOptionValueForFile(options, inputPath, data, options.output);
186
- const outputDir = getOutputDir(options, data, outputPathOpt, basePath);
211
+ const outputPathOpt = getOptionValueForFile(options, inputPath, options.output);
212
+ const outputDir = getOutputDir(options, outputPathOpt, basePath);
187
213
  const outputPath = handlebarsParse(options, path_1.default.join(outputDir, path_1.default.basename(inputPath)), {
188
214
  isPath: true,
189
215
  }).toString();
@@ -191,20 +217,22 @@ async function getTemplateFileInfo(options, data, { templatePath, basePath }) {
191
217
  return { inputPath, outputPathOpt, outputDir, outputPath, exists };
192
218
  }
193
219
  exports.getTemplateFileInfo = getTemplateFileInfo;
194
- async function copyFileTransformed(options, data, { exists, overwrite, outputPath, inputPath, }) {
220
+ async function copyFileTransformed(options, { exists, overwrite, outputPath, inputPath, }) {
221
+ var _a, _b;
195
222
  if (!exists || overwrite) {
196
223
  if (exists && overwrite) {
197
224
  log(options, types_1.LogLevel.Info, `File ${outputPath} exists, overwriting`);
198
225
  }
199
226
  const templateBuffer = await readFile(inputPath);
200
- const outputContents = handlebarsParse(options, templateBuffer);
227
+ const unprocessedOutputContents = handlebarsParse(options, templateBuffer);
228
+ const finalOutputContents = ((_b = (_a = options.beforeWrite) === null || _a === void 0 ? void 0 : _a.call(options, unprocessedOutputContents, templateBuffer, outputPath)) !== null && _b !== void 0 ? _b : unprocessedOutputContents).toString();
201
229
  if (!options.dryRun) {
202
- await writeFile(outputPath, outputContents);
230
+ await writeFile(outputPath, finalOutputContents);
203
231
  log(options, types_1.LogLevel.Info, "Done.");
204
232
  }
205
233
  else {
206
234
  log(options, types_1.LogLevel.Info, "Content output:");
207
- log(options, types_1.LogLevel.Info, outputContents);
235
+ log(options, types_1.LogLevel.Info, finalOutputContents);
208
236
  }
209
237
  }
210
238
  else if (exists) {
@@ -212,13 +240,13 @@ async function copyFileTransformed(options, data, { exists, overwrite, outputPat
212
240
  }
213
241
  }
214
242
  exports.copyFileTransformed = copyFileTransformed;
215
- function getOutputDir(options, data, outputPathOpt, basePath) {
243
+ function getOutputDir(options, outputPathOpt, basePath) {
216
244
  return path_1.default.resolve(process.cwd(), ...[
217
245
  outputPathOpt,
218
246
  basePath,
219
247
  options.createSubFolder
220
248
  ? options.subFolderNameHelper
221
- ? handlebarsParse(options, `{{ ${options.subFolderNameHelper} name }}`)
249
+ ? handlebarsParse(options, `{{ ${options.subFolderNameHelper} name }}`).toString()
222
250
  : options.name
223
251
  : undefined,
224
252
  ].filter(Boolean));
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;AAE1C,+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;CACxC,CAAA;AAED,SAAgB,eAAe,CAAC,OAAuB;IACrD,MAAM,QAAQ,GAAG,EAAE,GAAG,sBAAc,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAA;IAC1D,KAAK,MAAM,UAAU,IAAI,QAAQ,EAAE;QACjC,GAAG,CAAC,OAAO,EAAE,gBAAQ,CAAC,KAAK,EAAE,uBAAuB,UAAU,EAAE,CAAC,CAAA;QACjE,oBAAU,CAAC,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,UAAmC,CAAC,CAAC,CAAA;KACrF;AACH,CAAC;AAND,0CAMC;AAED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