zcatalyst-cli 1.25.3 → 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 +6 -7
- 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 +17 -7
- 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 +19 -9
- 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 +7 -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 +17 -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 +27 -34
- 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 +2 -2
- 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
package/lib/fn-utils/lib/node.js
CHANGED
|
@@ -12,29 +12,35 @@ 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.validate = validate;
|
|
16
|
+
exports.ensureNodeVersion = ensureNodeVersion;
|
|
17
|
+
exports.getTemplatePath = getTemplatePath;
|
|
16
18
|
const ansi_colors_1 = require("ansi-colors");
|
|
17
19
|
const path_1 = require("path");
|
|
18
20
|
const index_js_1 = __importDefault(require("../../error/index.js"));
|
|
19
21
|
const npm_install_1 = __importDefault(require("../../init/dependencies/npm-install"));
|
|
20
|
-
const runtime_store_js_1 = __importDefault(require("../../runtime-store.js"));
|
|
21
22
|
const env_js_1 = require("../../util_modules/env.js");
|
|
22
23
|
const constants_1 = require("../../util_modules/constants");
|
|
23
24
|
const fs_1 = require("../../util_modules/fs");
|
|
24
25
|
const js_1 = require("../../util_modules/js");
|
|
25
26
|
const shell_js_1 = require("../../util_modules/shell.js");
|
|
27
|
+
const userConfig_js_1 = __importDefault(require("../../userConfig.js"));
|
|
28
|
+
const utils_js_1 = require("../../util_modules/fs/utils.js");
|
|
29
|
+
const runtime_store_js_1 = __importDefault(require("../../runtime-store.js"));
|
|
26
30
|
function validate(targets) {
|
|
27
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
32
|
return _validate(targets);
|
|
29
33
|
});
|
|
30
34
|
}
|
|
31
|
-
|
|
32
|
-
function
|
|
33
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
function _validate(targets_1) {
|
|
36
|
+
return __awaiter(this, arguments, void 0, function* (targets, idx = 0) {
|
|
34
37
|
if (targets.length < idx + 1) {
|
|
35
38
|
return;
|
|
36
39
|
}
|
|
37
40
|
const currentTarget = targets[idx];
|
|
41
|
+
if (currentTarget.valid === false) {
|
|
42
|
+
return _validate(targets, ++idx);
|
|
43
|
+
}
|
|
38
44
|
try {
|
|
39
45
|
const catalystFile = (0, path_1.join)(currentTarget.source, constants_1.FILENAME.catalyst_config);
|
|
40
46
|
const data = yield fs_1.ASYNC.readJSONFile(catalystFile, { checkpath: true });
|
|
@@ -72,18 +78,65 @@ function _validate(targets, idx = 0) {
|
|
|
72
78
|
}
|
|
73
79
|
});
|
|
74
80
|
}
|
|
75
|
-
function
|
|
76
|
-
return __awaiter(this,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
function ensureNodeVersion(stack_1) {
|
|
82
|
+
return __awaiter(this, arguments, void 0, function* (stack, onlyDirPath = false) {
|
|
83
|
+
if (!stack.startsWith('node')) {
|
|
84
|
+
throw new index_js_1.default('Invalid stack passed for node: ' + stack, { exit: 2 });
|
|
85
|
+
}
|
|
86
|
+
const configKey = `${stack}.bin`;
|
|
87
|
+
let binPath = env_js_1.isExtension
|
|
88
|
+
? runtime_store_js_1.default.get(`executables.${configKey}`)
|
|
89
|
+
: userConfig_js_1.default.get(configKey);
|
|
90
|
+
const bin = env_js_1.isWindows ? 'node.exe' : 'node';
|
|
91
|
+
if (binPath) {
|
|
92
|
+
binPath = (0, utils_js_1.untildify)(binPath);
|
|
93
|
+
if (!binPath.endsWith(bin))
|
|
94
|
+
binPath = (0, path_1.join)(binPath, bin);
|
|
95
|
+
const fileExists = yield fs_1.ASYNC.fileExists(binPath);
|
|
96
|
+
if (!fileExists) {
|
|
97
|
+
throw new index_js_1.default(`Invalid NodeJS binary path set for stack ${stack}`, {
|
|
98
|
+
exit: 1,
|
|
99
|
+
errorId: '',
|
|
100
|
+
arg: [stack.replace('node', ''), (0, ansi_colors_1.bold)(binPath), (0, ansi_colors_1.bold)(configKey)]
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
binPath = checkNodePresence(stack);
|
|
106
|
+
}
|
|
107
|
+
if (onlyDirPath) {
|
|
108
|
+
return (0, path_1.dirname)(binPath);
|
|
83
109
|
}
|
|
110
|
+
return binPath;
|
|
84
111
|
});
|
|
85
112
|
}
|
|
86
|
-
|
|
113
|
+
function checkNodePresence(stack) {
|
|
114
|
+
const nodeVersion = `v${stack.replace('node', '')}`;
|
|
115
|
+
if (process.version.includes(nodeVersion)) {
|
|
116
|
+
return process.execPath;
|
|
117
|
+
}
|
|
118
|
+
const nodeVChild = (0, shell_js_1.spawn)('node', ['-v'], { stdio: 'pipe' }).SYNC();
|
|
119
|
+
if (!nodeVChild.stdout.toString().includes(nodeVersion)) {
|
|
120
|
+
throw new index_js_1.default(`Required NodeJS version ${nodeVersion} is not present in the system path`, {
|
|
121
|
+
exit: 1,
|
|
122
|
+
errorId: 'NODE-2',
|
|
123
|
+
arg: [
|
|
124
|
+
(0, ansi_colors_1.bold)(nodeVersion),
|
|
125
|
+
env_js_1.isExtension
|
|
126
|
+
? `settings ${(0, ansi_colors_1.italic)(`zcatalyst.${stack}`)}`
|
|
127
|
+
: `${(0, ansi_colors_1.italic)('`catalyst config`')} command.\n\n${(0, ansi_colors_1.bold)('Example:')} ${(0, ansi_colors_1.italic)(`catalyst config:set ${stack}.bin=<path-to-node-${nodeVersion}-binary>`)}`
|
|
128
|
+
]
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
const whichChild = (0, shell_js_1.spawn)('node', ['-p', 'process.execPath'], {
|
|
132
|
+
stdio: 'pipe'
|
|
133
|
+
}).SYNC();
|
|
134
|
+
const nodePath = whichChild.stdout.toString().trim();
|
|
135
|
+
if (!nodePath) {
|
|
136
|
+
throw new index_js_1.default(`Unable to find the file path for node ${nodeVersion} binary in system path`, { exit: 1 });
|
|
137
|
+
}
|
|
138
|
+
return nodePath;
|
|
139
|
+
}
|
|
87
140
|
function getTemplatePath(fnType, add) {
|
|
88
141
|
switch (fnType) {
|
|
89
142
|
case constants_1.FN_TYPE.browserLogic:
|
|
@@ -99,4 +152,3 @@ function getTemplatePath(fnType, add) {
|
|
|
99
152
|
}
|
|
100
153
|
}
|
|
101
154
|
}
|
|
102
|
-
exports.getTemplatePath = getTemplatePath;
|
|
@@ -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,8 @@ 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.validate = validate;
|
|
49
|
+
exports.removeRequirements = removeRequirements;
|
|
39
50
|
const ansi_colors_1 = require("ansi-colors");
|
|
40
51
|
const os_1 = require("os");
|
|
41
52
|
const path_1 = __importStar(require("path"));
|
|
@@ -45,15 +56,13 @@ const pip_install_1 = require("../../init/dependencies/python/pip-install");
|
|
|
45
56
|
const constants_1 = require("../../util_modules/constants");
|
|
46
57
|
const fs_1 = require("../../util_modules/fs");
|
|
47
58
|
const js_1 = require("../../util_modules/js");
|
|
48
|
-
const validationResults = {};
|
|
49
59
|
function validate(targets) {
|
|
50
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
61
|
return _validate(targets);
|
|
52
62
|
});
|
|
53
63
|
}
|
|
54
|
-
|
|
55
|
-
function
|
|
56
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
function _validate(targets_1) {
|
|
65
|
+
return __awaiter(this, arguments, void 0, function* (targets, idx = 0, validationResults = {}) {
|
|
57
66
|
if (targets.length < idx + 1) {
|
|
58
67
|
return;
|
|
59
68
|
}
|
|
@@ -87,8 +96,9 @@ function _validate(targets, idx = 0) {
|
|
|
87
96
|
});
|
|
88
97
|
}
|
|
89
98
|
if (!(stack in validationResults)) {
|
|
90
|
-
yield (0, ensure_python_1.ensurePythonWithPip)(stack.replace('python_', '').replace('_', '.'));
|
|
91
|
-
validationResults[stack] = { valid: true };
|
|
99
|
+
const _bin = yield (0, ensure_python_1.ensurePythonWithPip)(stack.replace('python_', '').replace('_', '.'));
|
|
100
|
+
validationResults[stack] = { valid: true, bin: _bin };
|
|
101
|
+
currentTarget.additionalInfo = { binPath: _bin };
|
|
92
102
|
}
|
|
93
103
|
if (!validationResults[stack]['valid']) {
|
|
94
104
|
currentTarget.valid = validationResults[stack]['valid'];
|
|
@@ -96,8 +106,9 @@ function _validate(targets, idx = 0) {
|
|
|
96
106
|
}
|
|
97
107
|
else {
|
|
98
108
|
currentTarget.valid = true;
|
|
109
|
+
currentTarget.additionalInfo = { binPath: validationResults[stack]['bin'] };
|
|
99
110
|
}
|
|
100
|
-
return _validate(targets, ++idx);
|
|
111
|
+
return _validate(targets, ++idx, validationResults);
|
|
101
112
|
}
|
|
102
113
|
catch (e) {
|
|
103
114
|
const err = error_1.default.getErrorInstance(e);
|
|
@@ -106,21 +117,20 @@ function _validate(targets, idx = 0) {
|
|
|
106
117
|
if (stack) {
|
|
107
118
|
validationResults[stack] = { valid: false, message: err.message };
|
|
108
119
|
}
|
|
109
|
-
return _validate(targets, ++idx);
|
|
120
|
+
return _validate(targets, ++idx, validationResults);
|
|
110
121
|
}
|
|
111
122
|
});
|
|
112
123
|
}
|
|
113
124
|
function removeRequirements(reqFile, target) {
|
|
114
|
-
var _a;
|
|
115
125
|
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
+
var _a;
|
|
116
127
|
const tmpDir = (0, path_1.join)((0, os_1.tmpdir)(), '.catalyst', 'python', Date.now().toString());
|
|
117
128
|
yield fs_1.ASYNC.ensureDir(tmpDir);
|
|
118
129
|
yield fs_1.ASYNC.emptyDir(tmpDir);
|
|
119
|
-
yield (0, pip_install_1.installRequirements)(reqFile, tmpDir, (_a = target.
|
|
130
|
+
yield (0, pip_install_1.installRequirements)(reqFile, tmpDir, (_a = target.additionalInfo) === null || _a === void 0 ? void 0 : _a.binPath, true);
|
|
120
131
|
const files = yield fs_1.ASYNC.walk(tmpDir, { depth: 1, includeDirPaths: true });
|
|
121
132
|
yield Promise.all(files.map((file) => __awaiter(this, void 0, void 0, function* () {
|
|
122
133
|
yield fs_1.ASYNC.deleteFile((0, path_1.join)(target.source, path_1.default.basename(file.path)));
|
|
123
134
|
})));
|
|
124
135
|
});
|
|
125
136
|
}
|
|
126
|
-
exports.removeRequirements = removeRequirements;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { IIacResponse } from '../../../endpoints/lib/iac';
|
|
2
|
-
export declare const getSpinnerTxt: (type:
|
|
2
|
+
export declare const getSpinnerTxt: (type: "bundle" | "deploy" | "codedeck") => (deployDetails: IIacResponse, status?: string) => string;
|
|
@@ -16,14 +16,14 @@ const index_js_1 = __importDefault(require("../../error/index.js"));
|
|
|
16
16
|
const prompt_1 = __importDefault(require("../../prompt"));
|
|
17
17
|
const env_js_1 = require("../../util_modules/env.js");
|
|
18
18
|
const shell_1 = require("../../util_modules/shell");
|
|
19
|
-
exports.default = (
|
|
19
|
+
exports.default = (pth_1, ...args_1) => __awaiter(void 0, [pth_1, ...args_1], void 0, function* (pth, skipPrompt = false) {
|
|
20
20
|
const ans = yield prompt_1.default.ask(prompt_1.default.question('NPMinstall', 'Do you wish to install all dependencies now ? ', {
|
|
21
21
|
type: 'confirm',
|
|
22
22
|
defaultAns: true,
|
|
23
23
|
when: () => !skipPrompt
|
|
24
24
|
}));
|
|
25
25
|
if (ans.NPMinstall === undefined || ans.NPMinstall) {
|
|
26
|
-
return (0, shell_1.spawn)('npm', ['install'], { cwd: pth, detached: env_js_1.
|
|
26
|
+
return (0, shell_1.spawn)('npm', ['install'], { cwd: pth, detached: env_js_1.isExtension })
|
|
27
27
|
.ASYNC()
|
|
28
28
|
.catch((err) => {
|
|
29
29
|
throw index_js_1.default.getErrorInstance(err, {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function ensurePython(version: string, fallBackNeeded: boolean, skipHelp: boolean): Promise<
|
|
2
|
-
export declare function ensurePythonWithPip(version: string, fallBackNeeded?: boolean, skipHelp?: boolean): Promise<
|
|
1
|
+
export declare function ensurePython(version: string, fallBackNeeded: boolean, skipHelp: boolean): Promise<string>;
|
|
2
|
+
export declare function ensurePythonWithPip(version: string, fallBackNeeded?: boolean, skipHelp?: boolean): Promise<string>;
|
|
@@ -12,7 +12,8 @@ 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.ensurePython = ensurePython;
|
|
16
|
+
exports.ensurePythonWithPip = ensurePythonWithPip;
|
|
16
17
|
const error_1 = __importDefault(require("../../../error"));
|
|
17
18
|
const prompt_1 = __importDefault(require("../../../prompt"));
|
|
18
19
|
const env_1 = require("../../../util_modules/env");
|
|
@@ -20,71 +21,68 @@ const shell_1 = require("../../../util_modules/shell");
|
|
|
20
21
|
const userConfig_1 = __importDefault(require("../../../userConfig"));
|
|
21
22
|
const ansi_colors_1 = require("ansi-colors");
|
|
22
23
|
const console_1 = require("console");
|
|
24
|
+
const utils_1 = require("../../../util_modules/fs/utils");
|
|
25
|
+
const runtime_store_1 = __importDefault(require("../../../runtime-store"));
|
|
26
|
+
const logger_1 = require("../../../util_modules/logger");
|
|
23
27
|
function ensurePython(version, fallBackNeeded, skipHelp) {
|
|
24
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
29
|
const configKey = `python${version.replace('.', '_')}.bin`;
|
|
26
|
-
const spawnCommand =
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
const spawnCommand = env_1.isExtension
|
|
31
|
+
? runtime_store_1.default.get(`executables.${configKey}`)
|
|
32
|
+
: userConfig_1.default.get(configKey);
|
|
33
|
+
if (spawnCommand) {
|
|
34
|
+
try {
|
|
29
35
|
yield validateCommand(version, spawnCommand, true);
|
|
30
|
-
return;
|
|
36
|
+
return getPythonExecPath(spawnCommand);
|
|
37
|
+
}
|
|
38
|
+
catch (er) {
|
|
39
|
+
throw er;
|
|
31
40
|
}
|
|
32
41
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
if (fallBackNeeded) {
|
|
50
|
-
(0, console_1.info)(`unable to locate python${version} in your system`);
|
|
51
|
-
const ans = yield prompt_1.default.ask(prompt_1.default.question('binPath', `Please provide the binary path for python${version}:`, {
|
|
52
|
-
type: 'input'
|
|
53
|
-
}));
|
|
54
|
-
yield validateCommand(version, ans.binPath, skipHelp)
|
|
55
|
-
.then(() => {
|
|
56
|
-
userConfig_1.default.set(`python${version.replace('.', '_')}.bin`, ans.binPath);
|
|
57
|
-
resolve();
|
|
58
|
-
})
|
|
59
|
-
.catch((err) => {
|
|
60
|
-
reject(err);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
reject(new error_1.default(`unable to locate python${version} in your system`, {
|
|
65
|
-
original: error,
|
|
66
|
-
exit: 1,
|
|
67
|
-
errorId: 'PY-2',
|
|
68
|
-
arg: [
|
|
69
|
-
version,
|
|
70
|
-
(0, ansi_colors_1.italic)((0, ansi_colors_1.bold)(`catalyst config:set ${configKey}=<binary_path>`))
|
|
71
|
-
],
|
|
72
|
-
skipHelp
|
|
73
|
-
}));
|
|
42
|
+
try {
|
|
43
|
+
const fallBackSpawnCommand = 'python' + version;
|
|
44
|
+
yield validateCommand(version, fallBackSpawnCommand, true);
|
|
45
|
+
return getPythonExecPath(fallBackSpawnCommand);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
if (env_1.isWindows) {
|
|
49
|
+
try {
|
|
50
|
+
const winPyLauncher = 'py -' + version;
|
|
51
|
+
yield (0, shell_1.spawn)(winPyLauncher, ['--version'], {
|
|
52
|
+
stdio: 'ignore'
|
|
53
|
+
}).ASYNC();
|
|
54
|
+
userConfig_1.default.set(configKey, winPyLauncher);
|
|
55
|
+
yield validateCommand(version, winPyLauncher, true);
|
|
56
|
+
return getPythonExecPath(winPyLauncher);
|
|
74
57
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (code === 0) {
|
|
78
|
-
userConfig_1.default.set(configKey, 'python' + version);
|
|
58
|
+
catch (er) {
|
|
59
|
+
(0, logger_1.debug)('Unable to locate PyLauncher in win: ' + er);
|
|
79
60
|
}
|
|
80
|
-
|
|
61
|
+
}
|
|
62
|
+
if (fallBackNeeded) {
|
|
63
|
+
(0, console_1.info)(`unable to locate python${version} in your system`);
|
|
64
|
+
const ans = yield prompt_1.default.ask(prompt_1.default.question('binPath', `Please provide the binary path for python${version}:`, {
|
|
65
|
+
type: 'input'
|
|
66
|
+
}));
|
|
67
|
+
yield validateCommand(version, ans.binPath, skipHelp);
|
|
68
|
+
userConfig_1.default.set(`python${version.replace('.', '_')}.bin`, ans.binPath);
|
|
69
|
+
return getPythonExecPath(ans.binPath);
|
|
70
|
+
}
|
|
71
|
+
const { errorId, config } = env_1.isExtension
|
|
72
|
+
? { errorId: 'PY-2-EXT', config: 'zcatalyst.python_3_9' }
|
|
73
|
+
: { errorId: 'PY-2', config: `catalyst config:set ${configKey}=<binary_path>` };
|
|
74
|
+
throw new error_1.default(`unable to locate python${version} in your system`, {
|
|
75
|
+
exit: 1,
|
|
76
|
+
errorId: errorId,
|
|
77
|
+
arg: [version, (0, ansi_colors_1.italic)((0, ansi_colors_1.bold)(config))],
|
|
78
|
+
skipHelp
|
|
81
79
|
});
|
|
82
|
-
}
|
|
80
|
+
}
|
|
83
81
|
});
|
|
84
82
|
}
|
|
85
|
-
exports.ensurePython = ensurePython;
|
|
86
83
|
function validateCommand(version, spawnCommand, skipHelp) {
|
|
87
84
|
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
spawnCommand = (0, utils_1.untildify)(spawnCommand);
|
|
88
86
|
const versionResponse = yield new Promise((resolve, reject) => {
|
|
89
87
|
var _a;
|
|
90
88
|
const child = (0, shell_1.spawn)(spawnCommand, ['--version'], {
|
|
@@ -126,11 +124,20 @@ function validateCommand(version, spawnCommand, skipHelp) {
|
|
|
126
124
|
}
|
|
127
125
|
});
|
|
128
126
|
}
|
|
129
|
-
function
|
|
127
|
+
function getPythonExecPath(spawnCommand) {
|
|
130
128
|
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
129
|
+
spawnCommand = (0, utils_1.untildify)(spawnCommand);
|
|
130
|
+
const pyVChild = (0, shell_1.spawn)(spawnCommand, ['-c', 'import sys;print(sys.executable)'], {
|
|
131
|
+
stdio: 'pipe'
|
|
132
|
+
}).SYNC();
|
|
133
|
+
return pyVChild.stdout.toString().trim();
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function ensurePythonWithPip(version_1) {
|
|
137
|
+
return __awaiter(this, arguments, void 0, function* (version, fallBackNeeded = false, skipHelp = false) {
|
|
138
|
+
const pyBin = yield ensurePython(version, fallBackNeeded, skipHelp);
|
|
139
|
+
yield new Promise((resolve, reject) => {
|
|
140
|
+
const child = (0, shell_1.spawn)(pyBin, ['-m', 'pip', '--version'], {
|
|
134
141
|
stdio: 'ignore'
|
|
135
142
|
}).RAW();
|
|
136
143
|
child.on('error', (err) => {
|
|
@@ -144,6 +151,6 @@ function ensurePythonWithPip(version, fallBackNeeded = false, skipHelp = false)
|
|
|
144
151
|
});
|
|
145
152
|
child.on('exit', resolve);
|
|
146
153
|
});
|
|
154
|
+
return pyBin;
|
|
147
155
|
});
|
|
148
156
|
}
|
|
149
|
-
exports.ensurePythonWithPip = ensurePythonWithPip;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { asyncSpawnResposne } from '../../../util_modules/shell';
|
|
2
|
-
declare
|
|
3
|
-
export default _default;
|
|
4
|
-
export declare function ensurePyRuntime(pth: string, stack: string): Promise<void>;
|
|
2
|
+
export declare function ensurePyRuntime(pth: string, stack: string, spawnCommand?: string): Promise<void>;
|
|
5
3
|
export declare const pypiRes: (pkg: string) => Promise<Record<string, unknown>>;
|
|
6
|
-
export declare function installRequirements(reqFile: string, pth: string,
|
|
7
|
-
export declare function installPkgs(pkgs: Array<string>,
|
|
4
|
+
export declare function installRequirements(reqFile: string, pth: string, spawnCommand?: string, linuxMode?: boolean): Promise<void>;
|
|
5
|
+
export declare function installPkgs(pkgs: Array<string>, spawnCommand?: string, pth?: string | undefined): Promise<asyncSpawnResposne>;
|
|
@@ -12,9 +12,11 @@ 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.pypiRes = void 0;
|
|
16
|
+
exports.ensurePyRuntime = ensurePyRuntime;
|
|
17
|
+
exports.installRequirements = installRequirements;
|
|
18
|
+
exports.installPkgs = installPkgs;
|
|
16
19
|
const error_1 = __importDefault(require("../../../error"));
|
|
17
|
-
const prompt_1 = __importDefault(require("../../../prompt"));
|
|
18
20
|
const shell_1 = require("../../../util_modules/shell");
|
|
19
21
|
const constants_1 = require("../../../util_modules/constants");
|
|
20
22
|
const path_1 = require("path");
|
|
@@ -22,48 +24,10 @@ const fs_1 = require("../../../util_modules/fs");
|
|
|
22
24
|
const https_1 = __importDefault(require("https"));
|
|
23
25
|
const runtime_1 = __importDefault(require("../../../util_modules/constants/lib/runtime"));
|
|
24
26
|
const env_1 = require("../../../util_modules/env");
|
|
25
|
-
const ensure_python_1 = require("./ensure-python");
|
|
26
|
-
const userConfig_1 = __importDefault(require("../../../userConfig"));
|
|
27
27
|
const index_1 = require("../../../util_modules/logger/index");
|
|
28
|
-
const sdkPipOpts = (0, env_1.envOverride)('CATALYST_SDK_PIP_OPTS', 'zcatalyst-sdk');
|
|
29
|
-
const cliqSdkPipOpts = (0, env_1.envOverride)('CATALYST_CLIQ_SDK_PIP_OPTS', 'zcatalyst-cliq');
|
|
30
28
|
const testPypi = (0, env_1.envOverride)('CATALYST_TEST_PYPI', 'false');
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const ans = yield prompt_1.default.ask(prompt_1.default.question('pipInstall', 'Do you wish to install all dependency libraries now ? ', {
|
|
34
|
-
type: 'confirm',
|
|
35
|
-
defaultAns: true,
|
|
36
|
-
when: () => !isIntegFn
|
|
37
|
-
}));
|
|
38
|
-
if (ans.pipInstall && !isIntegFn) {
|
|
39
|
-
yield (0, ensure_python_1.ensurePythonWithPip)(stackVersion.replace('_', '.'), true);
|
|
40
|
-
const spawnOpts = ['-m', 'pip', 'install', ...sdkPipOpts.split(' '), '-t', '.'];
|
|
41
|
-
return (0, shell_1.spawn)(userConfig_1.default.get(`python${stackVersion}.bin`), spawnOpts, {
|
|
42
|
-
cwd: pth
|
|
43
|
-
})
|
|
44
|
-
.ASYNC()
|
|
45
|
-
.catch((err) => {
|
|
46
|
-
throw new error_1.default('Failure while installing zcatalyst SDk', {
|
|
47
|
-
exit: 2,
|
|
48
|
-
original: err
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
else if ((isIntegFn || ans.pipInstall === undefined) &&
|
|
53
|
-
integService === constants_1.INTEG.services.cliq) {
|
|
54
|
-
yield (0, ensure_python_1.ensurePythonWithPip)(stackVersion.replace('_', '.'), true);
|
|
55
|
-
const spawnOpts = ['-m', 'pip', 'install', ...cliqSdkPipOpts.split(' '), '-t', '.'];
|
|
56
|
-
return (0, shell_1.spawn)(userConfig_1.default.get(`python${stackVersion}.bin`), spawnOpts, { cwd: pth })
|
|
57
|
-
.ASYNC()
|
|
58
|
-
.catch((err) => {
|
|
59
|
-
throw error_1.default.getErrorInstance(err, {
|
|
60
|
-
message: 'Failure while installing zcatalyst cliq SDK.'
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
function ensurePyRuntime(pth, stack) {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
function ensurePyRuntime(pth_1, stack_1) {
|
|
30
|
+
return __awaiter(this, arguments, void 0, function* (pth, stack, spawnCommand = 'python') {
|
|
67
31
|
const stackVersion = stack.replace('python_', '');
|
|
68
32
|
const runtimePkgName = 'zcatalyst-runtime-' + stackVersion.replace('_', '');
|
|
69
33
|
yield fs_1.ASYNC.ensureDir(pth);
|
|
@@ -82,7 +46,7 @@ function ensurePyRuntime(pth, stack) {
|
|
|
82
46
|
if (testPypi === 'true') {
|
|
83
47
|
spawnOpts.push('-i', 'https://test.pypi.org/simple/', '--extra-index-url', 'https://pypi.org/simple/');
|
|
84
48
|
}
|
|
85
|
-
const child = (0, shell_1.spawn)(
|
|
49
|
+
const child = (0, shell_1.spawn)(spawnCommand, spawnOpts, {
|
|
86
50
|
cwd: pth,
|
|
87
51
|
stdio: 'pipe'
|
|
88
52
|
}).RAW();
|
|
@@ -110,7 +74,7 @@ function ensurePyRuntime(pth, stack) {
|
|
|
110
74
|
try {
|
|
111
75
|
const runtimeReqFile = (0, path_1.join)(runtimeDir, constants_1.FILENAME.functions.python_requirements);
|
|
112
76
|
if (yield fs_1.ASYNC.fileExists(runtimeReqFile)) {
|
|
113
|
-
yield installRequirements(runtimeReqFile, runtimeDir,
|
|
77
|
+
yield installRequirements(runtimeReqFile, runtimeDir, spawnCommand);
|
|
114
78
|
}
|
|
115
79
|
}
|
|
116
80
|
catch (err) {
|
|
@@ -119,7 +83,6 @@ function ensurePyRuntime(pth, stack) {
|
|
|
119
83
|
}
|
|
120
84
|
});
|
|
121
85
|
}
|
|
122
|
-
exports.ensurePyRuntime = ensurePyRuntime;
|
|
123
86
|
const pypiRes = (pkg) => __awaiter(void 0, void 0, void 0, function* () {
|
|
124
87
|
const url = testPypi === 'true'
|
|
125
88
|
? `https://test.pypi.org/pypi/${pkg}/json`
|
|
@@ -144,8 +107,8 @@ const pypiRes = (pkg) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
144
107
|
});
|
|
145
108
|
});
|
|
146
109
|
exports.pypiRes = pypiRes;
|
|
147
|
-
function installRequirements(
|
|
148
|
-
return __awaiter(this,
|
|
110
|
+
function installRequirements(reqFile_1, pth_1) {
|
|
111
|
+
return __awaiter(this, arguments, void 0, function* (reqFile, pth, spawnCommand = 'python', linuxMode = false) {
|
|
149
112
|
const spawnOpts = ['-m', 'pip', 'install', '-r', reqFile, '-t', '.', '--upgrade'];
|
|
150
113
|
if (linuxMode) {
|
|
151
114
|
spawnOpts.push(...[
|
|
@@ -161,7 +124,7 @@ function installRequirements(reqFile, pth, stackVersion, linuxMode = false) {
|
|
|
161
124
|
}
|
|
162
125
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
163
126
|
var _a;
|
|
164
|
-
const child = (0, shell_1.spawn)(
|
|
127
|
+
const child = (0, shell_1.spawn)(spawnCommand, spawnOpts, {
|
|
165
128
|
cwd: pth,
|
|
166
129
|
stdio: 'pipe'
|
|
167
130
|
}).RAW();
|
|
@@ -189,14 +152,13 @@ function installRequirements(reqFile, pth, stackVersion, linuxMode = false) {
|
|
|
189
152
|
}));
|
|
190
153
|
});
|
|
191
154
|
}
|
|
192
|
-
|
|
193
|
-
function
|
|
194
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
155
|
+
function installPkgs(pkgs_1) {
|
|
156
|
+
return __awaiter(this, arguments, void 0, function* (pkgs, spawnCommand = 'python', pth = undefined) {
|
|
195
157
|
const spawnOpts = ['-m', 'pip', 'install', ...pkgs, '--upgrade'];
|
|
196
158
|
if (pth) {
|
|
197
159
|
spawnOpts.push(...['-t', pth]);
|
|
198
160
|
}
|
|
199
|
-
return (0, shell_1.spawn)(
|
|
161
|
+
return (0, shell_1.spawn)(spawnCommand, spawnOpts, {
|
|
200
162
|
cwd: pth,
|
|
201
163
|
stdio: 'ignore'
|
|
202
164
|
})
|
|
@@ -209,4 +171,3 @@ function installPkgs(pkgs, stackVersion, pth = undefined) {
|
|
|
209
171
|
});
|
|
210
172
|
});
|
|
211
173
|
}
|
|
212
|
-
exports.installPkgs = installPkgs;
|
|
@@ -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.getAppSailZip = getAppSailZip;
|
|
49
|
+
exports.getAppSailName = getAppSailName;
|
|
50
|
+
exports.getContainerImageTag = getContainerImageTag;
|
|
51
|
+
exports.getCustomAppSailSource = getCustomAppSailSource;
|
|
39
52
|
const image_1 = require("@zcatalyst/container-plugin/out/endpoints/image");
|
|
40
53
|
const ansi_colors_1 = require("ansi-colors");
|
|
41
54
|
const inquirer = __importStar(require("inquirer"));
|
|
@@ -138,7 +151,6 @@ function getAppSailZip() {
|
|
|
138
151
|
};
|
|
139
152
|
});
|
|
140
153
|
}
|
|
141
|
-
exports.getAppSailZip = getAppSailZip;
|
|
142
154
|
function getAppSailName() {
|
|
143
155
|
return __awaiter(this, void 0, void 0, function* () {
|
|
144
156
|
const existingSails = config_1.appSailConfig.raw() || [];
|
|
@@ -162,7 +174,6 @@ function getAppSailName() {
|
|
|
162
174
|
return appName.name;
|
|
163
175
|
});
|
|
164
176
|
}
|
|
165
|
-
exports.getAppSailName = getAppSailName;
|
|
166
177
|
function getContainerImageTag() {
|
|
167
178
|
return __awaiter(this, void 0, void 0, function* () {
|
|
168
179
|
yield (0, container_1.isSocketAccessible)();
|
|
@@ -214,7 +225,6 @@ function getContainerImageTag() {
|
|
|
214
225
|
return `docker://${image.name}`;
|
|
215
226
|
});
|
|
216
227
|
}
|
|
217
|
-
exports.getContainerImageTag = getContainerImageTag;
|
|
218
228
|
function getCustomAppSailSource() {
|
|
219
229
|
return __awaiter(this, void 0, void 0, function* () {
|
|
220
230
|
const dockerProtocol = yield prompt_1.default.ask(prompt_1.default.question('type', 'Please choose one of the supported protocols:', {
|
|
@@ -261,4 +271,3 @@ function getCustomAppSailSource() {
|
|
|
261
271
|
}
|
|
262
272
|
});
|
|
263
273
|
}
|
|
264
|
-
exports.getCustomAppSailSource = getCustomAppSailSource;
|