simple-scaffold 1.0.0-alpha.8 → 1.0.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 +120 -48
- package/cmd.d.ts +2 -1
- package/cmd.js +100 -2
- package/cmd.js.map +1 -1
- package/package.json +3 -4
- package/scaffold.d.ts +31 -1
- package/scaffold.js +66 -65
- package/scaffold.js.map +1 -1
- package/types.d.ts +73 -3
- package/utils.d.ts +46 -3
- package/utils.js +142 -13
- package/utils.js.map +1 -1
- package/cmd_util.d.ts +0 -1
- package/cmd_util.js +0 -90
- package/cmd_util.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Simple Scaffold allows you to create your structured files based on templates.
|
|
4
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.
|
|
14
|
+
|
|
5
15
|
## Install
|
|
6
16
|
|
|
7
17
|
You can either use it as a command line tool or import into your own code and run from there.
|
|
@@ -26,41 +36,45 @@ Create structured files based on templates.
|
|
|
26
36
|
|
|
27
37
|
Options:
|
|
28
38
|
|
|
29
|
-
--help|-h
|
|
39
|
+
--help|-h Display help information
|
|
40
|
+
|
|
41
|
+
--name|-n Name to be passed to the generated files. {{name}} and
|
|
42
|
+
{{Name}} inside contents and file names will be replaced
|
|
43
|
+
accordingly.
|
|
30
44
|
|
|
31
|
-
--
|
|
32
|
-
|
|
33
|
-
|
|
45
|
+
--output|-o Path to output to. If --create-sub-folder is enabled,
|
|
46
|
+
the subfolder will be created inside this path.
|
|
47
|
+
(default: current dir)
|
|
34
48
|
|
|
35
|
-
--
|
|
36
|
-
|
|
49
|
+
--templates|-t Template files to use as input. You may provide multiple
|
|
50
|
+
files, each of which can be a relative or absolute path, or a
|
|
51
|
+
glob pattern for multiple file matching easily.
|
|
37
52
|
|
|
38
|
-
--
|
|
39
|
-
|
|
40
|
-
pattern for multiple file matching easily. (default:
|
|
41
|
-
)
|
|
53
|
+
--overwrite|-w Enable to override output files, even if they already
|
|
54
|
+
exist. (default: false)
|
|
42
55
|
|
|
43
|
-
--
|
|
44
|
-
|
|
56
|
+
--data|-d Add custom data to the templates. By default, only your
|
|
57
|
+
app name is included.
|
|
45
58
|
|
|
46
|
-
--
|
|
47
|
-
|
|
59
|
+
--create-sub-folder|-s Create subfolder with the input name
|
|
60
|
+
(default: false)
|
|
48
61
|
|
|
49
|
-
--
|
|
50
|
-
|
|
62
|
+
--sub-folder-name-helper|-sh Default helper to apply to subfolder name when using
|
|
63
|
+
`--create-sub-folder true`.
|
|
51
64
|
|
|
52
|
-
--quiet|-q
|
|
53
|
-
|
|
65
|
+
--quiet|-q Suppress output logs (Same as --verbose 0)
|
|
66
|
+
(default: false)
|
|
54
67
|
|
|
55
|
-
--verbose|-v
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
68
|
+
--verbose|-v Determine amount of logs to display. The values are:
|
|
69
|
+
0 (none) | 1 (debug) | 2 (info) | 3 (warn) | 4
|
|
70
|
+
(error). The provided level will display messages of
|
|
71
|
+
the same level or higher. (default:
|
|
72
|
+
2)
|
|
59
73
|
|
|
60
|
-
--dry-run|-dr
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
74
|
+
--dry-run|-dr Don't emit files. This is good for testing your
|
|
75
|
+
scaffolds and making sure they don't fail, without having to
|
|
76
|
+
write actual file contents or create directories.
|
|
77
|
+
(default: false)
|
|
64
78
|
```
|
|
65
79
|
|
|
66
80
|
You can also add this as a script in your `package.json`:
|
|
@@ -78,32 +92,47 @@ You can also add this as a script in your `package.json`:
|
|
|
78
92
|
## Use in Node.js
|
|
79
93
|
|
|
80
94
|
You can also build the scaffold yourself, if you want to create more complex arguments or scaffold groups.
|
|
81
|
-
Simply pass a config object to the
|
|
95
|
+
Simply pass a config object to the Scaffold function when you are ready to start.
|
|
82
96
|
The config takes similar arguments to the command line:
|
|
83
97
|
|
|
84
|
-
```
|
|
85
|
-
|
|
98
|
+
```typescript
|
|
99
|
+
import Scaffold from "simple-scaffold"
|
|
86
100
|
|
|
87
|
-
const
|
|
101
|
+
const config = {
|
|
88
102
|
name: "component",
|
|
89
103
|
templates: [path.join(__dirname, "scaffolds", "component")],
|
|
90
104
|
output: path.join(__dirname, "src", "components"),
|
|
91
105
|
createSubFolder: true,
|
|
106
|
+
subFolderNameHelper: "upperCase"
|
|
92
107
|
locals: {
|
|
93
108
|
property: "value",
|
|
94
109
|
},
|
|
95
|
-
|
|
110
|
+
helpers: {
|
|
111
|
+
twice: (text) => [text, text].join(" ")
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const scaffold = Scaffold(config)
|
|
96
116
|
```
|
|
97
117
|
|
|
98
|
-
|
|
99
|
-
function for each input file to output into a dynamic path:
|
|
118
|
+
### Additional Node.js options
|
|
100
119
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
120
|
+
In addition to all the options available in the command line, there are some JS-specific options
|
|
121
|
+
available:
|
|
122
|
+
|
|
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:
|
|
125
|
+
|
|
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.
|
|
107
136
|
|
|
108
137
|
## Preparing files
|
|
109
138
|
|
|
@@ -146,8 +175,23 @@ Here are the built-in helpers available for use:
|
|
|
146
175
|
| kebabCase | `{{ kebabCase name }}` | my-name |
|
|
147
176
|
| hyphenCase | `{{ hyphenCase name }}` | my-name |
|
|
148
177
|
| pascalCase | `{{ pascalCase name }}` | MyName |
|
|
178
|
+
| upperCase | `{{ upperCase name }}` | MYNAME |
|
|
179
|
+
| lowerCase | `{{ lowerCase name }}` | myname |
|
|
180
|
+
|
|
181
|
+
> These helpers are available for any data property, not exclusive to `name`.
|
|
149
182
|
|
|
150
|
-
|
|
183
|
+
You may also add your own custom helpers using the `helpers` options when using the JS API (rather
|
|
184
|
+
than the CLI). The `helpers` option takes an object whose keys are helper names, and values are
|
|
185
|
+
the transformation functions. For example, `upperCase` is implemented like so:
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
config.helpers = {
|
|
189
|
+
upperCase: (text) => text.toUpperCase(),
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
These helpers will also be available to you when using `subFolderNameHelper` or
|
|
194
|
+
`--sub-folder-name-helper` as a possible value.
|
|
151
195
|
|
|
152
196
|
## Examples
|
|
153
197
|
|
|
@@ -174,15 +218,15 @@ simple-scaffold MyComponent \
|
|
|
174
218
|
- ...
|
|
175
219
|
```
|
|
176
220
|
|
|
177
|
-
#### Contents of `project/scaffold/{{Name}}.
|
|
221
|
+
#### Contents of `project/scaffold/{{Name}}.jsx`
|
|
178
222
|
|
|
179
223
|
```js
|
|
180
224
|
const React = require('react')
|
|
181
225
|
|
|
182
|
-
module.exports =
|
|
183
|
-
|
|
226
|
+
module.exports = function {{Name}}(props) {
|
|
227
|
+
return (
|
|
184
228
|
<div className="{{className}}">{{Name}} Component</div>
|
|
185
|
-
|
|
229
|
+
)
|
|
186
230
|
}
|
|
187
231
|
```
|
|
188
232
|
|
|
@@ -209,14 +253,42 @@ With `createSubFolder = false`:
|
|
|
209
253
|
- ...
|
|
210
254
|
```
|
|
211
255
|
|
|
212
|
-
#### Contents of `project/scaffold/MyComponent/MyComponent.
|
|
256
|
+
#### Contents of `project/scaffold/MyComponent/MyComponent.jsx`
|
|
213
257
|
|
|
214
258
|
```js
|
|
215
259
|
const React = require("react")
|
|
216
260
|
|
|
217
|
-
module.exports =
|
|
218
|
-
|
|
261
|
+
module.exports = function MyComponent(props) {
|
|
262
|
+
return (
|
|
219
263
|
<div className="myClassName">MyComponent Component</div>
|
|
220
|
-
|
|
264
|
+
)
|
|
221
265
|
}
|
|
222
266
|
```
|
|
267
|
+
|
|
268
|
+
## Contributing
|
|
269
|
+
|
|
270
|
+
I welcome any issues or pull requests on GitHub. If you find a bug, or would like a new feature,
|
|
271
|
+
don't hesitate to open an appropriate issue and I will do my best to reply promptly.
|
|
272
|
+
|
|
273
|
+
If you are a developer and want to contribute code, here are some starting tips:
|
|
274
|
+
|
|
275
|
+
1. Fork this repository
|
|
276
|
+
2. Run `yarn install`
|
|
277
|
+
3. Run `yarn dev` to start file watch mode
|
|
278
|
+
4. Make any changes you would like
|
|
279
|
+
5. Create tests for your changes
|
|
280
|
+
6. Update the relevant documentation (readme, code comments, type comments)
|
|
281
|
+
7. Create a PR on upstream
|
|
282
|
+
|
|
283
|
+
Some tips on getting around the code:
|
|
284
|
+
|
|
285
|
+
- Use `yarn dev` for development - it runs TypeScript compile in watch mode, allowing you to make
|
|
286
|
+
changes and immediately be able to try them using `yarn cmd`.
|
|
287
|
+
- Use `yarn build` to build the output
|
|
288
|
+
- Use `yarn test` to run tests
|
|
289
|
+
- Use `yarn cmd` to use the CLI feature of Simple Scaffold from within the root directory,
|
|
290
|
+
enabling you to test different behaviors. See `yarn cmd -h` for more information.
|
|
291
|
+
|
|
292
|
+
> This requires an updated build, and does not trigger one itself. Either use `yarn dev` to watch
|
|
293
|
+
> for changes and build, or `yarn build` before running this, or use `yarn build-cmd` instead,
|
|
294
|
+
> which triggers a build right before running the command with the rest of the given arguments.
|
package/cmd.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export declare function parseCliArgs(args?: string[]): void;
|
package/cmd.js
CHANGED
|
@@ -1,5 +1,103 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
2
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
7
|
+
exports.parseCliArgs = void 0;
|
|
8
|
+
const massarg_1 = __importDefault(require("massarg"));
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const types_1 = require("./types");
|
|
11
|
+
const scaffold_1 = require("./scaffold");
|
|
12
|
+
function parseCliArgs(args = process.argv.slice(2)) {
|
|
13
|
+
return (massarg_1.default()
|
|
14
|
+
.main(scaffold_1.Scaffold)
|
|
15
|
+
.option({
|
|
16
|
+
name: "name",
|
|
17
|
+
aliases: ["n"],
|
|
18
|
+
description: "Name to be passed to the generated files. {{name}} and {{Name}} inside contents and file names will be replaced accordingly.",
|
|
19
|
+
isDefault: true,
|
|
20
|
+
required: true,
|
|
21
|
+
})
|
|
22
|
+
.option({
|
|
23
|
+
name: "output",
|
|
24
|
+
aliases: ["o"],
|
|
25
|
+
description: `Path to output to. If --create-sub-folder is enabled, the subfolder will be created inside this path. ${chalk_1.default.reset `${chalk_1.default.white `(default: current dir)`}`}`,
|
|
26
|
+
required: true,
|
|
27
|
+
})
|
|
28
|
+
.option({
|
|
29
|
+
name: "templates",
|
|
30
|
+
aliases: ["t"],
|
|
31
|
+
array: true,
|
|
32
|
+
description: "Template files to use as input. You may provide multiple files, each of which can be a relative or absolute path, " +
|
|
33
|
+
"or a glob pattern for multiple file matching easily.",
|
|
34
|
+
required: true,
|
|
35
|
+
})
|
|
36
|
+
.option({
|
|
37
|
+
name: "overwrite",
|
|
38
|
+
aliases: ["w"],
|
|
39
|
+
boolean: true,
|
|
40
|
+
defaultValue: false,
|
|
41
|
+
description: "Enable to override output files, even if they already exist.",
|
|
42
|
+
})
|
|
43
|
+
.option({
|
|
44
|
+
name: "data",
|
|
45
|
+
aliases: ["d"],
|
|
46
|
+
description: "Add custom data to the templates. By default, only your app name is included.",
|
|
47
|
+
parse: (v) => JSON.parse(v),
|
|
48
|
+
})
|
|
49
|
+
.option({
|
|
50
|
+
name: "create-sub-folder",
|
|
51
|
+
aliases: ["s"],
|
|
52
|
+
boolean: true,
|
|
53
|
+
defaultValue: false,
|
|
54
|
+
description: "Create subfolder with the input name",
|
|
55
|
+
})
|
|
56
|
+
.option({
|
|
57
|
+
name: "sub-folder-name-helper",
|
|
58
|
+
aliases: ["sh"],
|
|
59
|
+
description: "Default helper to apply to subfolder name when using `--create-sub-folder true`.",
|
|
60
|
+
})
|
|
61
|
+
.option({
|
|
62
|
+
name: "quiet",
|
|
63
|
+
aliases: ["q"],
|
|
64
|
+
boolean: true,
|
|
65
|
+
defaultValue: false,
|
|
66
|
+
description: "Suppress output logs (Same as --verbose 0)",
|
|
67
|
+
})
|
|
68
|
+
.option({
|
|
69
|
+
name: "verbose",
|
|
70
|
+
aliases: ["v"],
|
|
71
|
+
defaultValue: types_1.LogLevel.Info,
|
|
72
|
+
description: `Determine amount of logs to display. The values are: ${chalk_1.default.bold `0 (none) | 1 (debug) | 2 (info) | 3 (warn) | 4 (error)`}. The provided level will display messages of the same level or higher.`,
|
|
73
|
+
parse: Number,
|
|
74
|
+
})
|
|
75
|
+
.option({
|
|
76
|
+
name: "dry-run",
|
|
77
|
+
aliases: ["dr"],
|
|
78
|
+
boolean: true,
|
|
79
|
+
defaultValue: false,
|
|
80
|
+
description: "Don't emit files. This is good for testing your scaffolds and making sure they " +
|
|
81
|
+
"don't fail, without having to write actual file contents or create directories.",
|
|
82
|
+
})
|
|
83
|
+
// .example({
|
|
84
|
+
// input: `yarn cmd -t examples/test-input/Component -o examples/test-output -d '{"property":"myProp","value":"10"}'`,
|
|
85
|
+
// description: "Usage",
|
|
86
|
+
// output: "",
|
|
87
|
+
// })
|
|
88
|
+
.help({
|
|
89
|
+
binName: "simple-scaffold",
|
|
90
|
+
useGlobalColumns: true,
|
|
91
|
+
usageExample: "[options]",
|
|
92
|
+
header: "Create structured files based on templates.",
|
|
93
|
+
footer: [
|
|
94
|
+
`Copyright © Chen Asraf 2021`,
|
|
95
|
+
`NPM: ${chalk_1.default.underline `https://npmjs.com/package/simple-scaffold`}`,
|
|
96
|
+
`GitHub: ${chalk_1.default.underline `https://github.com/chenasraf/simple-scaffold`}`,
|
|
97
|
+
].join("\n"),
|
|
98
|
+
})
|
|
99
|
+
.parse(args));
|
|
100
|
+
}
|
|
101
|
+
exports.parseCliArgs = parseCliArgs;
|
|
102
|
+
parseCliArgs();
|
|
5
103
|
//# sourceMappingURL=cmd.js.map
|
package/cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmd.js","sourceRoot":"","sources":["../src/cmd.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cmd.js","sourceRoot":"","sources":["../src/cmd.ts"],"names":[],"mappings":";;;;;;;AACA,sDAA6B;AAC7B,kDAAyB;AACzB,mCAAqD;AACrD,yCAAqC;AAErC,SAAgB,YAAY,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACvD,OAAO,CACL,iBAAO,EAA2D;SAC/D,IAAI,CAAC,mBAAQ,CAAC;SACd,MAAM,CAAC;QACN,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,CAAC,GAAG,CAAC;QACd,WAAW,EACT,8HAA8H;QAChI,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,IAAI;KACf,CAAC;SACD,MAA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E,CAAC,GAAG,CAAC;QACd,YAAY,EAAE,gBAAQ,CAAC,IAAI;QAC3B,WAAW,EAAE,wDAAwD,eAAK,CAAC,IAAI,CAAA,wDAAwD,yEAAyE;QAChN,KAAK,EAAE,MAAM;KACd,CAAC;SACD,MAAM,CAAC;QACN,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,CAAC,IAAI,CAAC;QACf,OAAO,EAAE,IAAI;QACb,YAAY,EAAE,KAAK;QACnB,WAAW,EACT,iFAAiF;YACjF,iFAAiF;KACpF,CAAC;QACF,aAAa;QACb,wHAAwH;QACxH,0BAA0B;QAC1B,gBAAgB;QAChB,KAAK;SACJ,IAAI,CAAC;QACJ,OAAO,EAAE,iBAAiB;QAC1B,gBAAgB,EAAE,IAAI;QACtB,YAAY,EAAE,WAAW;QACzB,MAAM,EAAE,6CAA6C;QACrD,MAAM,EAAE;YACN,6BAA6B;YAC7B,QAAQ,eAAK,CAAC,SAAS,CAAA,2CAA2C,EAAE;YACpE,WAAW,eAAK,CAAC,SAAS,CAAA,8CAA8C,EAAE;SAC3E,CAAC,IAAI,CAAC,IAAI,CAAC;KACb,CAAC;SACD,KAAK,CAAC,IAAI,CAAC,CACf,CAAA;AACH,CAAC;AA7FD,oCA6FC;AAED,YAAY,EAAE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "simple-scaffold",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
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
|
-
"types": "types.d.ts",
|
|
11
10
|
"scripts": {
|
|
12
11
|
"clean": "rm -rf dist/",
|
|
13
|
-
"build": "yarn clean && tsc && chmod -R +x ./dist && cp ./package.json ./
|
|
12
|
+
"build": "yarn clean && tsc && chmod -R +x ./dist && cp ./package.json ./README.md ./dist/",
|
|
14
13
|
"dev": "tsc --watch",
|
|
15
14
|
"start": "node dist/scaffold.js",
|
|
16
15
|
"test": "jest --verbose",
|
|
@@ -24,7 +23,7 @@
|
|
|
24
23
|
"glob": "^7.1.3",
|
|
25
24
|
"handlebars": "^4.7.7",
|
|
26
25
|
"lodash": "^4.17.21",
|
|
27
|
-
"massarg": "^1.0.
|
|
26
|
+
"massarg": "^1.0.5",
|
|
28
27
|
"util.promisify": "^1.1.1"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
package/scaffold.d.ts
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
1
|
import { ScaffoldConfig } from "./types";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Create a scaffold using given `options`.
|
|
4
|
+
*
|
|
5
|
+
* #### Create files
|
|
6
|
+
* To create a file structure to output, use any directory and file structure you would like.
|
|
7
|
+
* Inside folder names, file names or file contents, you may place `{{ var }}` where `var` is either
|
|
8
|
+
* `name` which is the scaffold name you provided or one of the keys you provided in the `data` option.
|
|
9
|
+
*
|
|
10
|
+
* The contents and names will be replaced with the transformed values so you can use your original structure as a
|
|
11
|
+
* boilerplate for other projects, components, modules, or even single files.
|
|
12
|
+
*
|
|
13
|
+
* #### Helpers
|
|
14
|
+
* 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` → `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 |
|
|
28
|
+
*
|
|
29
|
+
* Any functions you provide in `helpers` option will also be available to you to make custom formatting as you see fit
|
|
30
|
+
* (for example, formatting a date)
|
|
31
|
+
*/
|
|
32
|
+
export declare function Scaffold({ ...options }: ScaffoldConfig): Promise<void>;
|
|
3
33
|
export default Scaffold;
|
package/scaffold.js
CHANGED
|
@@ -4,48 +4,70 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Scaffold = void 0;
|
|
7
|
-
const glob_1 = require("glob");
|
|
8
7
|
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const util_1 = require("util");
|
|
10
8
|
const fs_1 = require("fs");
|
|
11
9
|
const { readFile, writeFile } = fs_1.promises;
|
|
12
10
|
const utils_1 = require("./utils");
|
|
13
11
|
const types_1 = require("./types");
|
|
14
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Create a scaffold using given `options`.
|
|
14
|
+
*
|
|
15
|
+
* #### Create files
|
|
16
|
+
* To create a file structure to output, use any directory and file structure you would like.
|
|
17
|
+
* Inside folder names, file names or file contents, you may place `{{ var }}` where `var` is either
|
|
18
|
+
* `name` which is the scaffold name you provided or one of the keys you provided in the `data` option.
|
|
19
|
+
*
|
|
20
|
+
* The contents and names will be replaced with the transformed values so you can use your original structure as a
|
|
21
|
+
* boilerplate for other projects, components, modules, or even single files.
|
|
22
|
+
*
|
|
23
|
+
* #### Helpers
|
|
24
|
+
* Helpers are functions you can use to transform your `{{ var }}` contents into other values without having to
|
|
25
|
+
* pre-define the data and use a duplicated key. Common cases are transforming name-case format
|
|
26
|
+
* (e.g. `MyName` → `my_name`), so these have been provided as defaults:
|
|
27
|
+
*
|
|
28
|
+
* | Helper name | Example code | Example output |
|
|
29
|
+
* | ----------- | ----------------------- | -------------- |
|
|
30
|
+
* | camelCase | `{{ camelCase name }}` | myName |
|
|
31
|
+
* | snakeCase | `{{ snakeCase name }}` | my_name |
|
|
32
|
+
* | startCase | `{{ startCase name }}` | My Name |
|
|
33
|
+
* | kebabCase | `{{ kebabCase name }}` | my-name |
|
|
34
|
+
* | hyphenCase | `{{ hyphenCase name }}` | my-name |
|
|
35
|
+
* | pascalCase | `{{ pascalCase name }}` | MyName |
|
|
36
|
+
* | upperCase | `{{ upperCase name }}` | MYNAME |
|
|
37
|
+
* | lowerCase | `{{ lowerCase name }}` | myname |
|
|
38
|
+
*
|
|
39
|
+
* Any functions you provide in `helpers` option will also be available to you to make custom formatting as you see fit
|
|
40
|
+
* (for example, formatting a date)
|
|
41
|
+
*/
|
|
42
|
+
async function Scaffold({ ...options }) {
|
|
43
|
+
var _a;
|
|
44
|
+
(_a = options.output) !== null && _a !== void 0 ? _a : (options.output = process.cwd());
|
|
45
|
+
utils_1.registerHelpers(options);
|
|
15
46
|
try {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
name: options.name,
|
|
20
|
-
templates: options.templates,
|
|
21
|
-
output: options.output,
|
|
22
|
-
createSubfolder: options.createSubFolder,
|
|
23
|
-
data: options.data,
|
|
24
|
-
overwrite: options.overwrite,
|
|
25
|
-
quiet: options.quiet,
|
|
26
|
-
});
|
|
27
|
-
utils_1.log(options, types_1.LogLevel.Info, "Data:", data);
|
|
28
|
-
for (let template of config.templates) {
|
|
47
|
+
options.data = { name: options.name, Name: utils_1.pascalCase(options.name), ...options.data };
|
|
48
|
+
utils_1.logInitStep(options);
|
|
49
|
+
for (let _template of options.templates) {
|
|
29
50
|
try {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
const files = await util_1.promisify(glob_1.glob)(template, { dot: true, debug: false });
|
|
38
|
-
for (const templatePath of files) {
|
|
39
|
-
if (!(await utils_1.isDir(templatePath))) {
|
|
40
|
-
const basePath = path_1.default
|
|
41
|
-
.resolve(process.cwd(), _isDir
|
|
42
|
-
? templatePath.replace(template, "")
|
|
43
|
-
: path_1.default.dirname(utils_1.removeGlob(templatePath).replace(_nonGlobTemplate, "")))
|
|
44
|
-
.replace(process.cwd() + "/", "")
|
|
45
|
-
.replace(process.cwd(), "");
|
|
46
|
-
utils_1.log(options, types_1.LogLevel.Debug, `\ntemplate: ${template}\ntemplatePath: ${templatePath}, \nbase path: ${basePath}\n`);
|
|
47
|
-
await handleTemplateFile(templatePath, basePath, options, data);
|
|
51
|
+
const { nonGlobTemplate, origTemplate, isDirOrGlob, isGlob, template } = await utils_1.getTemplateGlobInfo(options, _template);
|
|
52
|
+
await utils_1.ensureFileExists(template, isDirOrGlob);
|
|
53
|
+
const files = await utils_1.getFileList(options, template);
|
|
54
|
+
for (const inputFilePath of files) {
|
|
55
|
+
if (await utils_1.isDir(inputFilePath)) {
|
|
56
|
+
continue;
|
|
48
57
|
}
|
|
58
|
+
const relPath = utils_1.makeRelativePath(path_1.default.dirname(utils_1.removeGlob(inputFilePath).replace(nonGlobTemplate, "")));
|
|
59
|
+
const basePath = utils_1.getBasePath(relPath);
|
|
60
|
+
utils_1.logInputFile(options, {
|
|
61
|
+
origTemplate,
|
|
62
|
+
relPath,
|
|
63
|
+
template,
|
|
64
|
+
inputFilePath,
|
|
65
|
+
nonGlobTemplate,
|
|
66
|
+
basePath,
|
|
67
|
+
isDirOrGlob,
|
|
68
|
+
isGlob,
|
|
69
|
+
});
|
|
70
|
+
await handleTemplateFile(options, options.data, { templatePath: inputFilePath, basePath });
|
|
49
71
|
}
|
|
50
72
|
}
|
|
51
73
|
catch (e) {
|
|
@@ -54,45 +76,24 @@ async function Scaffold(config) {
|
|
|
54
76
|
}
|
|
55
77
|
}
|
|
56
78
|
catch (e) {
|
|
57
|
-
|
|
79
|
+
utils_1.log(options, types_1.LogLevel.Error, e);
|
|
58
80
|
throw e;
|
|
59
81
|
}
|
|
60
82
|
}
|
|
61
83
|
exports.Scaffold = Scaffold;
|
|
62
|
-
async function handleTemplateFile(
|
|
84
|
+
async function handleTemplateFile(options, data, { templatePath, basePath }) {
|
|
63
85
|
return new Promise(async (resolve, reject) => {
|
|
64
86
|
var _a;
|
|
65
87
|
try {
|
|
66
|
-
const inputPath =
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
utils_1.log(options, types_1.LogLevel.Debug, "Filename parsed:", utils_1.handlebarsParse(path_1.default.basename(inputPath), data), "Orig:", path_1.default.basename(inputPath)
|
|
74
|
-
// "Test:",
|
|
75
|
-
// handlebarsParse("{{name}} {{name pascalCase}}", data)
|
|
76
|
-
);
|
|
77
|
-
await utils_1.createDirIfNotExists(outputDir, options);
|
|
88
|
+
const { inputPath, outputPathOpt, outputDir, outputPath, exists } = await utils_1.getTemplateFileInfo(options, data, {
|
|
89
|
+
templatePath,
|
|
90
|
+
basePath,
|
|
91
|
+
});
|
|
92
|
+
const overwrite = utils_1.getOptionValueForFile(options, inputPath, data, (_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);
|
|
78
95
|
utils_1.log(options, types_1.LogLevel.Info, `Writing to ${outputPath}`);
|
|
79
|
-
|
|
80
|
-
if (exists && overwrite) {
|
|
81
|
-
utils_1.log(options, types_1.LogLevel.Info, `File ${outputPath} exists, overwriting`);
|
|
82
|
-
}
|
|
83
|
-
const templateBuffer = await readFile(inputPath);
|
|
84
|
-
const outputContents = utils_1.handlebarsParse(templateBuffer, data);
|
|
85
|
-
if (!options.dryRun) {
|
|
86
|
-
await writeFile(outputPath, outputContents);
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
utils_1.log(options, types_1.LogLevel.Info, "Content output:");
|
|
90
|
-
utils_1.log(options, types_1.LogLevel.Info, outputContents);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
else if (exists) {
|
|
94
|
-
utils_1.log(options, types_1.LogLevel.Info, `File ${outputPath} already exists, skipping`);
|
|
95
|
-
}
|
|
96
|
+
await utils_1.copyFileTransformed(options, data, { exists, overwrite, outputPath, inputPath });
|
|
96
97
|
resolve();
|
|
97
98
|
}
|
|
98
99
|
catch (e) {
|
package/scaffold.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../src/scaffold.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../src/scaffold.ts"],"names":[],"mappings":";;;;;;AACA,gDAAuB;AAEvB,2BAA2C;AAC3C,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,aAAU,CAAA;AAE1C,mCAsBgB;AAChB,mCAAgE;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,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evel {
|
|
|
7
7
|
}
|
|
8
8
|
export declare type FileResponseFn<T> = (fullPath: string, basedir: string, basename: string) => T;
|
|
9
9
|
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 HelperKeys<T> = DefaultHelperKeys | T;
|
|
12
|
+
export declare type Helper = (text: string) => string;
|
|
10
13
|
export interface ScaffoldConfig {
|
|
11
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Name to be passed to the generated files. `{{name}}` and `{{Name}}` inside contents and file names will be replaced
|
|
16
|
+
* accordingly.
|
|
17
|
+
*/
|
|
12
18
|
name: string;
|
|
13
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Template files to use as input. You may provide multiple files, each of which can be a relative or absolute path,
|
|
21
|
+
* or a glob pattern for multiple file matching easily. (default: current working directory)
|
|
22
|
+
*/
|
|
14
23
|
templates: string[];
|
|
15
|
-
/**
|
|
24
|
+
/** Path to output to. If `createSubFolder` is `true`, the subfolder will be created inside this path. */
|
|
16
25
|
output: FileResponse<string>;
|
|
26
|
+
/**
|
|
27
|
+
* Create subfolder with the input name (default: `false`)
|
|
28
|
+
*/
|
|
17
29
|
createSubFolder?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Add custom data to the templates. By default, only your app name is included as `{{name}}` and `{{Name}}`.
|
|
32
|
+
*/
|
|
18
33
|
data?: Record<string, string>;
|
|
34
|
+
/**
|
|
35
|
+
* Enable to override output files, even if they already exist. (default: `false`)
|
|
36
|
+
*
|
|
37
|
+
* You may supply a function to this option, which can take the arguments `(fullPath, baseDir, baseName)` and returns
|
|
38
|
+
* a string, to return a dynamic path for each file.
|
|
39
|
+
*/
|
|
19
40
|
overwrite?: FileResponse<boolean>;
|
|
41
|
+
/** Suppress output logs (Same as `verbose: 0` or `verbose: LogLevel.None`) */
|
|
20
42
|
quiet?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Determine amount of logs to display.
|
|
45
|
+
*
|
|
46
|
+
* The values are: `0 (none) | 1 (debug) | 2 (info) | 3 (warn) | 4 (error)`. The provided level will display messages
|
|
47
|
+
* of the same level or higher. (default: `2 (info)`)
|
|
48
|
+
* @see LogLevel
|
|
49
|
+
*/
|
|
21
50
|
verbose?: LogLevel;
|
|
51
|
+
/**
|
|
52
|
+
* Don't emit files. This is good for testing your scaffolds and making sure they don't fail, without having to write
|
|
53
|
+
* actual file contents or create directories. (default: `false`)
|
|
54
|
+
*/
|
|
22
55
|
dryRun?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Additional helpers to add to the template parser. Provide an object whose keys are the name of the function to add,
|
|
58
|
+
* and the value is the helper function itself. The signature of helpers is as follows:
|
|
59
|
+
* ```typescript
|
|
60
|
+
* (text: string) => string
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* A full example might be:
|
|
64
|
+
*
|
|
65
|
+
* ```typescript
|
|
66
|
+
* Scaffold({
|
|
67
|
+
* //...
|
|
68
|
+
* helpers: {
|
|
69
|
+
* upperCamelCase: (text) => camelCase(text).toUpperCase()
|
|
70
|
+
* }
|
|
71
|
+
* })
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* Here are the built-in helpers available for use:
|
|
75
|
+
* | Helper name | Example code | Example output |
|
|
76
|
+
* | ----------- | ----------------------- | -------------- |
|
|
77
|
+
* | camelCase | `{{ camelCase name }}` | myName |
|
|
78
|
+
* | snakeCase | `{{ snakeCase name }}` | my_name |
|
|
79
|
+
* | startCase | `{{ startCase name }}` | My Name |
|
|
80
|
+
* | kebabCase | `{{ kebabCase name }}` | my-name |
|
|
81
|
+
* | hyphenCase | `{{ hyphenCase name }}` | my-name |
|
|
82
|
+
* | pascalCase | `{{ pascalCase name }}` | MyName |
|
|
83
|
+
* | upperCase | `{{ upperCase name }}` | MYNAME |
|
|
84
|
+
* | lowerCase | `{{ lowerCase name }}` | myname |
|
|
85
|
+
*/
|
|
86
|
+
helpers?: Record<string, Helper>;
|
|
87
|
+
/**
|
|
88
|
+
* Default transformer to apply to subfolder name when using `createSubFolder: true`. Can be one of the default
|
|
89
|
+
* helpers, or a custom one you provide to `helpers`. Defaults to `undefined`, which means no transformation is done.
|
|
90
|
+
*/
|
|
91
|
+
subFolderNameHelper?: DefaultHelperKeys | string;
|
|
23
92
|
}
|
|
24
93
|
export interface ScaffoldCmdConfig {
|
|
25
94
|
name: string;
|
|
@@ -29,5 +98,6 @@ export interface ScaffoldCmdConfig {
|
|
|
29
98
|
data?: Record<string, string>;
|
|
30
99
|
overwrite: boolean;
|
|
31
100
|
quiet: boolean;
|
|
101
|
+
verbose: LogLevel;
|
|
32
102
|
dryRun: boolean;
|
|
33
103
|
}
|
package/utils.d.ts
CHANGED
|
@@ -1,11 +1,54 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { FileResponse, LogLevel, ScaffoldConfig } from "./types";
|
|
2
|
+
import { DefaultHelperKeys, FileResponse, Helper, LogLevel, ScaffoldConfig } from "./types";
|
|
3
|
+
export declare const defaultHelpers: Record<DefaultHelperKeys, Helper>;
|
|
4
|
+
export declare function registerHelpers(options: ScaffoldConfig): void;
|
|
3
5
|
export declare function handleErr(err: NodeJS.ErrnoException | null): void;
|
|
4
6
|
export declare function log(options: ScaffoldConfig, level: LogLevel, ...obj: any[]): void;
|
|
5
7
|
export declare function createDirIfNotExists(dir: string, options: ScaffoldConfig): Promise<void>;
|
|
6
|
-
export declare function getOptionValueForFile<T>(filePath: string, data: Record<string, string>, fn: FileResponse<T>, defaultValue?: T): T;
|
|
7
|
-
export declare function handlebarsParse(templateBuffer: Buffer | string, data: Record<string, string>): string;
|
|
8
|
+
export declare function getOptionValueForFile<T>(options: ScaffoldConfig, filePath: string, data: Record<string, string>, fn: FileResponse<T>, defaultValue?: T): T;
|
|
9
|
+
export declare function handlebarsParse(options: ScaffoldConfig, templateBuffer: Buffer | string, data: Record<string, string>): string | Buffer;
|
|
8
10
|
export declare function pathExists(filePath: string): Promise<boolean>;
|
|
9
11
|
export declare function pascalCase(s: string): string;
|
|
10
12
|
export declare function isDir(path: string): Promise<boolean>;
|
|
11
13
|
export declare function removeGlob(template: string): string;
|
|
14
|
+
export declare function makeRelativePath(str: string): string;
|
|
15
|
+
export declare function getBasePath(relPath: string): string;
|
|
16
|
+
export declare function getFileList(options: ScaffoldConfig, template: string): Promise<string[]>;
|
|
17
|
+
export interface GlobInfo {
|
|
18
|
+
nonGlobTemplate: string;
|
|
19
|
+
origTemplate: string;
|
|
20
|
+
isDirOrGlob: boolean;
|
|
21
|
+
isGlob: boolean;
|
|
22
|
+
template: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function getTemplateGlobInfo(options: ScaffoldConfig, template: string): Promise<GlobInfo>;
|
|
25
|
+
export declare function ensureFileExists(template: string, isGlob: boolean): Promise<void>;
|
|
26
|
+
export interface OutputFileInfo {
|
|
27
|
+
inputPath: string;
|
|
28
|
+
outputPathOpt: string;
|
|
29
|
+
outputDir: string;
|
|
30
|
+
outputPath: string;
|
|
31
|
+
exists: boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare function getTemplateFileInfo(options: ScaffoldConfig, data: Record<string, string>, { templatePath, basePath }: {
|
|
34
|
+
templatePath: string;
|
|
35
|
+
basePath: string;
|
|
36
|
+
}): Promise<OutputFileInfo>;
|
|
37
|
+
export declare function copyFileTransformed(options: ScaffoldConfig, data: Record<string, string>, { exists, overwrite, outputPath, inputPath, }: {
|
|
38
|
+
exists: boolean;
|
|
39
|
+
overwrite: boolean;
|
|
40
|
+
outputPath: string;
|
|
41
|
+
inputPath: string;
|
|
42
|
+
}): Promise<void>;
|
|
43
|
+
export declare function getOutputDir(options: ScaffoldConfig, data: Record<string, string>, outputPathOpt: string, basePath: string): string;
|
|
44
|
+
export declare function logInputFile(options: ScaffoldConfig, { origTemplate, relPath, template, inputFilePath, nonGlobTemplate, basePath, isDirOrGlob, isGlob, }: {
|
|
45
|
+
origTemplate: string;
|
|
46
|
+
relPath: string;
|
|
47
|
+
template: string;
|
|
48
|
+
inputFilePath: string;
|
|
49
|
+
nonGlobTemplate: string;
|
|
50
|
+
basePath: string;
|
|
51
|
+
isDirOrGlob: boolean;
|
|
52
|
+
isGlob: boolean;
|
|
53
|
+
}): void;
|
|
54
|
+
export declare function logInitStep(options: ScaffoldConfig): void;
|
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.removeGlob = exports.isDir = exports.pascalCase = exports.pathExists = exports.handlebarsParse = exports.getOptionValueForFile = exports.createDirIfNotExists = exports.log = exports.handleErr = 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.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,17 +15,27 @@ 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
|
|
18
|
+
const glob_1 = require("glob");
|
|
19
|
+
const util_1 = require("util");
|
|
20
|
+
const { readFile, writeFile } = fs_1.promises;
|
|
21
|
+
exports.defaultHelpers = {
|
|
19
22
|
camelCase: camelCase_1.default,
|
|
20
23
|
snakeCase: snakeCase_1.default,
|
|
21
24
|
startCase: startCase_1.default,
|
|
22
25
|
kebabCase: kebabCase_1.default,
|
|
23
26
|
hyphenCase: kebabCase_1.default,
|
|
24
27
|
pascalCase,
|
|
28
|
+
lowerCase: (text) => text.toLowerCase(),
|
|
29
|
+
upperCase: (text) => text.toUpperCase(),
|
|
25
30
|
};
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
function registerHelpers(options) {
|
|
32
|
+
const _helpers = { ...exports.defaultHelpers, ...options.helpers };
|
|
33
|
+
for (const helperName in _helpers) {
|
|
34
|
+
log(options, types_1.LogLevel.Debug, `Registering helper: ${helperName}`);
|
|
35
|
+
handlebars_1.default.registerHelper(helperName, _helpers[helperName]);
|
|
36
|
+
}
|
|
28
37
|
}
|
|
38
|
+
exports.registerHelpers = registerHelpers;
|
|
29
39
|
function handleErr(err) {
|
|
30
40
|
if (err)
|
|
31
41
|
throw err;
|
|
@@ -33,7 +43,7 @@ function handleErr(err) {
|
|
|
33
43
|
exports.handleErr = handleErr;
|
|
34
44
|
function log(options, level, ...obj) {
|
|
35
45
|
var _a;
|
|
36
|
-
if (options.quiet || options.verbose === types_1.LogLevel.None || ((_a = options.verbose) !== null && _a !== void 0 ? _a : types_1.LogLevel.Info)
|
|
46
|
+
if (options.quiet || options.verbose === types_1.LogLevel.None || level < ((_a = options.verbose) !== null && _a !== void 0 ? _a : types_1.LogLevel.Info)) {
|
|
37
47
|
return;
|
|
38
48
|
}
|
|
39
49
|
const levelColor = {
|
|
@@ -44,8 +54,13 @@ function log(options, level, ...obj) {
|
|
|
44
54
|
[types_1.LogLevel.Error]: "red",
|
|
45
55
|
};
|
|
46
56
|
const chalkFn = chalk_1.default[levelColor[level]];
|
|
47
|
-
|
|
48
|
-
|
|
57
|
+
const key = level === types_1.LogLevel.Error ? "error" : level === types_1.LogLevel.Warning ? "warn" : "log";
|
|
58
|
+
const logFn = console[key];
|
|
59
|
+
logFn(...obj.map((i) => i instanceof Error
|
|
60
|
+
? chalkFn(i, JSON.stringify(i, undefined, 1), i.stack)
|
|
61
|
+
: typeof i === "object"
|
|
62
|
+
? chalkFn(JSON.stringify(i, undefined, 1))
|
|
63
|
+
: chalkFn(i)));
|
|
49
64
|
}
|
|
50
65
|
exports.log = log;
|
|
51
66
|
async function createDirIfNotExists(dir, options) {
|
|
@@ -55,6 +70,7 @@ async function createDirIfNotExists(dir, options) {
|
|
|
55
70
|
}
|
|
56
71
|
if (!(await pathExists(dir))) {
|
|
57
72
|
try {
|
|
73
|
+
log(options, types_1.LogLevel.Debug, `Creating dir ${dir}`);
|
|
58
74
|
await mkdir(dir);
|
|
59
75
|
return;
|
|
60
76
|
}
|
|
@@ -67,17 +83,23 @@ async function createDirIfNotExists(dir, options) {
|
|
|
67
83
|
}
|
|
68
84
|
}
|
|
69
85
|
exports.createDirIfNotExists = createDirIfNotExists;
|
|
70
|
-
function getOptionValueForFile(filePath, data, fn, defaultValue) {
|
|
86
|
+
function getOptionValueForFile(options, filePath, data, fn, defaultValue) {
|
|
71
87
|
if (typeof fn !== "function") {
|
|
72
88
|
return defaultValue !== null && defaultValue !== void 0 ? defaultValue : fn;
|
|
73
89
|
}
|
|
74
|
-
return fn(filePath, path_1.default.dirname(handlebarsParse(filePath, data)), path_1.default.basename(handlebarsParse(filePath, data)));
|
|
90
|
+
return fn(filePath, path_1.default.dirname(handlebarsParse(options, filePath, data).toString()), path_1.default.basename(handlebarsParse(options, filePath, data).toString()));
|
|
75
91
|
}
|
|
76
92
|
exports.getOptionValueForFile = getOptionValueForFile;
|
|
77
|
-
function handlebarsParse(templateBuffer, data) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
93
|
+
function handlebarsParse(options, templateBuffer, data) {
|
|
94
|
+
try {
|
|
95
|
+
const parser = handlebars_1.default.compile(templateBuffer.toString(), { noEscape: true });
|
|
96
|
+
const outputContents = parser(data);
|
|
97
|
+
return outputContents;
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
log(options, types_1.LogLevel.Warning, "Couldn't parse file with handlebars, returning original content");
|
|
101
|
+
return templateBuffer;
|
|
102
|
+
}
|
|
81
103
|
}
|
|
82
104
|
exports.handlebarsParse = handlebarsParse;
|
|
83
105
|
async function pathExists(filePath) {
|
|
@@ -106,4 +128,111 @@ function removeGlob(template) {
|
|
|
106
128
|
return template.replace(/\*/g, "").replace(/\/\//g, "/");
|
|
107
129
|
}
|
|
108
130
|
exports.removeGlob = removeGlob;
|
|
131
|
+
function makeRelativePath(str) {
|
|
132
|
+
return str.startsWith("/") ? str.slice(1) : str;
|
|
133
|
+
}
|
|
134
|
+
exports.makeRelativePath = makeRelativePath;
|
|
135
|
+
function getBasePath(relPath) {
|
|
136
|
+
return path_1.default
|
|
137
|
+
.resolve(process.cwd(), relPath)
|
|
138
|
+
.replace(process.cwd() + "/", "")
|
|
139
|
+
.replace(process.cwd(), "");
|
|
140
|
+
}
|
|
141
|
+
exports.getBasePath = getBasePath;
|
|
142
|
+
async function getFileList(options, template) {
|
|
143
|
+
return await util_1.promisify(glob_1.glob)(template, {
|
|
144
|
+
dot: true,
|
|
145
|
+
debug: options.verbose === types_1.LogLevel.Debug,
|
|
146
|
+
nodir: true,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
exports.getFileList = getFileList;
|
|
150
|
+
async function getTemplateGlobInfo(options, template) {
|
|
151
|
+
const isGlob = glob_1.glob.hasMagic(template);
|
|
152
|
+
log(options, types_1.LogLevel.Debug, "before isDir", "isGlob:", isGlob, template);
|
|
153
|
+
let _template = template;
|
|
154
|
+
const nonGlobTemplate = isGlob ? removeGlob(template) : template;
|
|
155
|
+
const isDirOrGlob = isGlob ? true : await isDir(template);
|
|
156
|
+
log(options, types_1.LogLevel.Debug, "after isDir", isDirOrGlob);
|
|
157
|
+
const _shouldAddGlob = !isGlob && isDirOrGlob;
|
|
158
|
+
const origTemplate = template;
|
|
159
|
+
if (_shouldAddGlob) {
|
|
160
|
+
_template = template + "/**/*";
|
|
161
|
+
}
|
|
162
|
+
return { nonGlobTemplate, origTemplate, isDirOrGlob, isGlob, template: _template };
|
|
163
|
+
}
|
|
164
|
+
exports.getTemplateGlobInfo = getTemplateGlobInfo;
|
|
165
|
+
async function ensureFileExists(template, isGlob) {
|
|
166
|
+
if (!isGlob && !(await pathExists(template))) {
|
|
167
|
+
const err = new Error(`ENOENT, no such file or directory ${template}`);
|
|
168
|
+
err.code = "ENOENT";
|
|
169
|
+
err.path = template;
|
|
170
|
+
err.errno = -2;
|
|
171
|
+
throw err;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
exports.ensureFileExists = ensureFileExists;
|
|
175
|
+
async function getTemplateFileInfo(options, data, { templatePath, basePath }) {
|
|
176
|
+
const inputPath = path_1.default.resolve(process.cwd(), templatePath);
|
|
177
|
+
const outputPathOpt = getOptionValueForFile(options, inputPath, data, options.output);
|
|
178
|
+
const outputDir = getOutputDir(options, data, outputPathOpt, basePath);
|
|
179
|
+
const outputPath = handlebarsParse(options, path_1.default.join(outputDir, path_1.default.basename(inputPath)), data).toString();
|
|
180
|
+
const exists = await pathExists(outputPath);
|
|
181
|
+
return { inputPath, outputPathOpt, outputDir, outputPath, exists };
|
|
182
|
+
}
|
|
183
|
+
exports.getTemplateFileInfo = getTemplateFileInfo;
|
|
184
|
+
async function copyFileTransformed(options, data, { exists, overwrite, outputPath, inputPath, }) {
|
|
185
|
+
if (!exists || overwrite) {
|
|
186
|
+
if (exists && overwrite) {
|
|
187
|
+
log(options, types_1.LogLevel.Info, `File ${outputPath} exists, overwriting`);
|
|
188
|
+
}
|
|
189
|
+
const templateBuffer = await readFile(inputPath);
|
|
190
|
+
const outputContents = handlebarsParse(options, templateBuffer, data);
|
|
191
|
+
if (!options.dryRun) {
|
|
192
|
+
await writeFile(outputPath, outputContents);
|
|
193
|
+
log(options, types_1.LogLevel.Info, "Done.");
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
log(options, types_1.LogLevel.Info, "Content output:");
|
|
197
|
+
log(options, types_1.LogLevel.Info, outputContents);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
else if (exists) {
|
|
201
|
+
log(options, types_1.LogLevel.Info, `File ${outputPath} already exists, skipping`);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
exports.copyFileTransformed = copyFileTransformed;
|
|
205
|
+
function getOutputDir(options, data, outputPathOpt, basePath) {
|
|
206
|
+
return path_1.default.resolve(process.cwd(), ...[
|
|
207
|
+
outputPathOpt,
|
|
208
|
+
basePath,
|
|
209
|
+
options.createSubFolder
|
|
210
|
+
? options.subFolderNameHelper
|
|
211
|
+
? handlebarsParse(options, `{{ ${options.subFolderNameHelper} name }}`, data)
|
|
212
|
+
: options.name
|
|
213
|
+
: undefined,
|
|
214
|
+
].filter(Boolean));
|
|
215
|
+
}
|
|
216
|
+
exports.getOutputDir = getOutputDir;
|
|
217
|
+
function logInputFile(options, { origTemplate, relPath, template, inputFilePath, nonGlobTemplate, basePath, isDirOrGlob, isGlob, }) {
|
|
218
|
+
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`);
|
|
219
|
+
}
|
|
220
|
+
exports.logInputFile = logInputFile;
|
|
221
|
+
function logInitStep(options) {
|
|
222
|
+
var _a;
|
|
223
|
+
log(options, types_1.LogLevel.Debug, "Full config:", {
|
|
224
|
+
name: options.name,
|
|
225
|
+
templates: options.templates,
|
|
226
|
+
output: options.output,
|
|
227
|
+
createSubfolder: options.createSubFolder,
|
|
228
|
+
data: options.data,
|
|
229
|
+
overwrite: options.overwrite,
|
|
230
|
+
quiet: options.quiet,
|
|
231
|
+
subFolderTransformHelper: options.subFolderNameHelper,
|
|
232
|
+
helpers: Object.keys((_a = options.helpers) !== null && _a !== void 0 ? _a : {}),
|
|
233
|
+
verbose: `${options.verbose} (${Object.keys(types_1.LogLevel).find((k) => types_1.LogLevel[k] === options.verbose)})`,
|
|
234
|
+
});
|
|
235
|
+
log(options, types_1.LogLevel.Info, "Data:", options.data);
|
|
236
|
+
}
|
|
237
|
+
exports.logInitStep = logInitStep;
|
|
109
238
|
//# 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,
|
|
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,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E,gBAAQ,CAAC,KAAK,EAAE,cAAc,EAAE;QAC3C,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,wBAAwB,EAAE,OAAO,CAAC,mBAAmB;QACrD,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,MAAA,OAAO,CAAC,OAAO,mCAAI,EAAE,CAAC;QAC3C,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,KAAK,MAAM,CAAC,IAAI,CAAC,gBAAQ,CAAC,CAAC,IAAI,CACxD,CAAC,CAAC,EAAE,EAAE,CAAE,gBAAQ,CAAC,CAAQ,CAAuB,KAAK,OAAO,CAAC,OAAQ,CACtE,GAAG;KACL,CAAC,CAAA;IACF,GAAG,CAAC,OAAO,EAAE,gBAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;AACpD,CAAC;AAhBD,kCAgBC"}
|
package/cmd_util.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function parseCliArgs(args?: string[]): void;
|
package/cmd_util.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.parseCliArgs = void 0;
|
|
7
|
-
const massarg_1 = __importDefault(require("massarg"));
|
|
8
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
-
const types_1 = require("./types");
|
|
10
|
-
const scaffold_1 = require("./scaffold");
|
|
11
|
-
function parseCliArgs(args = process.argv.slice(2)) {
|
|
12
|
-
return (massarg_1.default()
|
|
13
|
-
.main(scaffold_1.Scaffold)
|
|
14
|
-
.option({
|
|
15
|
-
name: "name",
|
|
16
|
-
aliases: ["n"],
|
|
17
|
-
isDefault: true,
|
|
18
|
-
description: "Name to be passed to the generated files. {{name}} and {{Name}} inside contents and file names will be replaced accordingly.",
|
|
19
|
-
})
|
|
20
|
-
.option({
|
|
21
|
-
name: "output",
|
|
22
|
-
aliases: ["o"],
|
|
23
|
-
description: "Path to output to. If --create-sub-folder is enabled, the subfolder will be created inside this path.",
|
|
24
|
-
})
|
|
25
|
-
.option({
|
|
26
|
-
name: "templates",
|
|
27
|
-
aliases: ["t"],
|
|
28
|
-
description: "Template files to use as input. You may provide multiple files, each of which can be a relative or absolute path, " +
|
|
29
|
-
"or a glob pattern for multiple file matching easily.",
|
|
30
|
-
defaultValue: [],
|
|
31
|
-
array: true,
|
|
32
|
-
})
|
|
33
|
-
.option({
|
|
34
|
-
aliases: ["w"],
|
|
35
|
-
name: "overwrite",
|
|
36
|
-
description: "Enable to override output files, even if they already exist.",
|
|
37
|
-
defaultValue: false,
|
|
38
|
-
boolean: true,
|
|
39
|
-
})
|
|
40
|
-
.option({
|
|
41
|
-
aliases: ["d"],
|
|
42
|
-
name: "data",
|
|
43
|
-
description: "Add custom data to the templates. By default, only your app name is included.",
|
|
44
|
-
parse: (v) => JSON.parse(v),
|
|
45
|
-
})
|
|
46
|
-
.option({
|
|
47
|
-
aliases: ["s"],
|
|
48
|
-
name: "create-sub-folder",
|
|
49
|
-
description: "Create subfolder with the input name",
|
|
50
|
-
defaultValue: false,
|
|
51
|
-
boolean: true,
|
|
52
|
-
})
|
|
53
|
-
.option({
|
|
54
|
-
aliases: ["q"],
|
|
55
|
-
name: "quiet",
|
|
56
|
-
description: "Suppress output logs (Same as --verbose 0)",
|
|
57
|
-
defaultValue: false,
|
|
58
|
-
boolean: true,
|
|
59
|
-
})
|
|
60
|
-
.option({
|
|
61
|
-
aliases: ["v"],
|
|
62
|
-
name: "verbose",
|
|
63
|
-
description: `Determine amount of logs to display. The values are: ${chalk_1.default.bold `0 (none) | 1 (debug) | 2 (info) | 3 (warn) | 4 (error)`}. The provided level will display messages of the same level or higher.`,
|
|
64
|
-
defaultValue: types_1.LogLevel.Info,
|
|
65
|
-
parse: Number,
|
|
66
|
-
})
|
|
67
|
-
.option({
|
|
68
|
-
aliases: ["dr"],
|
|
69
|
-
name: "dry-run",
|
|
70
|
-
description: "Don't emit files. This is good for testing your scaffolds and making sure they " +
|
|
71
|
-
"don't fail, without having to write actual file contents or create directories.",
|
|
72
|
-
defaultValue: false,
|
|
73
|
-
boolean: true,
|
|
74
|
-
})
|
|
75
|
-
// .example({
|
|
76
|
-
// input: `yarn cmd -t examples/test-input/Component -o examples/test-output -d '{"property":"myProp","value":"10"}'`,
|
|
77
|
-
// description: "Usage",
|
|
78
|
-
// output: "",
|
|
79
|
-
// })
|
|
80
|
-
.help({
|
|
81
|
-
binName: "simple-scaffold",
|
|
82
|
-
useGlobalColumns: true,
|
|
83
|
-
usageExample: "[options]",
|
|
84
|
-
header: "Create structured files based on templates.",
|
|
85
|
-
footer: `Copyright © Chen Asraf 2021\nNPM: ${chalk_1.default.underline `https://npmjs.com/package/massarg`}\nGitHub: ${chalk_1.default.underline `https://github.com/chenasraf/massarg`}`,
|
|
86
|
-
})
|
|
87
|
-
.parse(args));
|
|
88
|
-
}
|
|
89
|
-
exports.parseCliArgs = parseCliArgs;
|
|
90
|
-
//# sourceMappingURL=cmd_util.js.map
|
package/cmd_util.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cmd_util.js","sourceRoot":"","sources":["../src/cmd_util.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA6B;AAC7B,kDAAyB;AACzB,mCAAqD;AACrD,yCAAqC;AAErC,SAAgB,YAAY,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CA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