zcatalyst-cli 1.10.0 → 1.12.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/docs/.DS_Store +0 -0
- package/docs/client-utils.toml +5 -0
- package/docs/command_needs/auth.toml +1 -1
- package/docs/optional-import.toml +10 -0
- package/docs/plugin-loader.toml +4 -0
- package/docs/serve/server/index.toml +4 -0
- package/docs/serve/server/lib/web_client/server.toml +4 -0
- package/lib/apig-utils.js +2 -1
- package/lib/archiver.js +3 -3
- package/lib/client-utils.js +8 -6
- package/lib/command_needs/auth.js +2 -2
- package/lib/commands/client/delete.js +1 -0
- package/lib/commands/event/generate/index.js +4 -13
- package/lib/commands/functions/shell.js +5 -2
- package/lib/commands/iac/import.js +29 -6
- package/lib/commands/init.js +1 -1
- package/lib/commands/pull.js +1 -1
- package/lib/commands/serve.js +2 -1
- package/lib/endpoints/lib/sdk.js +2 -2
- package/lib/error.js +16 -13
- package/lib/errorOut.js +2 -2
- package/lib/fn-utils/lib/common.js +6 -5
- package/lib/fn-utils/lib/java.js +1 -1
- package/lib/fn-utils/lib/node.js +2 -2
- package/lib/init/dependencies/npm-install.js +10 -10
- package/lib/init/features/client/index.js +47 -0
- package/lib/init/features/client/initializers/angular.js +104 -0
- package/lib/init/features/client/initializers/basic.js +50 -0
- package/lib/init/features/client/initializers/lyte.js +56 -0
- package/lib/init/features/client/initializers/react.js +78 -0
- package/lib/init/features/functions/languages/node.js +3 -1
- package/lib/init/features/index.js +10 -3
- package/lib/init/features/project.js +2 -1
- package/lib/init/util/client.js +89 -4
- package/lib/internal/command.js +4 -1
- package/lib/internal/config.js +2 -1
- package/lib/optional-import.js +27 -26
- package/lib/plugin-loader.js +27 -10
- package/lib/port-resolver.js +4 -2
- package/lib/serve/index.js +6 -1
- package/lib/serve/server/index.js +52 -8
- package/lib/serve/server/lib/master.js +24 -12
- package/lib/serve/server/lib/web_client/index.js +30 -0
- package/lib/serve/server/lib/web_client/server.js +171 -0
- package/lib/shell/index.js +10 -6
- package/lib/util_modules/char.js +1 -1
- package/lib/util_modules/config/lib/apig.js +2 -1
- package/lib/util_modules/config/lib/client.js +18 -21
- package/lib/util_modules/constants/index.js +3 -1
- package/lib/util_modules/constants/lib/placeholders.js +1 -0
- package/lib/util_modules/constants/lib/plugin.js +28 -0
- package/lib/util_modules/constants/lib/template.js +11 -1
- package/lib/util_modules/constants/lib/urls.js +29 -13
- package/lib/util_modules/{contextHelp.js → context-help.js} +0 -0
- package/lib/util_modules/env.js +13 -12
- package/lib/util_modules/fs/index.js +1 -9
- package/lib/util_modules/fs/lib/async.js +3 -3
- package/lib/util_modules/fs/utils.js +8 -0
- package/lib/util_modules/global-space.js +2 -0
- package/lib/util_modules/option.js +5 -1
- package/lib/util_modules/shell.js +10 -6
- package/lib/winston.js +1 -1
- package/package.json +7 -4
- package/templates/.DS_Store +0 -0
- package/templates/init/.DS_Store +0 -0
- package/templates/init/client/.DS_Store +0 -0
- package/templates/init/client/{client-package.json → basic/client-package.json} +0 -0
- package/templates/init/client/{index.html → basic/index.html} +0 -0
- package/templates/init/client/{main.css → basic/main.css} +0 -0
- package/templates/init/client/{main.js → basic/main.js} +0 -0
- package/templates/init/client/lyte/build/build.js +301 -0
- package/templates/init/client/lyte/build/scripts/cliDownloadScript.js +54 -0
- package/templates/init/client/lyte/client-package.json +5 -0
- package/templates/init/client/lyte/components/javascript/welcome-comp.js +13 -0
- package/templates/init/client/lyte/components/styles/welcome-comp.css +0 -0
- package/templates/init/client/lyte/components/templates/welcome-comp.html +8 -0
- package/templates/init/client/lyte/data-store/adapters/.gitkeep +0 -0
- package/templates/init/client/lyte/data-store/models/.gitkeep +0 -0
- package/templates/init/client/lyte/data-store/serializers/.gitkeep +0 -0
- package/templates/init/client/lyte/index.html +17 -0
- package/templates/init/client/lyte/package.json +12 -0
- package/templates/init/client/lyte/router.js +14 -0
- package/templates/init/client/lyte/routes/index.js +54 -0
- package/templates/init/client/react/.DS_Store +0 -0
- package/templates/init/client/react/react_js/package.json +11 -0
- package/templates/init/client/react/react_js/template/README.md +70 -0
- package/templates/init/client/react/react_js/template/client-package.json +5 -0
- package/templates/init/client/react/react_js/template/gitignore +23 -0
- package/templates/init/client/react/react_js/template/public/favicon.ico +0 -0
- package/templates/init/client/react/react_js/template/public/index.html +43 -0
- package/templates/init/client/react/react_js/template/public/logo192.png +0 -0
- package/templates/init/client/react/react_js/template/public/logo512.png +0 -0
- package/templates/init/client/react/react_js/template/public/manifest.json +25 -0
- package/templates/init/client/react/react_js/template/public/robots.txt +3 -0
- package/templates/init/client/react/react_js/template/src/App.css +38 -0
- package/templates/init/client/react/react_js/template/src/App.js +25 -0
- package/templates/init/client/react/react_js/template/src/App.test.js +8 -0
- package/templates/init/client/react/react_js/template/src/index.css +13 -0
- package/templates/init/client/react/react_js/template/src/index.js +17 -0
- package/templates/init/client/react/react_js/template/src/logo.svg +1 -0
- package/templates/init/client/react/react_js/template/src/reportWebVitals.js +13 -0
- package/templates/init/client/react/react_js/template/src/setupTests.js +5 -0
- package/templates/init/client/react/react_js/template.json +13 -0
- package/templates/init/client/react/react_ts/package.json +11 -0
- package/templates/init/client/react/react_ts/template/README.md +46 -0
- package/templates/init/client/react/react_ts/template/client-package.json +5 -0
- package/templates/init/client/react/react_ts/template/gitignore +23 -0
- package/templates/init/client/react/react_ts/template/public/favicon.ico +0 -0
- package/templates/init/client/react/react_ts/template/public/index.html +43 -0
- package/templates/init/client/react/react_ts/template/public/logo192.png +0 -0
- package/templates/init/client/react/react_ts/template/public/logo512.png +0 -0
- package/templates/init/client/react/react_ts/template/public/manifest.json +25 -0
- package/templates/init/client/react/react_ts/template/public/robots.txt +3 -0
- package/templates/init/client/react/react_ts/template/src/App.css +38 -0
- package/templates/init/client/react/react_ts/template/src/App.test.tsx +9 -0
- package/templates/init/client/react/react_ts/template/src/App.tsx +26 -0
- package/templates/init/client/react/react_ts/template/src/index.css +13 -0
- package/templates/init/client/react/react_ts/template/src/index.tsx +17 -0
- package/templates/init/client/react/react_ts/template/src/logo.svg +1 -0
- package/templates/init/client/react/react_ts/template/src/reportWebVitals.ts +15 -0
- package/templates/init/client/react/react_ts/template/src/setupTests.ts +5 -0
- package/templates/init/client/react/react_ts/template.json +18 -0
- package/templates/init/functions/java/integ/cliq/com/handlers/BotHandler.java +96 -111
- package/templates/init/functions/java/integ/cliq/com/handlers/CommandHandler.java +20 -27
- package/templates/init/functions/java/integ/cliq/com/handlers/FunctionHandler.java +143 -112
- package/templates/init/functions/java/integ/cliq/com/handlers/InstallationHandler.java +4 -7
- package/templates/init/functions/java/integ/cliq/com/handlers/InstallationValidator.java +4 -7
- package/templates/init/functions/java/integ/cliq/com/handlers/MessageActionHandler.java +10 -12
- package/templates/init/functions/java/integ/cliq/com/handlers/WidgetHandler.java +100 -66
- package/templates/init/functions/java/integ/cliq/sample.java +5 -7
- package/templates/init/functions/node/integ/cliq/handlers/bot-handler.js +2 -3
- package/templates/init/functions/node/integ/cliq/handlers/command-handler.js +0 -1
- package/templates/init/functions/node/integ/cliq/handlers/function-handler.js +46 -0
- package/templates/init/functions/node/integ/cliq/handlers/widget-handler.js +31 -0
- package/templates/web-socket.txt +21 -0
- package/lib/init/features/client.js +0 -50
- package/lib/serve/server/lib/client.js +0 -30
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
|
+
};
|
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
const file_names_js_1 = __importDefault(require("../../../../util_modules/constants/lib/file-names.js"));
|
|
35
|
+
const plugin_js_1 = __importDefault(require("../../../../util_modules/constants/lib/plugin.js"));
|
|
36
|
+
const placeholders_js_1 = __importDefault(require("../../../../util_modules/constants/lib/placeholders.js"));
|
|
37
|
+
const folder_names_js_1 = __importDefault(require("../../../../util_modules/constants/lib/folder-names.js"));
|
|
38
|
+
const project_js_1 = require("../../../../util_modules/project.js");
|
|
39
|
+
const shell_js_1 = require("../../../../util_modules/shell.js");
|
|
40
|
+
const runtime_store_js_1 = __importDefault(require("../../../../runtime-store.js"));
|
|
41
|
+
const logger_js_1 = require("../../../../util_modules/logger.js");
|
|
42
|
+
const ansi_colors_1 = require("ansi-colors");
|
|
43
|
+
const client_js_1 = require("../../../util/client.js");
|
|
44
|
+
const path_1 = require("path");
|
|
45
|
+
const ASYNC = __importStar(require("../../../../util_modules/fs/lib/async.js"));
|
|
46
|
+
const error_js_1 = __importDefault(require("../../../../error.js"));
|
|
47
|
+
const { angular } = plugin_js_1.default;
|
|
48
|
+
const { client } = placeholders_js_1.default;
|
|
49
|
+
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
50
|
+
const clientName = yield client_js_1.clientNamePrompt('Please provide a name for your Angular App:', 'angular-app');
|
|
51
|
+
const clientDirPath = project_js_1.resolveProjectPath(folder_names_js_1.default.client);
|
|
52
|
+
yield client_js_1.directoryOverridePrompt(clientDirPath);
|
|
53
|
+
const opts = [
|
|
54
|
+
angular.runner_command[1],
|
|
55
|
+
clientName,
|
|
56
|
+
'--directory',
|
|
57
|
+
folder_names_js_1.default.client,
|
|
58
|
+
'--skip-git',
|
|
59
|
+
'true'
|
|
60
|
+
];
|
|
61
|
+
try {
|
|
62
|
+
const collection = require.resolve(path_1.join(angular.collection_name, 'package.json'));
|
|
63
|
+
yield shell_js_1.spawn(angular.runner_command[0], [...opts, '--collection', path_1.dirname(collection)], {
|
|
64
|
+
stdio: 'inherit',
|
|
65
|
+
cwd: runtime_store_js_1.default.get('cwd')
|
|
66
|
+
}).ASYNC();
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
if (e === null) {
|
|
70
|
+
throw new error_js_1.default('Process aborted!', { exit: 0, skipHelp: true });
|
|
71
|
+
}
|
|
72
|
+
const err = error_js_1.default.getErrorInstance(e, {
|
|
73
|
+
message: 'Failure when creating new Angular App'
|
|
74
|
+
}).original;
|
|
75
|
+
if (!err.code || err.code !== 'ENOENT') {
|
|
76
|
+
throw err;
|
|
77
|
+
}
|
|
78
|
+
logger_js_1.info(`Angular CLI (${ansi_colors_1.red.italic('@angular/cli')}) not found....`);
|
|
79
|
+
logger_js_1.info(`Installing ${ansi_colors_1.bold('@angular/cli')} using ${ansi_colors_1.bold('npx')}`);
|
|
80
|
+
logger_js_1.info('Note: this may take a while...');
|
|
81
|
+
yield shell_js_1.spawn('npx', [
|
|
82
|
+
'-p',
|
|
83
|
+
angular.collection_name,
|
|
84
|
+
'-p',
|
|
85
|
+
angular.runner_package,
|
|
86
|
+
angular.runner_command[0],
|
|
87
|
+
...opts,
|
|
88
|
+
'--collection',
|
|
89
|
+
angular.collection_name
|
|
90
|
+
], {
|
|
91
|
+
stdio: 'inherit',
|
|
92
|
+
cwd: runtime_store_js_1.default.get('cwd')
|
|
93
|
+
})
|
|
94
|
+
.ASYNC()
|
|
95
|
+
.catch((err) => {
|
|
96
|
+
throw error_js_1.default.getErrorInstance(err, {
|
|
97
|
+
message: 'Failure when creating new Angular App with npx'
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
yield ASYNC.findAndReplace(path_1.join(clientDirPath, file_names_js_1.default.client.package_json))(client.package.name, clientName);
|
|
102
|
+
runtime_store_js_1.default.set('payload.client.plugin', angular.plugin);
|
|
103
|
+
return client_js_1.fillClientInitPayload(clientDirPath, clientName);
|
|
104
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
|
+
};
|
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
const ansi_colors_1 = require("ansi-colors");
|
|
35
|
+
const folder_names_js_1 = __importDefault(require("../../../../util_modules/constants/lib/folder-names.js"));
|
|
36
|
+
const placeholders_js_1 = __importDefault(require("../../../../util_modules/constants/lib/placeholders.js"));
|
|
37
|
+
const template_js_1 = __importDefault(require("../../../../util_modules/constants/lib/template.js"));
|
|
38
|
+
const ASYNC = __importStar(require("../../../../util_modules/fs/lib/async.js"));
|
|
39
|
+
const logger_js_1 = require("../../../../util_modules/logger.js");
|
|
40
|
+
const project_js_1 = require("../../../../util_modules/project.js");
|
|
41
|
+
const client_js_1 = require("../../../util/client.js");
|
|
42
|
+
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
logger_js_1.message('A directory ' + ansi_colors_1.cyan.bold('client') + ' will be created with a webapp pre-configured.');
|
|
44
|
+
const clientDirPath = project_js_1.resolveProjectPath(folder_names_js_1.default.client);
|
|
45
|
+
yield client_js_1.directoryOverridePrompt(clientDirPath);
|
|
46
|
+
yield ASYNC.copyDir(template_js_1.default.client.basic.new, clientDirPath);
|
|
47
|
+
const clientName = yield client_js_1.clientNamePrompt('How do you want to address the client ?', 'sampleApp');
|
|
48
|
+
yield ASYNC.findAndReplace(clientDirPath)(placeholders_js_1.default.client.package.name, clientName);
|
|
49
|
+
return client_js_1.fillClientInitPayload(clientDirPath, clientName);
|
|
50
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
|
+
};
|
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
const path_1 = require("path");
|
|
35
|
+
const client_js_1 = require("../../../util/client.js");
|
|
36
|
+
const runtime_store_js_1 = __importDefault(require("../../../../runtime-store.js"));
|
|
37
|
+
const npm_install_js_1 = __importDefault(require("../../../dependencies/npm-install.js"));
|
|
38
|
+
const plugin_js_1 = __importDefault(require("../../../../util_modules/constants/lib/plugin.js"));
|
|
39
|
+
const template_js_1 = __importDefault(require("../../../../util_modules/constants/lib/template.js"));
|
|
40
|
+
const placeholders_js_1 = __importDefault(require("../../../../util_modules/constants/lib/placeholders.js"));
|
|
41
|
+
const folder_names_js_1 = __importDefault(require("../../../../util_modules/constants/lib/folder-names.js"));
|
|
42
|
+
const ASYNC = __importStar(require("../../../../util_modules/fs/lib/async.js"));
|
|
43
|
+
const project_js_1 = require("../../../../util_modules/project.js");
|
|
44
|
+
const { lyte } = plugin_js_1.default;
|
|
45
|
+
const { client } = placeholders_js_1.default;
|
|
46
|
+
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
+
const clientName = yield client_js_1.clientNamePrompt('Please provide a name for your Lyte web app: ', 'lyte-app');
|
|
48
|
+
const clientDirPath = project_js_1.resolveProjectPath(folder_names_js_1.default.client);
|
|
49
|
+
yield client_js_1.directoryOverridePrompt(clientDirPath);
|
|
50
|
+
yield ASYNC.copyDir(template_js_1.default.client.lyte, clientDirPath);
|
|
51
|
+
yield client_js_1.addDependency(path_1.join(clientDirPath, 'package.json'), { [lyte.plugin]: 'latest' }, { dev: true });
|
|
52
|
+
yield ASYNC.findAndReplace(clientDirPath)(client.package.name, clientName);
|
|
53
|
+
yield npm_install_js_1.default(clientDirPath, true);
|
|
54
|
+
runtime_store_js_1.default.set('payload.client.plugin', lyte.plugin);
|
|
55
|
+
return client_js_1.fillClientInitPayload(clientDirPath, clientName);
|
|
56
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
|
+
};
|
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
const project_js_1 = require("../../../../util_modules/project.js");
|
|
35
|
+
const shell_js_1 = require("../../../../util_modules/shell.js");
|
|
36
|
+
const runtime_store_js_1 = __importDefault(require("../../../../runtime-store.js"));
|
|
37
|
+
const ASYNC = __importStar(require("../../../../util_modules/fs/lib/async.js"));
|
|
38
|
+
const path_1 = require("path");
|
|
39
|
+
const os_1 = require("os");
|
|
40
|
+
const index_js_1 = __importDefault(require("../../../../prompt/index.js"));
|
|
41
|
+
const client_js_1 = require("../../../util/client.js");
|
|
42
|
+
const plugin_js_1 = __importDefault(require("../../../../util_modules/constants/lib/plugin.js"));
|
|
43
|
+
const template_js_1 = __importDefault(require("../../../../util_modules/constants/lib/template.js"));
|
|
44
|
+
const placeholders_js_1 = __importDefault(require("../../../../util_modules/constants/lib/placeholders.js"));
|
|
45
|
+
const error_js_1 = __importDefault(require("../../../../error.js"));
|
|
46
|
+
const { react } = plugin_js_1.default;
|
|
47
|
+
const { client } = placeholders_js_1.default;
|
|
48
|
+
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
+
const flavourPrompt = yield index_js_1.default.ask(index_js_1.default.question('flavour', `Choose an option to create the React App:`, {
|
|
50
|
+
type: 'list',
|
|
51
|
+
choices: [
|
|
52
|
+
index_js_1.default.choice('JavaScript', { value: 'js', short: 'JavaScript' }),
|
|
53
|
+
index_js_1.default.choice('TypeScript', { value: 'ts', short: 'TypeScript' })
|
|
54
|
+
]
|
|
55
|
+
}));
|
|
56
|
+
const clientName = yield client_js_1.clientNamePrompt('Please provide a name for your React App:', 'react-app');
|
|
57
|
+
const clientDirPath = project_js_1.resolveProjectPath(clientName);
|
|
58
|
+
yield client_js_1.directoryOverridePrompt(clientDirPath);
|
|
59
|
+
const catalystTempDir = path_1.join(os_1.tmpdir(), '.catalyst');
|
|
60
|
+
const reactPluginDir = path_1.join(catalystTempDir, 'react');
|
|
61
|
+
yield ASYNC.emptyDir(reactPluginDir);
|
|
62
|
+
yield ASYNC.copyDir(flavourPrompt.flavour === 'ts' ? template_js_1.default.client.react.ts : template_js_1.default.client.react.js, reactPluginDir);
|
|
63
|
+
yield client_js_1.addDependency(path_1.join(reactPluginDir, 'template.json'), { [react.plugin]: 'latest' }, { depPath: ['package'] });
|
|
64
|
+
yield ASYNC.findAndReplace(reactPluginDir)(client.package.name, clientName);
|
|
65
|
+
yield shell_js_1.spawn('npx', [react.runner_command[0], clientName, '--template', 'file:' + reactPluginDir], {
|
|
66
|
+
stdio: 'inherit',
|
|
67
|
+
cwd: runtime_store_js_1.default.get('cwd')
|
|
68
|
+
})
|
|
69
|
+
.ASYNC()
|
|
70
|
+
.catch((err) => {
|
|
71
|
+
throw error_js_1.default.getErrorInstance(err, {
|
|
72
|
+
message: 'Failure while Creating react app',
|
|
73
|
+
skipHelp: false
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
runtime_store_js_1.default.set('payload.client.plugin', react.plugin);
|
|
77
|
+
return client_js_1.fillClientInitPayload(clientDirPath, clientName);
|
|
78
|
+
});
|
|
@@ -70,6 +70,8 @@ exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* (
|
|
|
70
70
|
type: fnType,
|
|
71
71
|
integ_config
|
|
72
72
|
});
|
|
73
|
-
|
|
73
|
+
fnType === constants_1.FN_TYPE.integration
|
|
74
|
+
? yield npm_install_1.default(targetPath, true)
|
|
75
|
+
: yield npm_install_1.default(targetPath);
|
|
74
76
|
return functions_1.fillFunctionsInitPayload(targetPath, finalJson.name, stack, fnType);
|
|
75
77
|
});
|
|
@@ -98,6 +98,13 @@ function setFnConfig(featureName, add) {
|
|
|
98
98
|
break;
|
|
99
99
|
case 'client':
|
|
100
100
|
config.set('client.source', targetSource);
|
|
101
|
+
const plugin = runtime_store_1.default.get('payload.client.plugin', false);
|
|
102
|
+
if (plugin) {
|
|
103
|
+
config.set('client.plugin', plugin);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
config.unset('client.plugin');
|
|
107
|
+
}
|
|
101
108
|
break;
|
|
102
109
|
case 'apig':
|
|
103
110
|
config.set('apig.rules', targetSource);
|
|
@@ -109,21 +116,21 @@ function setFnConfig(featureName, add) {
|
|
|
109
116
|
exports.setFnConfig = setFnConfig;
|
|
110
117
|
function functions(add = false) {
|
|
111
118
|
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
yield (yield Promise.resolve().then(() => __importStar(require('./functions')))).default();
|
|
119
|
+
yield (yield Promise.resolve().then(() => __importStar(require('./functions/index.js')))).default();
|
|
113
120
|
setFnConfig('functions', add);
|
|
114
121
|
});
|
|
115
122
|
}
|
|
116
123
|
exports.functions = functions;
|
|
117
124
|
function client() {
|
|
118
125
|
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
yield (yield Promise.resolve().then(() => __importStar(require('./client')))).default();
|
|
126
|
+
yield (yield Promise.resolve().then(() => __importStar(require('./client/index.js')))).default();
|
|
120
127
|
setFnConfig('client', false);
|
|
121
128
|
});
|
|
122
129
|
}
|
|
123
130
|
exports.client = client;
|
|
124
131
|
function project() {
|
|
125
132
|
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
-
yield (yield Promise.resolve().then(() => __importStar(require('./project')))).default();
|
|
133
|
+
yield (yield Promise.resolve().then(() => __importStar(require('./project.js')))).default();
|
|
127
134
|
const projectPayload = runtime_store_1.default.get('payload.project', null);
|
|
128
135
|
if (!projectPayload) {
|
|
129
136
|
return;
|
|
@@ -58,7 +58,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
58
58
|
const allProjects = (yield projectAPI.getAllProjects());
|
|
59
59
|
if (allProjects.length === 0) {
|
|
60
60
|
throw new error_1.default('Visit ' +
|
|
61
|
-
ansi_colors_1.underline(constants_1.ORIGIN.
|
|
61
|
+
ansi_colors_1.underline(constants_1.ORIGIN.console) +
|
|
62
62
|
' for creation of your first project before you continue.', { exit: 1 });
|
|
63
63
|
}
|
|
64
64
|
const projectChoices = [
|
|
@@ -113,6 +113,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
113
113
|
logger_1.warning(`skipping setup of function(${refinedTargets[0].name}) since provided stack ${stack} is not supported.`);
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
|
+
yield fnUtil.validate(refinedTargets, 0);
|
|
116
117
|
if (!refinedTargets[0].valid) {
|
|
117
118
|
logger_1.debug('Invalid target : ' +
|
|
118
119
|
refinedTargets[0].name +
|
package/lib/init/util/client.js
CHANGED
|
@@ -1,12 +1,97 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
2
30
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
31
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
32
|
};
|
|
5
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.fillClientInitPayload = void 0;
|
|
7
|
-
const
|
|
34
|
+
exports.addDependency = exports.clientNamePrompt = exports.directoryOverridePrompt = exports.fillClientInitPayload = void 0;
|
|
35
|
+
const ansi_colors_1 = require("ansi-colors");
|
|
36
|
+
const runtime_store_js_1 = __importDefault(require("../../runtime-store.js"));
|
|
37
|
+
const error_js_1 = __importDefault(require("../../error.js"));
|
|
38
|
+
const index_js_1 = __importDefault(require("../../prompt/index.js"));
|
|
39
|
+
const regex_js_1 = __importDefault(require("../../util_modules/constants/lib/regex.js"));
|
|
40
|
+
const ASYNC = __importStar(require("../../util_modules/fs/lib/async.js"));
|
|
41
|
+
const logger_js_1 = require("../../util_modules/logger.js");
|
|
42
|
+
const js_js_1 = require("../../util_modules/js.js");
|
|
8
43
|
const fillClientInitPayload = (source, name) => {
|
|
9
|
-
|
|
10
|
-
|
|
44
|
+
runtime_store_js_1.default.set('payload.client.source', source);
|
|
45
|
+
runtime_store_js_1.default.set('payload.client.name', name);
|
|
11
46
|
};
|
|
12
47
|
exports.fillClientInitPayload = fillClientInitPayload;
|
|
48
|
+
function directoryOverridePrompt(dir) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const foldeExists = yield ASYNC.dirExists(dir);
|
|
51
|
+
if (foldeExists) {
|
|
52
|
+
const overwriteAns = yield index_js_1.default.ask(index_js_1.default.question('overwrite', 'Directory ' + ansi_colors_1.underline(dir) + ' already exists. Overwrite ?', {
|
|
53
|
+
type: 'confirm',
|
|
54
|
+
defaultAns: false
|
|
55
|
+
}));
|
|
56
|
+
if (!overwriteAns.overwrite) {
|
|
57
|
+
throw new error_js_1.default('Skipping client setup since unable to override the already existing client', { exit: 0, errorId: 'CLIENT-UTILS-6', arg: [ansi_colors_1.italic.red(dir)] });
|
|
58
|
+
}
|
|
59
|
+
yield ASYNC.deleteDir(dir);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
exports.directoryOverridePrompt = directoryOverridePrompt;
|
|
64
|
+
function clientNamePrompt(question, defaultAns) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
const namePrompt = yield index_js_1.default.ask(index_js_1.default.question('name', question, {
|
|
67
|
+
type: 'input',
|
|
68
|
+
defaultAns,
|
|
69
|
+
validate: (ans) => {
|
|
70
|
+
if (ans.match(regex_js_1.default.client.package_name)) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
return 'Invalid client name';
|
|
74
|
+
}
|
|
75
|
+
}));
|
|
76
|
+
return namePrompt.name;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
exports.clientNamePrompt = clientNamePrompt;
|
|
80
|
+
function addDependency(filePath, dep, { dev = false, depPath = [] } = {}) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
try {
|
|
83
|
+
const packageJson = yield ASYNC.readJSONFile(filePath);
|
|
84
|
+
if (packageJson) {
|
|
85
|
+
depPath.push(dev ? 'devDependencies' : 'dependencies');
|
|
86
|
+
js_js_1.JS.assign(dep, js_js_1.JS.get(packageJson, depPath));
|
|
87
|
+
js_js_1.JS.set(packageJson, depPath, dep);
|
|
88
|
+
yield ASYNC.writeJSONFile(filePath, packageJson);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (e) {
|
|
92
|
+
const err = error_js_1.default.getErrorInstance(e, { skipHelp: true });
|
|
93
|
+
logger_js_1.debug(`unable to write to ${filePath}: ${err.message}`);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
exports.addDependency = addDependency;
|
package/lib/internal/command.js
CHANGED
|
@@ -167,7 +167,10 @@ class Command {
|
|
|
167
167
|
args.push({});
|
|
168
168
|
}
|
|
169
169
|
const [opts, command] = args.slice(-2);
|
|
170
|
-
|
|
170
|
+
const unknownOpts = this.allowUnknownOptions
|
|
171
|
+
? command.parseOptions(process.argv).unknown
|
|
172
|
+
: undefined;
|
|
173
|
+
runtime_store_1.default.set('opts', Object.assign({ _name: command.name(), unknownOpts }, opts));
|
|
171
174
|
this._prepare(command);
|
|
172
175
|
try {
|
|
173
176
|
yield migration_1.default(runtime_store_1.default.get('context.cli.package.version'));
|
package/lib/internal/config.js
CHANGED
|
@@ -70,7 +70,8 @@ class Config {
|
|
|
70
70
|
catch (e) {
|
|
71
71
|
const err = error_1.default.getErrorInstance(e, {
|
|
72
72
|
message: 'There was an error loading a file',
|
|
73
|
-
skipHelp: false
|
|
73
|
+
skipHelp: false,
|
|
74
|
+
fileName: __filename
|
|
74
75
|
});
|
|
75
76
|
err.errorId = 'CONFIG-1';
|
|
76
77
|
err.arg = [ansi_colors_1.bold(constants_1.FILENAME.config), err.message];
|
package/lib/optional-import.js
CHANGED
|
@@ -31,34 +31,35 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
31
31
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
32
|
};
|
|
33
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
-
const path_1 = __importDefault(require("path"));
|
|
35
34
|
const app_module_path_1 = __importDefault(require("app-module-path"));
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return Promise.resolve().then(() => __importStar(require(packageName)));
|
|
52
|
-
}
|
|
53
|
-
catch (e) {
|
|
54
|
-
logger_1.debug(e);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return;
|
|
35
|
+
const project_js_1 = require("./util_modules/project.js");
|
|
36
|
+
const path_1 = require("path");
|
|
37
|
+
const async_js_1 = require("./util_modules/fs/lib/async.js");
|
|
38
|
+
const error_js_1 = __importDefault(require("./error.js"));
|
|
39
|
+
const ansi_colors_1 = require("ansi-colors");
|
|
40
|
+
exports.default = (name, source) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
+
if (name === path_1.basename(name)) {
|
|
42
|
+
const projectModulePath = project_js_1.resolveProjectPath(path_1.join(source, 'node_modules', name));
|
|
43
|
+
const projectModulePathExists = yield async_js_1.dirExists(projectModulePath);
|
|
44
|
+
if (!projectModulePathExists) {
|
|
45
|
+
throw new error_js_1.default('Module path does not exists', {
|
|
46
|
+
errorId: 'OPT-IMP-1',
|
|
47
|
+
arg: [ansi_colors_1.bold(name), ansi_colors_1.italic.red(projectModulePath), ansi_colors_1.bold(source)],
|
|
48
|
+
exit: 1
|
|
49
|
+
});
|
|
58
50
|
}
|
|
51
|
+
app_module_path_1.default.addPath(projectModulePath);
|
|
52
|
+
return Promise.resolve().then(() => __importStar(require(projectModulePath)));
|
|
59
53
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
const projectModulePath = project_js_1.resolveProjectPath(name);
|
|
55
|
+
const projectModulePathExists = yield async_js_1.dirExists(projectModulePath);
|
|
56
|
+
if (!projectModulePathExists) {
|
|
57
|
+
throw new error_js_1.default('Module path does not exists', {
|
|
58
|
+
errorId: 'OPT-IMP-2',
|
|
59
|
+
arg: [ansi_colors_1.bold(name), ansi_colors_1.italic.red(projectModulePath), ansi_colors_1.bold(source)],
|
|
60
|
+
exit: 1
|
|
61
|
+
});
|
|
63
62
|
}
|
|
63
|
+
app_module_path_1.default.addPath(projectModulePath);
|
|
64
|
+
return Promise.resolve().then(() => __importStar(require(projectModulePath)));
|
|
64
65
|
});
|
package/lib/plugin-loader.js
CHANGED
|
@@ -31,17 +31,30 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
31
31
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
32
|
};
|
|
33
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
34
|
+
const ansi_colors_1 = require("ansi-colors");
|
|
35
|
+
const error_js_1 = __importDefault(require("./error.js"));
|
|
36
|
+
const optional_import_js_1 = __importDefault(require("./optional-import.js"));
|
|
37
|
+
const runtime_store_js_1 = __importDefault(require("./runtime-store.js"));
|
|
38
|
+
const ClientConfig = __importStar(require("./util_modules/config/lib/client.js"));
|
|
39
|
+
const FunctionsConfig = __importStar(require("./util_modules/config/lib/functions.js"));
|
|
40
|
+
const config = {
|
|
41
|
+
client: {
|
|
42
|
+
plugin: ClientConfig.plugin,
|
|
43
|
+
source: ClientConfig.source
|
|
44
|
+
},
|
|
45
|
+
functions: {
|
|
46
|
+
plugin: FunctionsConfig.plugin,
|
|
47
|
+
source: FunctionsConfig.source
|
|
48
|
+
}
|
|
49
|
+
};
|
|
37
50
|
const loadedPlugins = {};
|
|
38
51
|
function pluginLoader(feature, name, source) {
|
|
39
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
53
|
+
const pluginConfig = config[feature];
|
|
54
|
+
if (pluginConfig === undefined) {
|
|
42
55
|
return;
|
|
43
56
|
}
|
|
44
|
-
const plugins =
|
|
57
|
+
const plugins = pluginConfig.plugin(name, source);
|
|
45
58
|
let specificPlugin;
|
|
46
59
|
if (typeof plugins === 'string') {
|
|
47
60
|
specificPlugin = plugins;
|
|
@@ -57,18 +70,22 @@ function pluginLoader(feature, name, source) {
|
|
|
57
70
|
pluginMod = loadedPlugins[specificPlugin];
|
|
58
71
|
}
|
|
59
72
|
else {
|
|
60
|
-
pluginMod =
|
|
73
|
+
pluginMod = yield optional_import_js_1.default(specificPlugin, pluginConfig.source());
|
|
61
74
|
}
|
|
62
75
|
if (pluginMod === undefined) {
|
|
63
|
-
|
|
76
|
+
throw new error_js_1.default(`Configured plugin could not be found for [${feature}:${name}] - ${specificPlugin}`, {
|
|
77
|
+
exit: 1,
|
|
78
|
+
errorId: 'PLG-LDR-1',
|
|
79
|
+
arg: [ansi_colors_1.italic.red(specificPlugin), ansi_colors_1.bold(name), ansi_colors_1.bold(feature)]
|
|
80
|
+
});
|
|
64
81
|
}
|
|
65
82
|
loadedPlugins[specificPlugin] = pluginMod;
|
|
66
83
|
if (typeof pluginMod === 'function') {
|
|
67
|
-
|
|
84
|
+
runtime_store_js_1.default.set(`context.${feature}.plugins.${name}${source ? '.' + source : ''}`, specificPlugin);
|
|
68
85
|
return pluginMod;
|
|
69
86
|
}
|
|
70
87
|
else if (typeof pluginMod[name] === 'function') {
|
|
71
|
-
|
|
88
|
+
runtime_store_js_1.default.set(`context.${feature}.plugins.${name}${source ? '.' + source : ''}`, specificPlugin);
|
|
72
89
|
return pluginMod[name];
|
|
73
90
|
}
|
|
74
91
|
return;
|
package/lib/port-resolver.js
CHANGED
|
@@ -70,7 +70,8 @@ class PortResolver {
|
|
|
70
70
|
if (searchSpan === 0) {
|
|
71
71
|
const err = error_1.default.getErrorInstance(e, {
|
|
72
72
|
message: `Provided port '${port}' is not available`,
|
|
73
|
-
skipHelp: false
|
|
73
|
+
skipHelp: false,
|
|
74
|
+
fileName: __filename
|
|
74
75
|
});
|
|
75
76
|
err.errorId = 'PORT-RESOLVER-1';
|
|
76
77
|
err.arg = [
|
|
@@ -84,7 +85,8 @@ class PortResolver {
|
|
|
84
85
|
}
|
|
85
86
|
const cerr = error_1.default.getErrorInstance(e, {
|
|
86
87
|
message: `No ports from '${port}' to ${port + searchSpan} is free to use as a ${type} port.`,
|
|
87
|
-
skipHelp: false
|
|
88
|
+
skipHelp: false,
|
|
89
|
+
fileName: __filename
|
|
88
90
|
});
|
|
89
91
|
cerr.errorId = 'PORT-RESOLVER-2';
|
|
90
92
|
cerr.arg = [ansi_colors_1.bold(port + ''), ansi_colors_1.bold(port + searchSpan + ''), ansi_colors_1.bold('--' + type)];
|