zcatalyst-cli 1.26.2 → 1.27.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/README.md +1 -0
- package/lib/authentication/credential.d.ts +2 -1
- package/lib/authentication/credential.js +20 -3
- package/lib/authentication/crypt.d.ts +7 -3
- package/lib/authentication/crypt.js +87 -16
- package/lib/authentication/index.js +1 -0
- package/lib/authentication/key-manager.d.ts +7 -0
- package/lib/authentication/key-manager.js +62 -0
- package/lib/authentication/login.js +20 -20
- package/lib/bin/catalyst.js +1 -15
- package/lib/client.d.ts +3 -1
- package/lib/client.js +16 -5
- package/lib/command_needs/rc.js +13 -3
- package/lib/commands/appsail/add.js +10 -0
- package/lib/commands/client/delete.js +18 -6
- package/lib/commands/client/setup.js +7 -0
- package/lib/commands/deploy/index.js +3 -3
- package/lib/commands/deploy/slate.js +65 -4
- package/lib/commands/functions/add.js +7 -0
- package/lib/commands/functions/delete.js +22 -4
- package/lib/commands/functions/execute.js +39 -71
- package/lib/commands/functions/setup.js +13 -0
- package/lib/commands/functions/shell.js +15 -1
- package/lib/commands/iac/import.js +2 -2
- package/lib/commands/init.js +34 -20
- package/lib/commands/login.js +1 -0
- package/lib/commands/pull.js +22 -1
- package/lib/commands/serve.js +2 -1
- package/lib/commands/slate/create.js +7 -4
- package/lib/commands/slate/link.js +11 -5
- package/lib/commands/slate/unlink.js +7 -0
- package/lib/commands/zest/generate/index.js +28 -35
- package/lib/deploy/features/slate.d.ts +3 -1
- package/lib/deploy/features/slate.js +204 -5
- package/lib/docs/client-utils.toml +0 -5
- package/lib/docs/command_needs/rc.toml +9 -1
- package/lib/docs/commands/client/delete.toml +4 -0
- package/lib/docs/commands/deploy/slate.toml +3 -0
- package/lib/docs/commands/functions/delete.toml +10 -0
- package/lib/docs/commands/functions/execute.toml +1 -16
- package/lib/docs/commands/functions/setup.toml +3 -0
- package/lib/docs/commands/functions/shell.toml +8 -0
- package/lib/docs/commands/init.toml +3 -0
- package/lib/docs/commands/pull.toml +6 -0
- package/lib/docs/commands/slate/unlink.toml +6 -0
- package/lib/docs/execute/command-utils.toml +14 -0
- package/lib/docs/execute/execute-input-resolver.toml +37 -0
- package/lib/docs/init/features/project.toml +20 -0
- package/lib/docs/init/util/client.toml +4 -0
- package/lib/docs/prompt/index.toml +15 -0
- package/lib/docs/pull/features/apig.toml +6 -0
- package/lib/docs/pull/features/client.toml +20 -0
- package/lib/docs/pull/features/functions/index.toml +24 -0
- package/lib/endpoints/lib/slate.d.ts +14 -1
- package/lib/endpoints/lib/slate.js +35 -0
- package/lib/error/context-help.js +1 -1
- package/lib/error/index.js +9 -13
- package/lib/execute/command-utils.d.ts +5 -0
- package/lib/execute/command-utils.js +86 -0
- package/lib/execute/execute-input-resolver.d.ts +29 -0
- package/lib/execute/execute-input-resolver.js +207 -0
- package/lib/execute/index.d.ts +4 -1
- package/lib/execute/index.js +3 -2
- package/lib/fn-utils/lib/integ.js +22 -17
- package/lib/index.js +1 -0
- package/lib/init/dependencies/package-json.js +11 -7
- package/lib/init/features/appsail/index.js +75 -26
- package/lib/init/features/appsail/prompt-fields.d.ts +43 -0
- package/lib/init/features/appsail/prompt-fields.js +55 -0
- package/lib/init/features/appsail/utils/custom-runtime.d.ts +3 -0
- package/lib/init/features/appsail/utils/custom-runtime.js +161 -0
- package/lib/init/features/appsail/{utils.d.ts → utils/index.d.ts} +2 -2
- package/lib/init/features/appsail/utils/index.js +170 -0
- package/lib/init/features/client/index.js +4 -3
- package/lib/init/features/client/initializers/angular.js +3 -2
- package/lib/init/features/client/initializers/react.js +4 -3
- package/lib/init/features/client/prompt-fields.d.ts +37 -0
- package/lib/init/features/client/prompt-fields.js +48 -0
- package/lib/init/features/functions/index.js +37 -8
- package/lib/init/features/functions/languages/java.js +42 -7
- package/lib/init/features/functions/languages/node.js +42 -10
- package/lib/init/features/functions/languages/python.js +42 -7
- package/lib/init/features/functions/prompt-fields.d.ts +25 -0
- package/lib/init/features/functions/prompt-fields.js +34 -0
- package/lib/init/features/project.js +41 -6
- package/lib/init/features/slate/index.js +2 -0
- package/lib/init/features/slate/prompt-fields.d.ts +31 -0
- package/lib/init/features/slate/prompt-fields.js +41 -0
- package/lib/init/index.js +2 -1
- package/lib/init/util/client.js +11 -8
- package/lib/init/util/common.d.ts +2 -0
- package/lib/init/util/common.js +33 -3
- package/lib/init/util/prompt-fields.d.ts +7 -0
- package/lib/init/util/prompt-fields.js +13 -0
- package/lib/internal/command.d.ts +3 -0
- package/lib/internal/command.js +26 -3
- package/lib/migration/global/1.27.0.d.ts +2 -0
- package/lib/migration/global/1.27.0.js +39 -0
- package/lib/prompt/choice.d.ts +2 -0
- package/lib/prompt/choice.js +24 -0
- package/lib/prompt/cli-option-key.d.ts +1 -0
- package/lib/prompt/cli-option-key.js +10 -0
- package/lib/prompt/index.d.ts +6 -22
- package/lib/prompt/index.js +264 -67
- package/lib/prompt/overwrite-prompt.d.ts +11 -0
- package/lib/prompt/overwrite-prompt.js +16 -0
- package/lib/prompt/question-factory.d.ts +34 -0
- package/lib/prompt/question-factory.js +41 -0
- package/lib/prompt/register-fields.d.ts +24 -0
- package/lib/prompt/register-fields.js +37 -0
- package/lib/pull/features/apig.js +57 -6
- package/lib/pull/features/client.js +107 -24
- package/lib/pull/features/functions/index.js +100 -4
- package/lib/pull/index.js +1 -1
- package/lib/pull/utils.d.ts +13 -0
- package/lib/pull/utils.js +20 -0
- package/lib/repl-server.d.ts +4 -0
- package/lib/repl-server.js +9 -0
- package/lib/serve/server/lib/master/index.js +3 -3
- package/lib/serve/server/lib/slate/static-server.js +2 -2
- package/lib/serve/server/lib/web_client/server.js +2 -2
- package/lib/shell/format-functions.d.ts +4 -0
- package/lib/shell/format-functions.js +59 -0
- package/lib/shell/index.js +18 -0
- package/lib/util_modules/config/lib/appsail.d.ts +3 -2
- package/lib/util_modules/config/lib/appsail.js +6 -3
- package/lib/util_modules/config/lib/slate.d.ts +19 -0
- package/lib/util_modules/config-store.d.ts +1 -0
- package/lib/util_modules/config-store.js +29 -10
- package/lib/util_modules/constants/index.d.ts +0 -1
- package/lib/util_modules/constants/index.js +1 -3
- package/lib/util_modules/constants/lib/urls.d.ts +2 -0
- package/lib/util_modules/constants/lib/urls.js +4 -0
- package/lib/util_modules/dc.d.ts +6 -1
- package/lib/util_modules/dc.js +21 -8
- package/lib/util_modules/env.d.ts +3 -0
- package/lib/util_modules/env.js +41 -0
- package/lib/util_modules/fs/lib/sync.d.ts +1 -0
- package/lib/util_modules/fs/lib/sync.js +19 -0
- package/lib/util_modules/logger/utils.d.ts +1 -0
- package/lib/util_modules/logger/utils.js +5 -1
- package/lib/util_modules/option.d.ts +1 -0
- package/lib/util_modules/option.js +8 -0
- package/lib/util_modules/{server.js → server/index.js} +3 -3
- package/lib/util_modules/server/needed-scopes.d.ts +1 -0
- package/lib/util_modules/{constants/lib → server}/needed-scopes.js +7 -7
- package/package.json +3 -2
- package/lib/init/features/appsail/utils.js +0 -273
- package/lib/util_modules/constants/lib/needed-scopes.d.ts +0 -4
- /package/lib/docs/{dc.toml → util_modules/dc.toml} +0 -0
- /package/lib/util_modules/{server.d.ts → server/index.d.ts} +0 -0
|
@@ -59,16 +59,17 @@ const path_1 = require("path");
|
|
|
59
59
|
const ASYNC = __importStar(require("../../../../util_modules/fs/lib/async.js"));
|
|
60
60
|
const index_js_1 = __importDefault(require("../../../../error/index.js"));
|
|
61
61
|
const index_js_2 = __importDefault(require("../../../../prompt/index.js"));
|
|
62
|
+
const prompt_fields_1 = require("../prompt-fields");
|
|
62
63
|
const { angular } = plugin_js_1.default;
|
|
63
64
|
const { client } = placeholders_js_1.default;
|
|
64
65
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
66
|
const clientName = yield (0, client_js_1.clientNamePrompt)('Please provide a name for your Angular App:', 'angular-app');
|
|
66
67
|
const clientDirPath = (0, project_js_1.resolveProjectPath)(folder_names_js_1.default.client);
|
|
67
68
|
yield (0, client_js_1.directoryOverridePrompt)(clientDirPath);
|
|
68
|
-
const angularQuestions = yield index_js_2.default.ask(index_js_2.default.question('routing', 'Would you like to add Angular routing?', {
|
|
69
|
+
const angularQuestions = yield index_js_2.default.ask(index_js_2.default.question(prompt_fields_1.clientPromptFields.get('routing'), 'Would you like to add Angular routing?', {
|
|
69
70
|
type: 'confirm',
|
|
70
71
|
defaultAns: false
|
|
71
|
-
}), index_js_2.default.question('stylesheet', 'Which stylesheet format would you like to use?', {
|
|
72
|
+
}), index_js_2.default.question(prompt_fields_1.clientPromptFields.get('stylesheet'), 'Which stylesheet format would you like to use?', {
|
|
72
73
|
type: 'list',
|
|
73
74
|
choices: [
|
|
74
75
|
index_js_2.default.choice('CSS', { id: 'CSS', value: 'css', short: 'CSS' }),
|
|
@@ -52,6 +52,7 @@ const ASYNC = __importStar(require("../../../../util_modules/fs/lib/async.js"));
|
|
|
52
52
|
const path_1 = require("path");
|
|
53
53
|
const os_1 = require("os");
|
|
54
54
|
const index_js_1 = __importDefault(require("../../../../prompt/index.js"));
|
|
55
|
+
const prompt_fields_1 = require("../prompt-fields");
|
|
55
56
|
const client_js_1 = require("../../../util/client.js");
|
|
56
57
|
const plugin_js_1 = __importDefault(require("../../../../util_modules/constants/lib/plugin.js"));
|
|
57
58
|
const template_js_1 = __importDefault(require("../../../../util_modules/constants/lib/template.js"));
|
|
@@ -60,11 +61,11 @@ const index_js_2 = __importDefault(require("../../../../error/index.js"));
|
|
|
60
61
|
const { react } = plugin_js_1.default;
|
|
61
62
|
const { client } = placeholders_js_1.default;
|
|
62
63
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
-
const flavourPrompt = yield index_js_1.default.ask(index_js_1.default.question('
|
|
64
|
+
const flavourPrompt = yield index_js_1.default.ask(index_js_1.default.question(prompt_fields_1.clientPromptFields.get('js-ts'), `Choose an option to create the React App:`, {
|
|
64
65
|
type: 'list',
|
|
65
66
|
choices: [
|
|
66
|
-
index_js_1.default.choice('JavaScript', { value: 'js', short: 'JavaScript' }),
|
|
67
|
-
index_js_1.default.choice('TypeScript', { value: 'ts', short: 'TypeScript' })
|
|
67
|
+
index_js_1.default.choice('JavaScript', { id: 'js', value: 'js', short: 'JavaScript' }),
|
|
68
|
+
index_js_1.default.choice('TypeScript', { id: 'ts', value: 'ts', short: 'TypeScript' })
|
|
68
69
|
]
|
|
69
70
|
}));
|
|
70
71
|
const clientName = yield (0, client_js_1.clientNamePrompt)('Please provide a name for your React App:', 'react-app');
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const clientPromptFields: import("../../../prompt/register-fields").PromptFieldsRegistry<readonly [{
|
|
2
|
+
readonly name: "clientType";
|
|
3
|
+
readonly cliOption: {
|
|
4
|
+
readonly option: "--type <type>";
|
|
5
|
+
readonly description: "client type to initialize: react, angular, basic";
|
|
6
|
+
};
|
|
7
|
+
}, {
|
|
8
|
+
readonly name: "name";
|
|
9
|
+
readonly cliOption: {
|
|
10
|
+
readonly option: "--name <name>";
|
|
11
|
+
readonly description: "client application name";
|
|
12
|
+
};
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "js-ts";
|
|
15
|
+
readonly cliOption: {
|
|
16
|
+
readonly option: "--flavour <flavour>";
|
|
17
|
+
readonly description: "React variant: js or ts - (FOR REACT ONLY)";
|
|
18
|
+
};
|
|
19
|
+
}, {
|
|
20
|
+
readonly name: "routing";
|
|
21
|
+
readonly cliOption: {
|
|
22
|
+
readonly option: "--routing";
|
|
23
|
+
readonly description: "enable Angular routing - (FOR ANGULAR ONLY)";
|
|
24
|
+
};
|
|
25
|
+
}, {
|
|
26
|
+
readonly name: "stylesheet";
|
|
27
|
+
readonly cliOption: {
|
|
28
|
+
readonly option: "--stylesheet <format>";
|
|
29
|
+
readonly description: "Angular stylesheet format: css, scss, sass, less - (FOR ANGULAR ONLY)";
|
|
30
|
+
};
|
|
31
|
+
}, {
|
|
32
|
+
readonly name: "overwrite";
|
|
33
|
+
readonly cliOption: {
|
|
34
|
+
readonly option: "--overwrite";
|
|
35
|
+
readonly description: "overwrite the web client source directory if already present";
|
|
36
|
+
};
|
|
37
|
+
}]>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clientPromptFields = void 0;
|
|
4
|
+
const register_fields_1 = require("../../../prompt/register-fields");
|
|
5
|
+
exports.clientPromptFields = (0, register_fields_1.definePromptFields)([
|
|
6
|
+
{
|
|
7
|
+
name: 'clientType',
|
|
8
|
+
cliOption: {
|
|
9
|
+
option: '--type <type>',
|
|
10
|
+
description: 'client type to initialize: react, angular, basic'
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'name',
|
|
15
|
+
cliOption: {
|
|
16
|
+
option: '--name <name>',
|
|
17
|
+
description: 'client application name'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'js-ts',
|
|
22
|
+
cliOption: {
|
|
23
|
+
option: '--flavour <flavour>',
|
|
24
|
+
description: 'React variant: js or ts - (FOR REACT ONLY)'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'routing',
|
|
29
|
+
cliOption: {
|
|
30
|
+
option: '--routing',
|
|
31
|
+
description: 'enable Angular routing - (FOR ANGULAR ONLY)'
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'stylesheet',
|
|
36
|
+
cliOption: {
|
|
37
|
+
option: '--stylesheet <format>',
|
|
38
|
+
description: 'Angular stylesheet format: css, scss, sass, less - (FOR ANGULAR ONLY)'
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'overwrite',
|
|
43
|
+
cliOption: {
|
|
44
|
+
option: '--overwrite',
|
|
45
|
+
description: 'overwrite the web client source directory if already present'
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
]);
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -14,7 +47,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
48
|
const ansi_colors_1 = require("ansi-colors");
|
|
16
49
|
const integ_1 = require("../../../fn-utils/lib/integ");
|
|
17
|
-
const prompt_1 =
|
|
50
|
+
const prompt_1 = __importStar(require("../../../prompt"));
|
|
18
51
|
const runtime_store_1 = __importDefault(require("../../../runtime-store"));
|
|
19
52
|
const constants_1 = require("../../../util_modules/constants");
|
|
20
53
|
const fs_1 = require("../../../util_modules/fs");
|
|
@@ -28,6 +61,7 @@ const signals_1 = require("../../../signals");
|
|
|
28
61
|
const config_1 = require("../../../util_modules/config");
|
|
29
62
|
const cliq_1 = __importDefault(require("../../../event_generate/integration/cliq"));
|
|
30
63
|
const error_1 = __importDefault(require("../../../error"));
|
|
64
|
+
const prompt_fields_1 = require("./prompt-fields");
|
|
31
65
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
66
|
const currentCmd = (0, option_1.getCurrentCommand)();
|
|
33
67
|
const functionsDirPath = config_1.functionsConfig.source();
|
|
@@ -42,12 +76,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
42
76
|
' will be created with a catalyst function pre-configured.\n');
|
|
43
77
|
const folderExits = yield fs_1.ASYNC.dirExists(functionsDirPath);
|
|
44
78
|
const overwriteAns = folderExits
|
|
45
|
-
? yield prompt_1.default.ask(prompt_1.
|
|
46
|
-
(0, ansi_colors_1.underline)(constants_1.FOLDERNAME.functions) +
|
|
47
|
-
' already exists. Overwrite ?', {
|
|
48
|
-
type: 'confirm',
|
|
49
|
-
defaultAns: false
|
|
50
|
-
}))
|
|
79
|
+
? yield prompt_1.default.ask((0, prompt_1.overwritePromptQuestion)({ resourceName: constants_1.FOLDERNAME.functions }))
|
|
51
80
|
: { overwrite: true };
|
|
52
81
|
if (!overwriteAns.overwrite) {
|
|
53
82
|
(0, index_1.warning)('skipping function setup');
|
|
@@ -90,7 +119,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
90
119
|
short: 'integration'
|
|
91
120
|
}));
|
|
92
121
|
}
|
|
93
|
-
const fnTypeAns = yield prompt_1.default.ask(prompt_1.default.question('type', 'Which type of function do you like to create?', {
|
|
122
|
+
const fnTypeAns = yield prompt_1.default.ask(prompt_1.default.question(prompt_fields_1.functionsAddPromptFields.get('type'), 'Which type of function do you like to create?', {
|
|
94
123
|
type: 'list',
|
|
95
124
|
choices: fnTypeChoices
|
|
96
125
|
}));
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -14,7 +47,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
48
|
const ansi_colors_1 = require("ansi-colors");
|
|
16
49
|
const path_1 = require("path");
|
|
17
|
-
const prompt_1 =
|
|
50
|
+
const prompt_1 = __importStar(require("../../../../prompt"));
|
|
18
51
|
const fn_utils_1 = require("../../../../fn-utils");
|
|
19
52
|
const runtime_store_1 = __importDefault(require("../../../../runtime-store"));
|
|
20
53
|
const constants_1 = require("../../../../util_modules/constants");
|
|
@@ -27,12 +60,14 @@ const functions_1 = require("../../../util/functions");
|
|
|
27
60
|
const browserLogic_1 = require("../../../../fn-utils/lib/browserLogic");
|
|
28
61
|
const browserLogic_2 = __importDefault(require("../../../../util_modules/constants/lib/browserLogic"));
|
|
29
62
|
const java_1 = require("../../../../fn-utils/lib/java");
|
|
63
|
+
const prompt_fields_1 = require("../prompt-fields");
|
|
64
|
+
const env_1 = require("../../../../util_modules/env");
|
|
30
65
|
exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
66
|
const fnType = runtime_store_1.default.get('context.functions.type');
|
|
32
67
|
const fnDirPath = (0, path_1.join)(runtime_store_1.default.get('context.functions.dir_path'));
|
|
33
68
|
yield fs_1.ASYNC.ensureDir(fnDirPath);
|
|
34
69
|
const framework = fnType === constants_1.FN_TYPE.browserLogic ? yield (0, browserLogic_1.getBrowserLogicFramework)('java') : undefined;
|
|
35
|
-
const functionAns = yield prompt_1.default.ask(prompt_1.default.question('name', 'What will be the name of the java function? This will also be the folder name. ', {
|
|
70
|
+
const functionAns = yield prompt_1.default.ask(prompt_1.default.question(prompt_fields_1.functionsAddPromptFields.get('name'), 'What will be the name of the java function? This will also be the folder name. ', {
|
|
36
71
|
defaultAns: 'sample',
|
|
37
72
|
validate: (ans) => {
|
|
38
73
|
if (ans.match(constants_1.REGEX.folder_name)) {
|
|
@@ -53,11 +88,11 @@ exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* (
|
|
|
53
88
|
const targetPath = (0, path_1.join)(fnDirPath, functionAns.name);
|
|
54
89
|
const dirExists = yield fs_1.ASYNC.dirExists(targetPath);
|
|
55
90
|
const overwriteAns = dirExists
|
|
56
|
-
? yield prompt_1.default.ask(prompt_1.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
defaultAns: false
|
|
91
|
+
? yield prompt_1.default.ask((0, prompt_1.overwritePromptQuestion)({
|
|
92
|
+
fieldOrName: prompt_fields_1.functionsAddPromptFields.get('overwrite'),
|
|
93
|
+
resourceName: functionAns.name,
|
|
94
|
+
contextText: 'inside functions directory',
|
|
95
|
+
defaultAns: (0, env_1.isNonInteractiveMode)() ? null : false
|
|
61
96
|
}))
|
|
62
97
|
: { overwrite: true };
|
|
63
98
|
if (!overwriteAns.overwrite) {
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -12,9 +45,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
45
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
46
|
};
|
|
14
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const ansi_colors_1 = require("ansi-colors");
|
|
16
48
|
const path_1 = require("path");
|
|
17
|
-
const prompt_1 =
|
|
49
|
+
const prompt_1 = __importStar(require("../../../../prompt"));
|
|
18
50
|
const npm_install_1 = __importDefault(require("../../../dependencies/npm-install"));
|
|
19
51
|
const package_json_1 = __importDefault(require("../../../dependencies/package-json"));
|
|
20
52
|
const fn_utils_1 = require("../../../../fn-utils");
|
|
@@ -28,6 +60,8 @@ const functions_1 = require("../../../util/functions");
|
|
|
28
60
|
const browserLogic_1 = require("../../../../fn-utils/lib/browserLogic");
|
|
29
61
|
const browserLogic_2 = __importDefault(require("../../../../util_modules/constants/lib/browserLogic"));
|
|
30
62
|
const node_1 = require("../../../../fn-utils/lib/node");
|
|
63
|
+
const prompt_fields_1 = require("../prompt-fields");
|
|
64
|
+
const env_1 = require("../../../../util_modules/env");
|
|
31
65
|
exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
66
|
const fnType = runtime_store_1.default.get('context.functions.type');
|
|
33
67
|
const service = runtime_store_1.default.get('context.functions.integration.service', '');
|
|
@@ -39,11 +73,11 @@ exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* (
|
|
|
39
73
|
const targetPath = (0, path_1.join)(functionsDirPath, finalJson.name);
|
|
40
74
|
const dirExists = yield fs_1.ASYNC.dirExists(targetPath);
|
|
41
75
|
const overwriteAns = dirExists
|
|
42
|
-
? yield prompt_1.default.ask(prompt_1.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
defaultAns: false
|
|
76
|
+
? yield prompt_1.default.ask((0, prompt_1.overwritePromptQuestion)({
|
|
77
|
+
fieldOrName: prompt_fields_1.functionsAddPromptFields.get('overwrite'),
|
|
78
|
+
resourceName: finalJson.name,
|
|
79
|
+
contextText: 'inside functions directory',
|
|
80
|
+
defaultAns: (0, env_1.isNonInteractiveMode)() ? null : false
|
|
47
81
|
}))
|
|
48
82
|
: { overwrite: true };
|
|
49
83
|
if (!overwriteAns.overwrite) {
|
|
@@ -76,9 +110,7 @@ exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* (
|
|
|
76
110
|
integ_config,
|
|
77
111
|
integ_handler: ''
|
|
78
112
|
});
|
|
79
|
-
fnType === constants_1.FN_TYPE.integration
|
|
80
|
-
? yield (0, npm_install_1.default)(targetPath, true)
|
|
81
|
-
: yield (0, npm_install_1.default)(targetPath);
|
|
113
|
+
yield (0, npm_install_1.default)(targetPath, fnType === constants_1.FN_TYPE.integration || (0, env_1.isNonInteractiveMode)());
|
|
82
114
|
(0, functions_1.fillFunctionsInitPayload)(targetPath, finalJson.name, stack, fnType);
|
|
83
115
|
return targetPath;
|
|
84
116
|
});
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -14,7 +47,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
48
|
const ansi_colors_1 = require("ansi-colors");
|
|
16
49
|
const path_1 = require("path");
|
|
17
|
-
const prompt_1 =
|
|
50
|
+
const prompt_1 = __importStar(require("../../../../prompt"));
|
|
18
51
|
const fn_utils_1 = require("../../../../fn-utils");
|
|
19
52
|
const runtime_store_1 = __importDefault(require("../../../../runtime-store"));
|
|
20
53
|
const constants_1 = require("../../../../util_modules/constants");
|
|
@@ -30,6 +63,8 @@ const error_1 = __importDefault(require("../../../../error"));
|
|
|
30
63
|
const pip_install_1 = require("../../../dependencies/python/pip-install");
|
|
31
64
|
const cli_table_1 = require("../../../../cli_table");
|
|
32
65
|
const logger_1 = require("../../../../util_modules/logger");
|
|
66
|
+
const prompt_fields_1 = require("../prompt-fields");
|
|
67
|
+
const env_1 = require("../../../../util_modules/env");
|
|
33
68
|
exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* () {
|
|
34
69
|
const fnType = runtime_store_1.default.get('context.functions.type');
|
|
35
70
|
const fnDirPath = runtime_store_1.default.get('context.functions.dir_path');
|
|
@@ -38,7 +73,7 @@ exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* (
|
|
|
38
73
|
const templatePath = fnType === constants_1.FN_TYPE.integration
|
|
39
74
|
? js_1.JS.get(constants_1.TEMPLATE.functions.python[fnType], service)
|
|
40
75
|
: constants_1.TEMPLATE.functions.python[fnType];
|
|
41
|
-
const functionAns = yield prompt_1.default.ask(prompt_1.default.question('name', 'package name: ', {
|
|
76
|
+
const functionAns = yield prompt_1.default.ask(prompt_1.default.question(prompt_fields_1.functionsAddPromptFields.get('name'), 'package name: ', {
|
|
42
77
|
defaultAns: js_1.JS.snakeCase((0, project_1.getProjectName)('sample') + '_function'),
|
|
43
78
|
validate: (ans) => {
|
|
44
79
|
if (ans.match(constants_1.REGEX.folder_name)) {
|
|
@@ -58,11 +93,11 @@ exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* (
|
|
|
58
93
|
const targetPath = (0, path_1.join)(fnDirPath, functionAns.name);
|
|
59
94
|
const dirExists = yield fs_1.ASYNC.dirExists(targetPath);
|
|
60
95
|
const overwriteAns = dirExists
|
|
61
|
-
? yield prompt_1.default.ask(prompt_1.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
defaultAns: false
|
|
96
|
+
? yield prompt_1.default.ask((0, prompt_1.overwritePromptQuestion)({
|
|
97
|
+
fieldOrName: prompt_fields_1.functionsAddPromptFields.get('overwrite'),
|
|
98
|
+
resourceName: functionAns.name,
|
|
99
|
+
contextText: 'inside functions directory',
|
|
100
|
+
defaultAns: (0, env_1.isNonInteractiveMode)() ? null : false
|
|
66
101
|
}))
|
|
67
102
|
: { overwrite: true };
|
|
68
103
|
if (!overwriteAns.overwrite) {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const functionsAddPromptFields: import("../../../prompt/register-fields").PromptFieldsRegistry<readonly [{
|
|
2
|
+
readonly name: "name";
|
|
3
|
+
readonly cliOption: {
|
|
4
|
+
readonly option: "--name <name>";
|
|
5
|
+
readonly description: "function package name";
|
|
6
|
+
};
|
|
7
|
+
}, {
|
|
8
|
+
readonly name: "type";
|
|
9
|
+
readonly cliOption: {
|
|
10
|
+
readonly option: "--type <type>";
|
|
11
|
+
readonly description: "function type to scaffold <bio|aio|event|cron|browserlogic|job|integ>";
|
|
12
|
+
};
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "overwrite";
|
|
15
|
+
readonly cliOption: {
|
|
16
|
+
readonly option: "--overwrite";
|
|
17
|
+
readonly description: "overwrite function directory when target already exists";
|
|
18
|
+
};
|
|
19
|
+
}, {
|
|
20
|
+
readonly name: "service";
|
|
21
|
+
readonly cliOption: {
|
|
22
|
+
readonly option: "--integ-service <service>";
|
|
23
|
+
readonly description: "integration service for integ function type <ZohoCliq|Convokraft>";
|
|
24
|
+
};
|
|
25
|
+
}]>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.functionsAddPromptFields = void 0;
|
|
4
|
+
const register_fields_1 = require("../../../prompt/register-fields");
|
|
5
|
+
exports.functionsAddPromptFields = (0, register_fields_1.definePromptFields)([
|
|
6
|
+
{
|
|
7
|
+
name: 'name',
|
|
8
|
+
cliOption: {
|
|
9
|
+
option: '--name <name>',
|
|
10
|
+
description: 'function package name'
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'type',
|
|
15
|
+
cliOption: {
|
|
16
|
+
option: '--type <type>',
|
|
17
|
+
description: 'function type to scaffold <bio|aio|event|cron|browserlogic|job|integ>'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'overwrite',
|
|
22
|
+
cliOption: {
|
|
23
|
+
option: '--overwrite',
|
|
24
|
+
description: 'overwrite function directory when target already exists'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'service',
|
|
29
|
+
cliOption: {
|
|
30
|
+
option: '--integ-service <service>',
|
|
31
|
+
description: 'integration service for integ function type <ZohoCliq|Convokraft>'
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
]);
|
|
@@ -44,11 +44,12 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
44
44
|
if (defaultRCProjectName !== null &&
|
|
45
45
|
defaultRCProjectId !== null &&
|
|
46
46
|
!(0, option_1.getOptionValue)('force', false)) {
|
|
47
|
+
(0, index_1.info)();
|
|
47
48
|
(0, index_1.message)(constants_1.FILENAME.rc +
|
|
48
49
|
' already has ' +
|
|
49
50
|
(0, ansi_colors_1.bold)(defaultRCProjectName) +
|
|
50
51
|
' as a default project. To overwrite use --force option');
|
|
51
|
-
|
|
52
|
+
return;
|
|
52
53
|
}
|
|
53
54
|
const orgList = yield orgAPI.getAllOrgs();
|
|
54
55
|
if (orgList.length === 0) {
|
|
@@ -61,14 +62,29 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
61
62
|
value: org,
|
|
62
63
|
short: org.name
|
|
63
64
|
}));
|
|
65
|
+
const _orgOpt = (0, option_1.getGlobalOptionValue)('org', null);
|
|
66
|
+
const orgOpt = _orgOpt
|
|
67
|
+
? orgList.find((org) => org.id === _orgOpt || org.name === _orgOpt)
|
|
68
|
+
: null;
|
|
69
|
+
const whenOrgOpt = orgOpt === null && orgChoice.length > 1;
|
|
70
|
+
whenOrgOpt && (0, index_1.info)();
|
|
64
71
|
const orgAns = yield prompt_1.default.ask(prompt_1.default.question('org', 'Select a default Catalyst portal for this directory: ', {
|
|
65
72
|
type: 'list',
|
|
66
73
|
choices: js_1.JS.reverse(orgChoice),
|
|
67
|
-
when:
|
|
74
|
+
when: whenOrgOpt,
|
|
75
|
+
niInputMissingError: new error_1.default('Non-interactive mode requires --org. Pass a valid org id or name to the --org option.', {
|
|
76
|
+
exit: 1,
|
|
77
|
+
errorId: 'E_NON_INTERACTIVE_MISSING_INPUTS_ORG_OPT',
|
|
78
|
+
arg: [
|
|
79
|
+
(0, ansi_colors_1.italic)('--org <org_id>'),
|
|
80
|
+
(0, ansi_colors_1.italic)(`catalyst init ${(0, ansi_colors_1.bold)('--org <org_id>')} --project <project_id>`),
|
|
81
|
+
(0, ansi_colors_1.bold)(orgChoice.map((org) => '* ' + org.name).join('\n'))
|
|
82
|
+
],
|
|
83
|
+
skipHelp: true
|
|
84
|
+
})
|
|
68
85
|
}));
|
|
69
|
-
const selectedOrg = orgAns.org || orgList[0];
|
|
86
|
+
const selectedOrg = orgOpt || orgAns.org || orgList[0];
|
|
70
87
|
runtime_store_1.default.set('project.env.id', selectedOrg.id);
|
|
71
|
-
(0, index_1.message)('Setting up a new default project for this folder\n');
|
|
72
88
|
const projectAPI = yield (0, endpoints_1.projectAPI)({ auth: true, org: selectedOrg.id });
|
|
73
89
|
const allProjects = (yield projectAPI.getAllProjects());
|
|
74
90
|
if (allProjects.length === 0) {
|
|
@@ -93,11 +109,30 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
93
109
|
short: project.project_name
|
|
94
110
|
}));
|
|
95
111
|
});
|
|
112
|
+
const _projectOpt = (0, option_1.getGlobalOptionValue)('project', null);
|
|
113
|
+
const projectOpt = _projectOpt
|
|
114
|
+
? allProjects.find((project) => project.id === _projectOpt || project.project_name === _projectOpt)
|
|
115
|
+
: null;
|
|
96
116
|
const projectAns = yield prompt_1.default.ask(prompt_1.default.question('project', 'Select a default Catalyst project for this directory: ', {
|
|
97
117
|
type: 'list',
|
|
98
|
-
choices: js_1.JS.reverse(projectChoices)
|
|
118
|
+
choices: js_1.JS.reverse(projectChoices),
|
|
119
|
+
when: projectOpt === null,
|
|
120
|
+
niInputMissingError: new error_1.default('Non-interactive mode requires --project. Pass a valid project id or name to the --project option.', {
|
|
121
|
+
exit: 1,
|
|
122
|
+
errorId: 'E_NON_INTERACTIVE_MISSING_INPUTS_PROJECT_OPT',
|
|
123
|
+
arg: [
|
|
124
|
+
(0, ansi_colors_1.italic)('--project <project_id>'),
|
|
125
|
+
(0, ansi_colors_1.italic)(`catalyst init --org <org_id> ${(0, ansi_colors_1.bold)('--project <project_id>')}`),
|
|
126
|
+
(0, ansi_colors_1.bold)(allProjects
|
|
127
|
+
.map((_proj) => '* ' + _proj.project_name + `(${_proj.id})`)
|
|
128
|
+
.join('\n'))
|
|
129
|
+
],
|
|
130
|
+
skipHelp: true
|
|
131
|
+
})
|
|
99
132
|
}));
|
|
100
|
-
|
|
133
|
+
(0, index_1.info)();
|
|
134
|
+
(0, index_1.message)('Setting up a new default project for this folder');
|
|
135
|
+
let selectedProject = projectOpt || projectAns.project;
|
|
101
136
|
if (typeof selectedProject !== 'number') {
|
|
102
137
|
return (0, project_2.fillProjectPayload)(selectedOrg, selectedProject);
|
|
103
138
|
}
|
|
@@ -61,6 +61,7 @@ const constants_1 = require("../../../util_modules/constants");
|
|
|
61
61
|
const project_1 = require("../../../util_modules/project");
|
|
62
62
|
const toml_1 = require("../../../util_modules/toml");
|
|
63
63
|
const async_1 = require("../../../util_modules/fs/lib/async");
|
|
64
|
+
const env_1 = require("../../../util_modules/env");
|
|
64
65
|
const DEFAULT_DEV_COMMANDS = {
|
|
65
66
|
cra: 'PORT=$ZC_SLATE_PORT npm start',
|
|
66
67
|
'create-react-app': 'PORT=$ZC_SLATE_PORT npm start',
|
|
@@ -397,6 +398,7 @@ function getConfigDetails(frameworkOpt, frameworks) {
|
|
|
397
398
|
let editDefaultConfig;
|
|
398
399
|
if (!(0, option_1.getOptionValue)('default')) {
|
|
399
400
|
if (slateConfigs === null || slateConfigs === void 0 ? void 0 : slateConfigs.settings) {
|
|
401
|
+
(0, env_1.isNonInteractiveMode)() && (0, console_1.info)();
|
|
400
402
|
(0, console_1.log)(`Auto-detected App Configuration (${(0, ansi_colors_1.bold)(frameworkOpt)}):\n` +
|
|
401
403
|
`${(0, ansi_colors_1.grey)((0, ansi_colors_1.bold)('Install Command: ') +
|
|
402
404
|
(slateConfigs === null || slateConfigs === void 0 ? void 0 : slateConfigs.settings.install_command.placeholder))}\n` +
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const slateAddPromptFields: import("../../../prompt/register-fields").PromptFieldsRegistry<readonly [{
|
|
2
|
+
readonly name: "name";
|
|
3
|
+
readonly cliOption: {
|
|
4
|
+
readonly option: "--name <name>";
|
|
5
|
+
readonly description: "Specify the name of the Slate application";
|
|
6
|
+
};
|
|
7
|
+
}, {
|
|
8
|
+
readonly name: "framework";
|
|
9
|
+
readonly cliOption: {
|
|
10
|
+
readonly option: "--framework <framework_name>";
|
|
11
|
+
readonly description: "Specify the frontend framework (e.g., React, Angular, Vue)";
|
|
12
|
+
};
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "source";
|
|
15
|
+
readonly cliOption: {
|
|
16
|
+
readonly option: "--source <path>";
|
|
17
|
+
readonly description: "Specify the source directory of the Slate application";
|
|
18
|
+
};
|
|
19
|
+
}, {
|
|
20
|
+
readonly name: "template";
|
|
21
|
+
readonly cliOption: {
|
|
22
|
+
readonly option: "--template <template_url>";
|
|
23
|
+
readonly description: "Provide a template URL to initialize your Slate application";
|
|
24
|
+
};
|
|
25
|
+
}, {
|
|
26
|
+
readonly name: "default";
|
|
27
|
+
readonly cliOption: {
|
|
28
|
+
readonly option: "--default";
|
|
29
|
+
readonly description: "Use default application configurations without prompting";
|
|
30
|
+
};
|
|
31
|
+
}]>;
|