simple-scaffold 1.3.0 → 1.3.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/cmd.d.ts +2 -0
- package/cmd.js +127 -0
- package/cmd.js.map +1 -0
- package/index.d.ts +4 -0
- package/index.js +24 -0
- package/index.js.map +1 -0
- package/package.json +1 -4
- package/scaffold.d.ts +34 -0
- package/scaffold.js +113 -0
- package/scaffold.js.map +1 -0
- package/types.d.ts +310 -0
- package/types.js +32 -0
- package/types.js.map +1 -0
- package/utils.d.ts +66 -0
- package/utils.js +303 -0
- package/utils.js.map +1 -0
- package/.editorconfig +0 -8
- package/.github/FUNDING.yml +0 -13
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -47
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -24
- package/.github/workflows/docs.yml +0 -20
- package/.github/workflows/pull_requests.yml +0 -17
- package/.github/workflows/release.yml +0 -22
- package/.markdownlint.json +0 -9
- package/.prettierrc +0 -15
- package/.vscode/launch.json +0 -27
- package/.vscode/settings.json +0 -22
- package/.vscode/tasks.json +0 -59
- package/CHANGELOG.md +0 -111
- package/LICENSE +0 -21
- package/examples/test-input/Component/.hidden-file +0 -0
- package/examples/test-input/Component/button-example.png +0 -0
- package/examples/test-input/Component/inner/inner-{{name}}.txt +0 -1
- package/examples/test-input/Component/{{Name}}.tsx +0 -17
- package/examples/test-input/scaffold.config.js +0 -13
- package/jest.config.ts +0 -205
- package/media/intro.gif +0 -0
- package/pages/README.md +0 -7
- package/pages/cli.md +0 -74
- package/pages/configuration_files.md +0 -86
- package/pages/migration.md +0 -25
- package/pages/node.md +0 -53
- package/pages/templates.md +0 -224
- package/release.config.js +0 -76
- package/src/cmd.ts +0 -131
- package/src/docs.css +0 -55
- package/src/index.ts +0 -4
- package/src/scaffold.ts +0 -140
- package/src/types.ts +0 -342
- package/src/utils.ts +0 -423
- package/tests/scaffold.test.ts +0 -502
- package/tests/utils.test.ts +0 -124
- package/tsconfig.json +0 -16
- package/typedoc.config.js +0 -63
package/types.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
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` (2) will include `Info`, `Warning` and `Error`, but not `Debug`; and `Warning` will only
|
|
9
|
+
* show `Warning` and `Error`.
|
|
10
|
+
*
|
|
11
|
+
* @default `2 (info)`
|
|
12
|
+
*
|
|
13
|
+
* @category Logging
|
|
14
|
+
*/
|
|
15
|
+
var LogLevel;
|
|
16
|
+
(function (LogLevel) {
|
|
17
|
+
/** Silent output */
|
|
18
|
+
LogLevel[LogLevel["None"] = 0] = "None";
|
|
19
|
+
/** Debugging information. Very verbose and only recommended for troubleshooting. */
|
|
20
|
+
LogLevel[LogLevel["Debug"] = 1] = "Debug";
|
|
21
|
+
/**
|
|
22
|
+
* The regular level of logging. Major actions are logged to show the scaffold progress.
|
|
23
|
+
*
|
|
24
|
+
* @default
|
|
25
|
+
*/
|
|
26
|
+
LogLevel[LogLevel["Info"] = 2] = "Info";
|
|
27
|
+
/** Warnings such as when file fails to replace token values properly in template. */
|
|
28
|
+
LogLevel[LogLevel["Warning"] = 3] = "Warning";
|
|
29
|
+
/** Errors, such as missing files, bad replacement token syntax, or un-writable directories. */
|
|
30
|
+
LogLevel[LogLevel["Error"] = 4] = "Error";
|
|
31
|
+
})(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
|
|
32
|
+
//# sourceMappingURL=types.js.map
|
package/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AA0QA;;;;;;;;;;GAUG;AACH,IAAY,QAeX;AAfD,WAAY,QAAQ;IAClB,oBAAoB;IACpB,uCAAQ,CAAA;IACR,oFAAoF;IACpF,yCAAS,CAAA;IACT;;;;OAIG;IACH,uCAAQ,CAAA;IACR,qFAAqF;IACrF,6CAAW,CAAA;IACX,+FAA+F;IAC/F,yCAAS,CAAA;AACX,CAAC,EAfW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAenB"}
|
package/utils.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { DefaultHelpers, FileResponse, Helper, LogLevel, ScaffoldCmdConfig, ScaffoldConfig } from "./types";
|
|
4
|
+
import { OptionsBase } from "massarg/types";
|
|
5
|
+
export declare const defaultHelpers: Record<DefaultHelpers, Helper>;
|
|
6
|
+
export declare function _dateHelper(date: Date, formatString: string): string;
|
|
7
|
+
export declare function _dateHelper(date: Date, formatString: string, durationDifference: number, durationType: keyof Duration): string;
|
|
8
|
+
export declare function nowHelper(formatString: string): string;
|
|
9
|
+
export declare function nowHelper(formatString: string, durationDifference: number, durationType: keyof Duration): string;
|
|
10
|
+
export declare function dateHelper(date: string, formatString: string): string;
|
|
11
|
+
export declare function dateHelper(date: string, formatString: string, durationDifference: number, durationType: keyof Duration): string;
|
|
12
|
+
export declare function registerHelpers(config: ScaffoldConfig): void;
|
|
13
|
+
export declare function handleErr(err: NodeJS.ErrnoException | null): void;
|
|
14
|
+
export declare function log(config: ScaffoldConfig, level: LogLevel, ...obj: any[]): void;
|
|
15
|
+
export declare function createDirIfNotExists(dir: string, config: ScaffoldConfig): Promise<void>;
|
|
16
|
+
export declare function getOptionValueForFile<T>(config: ScaffoldConfig, filePath: string, fn: FileResponse<T>, defaultValue?: T): T;
|
|
17
|
+
export declare function handlebarsParse(config: ScaffoldConfig, templateBuffer: Buffer | string, { isPath }?: {
|
|
18
|
+
isPath?: boolean;
|
|
19
|
+
}): Buffer;
|
|
20
|
+
export declare function pathExists(filePath: string): Promise<boolean>;
|
|
21
|
+
export declare function pascalCase(s: string): string;
|
|
22
|
+
export declare function isDir(path: string): Promise<boolean>;
|
|
23
|
+
export declare function removeGlob(template: string): string;
|
|
24
|
+
export declare function makeRelativePath(str: string): string;
|
|
25
|
+
export declare function getBasePath(relPath: string): string;
|
|
26
|
+
export declare function getFileList(config: ScaffoldConfig, template: string): Promise<string[]>;
|
|
27
|
+
export interface GlobInfo {
|
|
28
|
+
nonGlobTemplate: string;
|
|
29
|
+
origTemplate: string;
|
|
30
|
+
isDirOrGlob: boolean;
|
|
31
|
+
isGlob: boolean;
|
|
32
|
+
template: string;
|
|
33
|
+
}
|
|
34
|
+
export declare function getTemplateGlobInfo(config: ScaffoldConfig, template: string): Promise<GlobInfo>;
|
|
35
|
+
export interface OutputFileInfo {
|
|
36
|
+
inputPath: string;
|
|
37
|
+
outputPathOpt: string;
|
|
38
|
+
outputDir: string;
|
|
39
|
+
outputPath: string;
|
|
40
|
+
exists: boolean;
|
|
41
|
+
}
|
|
42
|
+
export declare function getTemplateFileInfo(config: ScaffoldConfig, { templatePath, basePath }: {
|
|
43
|
+
templatePath: string;
|
|
44
|
+
basePath: string;
|
|
45
|
+
}): Promise<OutputFileInfo>;
|
|
46
|
+
export declare function copyFileTransformed(config: ScaffoldConfig, { exists, overwrite, outputPath, inputPath, }: {
|
|
47
|
+
exists: boolean;
|
|
48
|
+
overwrite: boolean;
|
|
49
|
+
outputPath: string;
|
|
50
|
+
inputPath: string;
|
|
51
|
+
}): Promise<void>;
|
|
52
|
+
export declare function getOutputDir(config: ScaffoldConfig, outputPathOpt: string, basePath: string): string;
|
|
53
|
+
export declare function logInputFile(config: ScaffoldConfig, { origTemplate, relPath, template, inputFilePath, nonGlobTemplate, basePath, isDirOrGlob, isGlob, }: {
|
|
54
|
+
origTemplate: string;
|
|
55
|
+
relPath: string;
|
|
56
|
+
template: string;
|
|
57
|
+
inputFilePath: string;
|
|
58
|
+
nonGlobTemplate: string;
|
|
59
|
+
basePath: string;
|
|
60
|
+
isDirOrGlob: boolean;
|
|
61
|
+
isGlob: boolean;
|
|
62
|
+
}): void;
|
|
63
|
+
export declare function logInitStep(config: ScaffoldConfig): void;
|
|
64
|
+
export declare function parseAppendData(value: string, options: ScaffoldCmdConfig & OptionsBase): unknown;
|
|
65
|
+
/** @internal */
|
|
66
|
+
export declare function parseConfig(config: ScaffoldCmdConfig & OptionsBase): ScaffoldConfig;
|
package/utils.js
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
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.parseConfig = exports.parseAppendData = exports.logInitStep = exports.logInputFile = exports.getOutputDir = exports.copyFileTransformed = exports.getTemplateFileInfo = exports.getTemplateGlobInfo = exports.getFileList = exports.getBasePath = exports.makeRelativePath = exports.removeGlob = exports.isDir = exports.pascalCase = exports.pathExists = exports.handlebarsParse = exports.getOptionValueForFile = exports.createDirIfNotExists = exports.log = exports.handleErr = exports.registerHelpers = exports.dateHelper = exports.nowHelper = exports._dateHelper = exports.defaultHelpers = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const constants_1 = require("constants");
|
|
9
|
+
const types_1 = require("./types");
|
|
10
|
+
const camelCase_1 = __importDefault(require("lodash/camelCase"));
|
|
11
|
+
const snakeCase_1 = __importDefault(require("lodash/snakeCase"));
|
|
12
|
+
const kebabCase_1 = __importDefault(require("lodash/kebabCase"));
|
|
13
|
+
const startCase_1 = __importDefault(require("lodash/startCase"));
|
|
14
|
+
const handlebars_1 = __importDefault(require("handlebars"));
|
|
15
|
+
const fs_1 = require("fs");
|
|
16
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
17
|
+
const { stat, access, mkdir } = fs_1.promises;
|
|
18
|
+
const add_1 = __importDefault(require("date-fns/add"));
|
|
19
|
+
const format_1 = __importDefault(require("date-fns/format"));
|
|
20
|
+
const parseISO_1 = __importDefault(require("date-fns/parseISO"));
|
|
21
|
+
const glob_1 = require("glob");
|
|
22
|
+
const dateFns = {
|
|
23
|
+
add: add_1.default,
|
|
24
|
+
format: format_1.default,
|
|
25
|
+
parseISO: parseISO_1.default,
|
|
26
|
+
};
|
|
27
|
+
const { readFile, writeFile } = fs_1.promises;
|
|
28
|
+
exports.defaultHelpers = {
|
|
29
|
+
camelCase: camelCase_1.default,
|
|
30
|
+
snakeCase: snakeCase_1.default,
|
|
31
|
+
startCase: startCase_1.default,
|
|
32
|
+
kebabCase: kebabCase_1.default,
|
|
33
|
+
hyphenCase: kebabCase_1.default,
|
|
34
|
+
pascalCase,
|
|
35
|
+
lowerCase: (text) => text.toLowerCase(),
|
|
36
|
+
upperCase: (text) => text.toUpperCase(),
|
|
37
|
+
now: nowHelper,
|
|
38
|
+
date: dateHelper,
|
|
39
|
+
};
|
|
40
|
+
function _dateHelper(date, formatString, durationDifference, durationType) {
|
|
41
|
+
if (durationType && durationDifference !== undefined) {
|
|
42
|
+
return dateFns.format(dateFns.add(date, { [durationType]: durationDifference }), formatString);
|
|
43
|
+
}
|
|
44
|
+
return dateFns.format(date, formatString);
|
|
45
|
+
}
|
|
46
|
+
exports._dateHelper = _dateHelper;
|
|
47
|
+
function nowHelper(formatString, durationDifference, durationType) {
|
|
48
|
+
return _dateHelper(new Date(), formatString, durationDifference, durationType);
|
|
49
|
+
}
|
|
50
|
+
exports.nowHelper = nowHelper;
|
|
51
|
+
function dateHelper(date, formatString, durationDifference, durationType) {
|
|
52
|
+
return _dateHelper(dateFns.parseISO(date), formatString, durationDifference, durationType);
|
|
53
|
+
}
|
|
54
|
+
exports.dateHelper = dateHelper;
|
|
55
|
+
function registerHelpers(config) {
|
|
56
|
+
const _helpers = { ...exports.defaultHelpers, ...config.helpers };
|
|
57
|
+
for (const helperName in _helpers) {
|
|
58
|
+
log(config, types_1.LogLevel.Debug, `Registering helper: ${helperName}`);
|
|
59
|
+
handlebars_1.default.registerHelper(helperName, _helpers[helperName]);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.registerHelpers = registerHelpers;
|
|
63
|
+
function handleErr(err) {
|
|
64
|
+
if (err)
|
|
65
|
+
throw err;
|
|
66
|
+
}
|
|
67
|
+
exports.handleErr = handleErr;
|
|
68
|
+
function log(config, level, ...obj) {
|
|
69
|
+
var _a;
|
|
70
|
+
if (config.quiet || config.verbose === types_1.LogLevel.None || level < ((_a = config.verbose) !== null && _a !== void 0 ? _a : types_1.LogLevel.Info)) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const levelColor = {
|
|
74
|
+
[types_1.LogLevel.None]: "reset",
|
|
75
|
+
[types_1.LogLevel.Debug]: "blue",
|
|
76
|
+
[types_1.LogLevel.Info]: "dim",
|
|
77
|
+
[types_1.LogLevel.Warning]: "yellow",
|
|
78
|
+
[types_1.LogLevel.Error]: "red",
|
|
79
|
+
};
|
|
80
|
+
const chalkFn = chalk_1.default[levelColor[level]];
|
|
81
|
+
const key = level === types_1.LogLevel.Error ? "error" : level === types_1.LogLevel.Warning ? "warn" : "log";
|
|
82
|
+
const logFn = console[key];
|
|
83
|
+
logFn(...obj.map((i) => i instanceof Error
|
|
84
|
+
? chalkFn(i, JSON.stringify(i, undefined, 1), i.stack)
|
|
85
|
+
: typeof i === "object"
|
|
86
|
+
? chalkFn(JSON.stringify(i, undefined, 1))
|
|
87
|
+
: chalkFn(i)));
|
|
88
|
+
}
|
|
89
|
+
exports.log = log;
|
|
90
|
+
async function createDirIfNotExists(dir, config) {
|
|
91
|
+
const parentDir = path_1.default.dirname(dir);
|
|
92
|
+
if (!(await pathExists(parentDir))) {
|
|
93
|
+
await createDirIfNotExists(parentDir, config);
|
|
94
|
+
}
|
|
95
|
+
if (!(await pathExists(dir))) {
|
|
96
|
+
try {
|
|
97
|
+
log(config, types_1.LogLevel.Debug, `Creating dir ${dir}`);
|
|
98
|
+
await mkdir(dir);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
if (e.code !== "EEXIST") {
|
|
103
|
+
throw e;
|
|
104
|
+
}
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.createDirIfNotExists = createDirIfNotExists;
|
|
110
|
+
function getOptionValueForFile(config, filePath, fn, defaultValue) {
|
|
111
|
+
if (typeof fn !== "function") {
|
|
112
|
+
return defaultValue !== null && defaultValue !== void 0 ? defaultValue : fn;
|
|
113
|
+
}
|
|
114
|
+
return fn(filePath, path_1.default.dirname(handlebarsParse(config, filePath, { isPath: true }).toString()), path_1.default.basename(handlebarsParse(config, filePath, { isPath: true }).toString()));
|
|
115
|
+
}
|
|
116
|
+
exports.getOptionValueForFile = getOptionValueForFile;
|
|
117
|
+
function handlebarsParse(config, templateBuffer, { isPath = false } = {}) {
|
|
118
|
+
const { data } = config;
|
|
119
|
+
try {
|
|
120
|
+
let str = templateBuffer.toString();
|
|
121
|
+
if (isPath) {
|
|
122
|
+
str = str.replace(/\\/g, "/");
|
|
123
|
+
}
|
|
124
|
+
const parser = handlebars_1.default.compile(str, { noEscape: true });
|
|
125
|
+
let outputContents = parser(data);
|
|
126
|
+
if (isPath && path_1.default.sep !== "/") {
|
|
127
|
+
outputContents = outputContents.replace(/\//g, "\\");
|
|
128
|
+
}
|
|
129
|
+
return Buffer.from(outputContents);
|
|
130
|
+
}
|
|
131
|
+
catch (e) {
|
|
132
|
+
log(config, types_1.LogLevel.Debug, e);
|
|
133
|
+
log(config, types_1.LogLevel.Warning, "Couldn't parse file with handlebars, returning original content");
|
|
134
|
+
return Buffer.from(templateBuffer);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.handlebarsParse = handlebarsParse;
|
|
138
|
+
async function pathExists(filePath) {
|
|
139
|
+
try {
|
|
140
|
+
await access(filePath, constants_1.F_OK);
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
catch (e) {
|
|
144
|
+
if (e.code === "ENOENT") {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
throw e;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.pathExists = pathExists;
|
|
151
|
+
function pascalCase(s) {
|
|
152
|
+
return (0, startCase_1.default)(s).replace(/\s+/g, "");
|
|
153
|
+
}
|
|
154
|
+
exports.pascalCase = pascalCase;
|
|
155
|
+
async function isDir(path) {
|
|
156
|
+
const tplStat = await stat(path);
|
|
157
|
+
return tplStat.isDirectory();
|
|
158
|
+
}
|
|
159
|
+
exports.isDir = isDir;
|
|
160
|
+
function removeGlob(template) {
|
|
161
|
+
return template.replace(/\*/g, "").replace(/(\/\/|\\\\)/g, path_1.default.sep);
|
|
162
|
+
}
|
|
163
|
+
exports.removeGlob = removeGlob;
|
|
164
|
+
function makeRelativePath(str) {
|
|
165
|
+
return str.startsWith(path_1.default.sep) ? str.slice(1) : str;
|
|
166
|
+
}
|
|
167
|
+
exports.makeRelativePath = makeRelativePath;
|
|
168
|
+
function getBasePath(relPath) {
|
|
169
|
+
return path_1.default
|
|
170
|
+
.resolve(process.cwd(), relPath)
|
|
171
|
+
.replace(process.cwd() + path_1.default.sep, "")
|
|
172
|
+
.replace(process.cwd(), "");
|
|
173
|
+
}
|
|
174
|
+
exports.getBasePath = getBasePath;
|
|
175
|
+
async function getFileList(config, template) {
|
|
176
|
+
return (await (0, glob_1.glob)(template, {
|
|
177
|
+
dot: true,
|
|
178
|
+
nodir: true,
|
|
179
|
+
// debug: config.verbose === LogLevel.Debug,
|
|
180
|
+
})).map((f) => f.replace(/\//g, path_1.default.sep));
|
|
181
|
+
}
|
|
182
|
+
exports.getFileList = getFileList;
|
|
183
|
+
async function getTemplateGlobInfo(config, template) {
|
|
184
|
+
const isGlob = (0, glob_1.hasMagic)(template);
|
|
185
|
+
log(config, types_1.LogLevel.Debug, "before isDir", "isGlob:", isGlob, template);
|
|
186
|
+
let _template = template;
|
|
187
|
+
let nonGlobTemplate = isGlob ? removeGlob(template) : template;
|
|
188
|
+
nonGlobTemplate = path_1.default.normalize(nonGlobTemplate);
|
|
189
|
+
const isDirOrGlob = isGlob ? true : await isDir(template);
|
|
190
|
+
log(config, types_1.LogLevel.Debug, "after isDir", isDirOrGlob);
|
|
191
|
+
const _shouldAddGlob = !isGlob && isDirOrGlob;
|
|
192
|
+
const origTemplate = template;
|
|
193
|
+
if (_shouldAddGlob) {
|
|
194
|
+
_template = path_1.default.join(template, "**", "*");
|
|
195
|
+
}
|
|
196
|
+
return { nonGlobTemplate, origTemplate, isDirOrGlob, isGlob, template: _template };
|
|
197
|
+
}
|
|
198
|
+
exports.getTemplateGlobInfo = getTemplateGlobInfo;
|
|
199
|
+
async function getTemplateFileInfo(config, { templatePath, basePath }) {
|
|
200
|
+
const inputPath = path_1.default.resolve(process.cwd(), templatePath);
|
|
201
|
+
const outputPathOpt = getOptionValueForFile(config, inputPath, config.output);
|
|
202
|
+
const outputDir = getOutputDir(config, outputPathOpt, basePath);
|
|
203
|
+
const outputPath = handlebarsParse(config, path_1.default.join(outputDir, path_1.default.basename(inputPath)), {
|
|
204
|
+
isPath: true,
|
|
205
|
+
}).toString();
|
|
206
|
+
const exists = await pathExists(outputPath);
|
|
207
|
+
return { inputPath, outputPathOpt, outputDir, outputPath, exists };
|
|
208
|
+
}
|
|
209
|
+
exports.getTemplateFileInfo = getTemplateFileInfo;
|
|
210
|
+
async function copyFileTransformed(config, { exists, overwrite, outputPath, inputPath, }) {
|
|
211
|
+
var _a, _b;
|
|
212
|
+
if (!exists || overwrite) {
|
|
213
|
+
if (exists && overwrite) {
|
|
214
|
+
log(config, types_1.LogLevel.Info, `File ${outputPath} exists, overwriting`);
|
|
215
|
+
}
|
|
216
|
+
const templateBuffer = await readFile(inputPath);
|
|
217
|
+
const unprocessedOutputContents = handlebarsParse(config, templateBuffer);
|
|
218
|
+
const finalOutputContents = (_b = (await ((_a = config.beforeWrite) === null || _a === void 0 ? void 0 : _a.call(config, unprocessedOutputContents, templateBuffer, outputPath)))) !== null && _b !== void 0 ? _b : unprocessedOutputContents;
|
|
219
|
+
if (!config.dryRun) {
|
|
220
|
+
await writeFile(outputPath, finalOutputContents);
|
|
221
|
+
log(config, types_1.LogLevel.Info, "Done.");
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
log(config, types_1.LogLevel.Info, "Content output:");
|
|
225
|
+
log(config, types_1.LogLevel.Info, finalOutputContents);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
else if (exists) {
|
|
229
|
+
log(config, types_1.LogLevel.Info, `File ${outputPath} already exists, skipping`);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
exports.copyFileTransformed = copyFileTransformed;
|
|
233
|
+
function getOutputDir(config, outputPathOpt, basePath) {
|
|
234
|
+
return path_1.default.resolve(process.cwd(), ...[
|
|
235
|
+
outputPathOpt,
|
|
236
|
+
basePath,
|
|
237
|
+
config.createSubFolder
|
|
238
|
+
? config.subFolderNameHelper
|
|
239
|
+
? handlebarsParse(config, `{{ ${config.subFolderNameHelper} name }}`).toString()
|
|
240
|
+
: config.name
|
|
241
|
+
: undefined,
|
|
242
|
+
].filter(Boolean));
|
|
243
|
+
}
|
|
244
|
+
exports.getOutputDir = getOutputDir;
|
|
245
|
+
function logInputFile(config, { origTemplate, relPath, template, inputFilePath, nonGlobTemplate, basePath, isDirOrGlob, isGlob, }) {
|
|
246
|
+
log(config, types_1.LogLevel.Debug, `\nprocess.cwd(): ${process.cwd()}`, `\norigTemplate: ${origTemplate}`, `\nrelPath: ${relPath}`, `\ntemplate: ${template}`, `\ninputFilePath: ${inputFilePath}`, `\nnonGlobTemplate: ${nonGlobTemplate}`, `\nbasePath: ${basePath}`, `\nisDirOrGlob: ${isDirOrGlob}`, `\nisGlob: ${isGlob}`, `\n`);
|
|
247
|
+
}
|
|
248
|
+
exports.logInputFile = logInputFile;
|
|
249
|
+
function logInitStep(config) {
|
|
250
|
+
var _a;
|
|
251
|
+
log(config, types_1.LogLevel.Debug, "Full config:", {
|
|
252
|
+
name: config.name,
|
|
253
|
+
templates: config.templates,
|
|
254
|
+
output: config.output,
|
|
255
|
+
createSubfolder: config.createSubFolder,
|
|
256
|
+
data: config.data,
|
|
257
|
+
overwrite: config.overwrite,
|
|
258
|
+
quiet: config.quiet,
|
|
259
|
+
subFolderTransformHelper: config.subFolderNameHelper,
|
|
260
|
+
helpers: Object.keys((_a = config.helpers) !== null && _a !== void 0 ? _a : {}),
|
|
261
|
+
verbose: `${config.verbose} (${Object.keys(types_1.LogLevel).find((k) => types_1.LogLevel[k] === config.verbose)})`,
|
|
262
|
+
});
|
|
263
|
+
log(config, types_1.LogLevel.Info, "Data:", config.data);
|
|
264
|
+
}
|
|
265
|
+
exports.logInitStep = logInitStep;
|
|
266
|
+
function parseAppendData(value, options) {
|
|
267
|
+
var _a;
|
|
268
|
+
const data = (_a = options.data) !== null && _a !== void 0 ? _a : {};
|
|
269
|
+
const [key, val] = value.split(/\:?=/);
|
|
270
|
+
// raw
|
|
271
|
+
if (value.includes(":=") && !val.includes(":=")) {
|
|
272
|
+
return { ...data, [key]: JSON.parse(val) };
|
|
273
|
+
}
|
|
274
|
+
return { ...data, [key]: isWrappedWithQuotes(val) ? val.substring(1, val.length - 1) : val };
|
|
275
|
+
}
|
|
276
|
+
exports.parseAppendData = parseAppendData;
|
|
277
|
+
function isWrappedWithQuotes(string) {
|
|
278
|
+
return (string.startsWith('"') && string.endsWith('"')) || (string.startsWith("'") && string.endsWith("'"));
|
|
279
|
+
}
|
|
280
|
+
/** @internal */
|
|
281
|
+
function parseConfig(config) {
|
|
282
|
+
let c = config;
|
|
283
|
+
if (config.config) {
|
|
284
|
+
const [configFile, template = "default"] = config.config.split(":");
|
|
285
|
+
const configImport = require(path_1.default.resolve(process.cwd(), configFile));
|
|
286
|
+
if (!configImport[template]) {
|
|
287
|
+
throw new Error(`Template "${template}" not found in ${configFile}`);
|
|
288
|
+
}
|
|
289
|
+
c = {
|
|
290
|
+
...config,
|
|
291
|
+
...configImport[template],
|
|
292
|
+
data: {
|
|
293
|
+
...configImport[template].data,
|
|
294
|
+
...config.data,
|
|
295
|
+
},
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
c.data = { ...c.data, ...config.appendData };
|
|
299
|
+
delete config.appendData;
|
|
300
|
+
return c;
|
|
301
|
+
}
|
|
302
|
+
exports.parseConfig = parseConfig;
|
|
303
|
+
//# sourceMappingURL=utils.js.map
|
package/utils.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,yCAAgC;AAChC,mCASgB;AAChB,iEAAwC;AACxC,iEAAwC;AACxC,iEAAwC;AACxC,iEAAwC;AACxC,4DAAmC;AACnC,2BAA2C;AAC3C,kDAAyB;AACzB,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,aAAU,CAAA;AAC1C,uDAAgC;AAChC,6DAAsC;AACtC,iEAA0C;AAC1C,+BAAqC;AAGrC,MAAM,OAAO,GAAG;IACd,GAAG,EAAE,aAAK;IACV,MAAM,EAAE,gBAAQ;IAChB,QAAQ,EAAE,kBAAU;CACrB,CAAA;AAED,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,aAAU,CAAA;AAE7B,QAAA,cAAc,GAAmC;IAC5D,SAAS,EAAT,mBAAS;IACT,SAAS,EAAT,mBAAS;IACT,SAAS,EAAT,mBAAS;IACT,SAAS,EAAT,mBAAS;IACT,UAAU,EAAE,mBAAS;IACrB,UAAU;IACV,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE;IACvC,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE;IACvC,GAAG,EAAE,SAAS;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AI,GAAG,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,UAAU,EAAE,CAAA;IAC5C,OAAO,MAAM,CAAC,UAAU,CAAA;IACxB,OAAO,CAAC,CAAA;AACV,CAAC;AAtBD,kCAsBC"}
|
package/.editorconfig
DELETED
package/.github/FUNDING.yml
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# These are supported funding model platforms
|
|
2
|
-
|
|
3
|
-
github: chenasraf
|
|
4
|
-
patreon: # Replace with a single Patreon username
|
|
5
|
-
open_collective: # Replace with a single Open Collective username
|
|
6
|
-
ko_fi: casraf
|
|
7
|
-
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
|
8
|
-
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
|
9
|
-
liberapay: # Replace with a single Liberapay username
|
|
10
|
-
issuehunt: # Replace with a single IssueHunt username
|
|
11
|
-
otechie: # Replace with a single Otechie username
|
|
12
|
-
custom:
|
|
13
|
-
- "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=TSH3C3ABGQM22¤cy_code=ILS&source=url"
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Bug report
|
|
3
|
-
about: Create a report to help us improve
|
|
4
|
-
title: "[BUG] "
|
|
5
|
-
labels: bug, needs-triage
|
|
6
|
-
assignees: chenasraf
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
#### Describe the bug
|
|
10
|
-
|
|
11
|
-
A clear and concise description of what the bug is.
|
|
12
|
-
|
|
13
|
-
#### How To Reproduce
|
|
14
|
-
|
|
15
|
-
Steps to reproduce the behavior:
|
|
16
|
-
|
|
17
|
-
1. Prepare templates:
|
|
18
|
-
|
|
19
|
-
```text
|
|
20
|
-
This is my {{ template }}
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
2. Run with args/config:
|
|
24
|
-
|
|
25
|
-
```shell
|
|
26
|
-
npx simple-scaffold@latest -t input -o output TplName
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
#### Expected behavior\*\*
|
|
30
|
-
|
|
31
|
-
A clear and concise description of what you expected to happen.
|
|
32
|
-
|
|
33
|
-
#### Logs
|
|
34
|
-
|
|
35
|
-
If applicable, paste your logs to help explain your problem. To see more logs, run the scaffold with
|
|
36
|
-
`-v 1` to enable debug logging.
|
|
37
|
-
|
|
38
|
-
#### Desktop (please complete the following information):
|
|
39
|
-
|
|
40
|
-
- OS: [e.g. macOS, Windows, Linux]
|
|
41
|
-
- OS Version: [e.g. Big Sur, 11, Ubuntu 20.04]
|
|
42
|
-
- Node.js: [e.g. 16.8]
|
|
43
|
-
- Simple Scaffold Version [e.g. 1.1.2]
|
|
44
|
-
|
|
45
|
-
#### Additional context
|
|
46
|
-
|
|
47
|
-
Add any other context about the problem here.
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Feature request
|
|
3
|
-
about: Suggest an idea for this project
|
|
4
|
-
title: "[FEATURE] "
|
|
5
|
-
labels: enhancement, needs-triage
|
|
6
|
-
assignees: chenasraf
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
#### Is your feature request related to a problem? Please describe.
|
|
10
|
-
|
|
11
|
-
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
-
|
|
13
|
-
#### Describe the solution you'd like
|
|
14
|
-
|
|
15
|
-
A clear and concise description of what you want to happen.
|
|
16
|
-
|
|
17
|
-
#### Describe alternatives you've considered
|
|
18
|
-
|
|
19
|
-
A clear and concise description of any alternative solutions or features you've considered, if
|
|
20
|
-
applicable.
|
|
21
|
-
|
|
22
|
-
#### Additional context
|
|
23
|
-
|
|
24
|
-
Add any other context or screenshots about the feature request here.
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
name: Build Documentation
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [master]
|
|
6
|
-
jobs:
|
|
7
|
-
docs:
|
|
8
|
-
runs-on: ubuntu-latest
|
|
9
|
-
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip docs]')"
|
|
10
|
-
steps:
|
|
11
|
-
- uses: actions/checkout@v3
|
|
12
|
-
- uses: actions/setup-node@v3
|
|
13
|
-
with:
|
|
14
|
-
node-version: "18.x"
|
|
15
|
-
- run: yarn install --frozen-lockfile
|
|
16
|
-
- run: yarn build-docs
|
|
17
|
-
- uses: peaceiris/actions-gh-pages@v3
|
|
18
|
-
with:
|
|
19
|
-
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
20
|
-
publish_dir: ./docs
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
name: Pull Requests
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
branches: [master, develop]
|
|
6
|
-
jobs:
|
|
7
|
-
build:
|
|
8
|
-
runs-on: ubuntu-latest
|
|
9
|
-
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
|
10
|
-
steps:
|
|
11
|
-
- uses: actions/checkout@v3
|
|
12
|
-
- uses: actions/setup-node@v3
|
|
13
|
-
with:
|
|
14
|
-
node-version: "18.x"
|
|
15
|
-
- run: yarn install --frozen-lockfile
|
|
16
|
-
- run: yarn build
|
|
17
|
-
- run: yarn test
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
name: Semantic Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [master, develop, feat/*, fix/*]
|
|
6
|
-
jobs:
|
|
7
|
-
build:
|
|
8
|
-
runs-on: ubuntu-latest
|
|
9
|
-
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
|
10
|
-
steps:
|
|
11
|
-
- uses: actions/checkout@v3
|
|
12
|
-
- uses: actions/setup-node@v3
|
|
13
|
-
with:
|
|
14
|
-
node-version: "18.x"
|
|
15
|
-
- run: yarn install --frozen-lockfile
|
|
16
|
-
- run: yarn test
|
|
17
|
-
- run: yarn build
|
|
18
|
-
- run: yarn semantic-release
|
|
19
|
-
if: "!contains(github.event.head_commit.message, '[skip publish]')"
|
|
20
|
-
env:
|
|
21
|
-
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
|
|
22
|
-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
package/.markdownlint.json
DELETED
package/.prettierrc
DELETED
package/.vscode/launch.json
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Use IntelliSense to learn about possible attributes.
|
|
3
|
-
// Hover to view descriptions of existing attributes.
|
|
4
|
-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
-
"version": "0.2.0",
|
|
6
|
-
"configurations": [
|
|
7
|
-
{
|
|
8
|
-
"name": "Debug Scaffold",
|
|
9
|
-
"type": "node",
|
|
10
|
-
"request": "launch",
|
|
11
|
-
"protocol": "inspector",
|
|
12
|
-
"cwd": "${workspaceFolder}",
|
|
13
|
-
"program": "${workspaceFolder}/test.ts",
|
|
14
|
-
"outFiles": ["${workspaceRoot}/dist/test.js"],
|
|
15
|
-
"env": {
|
|
16
|
-
"NODE_ENV": "develop"
|
|
17
|
-
},
|
|
18
|
-
"sourceMaps": true
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"type": "node",
|
|
22
|
-
"request": "attach",
|
|
23
|
-
"name": "Attach by Process ID",
|
|
24
|
-
"processId": "${command:PickProcess}"
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
}
|
package/.vscode/settings.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"typescript.tsdk": "./node_modules/typescript/lib",
|
|
3
|
-
"npm.packageManager": "yarn",
|
|
4
|
-
"cSpell.words": [
|
|
5
|
-
"massarg",
|
|
6
|
-
"MYCOMPONENT",
|
|
7
|
-
"myname",
|
|
8
|
-
"nobrace",
|
|
9
|
-
"nocomment",
|
|
10
|
-
"nodir",
|
|
11
|
-
"noext",
|
|
12
|
-
"nonegate",
|
|
13
|
-
"subdir",
|
|
14
|
-
"variabletoken"
|
|
15
|
-
],
|
|
16
|
-
"[markdown]": {
|
|
17
|
-
"editor.rulers": [
|
|
18
|
-
87,
|
|
19
|
-
100
|
|
20
|
-
],
|
|
21
|
-
},
|
|
22
|
-
}
|