skuba 4.4.1 → 5.0.0-beta.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/config/tsconfig.json +1 -0
- package/jest/moduleNameMapper.js +50 -78
- package/jest/moduleNameMapper.test.ts +4 -14
- package/jest/transform.js +10 -1
- package/jest/tsConfig.js +26 -0
- package/lib/api/buildkite/annotate.js +46 -33
- package/lib/api/buildkite/annotate.js.map +7 -1
- package/lib/api/buildkite/index.js +31 -7
- package/lib/api/buildkite/index.js.map +7 -1
- package/lib/api/buildkite/md.js +31 -8
- package/lib/api/buildkite/md.js.map +7 -1
- package/lib/api/git/commit.js +45 -17
- package/lib/api/git/commit.js.map +7 -1
- package/lib/api/git/commitAllChanges.js +57 -27
- package/lib/api/git/commitAllChanges.js.map +7 -1
- package/lib/api/git/currentBranch.js +50 -28
- package/lib/api/git/currentBranch.js.map +7 -1
- package/lib/api/git/getChangedFiles.js +49 -27
- package/lib/api/git/getChangedFiles.js.map +7 -1
- package/lib/api/git/index.js +54 -22
- package/lib/api/git/index.js.map +7 -1
- package/lib/api/git/log.js +63 -42
- package/lib/api/git/log.js.map +7 -1
- package/lib/api/git/pull.js +62 -31
- package/lib/api/git/pull.js.map +7 -1
- package/lib/api/git/push.js +63 -31
- package/lib/api/git/push.js.map +7 -1
- package/lib/api/git/remote.js +59 -56
- package/lib/api/git/remote.js.map +7 -1
- package/lib/api/git/reset.js +55 -27
- package/lib/api/git/reset.js.map +7 -1
- package/lib/api/git/statusMatrix.js +46 -13
- package/lib/api/git/statusMatrix.js.map +7 -1
- package/lib/api/github/checkRun.js +70 -79
- package/lib/api/github/checkRun.js.map +7 -1
- package/lib/api/github/environment.js +40 -33
- package/lib/api/github/environment.js.map +7 -1
- package/lib/api/github/index.js +47 -17
- package/lib/api/github/index.js.map +7 -1
- package/lib/api/github/issueComment.js +73 -81
- package/lib/api/github/issueComment.js.map +7 -1
- package/lib/api/github/pullRequest.js +60 -61
- package/lib/api/github/pullRequest.js.map +7 -1
- package/lib/api/github/push.js +138 -133
- package/lib/api/github/push.js.map +7 -1
- package/lib/api/jest/index.d.ts +2 -1
- package/lib/api/jest/index.js +35 -14
- package/lib/api/jest/index.js.map +7 -1
- package/lib/api/net/compose.js +45 -17
- package/lib/api/net/compose.js.map +7 -1
- package/lib/api/net/index.js +28 -5
- package/lib/api/net/index.js.map +7 -1
- package/lib/api/net/socket.js +58 -36
- package/lib/api/net/socket.js.map +7 -1
- package/lib/api/net/waitFor.js +38 -18
- package/lib/api/net/waitFor.js.map +7 -1
- package/lib/cli/adapter/eslint.js +95 -72
- package/lib/cli/adapter/eslint.js.map +7 -1
- package/lib/cli/adapter/prettier.js +126 -124
- package/lib/cli/adapter/prettier.js.map +7 -1
- package/lib/cli/build/args.d.ts +7 -0
- package/lib/cli/build/args.js +69 -0
- package/lib/cli/build/args.js.map +7 -0
- package/lib/cli/build/esbuild.d.ts +5 -0
- package/lib/cli/build/esbuild.js +128 -0
- package/lib/cli/build/esbuild.js.map +7 -0
- package/lib/cli/build/index.d.ts +1 -1
- package/lib/cli/build/index.js +68 -5
- package/lib/cli/build/index.js.map +7 -1
- package/lib/cli/build/tsc.d.ts +1 -1
- package/lib/cli/build/tsc.js +34 -23
- package/lib/cli/build/tsc.js.map +7 -1
- package/lib/cli/buildPackage.js +53 -23
- package/lib/cli/buildPackage.js.map +7 -1
- package/lib/cli/configure/addEmptyExports.d.ts +5 -0
- package/lib/cli/configure/addEmptyExports.js +67 -0
- package/lib/cli/configure/addEmptyExports.js.map +7 -0
- package/lib/cli/configure/analyseConfiguration.js +61 -31
- package/lib/cli/configure/analyseConfiguration.js.map +7 -1
- package/lib/cli/configure/analyseDependencies.js +122 -113
- package/lib/cli/configure/analyseDependencies.js.map +7 -1
- package/lib/cli/configure/analysis/diff.js +37 -11
- package/lib/cli/configure/analysis/diff.js.map +7 -1
- package/lib/cli/configure/analysis/files.js +49 -22
- package/lib/cli/configure/analysis/files.js.map +7 -1
- package/lib/cli/configure/analysis/git.js +46 -16
- package/lib/cli/configure/analysis/git.js.map +7 -1
- package/lib/cli/configure/analysis/package.js +99 -52
- package/lib/cli/configure/analysis/package.js.map +7 -1
- package/lib/cli/configure/analysis/project.js +90 -54
- package/lib/cli/configure/analysis/project.js.map +7 -1
- package/lib/cli/configure/dependencies/index.js +40 -13
- package/lib/cli/configure/dependencies/index.js.map +7 -1
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +57 -32
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +7 -1
- package/lib/cli/configure/dependencies/seekKoala.js +53 -31
- package/lib/cli/configure/dependencies/seekKoala.js.map +7 -1
- package/lib/cli/configure/dependencies/skuba.js +49 -27
- package/lib/cli/configure/dependencies/skuba.js.map +7 -1
- package/lib/cli/configure/dependencies/skubaDeps.js +49 -28
- package/lib/cli/configure/dependencies/skubaDeps.js.map +7 -1
- package/lib/cli/configure/dependencies/skubaDive.js +65 -38
- package/lib/cli/configure/dependencies/skubaDive.js.map +7 -1
- package/lib/cli/configure/ensureTemplateCompletion.js +69 -41
- package/lib/cli/configure/ensureTemplateCompletion.js.map +7 -1
- package/lib/cli/configure/getEntryPoint.js +62 -32
- package/lib/cli/configure/getEntryPoint.js.map +7 -1
- package/lib/cli/configure/getProjectType.js +50 -28
- package/lib/cli/configure/getProjectType.js.map +7 -1
- package/lib/cli/configure/index.js +134 -109
- package/lib/cli/configure/index.js.map +7 -1
- package/lib/cli/configure/modules/eslint.js +57 -26
- package/lib/cli/configure/modules/eslint.js.map +7 -1
- package/lib/cli/configure/modules/ignore.js +37 -14
- package/lib/cli/configure/modules/ignore.js.map +7 -1
- package/lib/cli/configure/modules/index.js +53 -28
- package/lib/cli/configure/modules/index.js.map +7 -1
- package/lib/cli/configure/modules/jest.js +84 -47
- package/lib/cli/configure/modules/jest.js.map +7 -1
- package/lib/cli/configure/modules/nodemon.js +29 -6
- package/lib/cli/configure/modules/nodemon.js.map +7 -1
- package/lib/cli/configure/modules/package.js +113 -92
- package/lib/cli/configure/modules/package.js.map +7 -1
- package/lib/cli/configure/modules/prettier.js +48 -19
- package/lib/cli/configure/modules/prettier.js.map +7 -1
- package/lib/cli/configure/modules/renovate.js +52 -39
- package/lib/cli/configure/modules/renovate.js.map +7 -1
- package/lib/cli/configure/modules/serverless.js +33 -15
- package/lib/cli/configure/modules/serverless.js.map +7 -1
- package/lib/cli/configure/modules/skubaDive.js +63 -37
- package/lib/cli/configure/modules/skubaDive.js.map +7 -1
- package/lib/cli/configure/modules/tsconfig.js +79 -63
- package/lib/cli/configure/modules/tsconfig.js.map +7 -1
- package/lib/cli/configure/modules/tslint.js +29 -6
- package/lib/cli/configure/modules/tslint.js.map +7 -1
- package/lib/cli/configure/processing/deleteFiles.js +30 -8
- package/lib/cli/configure/processing/deleteFiles.js.map +7 -1
- package/lib/cli/configure/processing/ignoreFile.js +65 -59
- package/lib/cli/configure/processing/ignoreFile.js.map +7 -1
- package/lib/cli/configure/processing/javascript.js +35 -15
- package/lib/cli/configure/processing/javascript.js.map +7 -1
- package/lib/cli/configure/processing/json.js +51 -20
- package/lib/cli/configure/processing/json.js.map +7 -1
- package/lib/cli/configure/processing/loadFiles.js +30 -8
- package/lib/cli/configure/processing/loadFiles.js.map +7 -1
- package/lib/cli/configure/processing/module.js +37 -14
- package/lib/cli/configure/processing/module.js.map +7 -1
- package/lib/cli/configure/processing/package.js +73 -43
- package/lib/cli/configure/processing/package.js.map +7 -1
- package/lib/cli/configure/processing/prettier.js +37 -11
- package/lib/cli/configure/processing/prettier.js.map +7 -1
- package/lib/cli/configure/processing/record.js +54 -31
- package/lib/cli/configure/processing/record.js.map +7 -1
- package/lib/cli/configure/processing/typescript.js +176 -158
- package/lib/cli/configure/processing/typescript.js.map +7 -1
- package/lib/cli/configure/refreshIgnoreFiles.js +64 -40
- package/lib/cli/configure/refreshIgnoreFiles.js.map +7 -1
- package/lib/cli/configure/types.js +16 -2
- package/lib/cli/configure/types.js.map +7 -1
- package/lib/cli/format.js +58 -31
- package/lib/cli/format.js.map +7 -1
- package/lib/cli/help.js +31 -8
- package/lib/cli/help.js.map +7 -1
- package/lib/cli/init/getConfig.js +238 -207
- package/lib/cli/init/getConfig.js.map +7 -1
- package/lib/cli/init/git.js +70 -63
- package/lib/cli/init/git.js.map +7 -1
- package/lib/cli/init/index.js +133 -100
- package/lib/cli/init/index.js.map +7 -1
- package/lib/cli/init/prompts.js +84 -54
- package/lib/cli/init/prompts.js.map +7 -1
- package/lib/cli/init/types.js +52 -52
- package/lib/cli/init/types.js.map +7 -1
- package/lib/cli/init/validation.js +34 -12
- package/lib/cli/init/validation.js.map +7 -1
- package/lib/cli/init/writePackageJson.js +51 -22
- package/lib/cli/init/writePackageJson.js.map +7 -1
- package/lib/cli/lint/annotate/buildkite/eslint.js +34 -28
- package/lib/cli/lint/annotate/buildkite/eslint.js.map +7 -1
- package/lib/cli/lint/annotate/buildkite/index.js +50 -44
- package/lib/cli/lint/annotate/buildkite/index.js.map +7 -1
- package/lib/cli/lint/annotate/buildkite/prettier.js +41 -35
- package/lib/cli/lint/annotate/buildkite/prettier.js.map +7 -1
- package/lib/cli/lint/annotate/buildkite/tsc.js +39 -39
- package/lib/cli/lint/annotate/buildkite/tsc.js.map +7 -1
- package/lib/cli/lint/annotate/github/eslint.js +40 -16
- package/lib/cli/lint/annotate/github/eslint.js.map +7 -1
- package/lib/cli/lint/annotate/github/index.js +55 -51
- package/lib/cli/lint/annotate/github/index.js.map +7 -1
- package/lib/cli/lint/annotate/github/prettier.js +36 -13
- package/lib/cli/lint/annotate/github/prettier.js.map +7 -1
- package/lib/cli/lint/annotate/github/tsc.js +52 -52
- package/lib/cli/lint/annotate/github/tsc.js.map +7 -1
- package/lib/cli/lint/annotate/index.js +33 -10
- package/lib/cli/lint/annotate/index.js.map +7 -1
- package/lib/cli/lint/autofix.js +122 -117
- package/lib/cli/lint/autofix.js.map +7 -1
- package/lib/cli/lint/eslint.js +48 -18
- package/lib/cli/lint/eslint.js.map +7 -1
- package/lib/cli/lint/external.js +102 -81
- package/lib/cli/lint/external.js.map +7 -1
- package/lib/cli/lint/index.js +42 -18
- package/lib/cli/lint/index.js.map +7 -1
- package/lib/cli/lint/internal.js +54 -21
- package/lib/cli/lint/internal.js.map +7 -1
- package/lib/cli/lint/prettier.js +48 -18
- package/lib/cli/lint/prettier.js.map +7 -1
- package/lib/cli/lint/tsc.js +56 -32
- package/lib/cli/lint/tsc.js.map +7 -1
- package/lib/cli/lint/types.js +16 -2
- package/lib/cli/lint/types.js.map +7 -1
- package/lib/cli/node.js +65 -58
- package/lib/cli/node.js.map +7 -1
- package/lib/cli/release.js +29 -6
- package/lib/cli/release.js.map +7 -1
- package/lib/cli/start.js +61 -24
- package/lib/cli/start.js.map +7 -1
- package/lib/cli/test/index.js +35 -11
- package/lib/cli/test/index.js.map +7 -1
- package/lib/cli/test/reporters/github/annotations.js +89 -92
- package/lib/cli/test/reporters/github/annotations.js.map +7 -1
- package/lib/cli/test/reporters/github/index.js +68 -68
- package/lib/cli/test/reporters/github/index.js.map +7 -1
- package/lib/cli/version.js +31 -8
- package/lib/cli/version.js.map +7 -1
- package/lib/enquirer.d.js +2 -0
- package/lib/enquirer.d.js.map +7 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +45 -41
- package/lib/index.js.map +7 -1
- package/lib/skuba.js +45 -38
- package/lib/skuba.js.map +7 -1
- package/lib/utils/args.js +97 -96
- package/lib/utils/args.js.map +7 -1
- package/lib/utils/command.js +64 -33
- package/lib/utils/command.js.map +7 -1
- package/lib/utils/copy.js +88 -51
- package/lib/utils/copy.js.map +7 -1
- package/lib/utils/dir.js +79 -67
- package/lib/utils/dir.js.map +7 -1
- package/lib/utils/env.js +27 -7
- package/lib/utils/env.js.map +7 -1
- package/lib/utils/error.js +58 -56
- package/lib/utils/error.js.map +7 -1
- package/lib/utils/exec.js +139 -110
- package/lib/utils/exec.js.map +7 -1
- package/lib/utils/help.js +31 -8
- package/lib/utils/help.js.map +7 -1
- package/lib/utils/logging.js +52 -24
- package/lib/utils/logging.js.map +7 -1
- package/lib/utils/logo.js +65 -27
- package/lib/utils/logo.js.map +7 -1
- package/lib/utils/manifest.d.ts +1 -0
- package/lib/utils/manifest.js +65 -51
- package/lib/utils/manifest.js.map +7 -1
- package/lib/utils/port.js +38 -17
- package/lib/utils/port.js.map +7 -1
- package/lib/utils/template.js +106 -87
- package/lib/utils/template.js.map +7 -1
- package/lib/utils/validation.js +43 -18
- package/lib/utils/validation.js.map +7 -1
- package/lib/utils/version.js +72 -82
- package/lib/utils/version.js.map +7 -1
- package/lib/utils/wait.js +52 -25
- package/lib/utils/wait.js.map +7 -1
- package/lib/utils/worker.js +59 -44
- package/lib/utils/worker.js.map +7 -1
- package/lib/wrapper/function-arguments.d.js +2 -0
- package/lib/wrapper/function-arguments.d.js.map +7 -0
- package/lib/wrapper/functionHandler.js +56 -29
- package/lib/wrapper/functionHandler.js.map +7 -1
- package/lib/wrapper/http.js +66 -56
- package/lib/wrapper/http.js.map +7 -1
- package/lib/wrapper/index.js +9 -21
- package/lib/wrapper/index.js.map +7 -1
- package/lib/wrapper/main.js +39 -20
- package/lib/wrapper/main.js.map +7 -1
- package/lib/wrapper/requestListener.js +50 -35
- package/lib/wrapper/requestListener.js.map +7 -1
- package/package.json +19 -13
- package/template/base/jest.config.ts +0 -6
- package/template/base/jest.setup.ts +2 -0
- package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/express-rest-api/package.json +1 -1
- package/template/greeter/.buildkite/pipeline.yml +1 -1
- package/template/greeter/package.json +1 -1
- package/template/greeter/src/app.test.ts +3 -1
- package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/koa-rest-api/package.json +6 -7
- package/template/koa-rest-api/src/api/jobs/postJob.test.ts +3 -7
- package/template/koa-rest-api/src/api/jobs/postJob.ts +2 -2
- package/template/koa-rest-api/src/framework/validation.test.ts +17 -15
- package/template/koa-rest-api/src/framework/validation.ts +50 -9
- package/template/koa-rest-api/src/testing/types.ts +5 -10
- package/template/koa-rest-api/src/types/jobs.ts +5 -10
- package/template/lambda-sqs-worker/.buildkite/pipeline.yml +3 -3
- package/template/lambda-sqs-worker/package.json +2 -6
- package/template/lambda-sqs-worker/src/app.ts +2 -2
- package/template/lambda-sqs-worker/src/framework/validation.test.ts +37 -17
- package/template/lambda-sqs-worker/src/framework/validation.ts +4 -2
- package/template/lambda-sqs-worker/src/services/jobScorer.ts +2 -2
- package/template/lambda-sqs-worker/src/testing/types.ts +5 -10
- package/template/lambda-sqs-worker/src/types/jobScorer.ts +9 -16
- package/template/lambda-sqs-worker/src/types/pipelineEvents.ts +13 -20
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +3 -3
- package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +6 -0
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +3 -3
- package/template/lambda-sqs-worker-cdk/infra/index.ts +2 -2
- package/template/lambda-sqs-worker-cdk/package.json +2 -2
- package/template/lambda-sqs-worker-cdk/shared/context-types.ts +16 -25
- package/template/oss-npm-package/_package.json +1 -1
- package/template/private-npm-package/_package.json +1 -1
- package/jest/resolver.js +0 -24
package/lib/cli/format.js
CHANGED
|
@@ -1,34 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
4
11
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const refreshIgnoreFiles_1 = require("./configure/refreshIgnoreFiles");
|
|
13
|
-
const format = async (args = process.argv) => {
|
|
14
|
-
await (0, refreshIgnoreFiles_1.tryRefreshIgnoreFiles)();
|
|
15
|
-
const debug = (0, args_1.hasDebugFlag)(args);
|
|
16
|
-
const logger = (0, logging_1.createLogger)(debug);
|
|
17
|
-
logging_1.log.plain(chalk_1.default.magenta('ESLint'));
|
|
18
|
-
const eslint = await (0, eslint_1.runESLint)('format', logger);
|
|
19
|
-
logging_1.log.newline();
|
|
20
|
-
logging_1.log.plain(chalk_1.default.cyan('Prettier'));
|
|
21
|
-
const prettier = await (0, prettier_1.runPrettier)('format', logger);
|
|
22
|
-
if (eslint.ok && prettier.ok) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const tools = [
|
|
26
|
-
...(eslint.ok ? [] : ['ESLint']),
|
|
27
|
-
...(prettier.ok ? [] : ['Prettier']),
|
|
28
|
-
];
|
|
29
|
-
logging_1.log.newline();
|
|
30
|
-
logging_1.log.err(tools.join(', '), 'found issues that require triage.');
|
|
31
|
-
process.exitCode = 1;
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
32
19
|
};
|
|
33
|
-
|
|
34
|
-
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var format_exports = {};
|
|
26
|
+
__export(format_exports, {
|
|
27
|
+
format: () => format
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(format_exports);
|
|
30
|
+
var import_chalk = __toESM(require("chalk"));
|
|
31
|
+
var import_args = require("../utils/args");
|
|
32
|
+
var import_logging = require("../utils/logging");
|
|
33
|
+
var import_eslint = require("./adapter/eslint");
|
|
34
|
+
var import_prettier = require("./adapter/prettier");
|
|
35
|
+
var import_addEmptyExports = require("./configure/addEmptyExports");
|
|
36
|
+
var import_refreshIgnoreFiles = require("./configure/refreshIgnoreFiles");
|
|
37
|
+
const format = async (args = process.argv.slice(2)) => {
|
|
38
|
+
await Promise.all([(0, import_addEmptyExports.tryAddEmptyExports)(), (0, import_refreshIgnoreFiles.tryRefreshIgnoreFiles)()]);
|
|
39
|
+
const debug = (0, import_args.hasDebugFlag)(args);
|
|
40
|
+
const logger = (0, import_logging.createLogger)(debug);
|
|
41
|
+
import_logging.log.plain(import_chalk.default.magenta("ESLint"));
|
|
42
|
+
const eslint = await (0, import_eslint.runESLint)("format", logger);
|
|
43
|
+
import_logging.log.newline();
|
|
44
|
+
import_logging.log.plain(import_chalk.default.cyan("Prettier"));
|
|
45
|
+
const prettier = await (0, import_prettier.runPrettier)("format", logger);
|
|
46
|
+
if (eslint.ok && prettier.ok) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const tools = [
|
|
50
|
+
...eslint.ok ? [] : ["ESLint"],
|
|
51
|
+
...prettier.ok ? [] : ["Prettier"]
|
|
52
|
+
];
|
|
53
|
+
import_logging.log.newline();
|
|
54
|
+
import_logging.log.err(tools.join(", "), "found issues that require triage.");
|
|
55
|
+
process.exitCode = 1;
|
|
56
|
+
};
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
format
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=format.js.map
|
package/lib/cli/format.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/cli/format.ts"],
|
|
4
|
+
"sourcesContent": ["import chalk from 'chalk';\n\nimport { hasDebugFlag } from '../utils/args';\nimport { createLogger, log } from '../utils/logging';\n\nimport { runESLint } from './adapter/eslint';\nimport { runPrettier } from './adapter/prettier';\nimport { tryAddEmptyExports } from './configure/addEmptyExports';\nimport { tryRefreshIgnoreFiles } from './configure/refreshIgnoreFiles';\n\nexport const format = async (args = process.argv.slice(2)): Promise<void> => {\n await Promise.all([tryAddEmptyExports(), tryRefreshIgnoreFiles()]);\n\n const debug = hasDebugFlag(args);\n const logger = createLogger(debug);\n\n log.plain(chalk.magenta('ESLint'));\n\n const eslint = await runESLint('format', logger);\n\n log.newline();\n log.plain(chalk.cyan('Prettier'));\n\n const prettier = await runPrettier('format', logger);\n\n if (eslint.ok && prettier.ok) {\n return;\n }\n\n const tools = [\n ...(eslint.ok ? [] : ['ESLint']),\n ...(prettier.ok ? [] : ['Prettier']),\n ];\n\n log.newline();\n log.err(tools.join(', '), 'found issues that require triage.');\n\n process.exitCode = 1;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,kBAA6B;AAC7B,qBAAkC;AAElC,oBAA0B;AAC1B,sBAA4B;AAC5B,6BAAmC;AACnC,gCAAsC;AAE/B,MAAM,SAAS,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAqB;AAC3E,QAAM,QAAQ,IAAI,KAAC,2CAAmB,OAAG,iDAAsB,CAAC,CAAC;AAEjE,QAAM,YAAQ,0BAAa,IAAI;AAC/B,QAAM,aAAS,6BAAa,KAAK;AAEjC,qBAAI,MAAM,aAAAA,QAAM,QAAQ,QAAQ,CAAC;AAEjC,QAAM,SAAS,UAAM,yBAAU,UAAU,MAAM;AAE/C,qBAAI,QAAQ;AACZ,qBAAI,MAAM,aAAAA,QAAM,KAAK,UAAU,CAAC;AAEhC,QAAM,WAAW,UAAM,6BAAY,UAAU,MAAM;AAEnD,MAAI,OAAO,MAAM,SAAS,IAAI;AAC5B;AAAA,EACF;AAEA,QAAM,QAAQ;AAAA,IACZ,GAAI,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ;AAAA,IAC9B,GAAI,SAAS,KAAK,CAAC,IAAI,CAAC,UAAU;AAAA,EACpC;AAEA,qBAAI,QAAQ;AACZ,qBAAI,IAAI,MAAM,KAAK,IAAI,GAAG,mCAAmC;AAE7D,UAAQ,WAAW;AACrB;",
|
|
6
|
+
"names": ["chalk"]
|
|
7
|
+
}
|
package/lib/cli/help.js
CHANGED
|
@@ -1,11 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var help_exports = {};
|
|
20
|
+
__export(help_exports, {
|
|
21
|
+
help: () => help
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(help_exports);
|
|
24
|
+
var import_help = require("../utils/help");
|
|
25
|
+
var import_logo = require("../utils/logo");
|
|
6
26
|
const help = async () => {
|
|
7
|
-
|
|
8
|
-
|
|
27
|
+
await (0, import_logo.showLogoAndVersionInfo)();
|
|
28
|
+
(0, import_help.showHelp)();
|
|
9
29
|
};
|
|
10
|
-
|
|
11
|
-
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
help
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=help.js.map
|
package/lib/cli/help.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/cli/help.ts"],
|
|
4
|
+
"sourcesContent": ["import { showHelp } from '../utils/help';\nimport { showLogoAndVersionInfo } from '../utils/logo';\n\nexport const help = async () => {\n await showLogoAndVersionInfo();\n\n showHelp();\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAyB;AACzB,kBAAuC;AAEhC,MAAM,OAAO,YAAY;AAC9B,YAAM,oCAAuB;AAE7B,4BAAS;AACX;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,234 +1,265 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
4
11
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var getConfig_exports = {};
|
|
26
|
+
__export(getConfig_exports, {
|
|
27
|
+
configureFromPrompt: () => configureFromPrompt,
|
|
28
|
+
getConfig: () => getConfig,
|
|
29
|
+
getTemplateConfig: () => getTemplateConfig,
|
|
30
|
+
runForm: () => runForm
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(getConfig_exports);
|
|
33
|
+
var import_path = __toESM(require("path"));
|
|
34
|
+
var import_chalk = __toESM(require("chalk"));
|
|
35
|
+
var import_enquirer = require("enquirer");
|
|
36
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
37
|
+
var import_copy = require("../../utils/copy");
|
|
38
|
+
var import_error = require("../../utils/error");
|
|
39
|
+
var import_logging = require("../../utils/logging");
|
|
40
|
+
var import_port = require("../../utils/port");
|
|
41
|
+
var import_template = require("../../utils/template");
|
|
42
|
+
var import_git = require("./git");
|
|
43
|
+
var import_prompts = require("./prompts");
|
|
44
|
+
var import_types = require("./types");
|
|
19
45
|
const runForm = (props) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
46
|
+
const { message, name } = props;
|
|
47
|
+
const choices = props.choices.map((choice) => ({
|
|
48
|
+
...choice,
|
|
49
|
+
validate: (value) => {
|
|
50
|
+
if (value === "" || value === choice.initial) {
|
|
51
|
+
return "Form is not complete";
|
|
52
|
+
}
|
|
53
|
+
return choice.validate?.(value) ?? true;
|
|
54
|
+
}
|
|
55
|
+
}));
|
|
56
|
+
const form = new import_enquirer.Form({
|
|
57
|
+
choices,
|
|
58
|
+
message,
|
|
59
|
+
name,
|
|
60
|
+
validate: async (values) => {
|
|
61
|
+
const results = await Promise.all(
|
|
62
|
+
choices.map((choice) => choice.validate(values[choice.name]))
|
|
63
|
+
);
|
|
64
|
+
return results.find((result) => typeof result === "string") ?? results.every((result) => result === true);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
return form.run();
|
|
41
68
|
};
|
|
42
|
-
exports.runForm = runForm;
|
|
43
69
|
const confirmShouldContinue = async (choices) => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
70
|
+
const fieldsList = choices.map((choice) => choice.message);
|
|
71
|
+
import_logging.log.newline();
|
|
72
|
+
import_logging.log.plain("This template uses the following information:");
|
|
73
|
+
import_logging.log.newline();
|
|
74
|
+
fieldsList.forEach((message) => import_logging.log.subtle(`- ${message}`));
|
|
75
|
+
import_logging.log.newline();
|
|
76
|
+
const result = await import_prompts.SHOULD_CONTINUE_PROMPT.run();
|
|
77
|
+
return result === "yes";
|
|
52
78
|
};
|
|
53
79
|
const createDirectory = async (dir) => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
62
|
-
throw err;
|
|
80
|
+
try {
|
|
81
|
+
await import_fs_extra.default.promises.mkdir(dir);
|
|
82
|
+
} catch (err) {
|
|
83
|
+
if ((0, import_error.isErrorWithCode)(err, "EEXIST")) {
|
|
84
|
+
import_logging.log.err(`The directory '${dir}' already exists.`);
|
|
85
|
+
process.exit(1);
|
|
63
86
|
}
|
|
87
|
+
throw err;
|
|
88
|
+
}
|
|
64
89
|
};
|
|
65
90
|
const cloneTemplate = async (templateName, destinationDir) => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
stripUnderscorePrefix: true,
|
|
79
|
-
});
|
|
91
|
+
if (templateName.startsWith("github:")) {
|
|
92
|
+
const gitHubPath = templateName.slice("github:".length);
|
|
93
|
+
return (0, import_git.downloadGitHubTemplate)(gitHubPath, destinationDir);
|
|
94
|
+
}
|
|
95
|
+
const templateDir = import_path.default.join(import_template.TEMPLATE_DIR, templateName);
|
|
96
|
+
await (0, import_copy.copyFiles)({
|
|
97
|
+
include: () => true,
|
|
98
|
+
sourceRoot: templateDir,
|
|
99
|
+
destinationRoot: destinationDir,
|
|
100
|
+
processors: [],
|
|
101
|
+
stripUnderscorePrefix: true
|
|
102
|
+
});
|
|
80
103
|
};
|
|
81
104
|
const getTemplateName = async () => {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
105
|
+
const templateSelection = await import_prompts.TEMPLATE_PROMPT.run();
|
|
106
|
+
if (templateSelection === "github \u2192") {
|
|
107
|
+
const gitHubPath = await import_prompts.GIT_PATH_PROMPT.run();
|
|
108
|
+
return `github:${gitHubPath}`;
|
|
109
|
+
}
|
|
110
|
+
return templateSelection;
|
|
88
111
|
};
|
|
89
|
-
const generatePlaceholders = (choices) => Object.fromEntries(
|
|
112
|
+
const generatePlaceholders = (choices) => Object.fromEntries(
|
|
113
|
+
choices.map(({ name }) => [name, `<%- ${name} %>`])
|
|
114
|
+
);
|
|
90
115
|
const getTemplateConfig = (dir) => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
type: undefined,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
throw err;
|
|
116
|
+
const templateConfigPath = import_path.default.join(dir, import_template.TEMPLATE_CONFIG_FILENAME);
|
|
117
|
+
try {
|
|
118
|
+
const templateConfig = require(templateConfigPath);
|
|
119
|
+
return import_template.TemplateConfig.check(templateConfig);
|
|
120
|
+
} catch (err) {
|
|
121
|
+
if ((0, import_error.isErrorWithCode)(err, "MODULE_NOT_FOUND")) {
|
|
122
|
+
return {
|
|
123
|
+
entryPoint: void 0,
|
|
124
|
+
fields: [],
|
|
125
|
+
type: void 0
|
|
126
|
+
};
|
|
106
127
|
}
|
|
128
|
+
throw err;
|
|
129
|
+
}
|
|
107
130
|
};
|
|
108
|
-
exports.getTemplateConfig = getTemplateConfig;
|
|
109
131
|
const baseToTemplateData = async ({ ownerName, repoName }) => {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
};
|
|
132
|
+
const [orgName, teamName] = ownerName.split("/");
|
|
133
|
+
const port = String(await (0, import_port.getRandomPort)());
|
|
134
|
+
return {
|
|
135
|
+
orgName,
|
|
136
|
+
ownerName,
|
|
137
|
+
port,
|
|
138
|
+
repoName,
|
|
139
|
+
teamName: teamName ?? orgName
|
|
140
|
+
};
|
|
120
141
|
};
|
|
121
142
|
const configureFromPrompt = async () => {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
entryPoint,
|
|
152
|
-
templateComplete: true,
|
|
153
|
-
templateData: { ...templateData, ...customAnswers },
|
|
154
|
-
templateName,
|
|
155
|
-
type,
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
logging_1.log.newline();
|
|
159
|
-
logging_1.log.warn(`Resume this later with ${chalk_1.default.bold('yarn skuba configure')}.`);
|
|
160
|
-
const customAnswers = generatePlaceholders(fields);
|
|
143
|
+
const { ownerName, repoName } = await runForm(import_prompts.BASE_PROMPT_PROPS);
|
|
144
|
+
import_logging.log.plain(import_chalk.default.cyan(repoName), "by", import_chalk.default.cyan(ownerName));
|
|
145
|
+
const templateData = await baseToTemplateData({ ownerName, repoName });
|
|
146
|
+
const destinationDir = repoName;
|
|
147
|
+
await createDirectory(destinationDir);
|
|
148
|
+
import_logging.log.newline();
|
|
149
|
+
const templateName = await getTemplateName();
|
|
150
|
+
await cloneTemplate(templateName, destinationDir);
|
|
151
|
+
const { entryPoint, fields, noSkip, type } = getTemplateConfig(
|
|
152
|
+
import_path.default.join(process.cwd(), destinationDir)
|
|
153
|
+
);
|
|
154
|
+
if (fields.length === 0) {
|
|
155
|
+
return {
|
|
156
|
+
destinationDir,
|
|
157
|
+
entryPoint,
|
|
158
|
+
templateComplete: true,
|
|
159
|
+
templateData,
|
|
160
|
+
templateName,
|
|
161
|
+
type
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
const shouldContinue = noSkip ? true : await confirmShouldContinue(fields);
|
|
165
|
+
if (shouldContinue) {
|
|
166
|
+
import_logging.log.newline();
|
|
167
|
+
const customAnswers2 = await runForm({
|
|
168
|
+
choices: fields,
|
|
169
|
+
message: import_chalk.default.bold(`Complete ${import_chalk.default.cyan(templateName)}:`),
|
|
170
|
+
name: "customAnswers"
|
|
171
|
+
});
|
|
161
172
|
return {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
173
|
+
destinationDir,
|
|
174
|
+
entryPoint,
|
|
175
|
+
templateComplete: true,
|
|
176
|
+
templateData: { ...templateData, ...customAnswers2 },
|
|
177
|
+
templateName,
|
|
178
|
+
type
|
|
168
179
|
};
|
|
180
|
+
}
|
|
181
|
+
import_logging.log.newline();
|
|
182
|
+
import_logging.log.warn(`Resume this later with ${import_chalk.default.bold("yarn skuba configure")}.`);
|
|
183
|
+
const customAnswers = generatePlaceholders(fields);
|
|
184
|
+
return {
|
|
185
|
+
destinationDir,
|
|
186
|
+
entryPoint,
|
|
187
|
+
templateComplete: false,
|
|
188
|
+
templateData: { ...templateData, ...customAnswers },
|
|
189
|
+
templateName,
|
|
190
|
+
type
|
|
191
|
+
};
|
|
169
192
|
};
|
|
170
|
-
exports.configureFromPrompt = configureFromPrompt;
|
|
171
193
|
const configureFromPipe = async () => {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
text
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
entryPoint,
|
|
209
|
-
templateData: {
|
|
210
|
-
...templateData,
|
|
211
|
-
...generatePlaceholders(fields),
|
|
212
|
-
},
|
|
213
|
-
type,
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
const required = fields.map(({ name }) => name);
|
|
217
|
-
const provided = new Set(Object.keys(templateData));
|
|
218
|
-
const missing = required.filter((name) => !provided.has(name));
|
|
219
|
-
if (missing.length > 0) {
|
|
220
|
-
logging_1.log.err('This template uses the following information:');
|
|
221
|
-
logging_1.log.newline();
|
|
222
|
-
missing.forEach((name) => logging_1.log.err(`- ${name}`));
|
|
223
|
-
process.exit(1);
|
|
194
|
+
let text = "";
|
|
195
|
+
await new Promise(
|
|
196
|
+
(resolve) => process.stdin.on("data", (chunk) => text += chunk).once("end", resolve)
|
|
197
|
+
);
|
|
198
|
+
text = text.trim();
|
|
199
|
+
if (text === "") {
|
|
200
|
+
import_logging.log.err("No data from stdin.");
|
|
201
|
+
process.exit(1);
|
|
202
|
+
}
|
|
203
|
+
let value;
|
|
204
|
+
try {
|
|
205
|
+
value = JSON.parse(text);
|
|
206
|
+
} catch {
|
|
207
|
+
import_logging.log.err("Invalid JSON from stdin.");
|
|
208
|
+
process.exit(1);
|
|
209
|
+
}
|
|
210
|
+
const result = import_types.InitConfigInput.validate(value);
|
|
211
|
+
if (!result.success) {
|
|
212
|
+
import_logging.log.err("Invalid data from stdin:");
|
|
213
|
+
import_logging.log.err(result.message);
|
|
214
|
+
process.exit(1);
|
|
215
|
+
}
|
|
216
|
+
const { destinationDir, templateComplete, templateName } = result.value;
|
|
217
|
+
const templateData = {
|
|
218
|
+
...await baseToTemplateData(result.value.templateData),
|
|
219
|
+
...result.value.templateData
|
|
220
|
+
};
|
|
221
|
+
await createDirectory(destinationDir);
|
|
222
|
+
await cloneTemplate(templateName, destinationDir);
|
|
223
|
+
const { entryPoint, fields, noSkip, type } = getTemplateConfig(
|
|
224
|
+
import_path.default.join(process.cwd(), destinationDir)
|
|
225
|
+
);
|
|
226
|
+
if (!templateComplete) {
|
|
227
|
+
if (noSkip) {
|
|
228
|
+
import_logging.log.err("Templating for", import_logging.log.bold(templateName), "cannot be skipped.");
|
|
229
|
+
process.exit(1);
|
|
224
230
|
}
|
|
225
231
|
return {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
232
|
+
...result.value,
|
|
233
|
+
entryPoint,
|
|
234
|
+
templateData: {
|
|
235
|
+
...templateData,
|
|
236
|
+
...generatePlaceholders(fields)
|
|
237
|
+
},
|
|
238
|
+
type
|
|
230
239
|
};
|
|
240
|
+
}
|
|
241
|
+
const required = fields.map(({ name }) => name);
|
|
242
|
+
const provided = new Set(Object.keys(templateData));
|
|
243
|
+
const missing = required.filter((name) => !provided.has(name));
|
|
244
|
+
if (missing.length > 0) {
|
|
245
|
+
import_logging.log.err("This template uses the following information:");
|
|
246
|
+
import_logging.log.newline();
|
|
247
|
+
missing.forEach((name) => import_logging.log.err(`- ${name}`));
|
|
248
|
+
process.exit(1);
|
|
249
|
+
}
|
|
250
|
+
return {
|
|
251
|
+
...result.value,
|
|
252
|
+
entryPoint,
|
|
253
|
+
templateData,
|
|
254
|
+
type
|
|
255
|
+
};
|
|
231
256
|
};
|
|
232
|
-
const getConfig = () => process.stdin.isTTY ?
|
|
233
|
-
|
|
234
|
-
|
|
257
|
+
const getConfig = () => process.stdin.isTTY ? configureFromPrompt() : configureFromPipe();
|
|
258
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
259
|
+
0 && (module.exports = {
|
|
260
|
+
configureFromPrompt,
|
|
261
|
+
getConfig,
|
|
262
|
+
getTemplateConfig,
|
|
263
|
+
runForm
|
|
264
|
+
});
|
|
265
|
+
//# sourceMappingURL=getConfig.js.map
|