zcatalyst-cli 1.25.2 → 1.26.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/lib/api-timer.d.ts +0 -1
- package/lib/apig-utils.d.ts +1 -1
- package/lib/apig-utils.js +1 -1
- package/lib/appsail-utils.js +80 -13
- package/lib/archiver.d.ts +0 -4
- package/lib/archiver.js +21 -11
- package/lib/authentication/constants/auth.js +1 -1
- package/lib/authentication/credential.js +3 -3
- package/lib/authentication/index.js +25 -14
- package/lib/authentication/login.d.ts +0 -2
- package/lib/authentication/login.js +23 -10
- package/lib/bin/catalyst.js +17 -7
- package/lib/client-utils.d.ts +3 -3
- package/lib/client-utils.js +2 -2
- package/lib/client.js +19 -9
- package/lib/code-deck.d.ts +0 -2
- package/lib/code-deck.js +4 -4
- package/lib/command_needs/config.js +1 -1
- package/lib/command_needs/rc.js +5 -2
- package/lib/commands/appsail/add.js +17 -7
- package/lib/commands/client/setup.js +17 -7
- package/lib/commands/config/set.js +5 -3
- package/lib/commands/deploy/appsail.js +37 -14
- package/lib/commands/deploy/index.js +88 -66
- package/lib/commands/deploy/slate.js +37 -14
- package/lib/commands/event/generate/integ.js +18 -9
- package/lib/commands/functions/add.js +17 -7
- package/lib/commands/functions/execute.js +17 -7
- package/lib/commands/functions/setup.js +17 -7
- package/lib/commands/functions/shell.js +17 -7
- package/lib/commands/iac/import.js +18 -8
- package/lib/commands/iac/pack.js +17 -7
- package/lib/commands/iac/status.js +17 -7
- package/lib/commands/index.js +20 -12
- package/lib/commands/init.js +17 -7
- package/lib/commands/login.js +17 -7
- package/lib/commands/logout.js +17 -7
- package/lib/commands/project/list.js +17 -7
- package/lib/commands/project/use.js +1 -0
- package/lib/commands/pull.js +17 -7
- package/lib/commands/run.js +17 -7
- package/lib/commands/serve.js +17 -7
- package/lib/commands/signals/generate/index.js +1 -1
- package/lib/commands/slate/create.js +17 -7
- package/lib/commands/slate/link.js +18 -7
- package/lib/commands/slate/unlink.js +16 -4
- package/lib/commands/token/generate.js +17 -7
- package/lib/commands/token/list.js +17 -7
- package/lib/commands/token/revoke.js +17 -7
- package/lib/commands/zest/generate/index.js +21 -11
- package/lib/deploy/features/appsail/index.js +2 -3
- package/lib/deploy/features/appsail/pack.d.ts +0 -1
- package/lib/deploy/features/appsail/pack.js +2 -3
- package/lib/deploy/features/appsail/utils.js +7 -8
- package/lib/deploy/features/functions/languages/index.js +3 -4
- package/lib/deploy/features/index.js +17 -7
- package/lib/deploy/features/slate.js +2 -3
- package/lib/deploy/index.js +2 -2
- package/lib/deploy/util.d.ts +2 -0
- package/lib/deploy/util.js +3 -1
- package/lib/docs/commands/signals/generate/generate.toml +19 -0
- package/lib/docs/commands/slate/unlink.toml +9 -0
- package/lib/docs/fn-utils/lib/node.toml +4 -0
- package/lib/docs/init/dependencies/python/ensure-python.toml +4 -0
- package/lib/docs/serve/server/lib/slate/index.toml +15 -0
- package/lib/docs/slate-utils.toml +9 -0
- package/lib/endpoints/index.d.ts +2 -1
- package/lib/endpoints/index.js +88 -79
- package/lib/endpoints/lib/apig.d.ts +0 -1
- package/lib/endpoints/lib/apig.js +2 -2
- package/lib/endpoints/lib/applogic.d.ts +0 -1
- package/lib/endpoints/lib/applogic.js +2 -2
- package/lib/endpoints/lib/appsail.d.ts +1 -4
- package/lib/endpoints/lib/appsail.js +7 -7
- package/lib/endpoints/lib/client.d.ts +0 -1
- package/lib/endpoints/lib/code-deck.js +1 -1
- package/lib/endpoints/lib/common.d.ts +0 -2
- package/lib/endpoints/lib/ds-bulk.js +2 -2
- package/lib/endpoints/lib/env.js +2 -2
- package/lib/endpoints/lib/filestore.d.ts +0 -1
- package/lib/endpoints/lib/functions.d.ts +0 -1
- package/lib/endpoints/lib/functions.js +2 -2
- package/lib/endpoints/lib/git-hub.d.ts +0 -2
- package/lib/endpoints/lib/iac.d.ts +0 -3
- package/lib/endpoints/lib/iac.js +2 -2
- package/lib/endpoints/lib/project.d.ts +0 -1
- package/lib/endpoints/lib/project.js +2 -2
- package/lib/endpoints/lib/sdk.d.ts +0 -2
- package/lib/endpoints/lib/sdk.js +1 -1
- package/lib/endpoints/lib/slate.d.ts +0 -1
- package/lib/endpoints/lib/stratus.d.ts +0 -1
- package/lib/endpoints/lib/user.d.ts +0 -2
- package/lib/endpoints/lib/user.js +2 -1
- package/lib/error/context-help.js +1 -1
- package/lib/error/index.js +2 -2
- package/lib/event_generate/cache.js +4 -4
- package/lib/event_generate/custom.js +1 -2
- package/lib/event_generate/datastore.js +4 -4
- package/lib/event_generate/filestore.js +4 -4
- package/lib/event_generate/github.js +2 -2
- package/lib/event_generate/index.js +19 -11
- package/lib/event_generate/stratus.js +2 -2
- package/lib/event_generate/user.js +2 -2
- package/lib/event_generate/webapp.js +2 -2
- package/lib/execute/caller.d.ts +0 -1
- package/lib/execute/caller.js +20 -7
- package/lib/execute/index.js +27 -4
- package/lib/execute-script.js +22 -13
- package/lib/express_middlewares/auth-checker.js +2 -3
- package/lib/express_middlewares/project.d.ts +1 -1
- package/lib/fn-utils/index.js +17 -7
- package/lib/fn-utils/lib/browserLogic.js +4 -5
- package/lib/fn-utils/lib/common.d.ts +0 -1
- package/lib/fn-utils/lib/common.js +25 -26
- package/lib/fn-utils/lib/integ.js +2 -3
- package/lib/fn-utils/lib/java/classpath.js +2 -3
- package/lib/fn-utils/lib/java/compile.js +4 -4
- package/lib/fn-utils/lib/java/ensure-java-userconfig.d.ts +10 -0
- package/lib/fn-utils/lib/java/ensure-java-userconfig.js +45 -23
- package/lib/fn-utils/lib/java/index.d.ts +0 -1
- package/lib/fn-utils/lib/java/index.js +11 -11
- package/lib/fn-utils/lib/java/keywords.js +2 -2
- package/lib/fn-utils/lib/node.d.ts +1 -1
- package/lib/fn-utils/lib/node.js +67 -15
- package/lib/fn-utils/lib/python.js +29 -19
- package/lib/iac/status/util/index.d.ts +1 -1
- package/lib/init/dependencies/npm-install.js +2 -2
- package/lib/init/dependencies/python/ensure-python.d.ts +2 -2
- package/lib/init/dependencies/python/ensure-python.js +65 -58
- package/lib/init/dependencies/python/pip-install.d.ts +3 -5
- package/lib/init/dependencies/python/pip-install.js +14 -53
- package/lib/init/features/appsail/utils.js +21 -12
- package/lib/init/features/client/index.js +18 -9
- package/lib/init/features/client/initializers/angular.js +17 -7
- package/lib/init/features/client/initializers/basic.js +17 -7
- package/lib/init/features/client/initializers/lyte.js +17 -7
- package/lib/init/features/client/initializers/react.js +17 -7
- package/lib/init/features/index.js +29 -20
- package/lib/init/features/project.js +5 -5
- package/lib/init/features/slate/index.js +198 -69
- package/lib/init/util/client.js +23 -13
- package/lib/init/util/common.js +5 -6
- package/lib/init/util/project.js +1 -1
- package/lib/internal/api.d.ts +0 -3
- package/lib/internal/api.js +19 -9
- package/lib/internal/command.js +18 -9
- package/lib/migration/global/1.25.0.d.ts +2 -0
- package/lib/migration/global/1.25.0.js +28 -0
- package/lib/migration/index.js +20 -12
- package/lib/option-filter.js +19 -10
- package/lib/optional-import.js +19 -10
- package/lib/plugin-loader.d.ts +0 -2
- package/lib/plugin-loader.js +18 -8
- package/lib/port-resolver.js +10 -10
- package/lib/prompt/index.d.ts +3 -3
- package/lib/prompt/index.js +17 -7
- package/lib/prompt/types/file-path.d.ts +0 -1
- package/lib/prompt/types/search-box.d.ts +0 -1
- package/lib/prompt/types/tree.d.ts +1 -2
- package/lib/prompt/types/tree.js +10 -10
- package/lib/prompt/types/with-description.d.ts +0 -1
- package/lib/pull/features/functions/index.js +71 -52
- package/lib/pull/features/functions/languages.js +3 -4
- package/lib/pull/features/index.js +17 -7
- package/lib/repl-server.d.ts +0 -1
- package/lib/repl-server.js +9 -1
- package/lib/serve/features/apig.js +19 -1
- package/lib/serve/features/appsail.d.ts +1 -0
- package/lib/serve/features/appsail.js +51 -7
- package/lib/serve/features/index.js +22 -13
- package/lib/serve/index.js +20 -7
- package/lib/serve/server/index.d.ts +0 -2
- package/lib/serve/server/index.js +26 -12
- package/lib/serve/server/lib/appsail/index.js +31 -37
- package/lib/serve/server/lib/appsail/start.js +12 -5
- package/lib/serve/server/lib/appsail/util.d.ts +11 -0
- package/lib/serve/server/lib/appsail/util.js +69 -0
- package/lib/serve/server/lib/java/index.js +18 -7
- package/lib/serve/server/lib/master/appsail.js +3 -4
- package/lib/serve/server/lib/master/functions.js +1 -2
- package/lib/serve/server/lib/master/index.d.ts +0 -1
- package/lib/serve/server/lib/master/index.js +5 -5
- package/lib/serve/server/lib/master/slate.js +1 -2
- package/lib/serve/server/lib/master/unknown-req-proxy.js +5 -2
- package/lib/serve/server/lib/master/utils.d.ts +4 -8
- package/lib/serve/server/lib/master/utils.js +4 -6
- package/lib/serve/server/lib/master/web-client.js +1 -2
- package/lib/serve/server/lib/node/index.js +22 -11
- package/lib/serve/server/lib/node/server/browserlogic/utils/playwright-handler.js +1 -1
- package/lib/serve/server/lib/node/server/browserlogic/utils/puppeteer-handler.js +1 -1
- package/lib/serve/server/lib/node/server/browserlogic/utils/selenium-handler.js +2 -0
- package/lib/serve/server/lib/python/index.js +23 -14
- package/lib/serve/server/lib/slate/static-server.d.ts +0 -1
- package/lib/serve/server/lib/slate/static-server.js +5 -4
- package/lib/serve/server/lib/web_client/server.d.ts +0 -1
- package/lib/serve/server/lib/web_client/server.js +5 -4
- package/lib/shell/dependencies/http-functions.d.ts +0 -2
- package/lib/shell/dependencies/http-functions.js +7 -7
- package/lib/shell/dependencies/non-http-function/fn-execution-handler.d.ts +0 -2
- package/lib/shell/dependencies/non-http-function/fn-execution-handler.js +55 -24
- package/lib/shell/dependencies/non-http-function/fn-handler.d.ts +3 -3
- package/lib/shell/dependencies/non-http-function/fn-handler.js +54 -20
- package/lib/shell/dependencies/non-http-function/node.js +4 -4
- package/lib/shell/dependencies/non-http-function/python.d.ts +1 -1
- package/lib/shell/dependencies/non-http-function/python.js +11 -13
- package/lib/shell/dependencies/non-http-function/slave-manager.d.ts +0 -2
- package/lib/shell/dependencies/non-http-function/slave-manager.js +11 -7
- package/lib/shell/dependencies/tunnel-server.js +4 -4
- package/lib/shell/index.js +50 -3
- package/lib/shell/prepare/index.js +4 -3
- package/lib/shell/prepare/languages/index.js +18 -9
- package/lib/shell/prepare/languages/node.js +29 -19
- package/lib/shell/prepare/languages/python.js +6 -12
- package/lib/signals/index.js +19 -11
- package/lib/slate-utils.js +4 -3
- package/lib/throbber/index.d.ts +1 -2
- package/lib/throbber/index.js +5 -2
- package/lib/throbber/utils.d.ts +0 -1
- package/lib/throbber/utils.js +4 -5
- package/lib/userConfig.d.ts +14 -0
- package/lib/userConfig.js +15 -1
- package/lib/util_modules/config/index.js +17 -7
- package/lib/util_modules/config/lib/apig.d.ts +1 -0
- package/lib/util_modules/config/lib/apig.js +10 -5
- package/lib/util_modules/config/lib/appsail.js +7 -7
- package/lib/util_modules/config/lib/client.js +5 -6
- package/lib/util_modules/config/lib/functions.js +5 -6
- package/lib/util_modules/config/lib/slate.js +5 -6
- package/lib/util_modules/config-store.d.ts +1 -1
- package/lib/util_modules/config-store.js +30 -13
- package/lib/util_modules/constants/lib/apig-rules.d.ts +1 -1
- package/lib/util_modules/constants/lib/dc-type.js +3 -3
- package/lib/util_modules/constants/lib/placeholders.d.ts +1 -1
- package/lib/util_modules/constants/lib/placeholders.js +1 -1
- package/lib/util_modules/constants/lib/urls.js +2 -9
- package/lib/util_modules/container.js +23 -14
- package/lib/util_modules/dc.js +3 -4
- package/lib/util_modules/env.d.ts +3 -0
- package/lib/util_modules/env.js +64 -4
- package/lib/util_modules/event-emitter.d.ts +9 -0
- package/lib/util_modules/event-emitter.js +68 -0
- package/lib/util_modules/fs/index.js +17 -7
- package/lib/util_modules/fs/lib/async.d.ts +0 -4
- package/lib/util_modules/fs/lib/async.js +46 -46
- package/lib/util_modules/fs/lib/sync.d.ts +1 -3
- package/lib/util_modules/fs/lib/sync.js +40 -30
- package/lib/util_modules/logger/index.js +12 -12
- package/lib/util_modules/logger/utils.d.ts +0 -4
- package/lib/util_modules/logger/utils.js +1 -1
- package/lib/util_modules/logger/winston.js +2 -2
- package/lib/util_modules/option.js +5 -6
- package/lib/util_modules/project.js +22 -23
- package/lib/util_modules/runtime-store.d.ts +2 -2
- package/lib/util_modules/server.d.ts +1 -2
- package/lib/util_modules/server.js +54 -15
- package/lib/util_modules/shell.d.ts +0 -3
- package/lib/util_modules/shell.js +5 -6
- package/lib/util_modules/toml.js +2 -3
- package/package.json +13 -13
- package/templates/init/functions/java/event/sample.java +5 -2
- package/templates/web-socket.txt +1 -1
- /package/lib/docs/{commands/event/generate → event_generate}/index.toml +0 -0
- /package/templates/init/functions/java/integ/convokraft/{Sample.java → sample.java} +0 -0
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
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
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -51,21 +61,71 @@ const constants_1 = require("../../../util_modules/constants");
|
|
|
51
61
|
const project_1 = require("../../../util_modules/project");
|
|
52
62
|
const toml_1 = require("../../../util_modules/toml");
|
|
53
63
|
const async_1 = require("../../../util_modules/fs/lib/async");
|
|
64
|
+
const DEFAULT_DEV_COMMANDS = {
|
|
65
|
+
cra: 'PORT=$ZC_SLATE_PORT npm start',
|
|
66
|
+
'create-react-app': 'PORT=$ZC_SLATE_PORT npm start',
|
|
67
|
+
react: 'PORT=$ZC_SLATE_PORT npm start',
|
|
68
|
+
'react-vite': 'npm run dev -- --port $ZC_SLATE_PORT',
|
|
69
|
+
'react-vitejs': 'npm run dev -- --port $ZC_SLATE_PORT',
|
|
70
|
+
nextjs: 'npm run dev -- --port $ZC_SLATE_PORT',
|
|
71
|
+
next: 'npm run dev -- --port $ZC_SLATE_PORT',
|
|
72
|
+
angular: 'npm start -- --port $ZC_SLATE_PORT',
|
|
73
|
+
'vue-vite': 'npm run dev -- --port $ZC_SLATE_PORT',
|
|
74
|
+
vue: 'npm run dev -- --port $ZC_SLATE_PORT',
|
|
75
|
+
solidjs: 'npm run dev -- --port $ZC_SLATE_PORT',
|
|
76
|
+
'solid-js': 'npm run dev -- --port $ZC_SLATE_PORT',
|
|
77
|
+
solid: 'npm run dev -- --port $ZC_SLATE_PORT',
|
|
78
|
+
astro: 'npm run dev -- --port $ZC_SLATE_PORT',
|
|
79
|
+
preact: 'npm run dev -- --port $ZC_SLATE_PORT',
|
|
80
|
+
svelte: 'npm run dev -- --port $ZC_SLATE_PORT',
|
|
81
|
+
sveltekit: 'npm run dev -- --port $ZC_SLATE_PORT',
|
|
82
|
+
nuxt: 'npm run dev -- --port $ZC_SLATE_PORT',
|
|
83
|
+
gatsby: 'npm run develop -- --port $ZC_SLATE_PORT',
|
|
84
|
+
remix: 'npm run dev -- --port $ZC_SLATE_PORT'
|
|
85
|
+
};
|
|
86
|
+
const GENERIC_DEV_COMMAND = 'npm run dev -- --port $ZC_SLATE_PORT';
|
|
87
|
+
function hasPortReference(cmd) {
|
|
88
|
+
if (!cmd)
|
|
89
|
+
return false;
|
|
90
|
+
return /\$\{?ZC_SLATE_PORT\}?|%ZC_SLATE_PORT%/.test(cmd);
|
|
91
|
+
}
|
|
92
|
+
function resolveDevCommand(frameworkName, frameworks) {
|
|
93
|
+
var _a, _b;
|
|
94
|
+
const fw = frameworks.find((f) => f.name === frameworkName);
|
|
95
|
+
const apiCmd = (_b = (_a = fw === null || fw === void 0 ? void 0 : fw.settings) === null || _a === void 0 ? void 0 : _a.dev_command) === null || _b === void 0 ? void 0 : _b.value;
|
|
96
|
+
if (apiCmd && hasPortReference(apiCmd)) {
|
|
97
|
+
return apiCmd;
|
|
98
|
+
}
|
|
99
|
+
const mapped = DEFAULT_DEV_COMMANDS[frameworkName.toLowerCase()];
|
|
100
|
+
if (mapped)
|
|
101
|
+
return mapped;
|
|
102
|
+
return GENERIC_DEV_COMMAND;
|
|
103
|
+
}
|
|
104
|
+
function promptFramework(frameworks, defaultName) {
|
|
105
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
let ordered = frameworks;
|
|
107
|
+
if (defaultName) {
|
|
108
|
+
const idx = frameworks.findIndex((f) => f.name === defaultName);
|
|
109
|
+
if (idx > 0) {
|
|
110
|
+
ordered = [frameworks[idx], ...frameworks.slice(0, idx), ...frameworks.slice(idx + 1)];
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const choices = ordered.map(({ label, name }) => prompt_1.default.choice(label, { value: name, short: label }));
|
|
114
|
+
const defaultIdx = defaultName ? ordered.findIndex((f) => f.name === defaultName) : -1;
|
|
115
|
+
const { selectedFramework } = yield prompt_1.default.ask(prompt_1.default.question('selectedFramework', 'Select a framework to start with: ', Object.assign({ type: 'list', choices }, (defaultIdx >= 0 ? { default: defaultIdx } : {}))));
|
|
116
|
+
return selectedFramework;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
54
119
|
function getFrameworkOption(frameworks, source) {
|
|
55
120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
121
|
let frameworkOpt = (0, option_1.getOptionValue)('framework');
|
|
57
122
|
if (frameworkOpt &&
|
|
58
123
|
frameworks.findIndex((framework) => framework.name === frameworkOpt) === -1) {
|
|
59
|
-
(0, logger_1.warning)(
|
|
124
|
+
(0, logger_1.warning)(`Given framework "${frameworkOpt}" is not supported in Slate.`);
|
|
60
125
|
frameworkOpt = '';
|
|
61
126
|
}
|
|
62
127
|
if (!frameworkOpt) {
|
|
63
|
-
|
|
64
|
-
const { selectedFramework } = yield prompt_1.default.ask(prompt_1.default.question('selectedFramework', 'Select a framework to start with: ', {
|
|
65
|
-
type: 'list',
|
|
66
|
-
choices: filteredFrameworks.map(({ label, name }) => prompt_1.default.choice(label, { value: name, short: label }))
|
|
67
|
-
}));
|
|
68
|
-
frameworkOpt = selectedFramework;
|
|
128
|
+
frameworkOpt = yield promptFramework(frameworks.filter((f) => f.name !== 'other'));
|
|
69
129
|
}
|
|
70
130
|
return { name: frameworkOpt, source };
|
|
71
131
|
});
|
|
@@ -111,8 +171,8 @@ function getAppName(existingSlates, frameworkOpt) {
|
|
|
111
171
|
return appName;
|
|
112
172
|
});
|
|
113
173
|
}
|
|
114
|
-
function handleTemplate(
|
|
115
|
-
return __awaiter(this,
|
|
174
|
+
function handleTemplate(appName_1) {
|
|
175
|
+
return __awaiter(this, arguments, void 0, function* (appName, { templateName, frameworkName } = {}) {
|
|
116
176
|
const projectRoot = (0, project_1.getProjectRoot)();
|
|
117
177
|
const appPath = path_1.default.join(projectRoot, appName);
|
|
118
178
|
const folderExists = yield fs_1.ASYNC.dirExists(appPath);
|
|
@@ -140,8 +200,23 @@ function handleTemplate(appName, { templateName, frameworkName } = {}) {
|
|
|
140
200
|
}
|
|
141
201
|
function addExistingSlate(existingSlates) {
|
|
142
202
|
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
-
yield prompt_1.default.register('file-path');
|
|
144
203
|
const projectRoot = (0, project_1.getProjectRoot)();
|
|
204
|
+
const sourceOpt = (0, option_1.getOptionValue)('source');
|
|
205
|
+
if (sourceOpt) {
|
|
206
|
+
const buildPath = (0, path_1.resolve)(projectRoot, sourceOpt);
|
|
207
|
+
if (existingSlates.findIndex((targ) => targ.source === buildPath) !== -1) {
|
|
208
|
+
throw new error_1.default(`Path ${(0, ansi_colors_1.bold)(buildPath)} is already linked to a Slate app.`, {
|
|
209
|
+
exit: 1
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
if (!(yield fs_1.ASYNC.dirExists(buildPath))) {
|
|
213
|
+
throw new error_1.default(`Source path ${(0, ansi_colors_1.bold)(buildPath)} does not exist.`, {
|
|
214
|
+
exit: 1
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
return buildPath;
|
|
218
|
+
}
|
|
219
|
+
yield prompt_1.default.register('file-path');
|
|
145
220
|
const { sourcePath } = yield prompt_1.default.ask(prompt_1.default.question('sourcePath', 'Please provide the source path of your slate service: ', {
|
|
146
221
|
type: 'file-path',
|
|
147
222
|
validate: (pth) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -167,89 +242,132 @@ function addExistingSlate(existingSlates) {
|
|
|
167
242
|
function detectFramework(source, frameworkList) {
|
|
168
243
|
return __awaiter(this, void 0, void 0, function* () {
|
|
169
244
|
const frameworkOpt = (0, option_1.getOptionValue)('framework');
|
|
170
|
-
if (frameworkOpt
|
|
171
|
-
frameworkList.findIndex((framework) => framework.name === frameworkOpt)
|
|
172
|
-
|
|
245
|
+
if (frameworkOpt) {
|
|
246
|
+
if (frameworkList.findIndex((framework) => framework.name === frameworkOpt) !== -1) {
|
|
247
|
+
return { name: frameworkOpt, source };
|
|
248
|
+
}
|
|
249
|
+
(0, logger_1.warning)(`Given framework "${frameworkOpt}" is not supported in Slate. Auto-detecting...`);
|
|
173
250
|
}
|
|
251
|
+
const fallback = (reason) => __awaiter(this, void 0, void 0, function* () {
|
|
252
|
+
(0, logger_1.warning)(reason);
|
|
253
|
+
const name = yield promptFramework(frameworkList.filter((f) => f.name !== 'other'));
|
|
254
|
+
return { name, source };
|
|
255
|
+
});
|
|
174
256
|
const packageJsonPath = (0, path_1.join)(source, constants_1.FILENAME.package_json);
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
(0, logger_1.warning)('Unable to find the package.json file at the given source path');
|
|
178
|
-
return getFrameworkOption(frameworkList, source);
|
|
257
|
+
if (!(yield fs_1.ASYNC.fileExists(packageJsonPath))) {
|
|
258
|
+
return fallback('Unable to find the package.json file at the given source path');
|
|
179
259
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
260
|
+
let data;
|
|
261
|
+
try {
|
|
262
|
+
data = yield fs_1.ASYNC.readJSONFile(packageJsonPath);
|
|
263
|
+
}
|
|
264
|
+
catch (err) {
|
|
265
|
+
return fallback(`Could not parse package.json (${err instanceof Error ? err.message : String(err)})`);
|
|
266
|
+
}
|
|
267
|
+
const dependencies = Object.assign(Object.assign({}, ((data === null || data === void 0 ? void 0 : data.dependencies) || {})), ((data === null || data === void 0 ? void 0 : data.devDependencies) || {}));
|
|
268
|
+
if (Object.keys(dependencies).length === 0) {
|
|
269
|
+
return fallback('The package.json file does not contain dependencies');
|
|
185
270
|
}
|
|
186
271
|
const dependencyNames = Object.keys(dependencies);
|
|
272
|
+
const scripts = ((data === null || data === void 0 ? void 0 : data.scripts) || {});
|
|
273
|
+
const scriptCommands = [scripts.dev, scripts.start, scripts.build, scripts.serve]
|
|
274
|
+
.filter((s) => typeof s === 'string')
|
|
275
|
+
.join(' ');
|
|
276
|
+
const scriptTokens = new Set(scriptCommands
|
|
277
|
+
.toLowerCase()
|
|
278
|
+
.replace(/[a-z_][a-z0-9_]*=\S+/gi, ' ')
|
|
279
|
+
.split(/[\s&|;]+/)
|
|
280
|
+
.filter(Boolean));
|
|
281
|
+
const normalize = (s) => s.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
187
282
|
const matchesKeywordPattern = (dep, keyword) => {
|
|
188
283
|
if (!keyword)
|
|
189
284
|
return false;
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
|
|
285
|
+
const k = normalize(keyword);
|
|
286
|
+
if (!k)
|
|
287
|
+
return false;
|
|
288
|
+
const lowerDep = dep.toLowerCase();
|
|
289
|
+
const normDep = normalize(dep);
|
|
290
|
+
if (normDep === k)
|
|
193
291
|
return true;
|
|
194
|
-
}
|
|
195
|
-
if (normalizedDep.startsWith(`${normalizedKeyword}-`) ||
|
|
196
|
-
normalizedDep.endsWith(`-${normalizedKeyword}`) ||
|
|
197
|
-
normalizedDep.startsWith(`@${normalizedKeyword}/`) ||
|
|
198
|
-
normalizedDep.endsWith(`/${normalizedKeyword}`) ||
|
|
199
|
-
normalizedDep === `@${normalizedKeyword}`) {
|
|
292
|
+
if (lowerDep.startsWith(`@${keyword.toLowerCase()}/`))
|
|
200
293
|
return true;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
if (
|
|
294
|
+
if (lowerDep === `@${keyword.toLowerCase()}`)
|
|
295
|
+
return true;
|
|
296
|
+
if (normDep === `${k}js` || normDep === `${k}dom` || normDep === `${k}native`)
|
|
204
297
|
return true;
|
|
205
|
-
}
|
|
206
298
|
return false;
|
|
207
299
|
};
|
|
208
|
-
|
|
209
|
-
|
|
300
|
+
const scriptKeywordHit = (keyword) => {
|
|
301
|
+
if (!keyword)
|
|
302
|
+
return false;
|
|
303
|
+
const k = keyword.toLowerCase();
|
|
304
|
+
return scriptTokens.has(k) || scriptTokens.has(normalize(keyword));
|
|
305
|
+
};
|
|
210
306
|
const frameworkScores = [];
|
|
307
|
+
let bestMatch = null;
|
|
308
|
+
let maxScore = 0;
|
|
211
309
|
for (const framework of frameworkList) {
|
|
212
310
|
if (!framework.keywords || framework.keywords.length === 0 || framework.name === 'other') {
|
|
213
311
|
continue;
|
|
214
312
|
}
|
|
215
|
-
const matchingKeywords = framework.keywords.filter((keyword) =>
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
});
|
|
313
|
+
const matchingKeywords = framework.keywords.filter((keyword) => !!keyword &&
|
|
314
|
+
keyword.trim() !== '' &&
|
|
315
|
+
dependencyNames.some((dep) => matchesKeywordPattern(dep, keyword)));
|
|
316
|
+
const scriptHits = framework.keywords.filter((keyword) => scriptKeywordHit(keyword));
|
|
220
317
|
const matchCount = matchingKeywords.length;
|
|
221
|
-
let score = matchCount;
|
|
222
|
-
const priorityKeywords = ['next', 'nuxt', 'gatsby', 'angular', 'vue', 'solid-js'];
|
|
223
|
-
const hasPriorityKeyword = matchingKeywords.some((keyword) => priorityKeywords.includes(keyword.toLowerCase()));
|
|
224
|
-
if (hasPriorityKeyword) {
|
|
225
|
-
score += 10;
|
|
226
|
-
}
|
|
318
|
+
let score = matchCount + scriptHits.length * 50;
|
|
227
319
|
if (matchCount > 1) {
|
|
228
320
|
score += matchCount * 2;
|
|
229
321
|
}
|
|
230
|
-
if (
|
|
231
|
-
frameworkScores.push({ framework, score, matches: matchingKeywords });
|
|
322
|
+
if (score > 0) {
|
|
323
|
+
frameworkScores.push({ framework, score, matches: matchingKeywords, scriptHits });
|
|
232
324
|
}
|
|
233
|
-
if (score >
|
|
234
|
-
|
|
325
|
+
if (score > maxScore) {
|
|
326
|
+
maxScore = score;
|
|
235
327
|
bestMatch = framework;
|
|
236
328
|
}
|
|
237
329
|
}
|
|
238
330
|
const perfectMatches = frameworkScores.filter(({ framework }) => framework.keywords.length > 0 &&
|
|
239
331
|
framework.keywords.every((keyword) => dependencyNames.some((dep) => matchesKeywordPattern(dep, keyword))));
|
|
332
|
+
let pick = null;
|
|
333
|
+
let highConfidence = false;
|
|
240
334
|
if (perfectMatches.length > 0) {
|
|
241
335
|
const filteredPerfectMatches = perfectMatches.filter((a) => !perfectMatches.some((b) => b !== a &&
|
|
242
336
|
b.framework.keywords.length > a.framework.keywords.length &&
|
|
243
337
|
a.framework.keywords.every((k) => b.framework.keywords.includes(k))));
|
|
244
|
-
filteredPerfectMatches.sort((a, b) =>
|
|
245
|
-
|
|
246
|
-
|
|
338
|
+
filteredPerfectMatches.sort((a, b) => {
|
|
339
|
+
if (a.scriptHits.length !== b.scriptHits.length) {
|
|
340
|
+
return b.scriptHits.length - a.scriptHits.length;
|
|
341
|
+
}
|
|
342
|
+
if (a.framework.keywords.length !== b.framework.keywords.length) {
|
|
343
|
+
return b.framework.keywords.length - a.framework.keywords.length;
|
|
344
|
+
}
|
|
345
|
+
return b.score - a.score;
|
|
346
|
+
});
|
|
347
|
+
pick = filteredPerfectMatches[0];
|
|
348
|
+
highConfidence =
|
|
349
|
+
pick.scriptHits.length > 0 ||
|
|
350
|
+
(pick.framework.keywords.length > 1 && filteredPerfectMatches.length === 1);
|
|
247
351
|
}
|
|
248
|
-
if (
|
|
249
|
-
|
|
250
|
-
|
|
352
|
+
else if (bestMatch) {
|
|
353
|
+
const best = frameworkScores.find((s) => s.framework === bestMatch);
|
|
354
|
+
pick = best ? { framework: best.framework, scriptHits: best.scriptHits } : null;
|
|
355
|
+
highConfidence = !!best && best.scriptHits.length > 0;
|
|
251
356
|
}
|
|
252
|
-
|
|
357
|
+
if (!pick) {
|
|
358
|
+
return fallback('No matching framework found in package.json dependencies');
|
|
359
|
+
}
|
|
360
|
+
const pickedLabel = pick.framework.label || pick.framework.name;
|
|
361
|
+
if (highConfidence) {
|
|
362
|
+
(0, console_1.log)((0, ansi_colors_1.grey)(`Auto-detected framework: ${(0, ansi_colors_1.bold)(pickedLabel)}`));
|
|
363
|
+
return { name: pick.framework.name, source };
|
|
364
|
+
}
|
|
365
|
+
(0, logger_1.warning)(`Framework detection is uncertain. Best guess: ${(0, ansi_colors_1.bold)(pickedLabel)}.`);
|
|
366
|
+
if ((0, option_1.getOptionValue)('default')) {
|
|
367
|
+
return { name: pick.framework.name, source };
|
|
368
|
+
}
|
|
369
|
+
const name = yield promptFramework(frameworkList.filter((f) => f.name !== 'other'), pick.framework.name);
|
|
370
|
+
return { name, source };
|
|
253
371
|
});
|
|
254
372
|
}
|
|
255
373
|
function getConfigDetails(frameworkOpt, frameworks) {
|
|
@@ -349,6 +467,9 @@ exports.default = (add) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
349
467
|
const frameworkOpt = add
|
|
350
468
|
? yield detectFramework(yield addExistingSlate(config_1.slateConfig.raw() || []), frameworks)
|
|
351
469
|
: yield getFrameworkOption(frameworks);
|
|
470
|
+
if (add && templateName) {
|
|
471
|
+
(0, logger_1.warning)('--template is ignored when linking an existing Slate app.');
|
|
472
|
+
}
|
|
352
473
|
const appName = yield getAppName(config_1.slateConfig.raw() || [], frameworkOpt.name);
|
|
353
474
|
const payload = {
|
|
354
475
|
name: appName,
|
|
@@ -357,17 +478,25 @@ exports.default = (add) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
357
478
|
};
|
|
358
479
|
const slateConfigDetails = yield getConfigDetails(frameworkOpt.name, frameworks);
|
|
359
480
|
if (frameworkOpt.name !== 'static') {
|
|
481
|
+
const defaultDevCommand = resolveDevCommand(frameworkOpt.name, frameworks);
|
|
360
482
|
const slateRunConfig = (0, option_1.getOptionValue)('default')
|
|
361
|
-
? { devCommand:
|
|
483
|
+
? { devCommand: defaultDevCommand }
|
|
362
484
|
: yield prompt_1.default.ask(prompt_1.default.question('devCommand', 'Please provide your Development Command:', {
|
|
363
485
|
type: 'input',
|
|
364
|
-
default:
|
|
486
|
+
default: defaultDevCommand,
|
|
365
487
|
validate: (value) => __awaiter(void 0, void 0, void 0, function* () {
|
|
366
488
|
value = value.trim();
|
|
367
489
|
if (value === '')
|
|
368
490
|
return 'Please provide a valid development command';
|
|
369
|
-
|
|
491
|
+
if (value.length > 50)
|
|
370
492
|
return 'Cannot exceed 50 characters.';
|
|
493
|
+
if (!hasPortReference(value)) {
|
|
494
|
+
return (0, ansi_colors_1.grey)('Command must reference ' +
|
|
495
|
+
(0, ansi_colors_1.bold)('$ZC_SLATE_PORT') +
|
|
496
|
+
' so Catalyst can bind the dev server to a free port (e.g. ' +
|
|
497
|
+
(0, ansi_colors_1.bold)(defaultDevCommand) +
|
|
498
|
+
').');
|
|
499
|
+
}
|
|
371
500
|
return true;
|
|
372
501
|
})
|
|
373
502
|
}));
|
package/lib/init/util/client.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
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
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -35,7 +45,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
45
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
46
|
};
|
|
37
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.
|
|
48
|
+
exports.fillClientInitPayload = void 0;
|
|
49
|
+
exports.directoryOverridePrompt = directoryOverridePrompt;
|
|
50
|
+
exports.clientNamePrompt = clientNamePrompt;
|
|
51
|
+
exports.addDependency = addDependency;
|
|
39
52
|
const ansi_colors_1 = require("ansi-colors");
|
|
40
53
|
const runtime_store_js_1 = __importDefault(require("../../runtime-store.js"));
|
|
41
54
|
const index_js_1 = __importDefault(require("../../error/index.js"));
|
|
@@ -64,7 +77,6 @@ function directoryOverridePrompt(dir) {
|
|
|
64
77
|
}
|
|
65
78
|
});
|
|
66
79
|
}
|
|
67
|
-
exports.directoryOverridePrompt = directoryOverridePrompt;
|
|
68
80
|
function clientNamePrompt(question, defaultAns) {
|
|
69
81
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
82
|
const namePrompt = yield index_js_2.default.ask(index_js_2.default.question('name', question, {
|
|
@@ -80,9 +92,8 @@ function clientNamePrompt(question, defaultAns) {
|
|
|
80
92
|
return namePrompt.name;
|
|
81
93
|
});
|
|
82
94
|
}
|
|
83
|
-
|
|
84
|
-
function
|
|
85
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
+
function addDependency(filePath_1, dep_1) {
|
|
96
|
+
return __awaiter(this, arguments, void 0, function* (filePath, dep, { dev = false, depPath = [] } = {}) {
|
|
86
97
|
try {
|
|
87
98
|
const packageJson = yield ASYNC.readJSONFile(filePath);
|
|
88
99
|
if (packageJson) {
|
|
@@ -98,4 +109,3 @@ function addDependency(filePath, dep, { dev = false, depPath = [] } = {}) {
|
|
|
98
109
|
}
|
|
99
110
|
});
|
|
100
111
|
}
|
|
101
|
-
exports.addDependency = addDependency;
|
package/lib/init/util/common.js
CHANGED
|
@@ -12,7 +12,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
15
|
+
exports.getRuntimeDetails = getRuntimeDetails;
|
|
16
|
+
exports.getRuntimeChoices = getRuntimeChoices;
|
|
17
|
+
exports.getRuntimePromptAnswer = getRuntimePromptAnswer;
|
|
16
18
|
const catalyst_details_js_1 = __importDefault(require("../../endpoints/lib/catalyst-details.js"));
|
|
17
19
|
const index_js_1 = __importDefault(require("../../error/index.js"));
|
|
18
20
|
const index_js_2 = __importDefault(require("../../prompt/index.js"));
|
|
@@ -23,9 +25,8 @@ function getRuntimeDetails(fnType) {
|
|
|
23
25
|
const catalystDetailsAPI = new catalyst_details_js_1.default();
|
|
24
26
|
return catalystDetailsAPI.getDetails('runtime', fnType ? index_js_3.REMOTE_REF.functions.type[fnType] : undefined);
|
|
25
27
|
}
|
|
26
|
-
|
|
27
|
-
function
|
|
28
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
function getRuntimeChoices(_a) {
|
|
29
|
+
return __awaiter(this, arguments, void 0, function* ({ fnType, runtimeDetails }) {
|
|
29
30
|
if (runtimeDetails === undefined) {
|
|
30
31
|
runtimeDetails = yield getRuntimeDetails(fnType);
|
|
31
32
|
}
|
|
@@ -84,7 +85,6 @@ function getRuntimeChoices({ fnType, runtimeDetails }) {
|
|
|
84
85
|
return [...runtimeChoices.java, ...runtimeChoices.node, ...runtimeChoices.python];
|
|
85
86
|
});
|
|
86
87
|
}
|
|
87
|
-
exports.getRuntimeChoices = getRuntimeChoices;
|
|
88
88
|
function getRuntimePromptAnswer(question, fnType) {
|
|
89
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
90
90
|
const runtimeChoices = yield getRuntimeChoices({ fnType });
|
|
@@ -101,4 +101,3 @@ function getRuntimePromptAnswer(question, fnType) {
|
|
|
101
101
|
return runtimeAns.runtime;
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
|
-
exports.getRuntimePromptAnswer = getRuntimePromptAnswer;
|
package/lib/init/util/project.js
CHANGED
|
@@ -18,7 +18,7 @@ const error_1 = __importDefault(require("../../error"));
|
|
|
18
18
|
const runtime_store_1 = __importDefault(require("../../runtime-store"));
|
|
19
19
|
const constants_1 = require("../../util_modules/constants");
|
|
20
20
|
const project_1 = require("../../util_modules/project");
|
|
21
|
-
const fillProjectPayload = (
|
|
21
|
+
const fillProjectPayload = (selectedOrg_1, selectedProject_1, ...args_1) => __awaiter(void 0, [selectedOrg_1, selectedProject_1, ...args_1], void 0, function* (selectedOrg, selectedProject, isNew = false, isImport = false) {
|
|
22
22
|
runtime_store_1.default.set('context.payload.project', selectedProject);
|
|
23
23
|
runtime_store_1.default.set('project', (0, project_1.transformProject)(selectedProject));
|
|
24
24
|
const envAPI = yield (0, endpoints_1.envAPI)({ auth: true, org: selectedOrg.id });
|
package/lib/internal/api.d.ts
CHANGED
package/lib/internal/api.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
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
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -188,8 +198,8 @@ class API {
|
|
|
188
198
|
return this._request(true);
|
|
189
199
|
});
|
|
190
200
|
}
|
|
191
|
-
_request(
|
|
192
|
-
return __awaiter(this,
|
|
201
|
+
_request() {
|
|
202
|
+
return __awaiter(this, arguments, void 0, function* (retry = false) {
|
|
193
203
|
if (!retry) {
|
|
194
204
|
this._logReq();
|
|
195
205
|
}
|
package/lib/internal/command.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
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
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -249,8 +259,7 @@ class Command {
|
|
|
249
259
|
(0, index_1.debug)(e);
|
|
250
260
|
}
|
|
251
261
|
yield Promise.all(js_1.JS.map(this.beforeRunners, (before) => __awaiter(this, void 0, void 0, function* () {
|
|
252
|
-
|
|
253
|
-
const beforeModule = (yield (_a = '../command_needs/' + before.fn, Promise.resolve().then(() => __importStar(require(_a))))).default;
|
|
262
|
+
const beforeModule = (yield Promise.resolve(`${'../command_needs/' + before.fn}`).then(s => __importStar(require(s)))).default;
|
|
254
263
|
return beforeModule.call(this, before.args);
|
|
255
264
|
})));
|
|
256
265
|
return this.cmdAction.call(this, ...args);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.migrate = exports.isRequire = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const fs_1 = require("../../util_modules/fs");
|
|
6
|
+
const constants_1 = require("../../util_modules/constants");
|
|
7
|
+
const logger_1 = require("../../util_modules/logger");
|
|
8
|
+
const isRequire = () => {
|
|
9
|
+
return fs_1.SYNC.fileExists((0, path_1.join)(constants_1.ENVPATH.runtimes.data, 'jetty', 'start.jar'));
|
|
10
|
+
};
|
|
11
|
+
exports.isRequire = isRequire;
|
|
12
|
+
const migrate = () => {
|
|
13
|
+
try {
|
|
14
|
+
const parent = constants_1.ENVPATH.runtimes.data;
|
|
15
|
+
const jettyDir = (0, path_1.join)(parent, 'jetty');
|
|
16
|
+
const jettyV1Dir = (0, path_1.join)(jettyDir, 'v1');
|
|
17
|
+
const tempDir = (0, path_1.join)(parent, 'v1');
|
|
18
|
+
fs_1.SYNC.renameDir(jettyDir, tempDir);
|
|
19
|
+
fs_1.SYNC.ensureDir(jettyDir);
|
|
20
|
+
fs_1.SYNC.renameDir(tempDir, jettyV1Dir);
|
|
21
|
+
(0, logger_1.debug)('jetty migration is success');
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
(0, logger_1.error)('jetty migration failed');
|
|
25
|
+
throw e;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.migrate = migrate;
|