simple-scaffold 2.3.3 → 3.0.0

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/parser.js DELETED
@@ -1,100 +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.defaultHelpers = void 0;
7
- exports.nowHelper = nowHelper;
8
- exports.dateHelper = dateHelper;
9
- exports.registerHelpers = registerHelpers;
10
- exports.handlebarsParse = handlebarsParse;
11
- const node_path_1 = __importDefault(require("node:path"));
12
- const types_1 = require("./types");
13
- const handlebars_1 = __importDefault(require("handlebars"));
14
- const add_1 = __importDefault(require("date-fns/add"));
15
- const format_1 = __importDefault(require("date-fns/format"));
16
- const parseISO_1 = __importDefault(require("date-fns/parseISO"));
17
- const logger_1 = require("./logger");
18
- const dateFns = {
19
- add: add_1.default.add,
20
- format: format_1.default.format,
21
- parseISO: parseISO_1.default.parseISO,
22
- };
23
- exports.defaultHelpers = {
24
- camelCase,
25
- snakeCase,
26
- startCase,
27
- kebabCase,
28
- hyphenCase: kebabCase,
29
- pascalCase,
30
- lowerCase: (text) => text.toLowerCase(),
31
- upperCase: (text) => text.toUpperCase(),
32
- now: nowHelper,
33
- date: dateHelper,
34
- };
35
- function _dateHelper(date, formatString, durationDifference, durationType) {
36
- if (durationType && durationDifference !== undefined) {
37
- return dateFns.format(dateFns.add(date, { [durationType]: durationDifference }), formatString);
38
- }
39
- return dateFns.format(date, formatString);
40
- }
41
- function nowHelper(formatString, durationDifference, durationType) {
42
- return _dateHelper(new Date(), formatString, durationDifference, durationType);
43
- }
44
- function dateHelper(date, formatString, durationDifference, durationType) {
45
- return _dateHelper(dateFns.parseISO(date), formatString, durationDifference, durationType);
46
- }
47
- // splits by either non-alpha character or capital letter
48
- function toWordParts(string) {
49
- return string.split(/(?=[A-Z])|[^a-zA-Z]/).filter((s) => s.length > 0);
50
- }
51
- function camelCase(s) {
52
- return toWordParts(s).reduce((acc, part, i) => {
53
- if (i === 0) {
54
- return part.toLowerCase();
55
- }
56
- return acc + part[0].toUpperCase() + part.slice(1).toLowerCase();
57
- }, "");
58
- }
59
- function snakeCase(s) {
60
- return toWordParts(s).join("_").toLowerCase();
61
- }
62
- function kebabCase(s) {
63
- return toWordParts(s).join("-").toLowerCase();
64
- }
65
- function startCase(s) {
66
- return toWordParts(s)
67
- .map((part) => part[0].toUpperCase() + part.slice(1).toLowerCase())
68
- .join(" ");
69
- }
70
- function pascalCase(s) {
71
- return startCase(s).replace(/\s+/g, "");
72
- }
73
- function registerHelpers(config) {
74
- const _helpers = { ...exports.defaultHelpers, ...config.helpers };
75
- for (const helperName in _helpers) {
76
- (0, logger_1.log)(config, types_1.LogLevel.debug, `Registering helper: ${helperName}`);
77
- handlebars_1.default.registerHelper(helperName, _helpers[helperName]);
78
- }
79
- }
80
- function handlebarsParse(config, templateBuffer, { asPath = false } = {}) {
81
- const { data } = config;
82
- try {
83
- let str = templateBuffer.toString();
84
- if (asPath) {
85
- str = str.replace(/\\/g, "/");
86
- }
87
- const parser = handlebars_1.default.compile(str, { noEscape: true });
88
- let outputContents = parser(data);
89
- if (asPath && node_path_1.default.sep !== "/") {
90
- outputContents = outputContents.replace(/\//g, "\\");
91
- }
92
- return Buffer.from(outputContents);
93
- }
94
- catch (e) {
95
- (0, logger_1.log)(config, types_1.LogLevel.debug, e);
96
- (0, logger_1.log)(config, types_1.LogLevel.info, "Couldn't parse file with handlebars, returning original content");
97
- return Buffer.from(templateBuffer);
98
- }
99
- }
100
- //# sourceMappingURL=parser.js.map
package/parser.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"parser.js","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":";;;;;;AA4CA,8BAEC;AASD,gCAOC;AAkCD,0CAMC;AAED,0CAsBC;AA9HD,0DAA4B;AAC5B,mCAA0E;AAC1E,4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A;QAC9B,IAAA,YAAG,EAAC,MAAM,EAAE,gBAAQ,CAAC,IAAI,EAAE,iEAAiE,CAAC,CAAA;QAC7F,OAAO,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;IACpC,CAAC;AACH,CAAC"}
package/scaffold.js DELETED
@@ -1,139 +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.Scaffold = Scaffold;
7
- /**
8
- * @module
9
- * Simple Scaffold
10
- *
11
- * See [readme](README.md)
12
- */
13
- const node_path_1 = __importDefault(require("node:path"));
14
- const node_os_1 = __importDefault(require("node:os"));
15
- const utils_1 = require("./utils");
16
- const file_1 = require("./file");
17
- const types_1 = require("./types");
18
- const parser_1 = require("./parser");
19
- const logger_1 = require("./logger");
20
- const config_1 = require("./config");
21
- /**
22
- * Create a scaffold using given `options`.
23
- *
24
- * #### Create files
25
- * To create a file structure to output, use any directory and file structure you would like.
26
- * Inside folder names, file names or file contents, you may place `{{ var }}` where `var` is either
27
- * `name` which is the scaffold name you provided or one of the keys you provided in the `data` option.
28
- *
29
- * The contents and names will be replaced with the transformed values so you can use your original structure as a
30
- * boilerplate for other projects, components, modules, or even single files.
31
- *
32
- * The files will maintain their structure, starting from the directory containing the template (or the template itself
33
- * if it is already a directory), and will output from that directory into the directory defined by `config.output`.
34
- *
35
- * #### Helpers
36
- * Helpers are functions you can use to transform your `{{ var }}` contents into other values without having to
37
- * pre-define the data and use a duplicated key.
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
- * For available default values, see {@link DefaultHelpers}.
43
- *
44
- * @param {ScaffoldConfig} config The main configuration object
45
- * @return {Promise<void>} A promise that resolves when the scaffold is complete
46
- *
47
- * @see {@link DefaultHelpers}
48
- * @see {@link CaseHelpers}
49
- * @see {@link DateHelpers}
50
- *
51
- * @category Main
52
- */
53
- async function Scaffold(config) {
54
- config.output ??= process.cwd();
55
- (0, parser_1.registerHelpers)(config);
56
- try {
57
- config.data = { name: config.name, ...config.data };
58
- (0, logger_1.logInitStep)(config);
59
- const excludes = config.templates.filter((t) => t.startsWith("!"));
60
- const includes = config.templates.filter((t) => !t.startsWith("!"));
61
- const templates = [];
62
- for (const includedTemplate of includes) {
63
- try {
64
- const { nonGlobTemplate, origTemplate, isDirOrGlob, isGlob, template } = await (0, file_1.getTemplateGlobInfo)(config, includedTemplate);
65
- templates.push({ nonGlobTemplate, origTemplate, isDirOrGlob, isGlob, template });
66
- }
67
- catch (e) {
68
- (0, utils_1.handleErr)(e);
69
- }
70
- }
71
- for (const tpl of templates) {
72
- const files = await (0, file_1.getFileList)(config, [tpl.template, ...excludes]);
73
- for (const file of files) {
74
- if (await (0, file_1.isDir)(file)) {
75
- continue;
76
- }
77
- (0, logger_1.log)(config, types_1.LogLevel.debug, "Iterating files", { files, file });
78
- const relPath = (0, file_1.makeRelativePath)(node_path_1.default.dirname((0, file_1.removeGlob)(file).replace(tpl.nonGlobTemplate, "")));
79
- const basePath = (0, file_1.getBasePath)(relPath);
80
- (0, logger_1.logInputFile)(config, {
81
- originalTemplate: tpl.origTemplate,
82
- relativePath: relPath,
83
- parsedTemplate: tpl.template,
84
- inputFilePath: file,
85
- nonGlobTemplate: tpl.nonGlobTemplate,
86
- basePath,
87
- isDirOrGlob: tpl.isDirOrGlob,
88
- isGlob: tpl.isGlob,
89
- });
90
- await (0, file_1.handleTemplateFile)(config, {
91
- templatePath: file,
92
- basePath,
93
- });
94
- }
95
- }
96
- }
97
- catch (e) {
98
- (0, logger_1.log)(config, types_1.LogLevel.error, e);
99
- throw e;
100
- }
101
- }
102
- /**
103
- * Create a scaffold based on a config file or URL.
104
- *
105
- * @param {string} pathOrUrl The path or URL to the config file
106
- * @param {Record<string, string>} config Information needed before loading the config
107
- * @param {Partial<Omit<ScaffoldConfig, 'name'>>} overrides Any overrides to the loaded config
108
- *
109
- * @see {@link Scaffold}
110
- * @category Main
111
- * @return {Promise<void>} A promise that resolves when the scaffold is complete
112
- */
113
- Scaffold.fromConfig = async function (
114
- /** The path or URL to the config file */
115
- pathOrUrl,
116
- /** Information needed before loading the config */
117
- config,
118
- /** Any overrides to the loaded config */
119
- overrides) {
120
- const tmpPath = node_path_1.default.resolve(node_os_1.default.tmpdir(), `scaffold-config-${Date.now()}`);
121
- const _cmdConfig = {
122
- dryRun: false,
123
- output: process.cwd(),
124
- logLevel: types_1.LogLevel.info,
125
- overwrite: false,
126
- templates: [],
127
- subdir: false,
128
- quiet: false,
129
- config: pathOrUrl,
130
- version: false,
131
- tmpDir: tmpPath,
132
- ...config,
133
- };
134
- const _overrides = (0, utils_1.resolve)(overrides, _cmdConfig);
135
- const _config = await (0, config_1.parseConfigFile)(_cmdConfig);
136
- return Scaffold({ ..._config, ..._overrides });
137
- };
138
- exports.default = Scaffold;
139
- //# sourceMappingURL=scaffold.js.map
package/scaffold.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../src/scaffold.ts"],"names":[],"mappings":";;;;;AAyDA,4BAkDC;AA3GD;;;;;GAKG;AACH,0DAA4B;AAC5B,sDAAwB;AAExB,mCAA4C;AAC5C,iCASe;AACf,mCAA8F;AAC9F,qCAA0C;AAC1C,qCAAyD;AACzD,qCAA0C;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACI,KAAK,UAAU,QAAQ,CAAC,MAAsB;IACnD,MAAM,CAAC,MAAM,KAAK,OAAO,CAAC,GAAG,EAAE,CAAA;IAE/B,IAAA,wBAAe,EAAC,MAAM,CAAC,CAAA;IACvB,IAAI,CAAC;QACH,MAAM,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,IAAI,EAAE,CAAA;QACnD,IAAA,oBAAW,EAAC,MAAM,CAAC,C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AChB,SAAS,EAAE,EAAE;QACb,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,OAAO;QACf,GAAG,MAAM;KACV,CAAA;IACD,MAAM,UAAU,GAAG,IAAA,eAAO,EAAC,SAAS,EAAE,UAAU,CAAC,CAAA;IACjD,MAAM,OAAO,GAAG,MAAM,IAAA,wBAAe,EAAC,UAAU,CAAC,CAAA;IACjD,OAAO,QAAQ,CAAC,EAAE,GAAG,OAAO,EAAE,GAAG,UAAU,EAAE,CAAC,CAAA;AAChD,CAAC,CAAA;AAED,kBAAe,QAAQ,CAAA"}
package/types.js DELETED
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LogLevel = void 0;
4
- /**
5
- * The amount of information to log when generating scaffold.
6
- * When not `none`, the selected level will be the lowest level included.
7
- *
8
- * For example, level `info` will include `info`, `warning` and `error`, but not `debug`; and `warning` will only
9
- * show `warning` and `error`, but not `info` or `debug`.
10
- *
11
- * @default `info`
12
- *
13
- * @category Logging (const)
14
- */
15
- exports.LogLevel = {
16
- /** Silent output */
17
- none: "none",
18
- /** Debugging information. Very verbose and only recommended for troubleshooting. */
19
- debug: "debug",
20
- /**
21
- * The regular level of logging. Major actions are logged to show the scaffold progress.
22
- *
23
- * @default
24
- */
25
- info: "info",
26
- /** Warnings such as when file fails to replace token values properly in template. */
27
- warning: "warning",
28
- /** Errors, such as missing files, bad replacement token syntax, or un-writable directories. */
29
- error: "error",
30
- };
31
- //# sourceMappingURL=types.js.map
package/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AA2QA;;;;;;;;;;GAUG;AAEU,QAAA,QAAQ,GAAG;IACtB,oBAAoB;IACpB,IAAI,EAAE,MAAM;IACZ,oFAAoF;IACpF,KAAK,EAAE,OAAO;IACd;;;;OAIG;IACH,IAAI,EAAE,MAAM;IACZ,qFAAqF;IACrF,OAAO,EAAE,SAAS;IAClB,+FAA+F;IAC/F,KAAK,EAAE,OAAO;CACN,CAAA"}
package/utils.js DELETED
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.colorize = void 0;
4
- exports.handleErr = handleErr;
5
- exports.resolve = resolve;
6
- exports.wrapNoopResolver = wrapNoopResolver;
7
- function handleErr(err) {
8
- if (err)
9
- throw err;
10
- }
11
- function resolve(resolver, arg) {
12
- return typeof resolver === "function" ? resolver(arg) : resolver;
13
- }
14
- function wrapNoopResolver(value) {
15
- if (typeof value === "function") {
16
- return value;
17
- }
18
- return (_) => value;
19
- }
20
- const colorMap = {
21
- reset: 0,
22
- dim: 2,
23
- bold: 1,
24
- italic: 3,
25
- underline: 4,
26
- red: 31,
27
- green: 32,
28
- yellow: 33,
29
- blue: 34,
30
- magenta: 35,
31
- cyan: 36,
32
- white: 37,
33
- gray: 90,
34
- };
35
- function _colorize(text, color) {
36
- const c = colorMap[color];
37
- let r = 0;
38
- if (c > 1 && c < 30) {
39
- r = c + 20;
40
- }
41
- else if (c === 1) {
42
- r = 23;
43
- }
44
- else {
45
- r = 0;
46
- }
47
- return `\x1b[${c}m${text}\x1b[${r}m`;
48
- }
49
- function isTemplateStringArray(template) {
50
- return Array.isArray(template) && typeof template[0] === "string";
51
- }
52
- const createColorize = (color) => (template, ...params) => {
53
- return isTemplateStringArray(template)
54
- ? _colorize(template.reduce((acc, str, i) => acc + str + (params[i] ?? ""), ""), color)
55
- : _colorize(String(template), color);
56
- };
57
- exports.colorize = Object.assign(_colorize, Object.entries(colorMap).reduce((acc, [key]) => {
58
- acc[key] = createColorize(key);
59
- return acc;
60
- }, {}));
61
- //# sourceMappingURL=utils.js.map
package/utils.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mapp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