simple-scaffold 1.0.0 → 1.0.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 +37 -28
- package/cmd.js +5 -0
- package/cmd.js.map +1 -1
- package/package.json +1 -1
- package/scaffold.d.ts +30 -0
- package/scaffold.js +56 -74
- package/scaffold.js.map +1 -1
- package/types.d.ts +21 -1
- package/utils.d.ts +45 -3
- package/utils.js +124 -8
- package/utils.js.map +1 -1
package/README.md
CHANGED
|
@@ -36,40 +36,45 @@ Create structured files based on templates.
|
|
|
36
36
|
|
|
37
37
|
Options:
|
|
38
38
|
|
|
39
|
-
--help|-h
|
|
39
|
+
--help|-h Display help information
|
|
40
40
|
|
|
41
|
-
--name|-n
|
|
42
|
-
|
|
43
|
-
|
|
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.
|
|
44
44
|
|
|
45
|
-
--output|-o
|
|
46
|
-
|
|
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)
|
|
47
48
|
|
|
48
|
-
--templates|-t
|
|
49
|
-
|
|
50
|
-
|
|
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.
|
|
51
52
|
|
|
52
|
-
--overwrite|-w
|
|
53
|
-
|
|
53
|
+
--overwrite|-w Enable to override output files, even if they already
|
|
54
|
+
exist. (default: false)
|
|
54
55
|
|
|
55
|
-
--data|-d
|
|
56
|
-
|
|
56
|
+
--data|-d Add custom data to the templates. By default, only your
|
|
57
|
+
app name is included.
|
|
57
58
|
|
|
58
|
-
--create-sub-folder|-s
|
|
59
|
-
|
|
59
|
+
--create-sub-folder|-s Create subfolder with the input name
|
|
60
|
+
(default: false)
|
|
60
61
|
|
|
61
|
-
--
|
|
62
|
-
|
|
62
|
+
--sub-folder-name-helper|-sh Default helper to apply to subfolder name when using
|
|
63
|
+
`--create-sub-folder true`.
|
|
63
64
|
|
|
64
|
-
--
|
|
65
|
-
|
|
66
|
-
provided level will display messages of the same level or higher.
|
|
67
|
-
(default: 2)
|
|
65
|
+
--quiet|-q Suppress output logs (Same as --verbose 0)
|
|
66
|
+
(default: false)
|
|
68
67
|
|
|
69
|
-
--
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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)
|
|
73
|
+
|
|
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)
|
|
73
78
|
```
|
|
74
79
|
|
|
75
80
|
You can also add this as a script in your `package.json`:
|
|
@@ -98,6 +103,7 @@ const config = {
|
|
|
98
103
|
templates: [path.join(__dirname, "scaffolds", "component")],
|
|
99
104
|
output: path.join(__dirname, "src", "components"),
|
|
100
105
|
createSubFolder: true,
|
|
106
|
+
subFolderNameHelper: "upperCase"
|
|
101
107
|
locals: {
|
|
102
108
|
property: "value",
|
|
103
109
|
},
|
|
@@ -184,6 +190,9 @@ config.helpers = {
|
|
|
184
190
|
}
|
|
185
191
|
```
|
|
186
192
|
|
|
193
|
+
These helpers will also be available to you when using `subFolderNameHelper` or
|
|
194
|
+
`--sub-folder-name-helper` as a possible value.
|
|
195
|
+
|
|
187
196
|
## Examples
|
|
188
197
|
|
|
189
198
|
### Command Example
|
|
@@ -280,6 +289,6 @@ Some tips on getting around the code:
|
|
|
280
289
|
- Use `yarn cmd` to use the CLI feature of Simple Scaffold from within the root directory,
|
|
281
290
|
enabling you to test different behaviors. See `yarn cmd -h` for more information.
|
|
282
291
|
|
|
283
|
-
> This requires an updated build, and does not trigger one itself. Either use `yarn dev`
|
|
284
|
-
> `yarn build` before running this, or use `yarn build-cmd` instead,
|
|
285
|
-
> before running the command with the rest of the given arguments.
|
|
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.js
CHANGED
|
@@ -52,6 +52,11 @@ function parseCliArgs(args = process.argv.slice(2)) {
|
|
|
52
52
|
boolean: true,
|
|
53
53
|
defaultValue: false,
|
|
54
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`.",
|
|
55
60
|
})
|
|
56
61
|
.option({
|
|
57
62
|
name: "quiet",
|
package/cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,MAAM,CAAC;QACN,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,CAAC,GAAG,CAAC;QACd,WAAW,EAAE,yGAAyG,eAAK,CAAC,KAAK,CAAA,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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
package/scaffold.d.ts
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
1
|
import { ScaffoldConfig } from "./types";
|
|
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
|
+
*/
|
|
2
32
|
export declare function Scaffold({ ...options }: ScaffoldConfig): Promise<void>;
|
|
3
33
|
export default Scaffold;
|
package/scaffold.js
CHANGED
|
@@ -4,68 +4,68 @@ 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
|
-
const fs_1 = require("fs");
|
|
11
|
-
const { readFile, writeFile } = fs_1.promises;
|
|
12
8
|
const utils_1 = require("./utils");
|
|
13
9
|
const types_1 = require("./types");
|
|
10
|
+
/**
|
|
11
|
+
* Create a scaffold using given `options`.
|
|
12
|
+
*
|
|
13
|
+
* #### Create files
|
|
14
|
+
* To create a file structure to output, use any directory and file structure you would like.
|
|
15
|
+
* Inside folder names, file names or file contents, you may place `{{ var }}` where `var` is either
|
|
16
|
+
* `name` which is the scaffold name you provided or one of the keys you provided in the `data` option.
|
|
17
|
+
*
|
|
18
|
+
* The contents and names will be replaced with the transformed values so you can use your original structure as a
|
|
19
|
+
* boilerplate for other projects, components, modules, or even single files.
|
|
20
|
+
*
|
|
21
|
+
* #### Helpers
|
|
22
|
+
* 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` → `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 |
|
|
36
|
+
*
|
|
37
|
+
* Any functions you provide in `helpers` option will also be available to you to make custom formatting as you see fit
|
|
38
|
+
* (for example, formatting a date)
|
|
39
|
+
*/
|
|
14
40
|
async function Scaffold({ ...options }) {
|
|
15
|
-
var _a
|
|
41
|
+
var _a;
|
|
16
42
|
(_a = options.output) !== null && _a !== void 0 ? _a : (options.output = process.cwd());
|
|
17
43
|
utils_1.registerHelpers(options);
|
|
18
44
|
try {
|
|
19
45
|
options.data = { name: options.name, Name: utils_1.pascalCase(options.name), ...options.data };
|
|
20
|
-
utils_1.
|
|
21
|
-
|
|
22
|
-
templates: options.templates,
|
|
23
|
-
output: options.output,
|
|
24
|
-
createSubfolder: options.createSubFolder,
|
|
25
|
-
data: options.data,
|
|
26
|
-
overwrite: options.overwrite,
|
|
27
|
-
quiet: options.quiet,
|
|
28
|
-
helpers: Object.keys((_b = options.helpers) !== null && _b !== void 0 ? _b : {}),
|
|
29
|
-
verbose: `${options.verbose} (${Object.keys(types_1.LogLevel).find((k) => types_1.LogLevel[k] === options.verbose)})`,
|
|
30
|
-
});
|
|
31
|
-
utils_1.log(options, types_1.LogLevel.Info, "Data:", options.data);
|
|
32
|
-
for (let template of options.templates) {
|
|
46
|
+
utils_1.logInitStep(options);
|
|
47
|
+
for (let _template of options.templates) {
|
|
33
48
|
try {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
err.code = "ENOENT";
|
|
38
|
-
err.path = "non-existing-input";
|
|
39
|
-
err.errno = -2;
|
|
40
|
-
throw err;
|
|
41
|
-
}
|
|
42
|
-
const _nonGlobTemplate = _isGlob ? utils_1.removeGlob(template) : template;
|
|
43
|
-
utils_1.log(options, types_1.LogLevel.Debug, "before isDir", "isGlob:", _isGlob, template);
|
|
44
|
-
const _isDir = _isGlob ? true : await utils_1.isDir(template);
|
|
45
|
-
utils_1.log(options, types_1.LogLevel.Debug, "after isDir", _isDir);
|
|
46
|
-
const _shouldAddGlob = !_isGlob && _isDir;
|
|
47
|
-
const origTemplate = template;
|
|
48
|
-
if (_shouldAddGlob) {
|
|
49
|
-
template = template + "/**/*";
|
|
50
|
-
}
|
|
51
|
-
utils_1.log(options, types_1.LogLevel.Debug, "before glob");
|
|
52
|
-
const files = await util_1.promisify(glob_1.glob)(template, {
|
|
53
|
-
dot: true,
|
|
54
|
-
debug: options.verbose === types_1.LogLevel.Debug,
|
|
55
|
-
nodir: true,
|
|
56
|
-
});
|
|
57
|
-
utils_1.log(options, types_1.LogLevel.Debug, "after glob");
|
|
49
|
+
const { nonGlobTemplate, origTemplate, isDirOrGlob, isGlob, template } = await utils_1.getTemplateGlobInfo(options, _template);
|
|
50
|
+
await utils_1.ensureFileExists(template, isDirOrGlob);
|
|
51
|
+
const files = await utils_1.getFileList(options, template);
|
|
58
52
|
for (const inputFilePath of files) {
|
|
59
53
|
if (await utils_1.isDir(inputFilePath)) {
|
|
60
54
|
continue;
|
|
61
55
|
}
|
|
62
|
-
const relPath = utils_1.makeRelativePath(path_1.default.dirname(utils_1.removeGlob(inputFilePath).replace(
|
|
63
|
-
const basePath =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
56
|
+
const relPath = utils_1.makeRelativePath(path_1.default.dirname(utils_1.removeGlob(inputFilePath).replace(nonGlobTemplate, "")));
|
|
57
|
+
const basePath = utils_1.getBasePath(relPath);
|
|
58
|
+
utils_1.logInputFile(options, {
|
|
59
|
+
origTemplate,
|
|
60
|
+
relPath,
|
|
61
|
+
template,
|
|
62
|
+
inputFilePath,
|
|
63
|
+
nonGlobTemplate,
|
|
64
|
+
basePath,
|
|
65
|
+
isDirOrGlob,
|
|
66
|
+
isGlob,
|
|
67
|
+
});
|
|
68
|
+
await handleTemplateFile(options, options.data, { templatePath: inputFilePath, basePath });
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
catch (e) {
|
|
@@ -79,37 +79,19 @@ async function Scaffold({ ...options }) {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
exports.Scaffold = Scaffold;
|
|
82
|
-
async function handleTemplateFile(
|
|
82
|
+
async function handleTemplateFile(options, data, { templatePath, basePath }) {
|
|
83
83
|
return new Promise(async (resolve, reject) => {
|
|
84
84
|
var _a;
|
|
85
85
|
try {
|
|
86
|
-
const inputPath =
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
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`);
|
|
86
|
+
const { inputPath, outputPathOpt, outputDir, outputPath, exists } = await utils_1.getTemplateFileInfo(options, data, {
|
|
87
|
+
templatePath,
|
|
88
|
+
basePath,
|
|
89
|
+
});
|
|
91
90
|
const overwrite = utils_1.getOptionValueForFile(options, inputPath, data, (_a = options.overwrite) !== null && _a !== void 0 ? _a : false);
|
|
92
|
-
|
|
91
|
+
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`);
|
|
93
92
|
await utils_1.createDirIfNotExists(path_1.default.dirname(outputPath), options);
|
|
94
93
|
utils_1.log(options, types_1.LogLevel.Info, `Writing to ${outputPath}`);
|
|
95
|
-
|
|
96
|
-
if (exists && overwrite) {
|
|
97
|
-
utils_1.log(options, types_1.LogLevel.Info, `File ${outputPath} exists, overwriting`);
|
|
98
|
-
}
|
|
99
|
-
const templateBuffer = await readFile(inputPath);
|
|
100
|
-
const outputContents = utils_1.handlebarsParse(options, templateBuffer, data);
|
|
101
|
-
if (!options.dryRun) {
|
|
102
|
-
await writeFile(outputPath, outputContents);
|
|
103
|
-
utils_1.log(options, types_1.LogLevel.Info, "Done.");
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
utils_1.log(options, types_1.LogLevel.Info, "Content output:");
|
|
107
|
-
utils_1.log(options, types_1.LogLevel.Info, outputContents);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
else if (exists) {
|
|
111
|
-
utils_1.log(options, types_1.LogLevel.Info, `File ${outputPath} already exists, skipping`);
|
|
112
|
-
}
|
|
94
|
+
await utils_1.copyFileTransformed(options, data, { exists, overwrite, outputPath, inputPath });
|
|
113
95
|
resolve();
|
|
114
96
|
}
|
|
115
97
|
catch (e) {
|
package/scaffold.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../src/scaffold.ts"],"names":[],"mappings":";;;;;;AAAA
|
|
1
|
+
{"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../src/scaffold.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AAEvB,mCAkBgB;AAChB,mCAAkD;AAElD;;;;;;;;;;;;;;;;;;;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A;YACvD,MAAM,2BAAmB,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAA;YACtF,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
|
@@ -7,6 +7,9 @@ export declare enum LogLevel {
|
|
|
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
|
/**
|
|
12
15
|
* Name to be passed to the generated files. `{{name}}` and `{{Name}}` inside contents and file names will be replaced
|
|
@@ -67,8 +70,25 @@ export interface ScaffoldConfig {
|
|
|
67
70
|
* }
|
|
68
71
|
* })
|
|
69
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.
|
|
70
90
|
*/
|
|
71
|
-
|
|
91
|
+
subFolderNameHelper?: DefaultHelperKeys | string;
|
|
72
92
|
}
|
|
73
93
|
export interface ScaffoldCmdConfig {
|
|
74
94
|
name: string;
|
package/utils.d.ts
CHANGED
|
@@ -1,14 +1,56 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { FileResponse, LogLevel, ScaffoldConfig } from "./types";
|
|
3
|
-
export declare const defaultHelpers:
|
|
2
|
+
import { DefaultHelperKeys, FileResponse, Helper, LogLevel, ScaffoldConfig } from "./types";
|
|
3
|
+
export declare const defaultHelpers: Record<DefaultHelperKeys, Helper>;
|
|
4
4
|
export declare function registerHelpers(options: ScaffoldConfig): void;
|
|
5
5
|
export declare function handleErr(err: NodeJS.ErrnoException | null): void;
|
|
6
6
|
export declare function log(options: ScaffoldConfig, level: LogLevel, ...obj: any[]): void;
|
|
7
7
|
export declare function createDirIfNotExists(dir: string, options: ScaffoldConfig): Promise<void>;
|
|
8
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,
|
|
9
|
+
export declare function handlebarsParse(options: ScaffoldConfig, templateBuffer: Buffer | string, { isPath }?: {
|
|
10
|
+
isPath?: boolean;
|
|
11
|
+
}): string | Buffer;
|
|
10
12
|
export declare function pathExists(filePath: string): Promise<boolean>;
|
|
11
13
|
export declare function pascalCase(s: string): string;
|
|
12
14
|
export declare function isDir(path: string): Promise<boolean>;
|
|
13
15
|
export declare function removeGlob(template: string): string;
|
|
14
16
|
export declare function makeRelativePath(str: string): string;
|
|
17
|
+
export declare function getBasePath(relPath: string): string;
|
|
18
|
+
export declare function getFileList(options: ScaffoldConfig, template: string): Promise<string[]>;
|
|
19
|
+
export interface GlobInfo {
|
|
20
|
+
nonGlobTemplate: string;
|
|
21
|
+
origTemplate: string;
|
|
22
|
+
isDirOrGlob: boolean;
|
|
23
|
+
isGlob: boolean;
|
|
24
|
+
template: string;
|
|
25
|
+
}
|
|
26
|
+
export declare function getTemplateGlobInfo(options: ScaffoldConfig, template: string): Promise<GlobInfo>;
|
|
27
|
+
export declare function ensureFileExists(template: string, isGlob: boolean): Promise<void>;
|
|
28
|
+
export interface OutputFileInfo {
|
|
29
|
+
inputPath: string;
|
|
30
|
+
outputPathOpt: string;
|
|
31
|
+
outputDir: string;
|
|
32
|
+
outputPath: string;
|
|
33
|
+
exists: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare function getTemplateFileInfo(options: ScaffoldConfig, data: Record<string, string>, { templatePath, basePath }: {
|
|
36
|
+
templatePath: string;
|
|
37
|
+
basePath: string;
|
|
38
|
+
}): Promise<OutputFileInfo>;
|
|
39
|
+
export declare function copyFileTransformed(options: ScaffoldConfig, data: Record<string, string>, { exists, overwrite, outputPath, inputPath, }: {
|
|
40
|
+
exists: boolean;
|
|
41
|
+
overwrite: boolean;
|
|
42
|
+
outputPath: string;
|
|
43
|
+
inputPath: string;
|
|
44
|
+
}): Promise<void>;
|
|
45
|
+
export declare function getOutputDir(options: ScaffoldConfig, data: Record<string, string>, outputPathOpt: string, basePath: string): string;
|
|
46
|
+
export declare function logInputFile(options: ScaffoldConfig, { origTemplate, relPath, template, inputFilePath, nonGlobTemplate, basePath, isDirOrGlob, isGlob, }: {
|
|
47
|
+
origTemplate: string;
|
|
48
|
+
relPath: string;
|
|
49
|
+
template: string;
|
|
50
|
+
inputFilePath: string;
|
|
51
|
+
nonGlobTemplate: string;
|
|
52
|
+
basePath: string;
|
|
53
|
+
isDirOrGlob: boolean;
|
|
54
|
+
isGlob: boolean;
|
|
55
|
+
}): void;
|
|
56
|
+
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.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.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,9 @@ 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 glob_1 = require("glob");
|
|
19
|
+
const util_1 = require("util");
|
|
20
|
+
const { readFile, writeFile } = fs_1.promises;
|
|
18
21
|
exports.defaultHelpers = {
|
|
19
22
|
camelCase: camelCase_1.default,
|
|
20
23
|
snakeCase: snakeCase_1.default,
|
|
@@ -40,7 +43,7 @@ function handleErr(err) {
|
|
|
40
43
|
exports.handleErr = handleErr;
|
|
41
44
|
function log(options, level, ...obj) {
|
|
42
45
|
var _a;
|
|
43
|
-
if (options.quiet || options.verbose === types_1.LogLevel.None || level
|
|
46
|
+
if (options.quiet || options.verbose === types_1.LogLevel.None || level < ((_a = options.verbose) !== null && _a !== void 0 ? _a : types_1.LogLevel.Info)) {
|
|
44
47
|
return;
|
|
45
48
|
}
|
|
46
49
|
const levelColor = {
|
|
@@ -84,13 +87,21 @@ function getOptionValueForFile(options, filePath, data, fn, defaultValue) {
|
|
|
84
87
|
if (typeof fn !== "function") {
|
|
85
88
|
return defaultValue !== null && defaultValue !== void 0 ? defaultValue : fn;
|
|
86
89
|
}
|
|
87
|
-
return fn(filePath, path_1.default.dirname(handlebarsParse(options, filePath,
|
|
90
|
+
return fn(filePath, path_1.default.dirname(handlebarsParse(options, filePath, { isPath: true }).toString()), path_1.default.basename(handlebarsParse(options, filePath, { isPath: true }).toString()));
|
|
88
91
|
}
|
|
89
92
|
exports.getOptionValueForFile = getOptionValueForFile;
|
|
90
|
-
function handlebarsParse(options, templateBuffer,
|
|
93
|
+
function handlebarsParse(options, templateBuffer, { isPath = false } = {}) {
|
|
94
|
+
const { data } = options;
|
|
91
95
|
try {
|
|
92
|
-
|
|
93
|
-
|
|
96
|
+
let str = templateBuffer.toString();
|
|
97
|
+
if (isPath) {
|
|
98
|
+
str = str.replace(/\\/g, "/");
|
|
99
|
+
}
|
|
100
|
+
const parser = handlebars_1.default.compile(str, { noEscape: true });
|
|
101
|
+
let outputContents = parser(data);
|
|
102
|
+
if (isPath && path_1.default.sep !== "/") {
|
|
103
|
+
outputContents = outputContents.replace(/\//g, "\\");
|
|
104
|
+
}
|
|
94
105
|
return outputContents;
|
|
95
106
|
}
|
|
96
107
|
catch {
|
|
@@ -122,11 +133,116 @@ async function isDir(path) {
|
|
|
122
133
|
}
|
|
123
134
|
exports.isDir = isDir;
|
|
124
135
|
function removeGlob(template) {
|
|
125
|
-
return template.replace(/\*/g, "").replace(
|
|
136
|
+
return template.replace(/\*/g, "").replace(/(\/\/|\\\\)/g, path_1.default.sep);
|
|
126
137
|
}
|
|
127
138
|
exports.removeGlob = removeGlob;
|
|
128
139
|
function makeRelativePath(str) {
|
|
129
|
-
return str.startsWith(
|
|
140
|
+
return str.startsWith(path_1.default.sep) ? str.slice(1) : str;
|
|
130
141
|
}
|
|
131
142
|
exports.makeRelativePath = makeRelativePath;
|
|
143
|
+
function getBasePath(relPath) {
|
|
144
|
+
return path_1.default
|
|
145
|
+
.resolve(process.cwd(), relPath)
|
|
146
|
+
.replace(process.cwd() + path_1.default.sep, "")
|
|
147
|
+
.replace(process.cwd(), "");
|
|
148
|
+
}
|
|
149
|
+
exports.getBasePath = getBasePath;
|
|
150
|
+
async function getFileList(options, template) {
|
|
151
|
+
return (await util_1.promisify(glob_1.glob)(template, {
|
|
152
|
+
dot: true,
|
|
153
|
+
debug: options.verbose === types_1.LogLevel.Debug,
|
|
154
|
+
nodir: true,
|
|
155
|
+
})).map((f) => f.replace(/\//g, path_1.default.sep));
|
|
156
|
+
}
|
|
157
|
+
exports.getFileList = getFileList;
|
|
158
|
+
async function getTemplateGlobInfo(options, template) {
|
|
159
|
+
const isGlob = glob_1.glob.hasMagic(template);
|
|
160
|
+
log(options, types_1.LogLevel.Debug, "before isDir", "isGlob:", isGlob, template);
|
|
161
|
+
let _template = template;
|
|
162
|
+
const nonGlobTemplate = isGlob ? removeGlob(template) : template;
|
|
163
|
+
const isDirOrGlob = isGlob ? true : await isDir(template);
|
|
164
|
+
log(options, types_1.LogLevel.Debug, "after isDir", isDirOrGlob);
|
|
165
|
+
const _shouldAddGlob = !isGlob && isDirOrGlob;
|
|
166
|
+
const origTemplate = template;
|
|
167
|
+
if (_shouldAddGlob) {
|
|
168
|
+
_template = path_1.default.join(template, "**", "*");
|
|
169
|
+
}
|
|
170
|
+
return { nonGlobTemplate, origTemplate, isDirOrGlob, isGlob, template: _template };
|
|
171
|
+
}
|
|
172
|
+
exports.getTemplateGlobInfo = getTemplateGlobInfo;
|
|
173
|
+
async function ensureFileExists(template, isGlob) {
|
|
174
|
+
if (!isGlob && !(await pathExists(template))) {
|
|
175
|
+
const err = new Error(`ENOENT, no such file or directory ${template}`);
|
|
176
|
+
err.code = "ENOENT";
|
|
177
|
+
err.path = template;
|
|
178
|
+
err.errno = -2;
|
|
179
|
+
throw err;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
exports.ensureFileExists = ensureFileExists;
|
|
183
|
+
async function getTemplateFileInfo(options, data, { templatePath, basePath }) {
|
|
184
|
+
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);
|
|
187
|
+
const outputPath = handlebarsParse(options, path_1.default.join(outputDir, path_1.default.basename(inputPath)), {
|
|
188
|
+
isPath: true,
|
|
189
|
+
}).toString();
|
|
190
|
+
const exists = await pathExists(outputPath);
|
|
191
|
+
return { inputPath, outputPathOpt, outputDir, outputPath, exists };
|
|
192
|
+
}
|
|
193
|
+
exports.getTemplateFileInfo = getTemplateFileInfo;
|
|
194
|
+
async function copyFileTransformed(options, data, { exists, overwrite, outputPath, inputPath, }) {
|
|
195
|
+
if (!exists || overwrite) {
|
|
196
|
+
if (exists && overwrite) {
|
|
197
|
+
log(options, types_1.LogLevel.Info, `File ${outputPath} exists, overwriting`);
|
|
198
|
+
}
|
|
199
|
+
const templateBuffer = await readFile(inputPath);
|
|
200
|
+
const outputContents = handlebarsParse(options, templateBuffer);
|
|
201
|
+
if (!options.dryRun) {
|
|
202
|
+
await writeFile(outputPath, outputContents);
|
|
203
|
+
log(options, types_1.LogLevel.Info, "Done.");
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
log(options, types_1.LogLevel.Info, "Content output:");
|
|
207
|
+
log(options, types_1.LogLevel.Info, outputContents);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
else if (exists) {
|
|
211
|
+
log(options, types_1.LogLevel.Info, `File ${outputPath} already exists, skipping`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
exports.copyFileTransformed = copyFileTransformed;
|
|
215
|
+
function getOutputDir(options, data, outputPathOpt, basePath) {
|
|
216
|
+
return path_1.default.resolve(process.cwd(), ...[
|
|
217
|
+
outputPathOpt,
|
|
218
|
+
basePath,
|
|
219
|
+
options.createSubFolder
|
|
220
|
+
? options.subFolderNameHelper
|
|
221
|
+
? handlebarsParse(options, `{{ ${options.subFolderNameHelper} name }}`)
|
|
222
|
+
: options.name
|
|
223
|
+
: undefined,
|
|
224
|
+
].filter(Boolean));
|
|
225
|
+
}
|
|
226
|
+
exports.getOutputDir = getOutputDir;
|
|
227
|
+
function logInputFile(options, { origTemplate, relPath, template, inputFilePath, nonGlobTemplate, basePath, isDirOrGlob, isGlob, }) {
|
|
228
|
+
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`);
|
|
229
|
+
}
|
|
230
|
+
exports.logInputFile = logInputFile;
|
|
231
|
+
function logInitStep(options) {
|
|
232
|
+
var _a;
|
|
233
|
+
log(options, types_1.LogLevel.Debug, "Full config:", {
|
|
234
|
+
name: options.name,
|
|
235
|
+
templates: options.templates,
|
|
236
|
+
output: options.output,
|
|
237
|
+
createSubfolder: options.createSubFolder,
|
|
238
|
+
data: options.data,
|
|
239
|
+
overwrite: options.overwrite,
|
|
240
|
+
quiet: options.quiet,
|
|
241
|
+
subFolderTransformHelper: options.subFolderNameHelper,
|
|
242
|
+
helpers: Object.keys((_a = options.helpers) !== null && _a !== void 0 ? _a : {}),
|
|
243
|
+
verbose: `${options.verbose} (${Object.keys(types_1.LogLevel).find((k) => types_1.LogLevel[k] === options.verbose)})`,
|
|
244
|
+
});
|
|
245
|
+
log(options, types_1.LogLevel.Info, "Data:", options.data);
|
|
246
|
+
}
|
|
247
|
+
exports.logInitStep = logInitStep;
|
|
132
248
|
//# 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,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAA;IAC1D,KAAK,MAAM,UAAU,IAAI,QAAQ,EAAE;QACjC,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