@squiz/dxp-cli-next 5.17.1-develop.1 → 5.18.0-develop.1
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/cmp/dev-mode-ui.d.ts +4 -0
- package/lib/cmp/dev-mode-ui.js +51 -0
- package/lib/cmp/index.js +2 -0
- package/package.json +3 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.buildDevModeUICommand = void 0;
|
|
13
|
+
const local_component_dev_ui_1 = require("@squiz/local-component-dev-ui");
|
|
14
|
+
const commander_1 = require("commander");
|
|
15
|
+
const MIN_PORT = 1024;
|
|
16
|
+
const MAX_PORT = 65535;
|
|
17
|
+
const buildDevModeUICommand = () => new commander_1.Command()
|
|
18
|
+
.name('dev-ui')
|
|
19
|
+
.description('A local component UI for developing new components')
|
|
20
|
+
.addHelpText('after', `
|
|
21
|
+
|
|
22
|
+
The logs are currently \`bunyan\` formatted and should be piped into the bunyan cli:
|
|
23
|
+
$ dxp-next cmp dev-ui <source> | npx bunyan
|
|
24
|
+
`)
|
|
25
|
+
.argument('<source>', 'folder containing the template files in development')
|
|
26
|
+
.addOption(new commander_1.Option('-p, --port <number>', 'Define port the webserver runs on')
|
|
27
|
+
.default(3000)
|
|
28
|
+
.argParser(v => {
|
|
29
|
+
const parsedPort = Number(v);
|
|
30
|
+
if (isNaN(parsedPort) ||
|
|
31
|
+
MIN_PORT > parsedPort ||
|
|
32
|
+
parsedPort > MAX_PORT) {
|
|
33
|
+
throw new commander_1.InvalidArgumentError(`Port must be a number between ${MIN_PORT}-${MAX_PORT}`);
|
|
34
|
+
}
|
|
35
|
+
return parsedPort;
|
|
36
|
+
}))
|
|
37
|
+
.addOption(new commander_1.Option('-l, --logging-format <string>', 'Format of log output')
|
|
38
|
+
.choices(['human', 'json'])
|
|
39
|
+
.default('human'))
|
|
40
|
+
.action((source, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
+
const input = {
|
|
42
|
+
port: options.port,
|
|
43
|
+
loggingFormat: options.loggingFormat,
|
|
44
|
+
noBrowser: true,
|
|
45
|
+
};
|
|
46
|
+
// Starts the dev-mode server with the development UI
|
|
47
|
+
yield (0, local_component_dev_ui_1.startLocalDevelopmentUIServer)(source, input);
|
|
48
|
+
}));
|
|
49
|
+
exports.buildDevModeUICommand = buildDevModeUICommand;
|
|
50
|
+
const devModeUICommand = (0, exports.buildDevModeUICommand)();
|
|
51
|
+
exports.default = devModeUICommand;
|
package/lib/cmp/index.js
CHANGED
|
@@ -6,11 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const commander_1 = require("commander");
|
|
7
7
|
const deploy_1 = __importDefault(require("./deploy"));
|
|
8
8
|
const dev_mode_1 = __importDefault(require("./dev-mode"));
|
|
9
|
+
const dev_mode_ui_1 = __importDefault(require("./dev-mode-ui"));
|
|
9
10
|
const init_1 = __importDefault(require("./init"));
|
|
10
11
|
const cmpCommand = new commander_1.Command('cmp');
|
|
11
12
|
cmpCommand
|
|
12
13
|
.description('Component Service Commands')
|
|
13
14
|
.addCommand(deploy_1.default)
|
|
14
15
|
.addCommand(dev_mode_1.default)
|
|
16
|
+
.addCommand(dev_mode_ui_1.default)
|
|
15
17
|
.addCommand(init_1.default);
|
|
16
18
|
exports.default = cmpCommand;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squiz/dxp-cli-next",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.18.0-develop.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "https://gitlab.squiz.net/dxp/dxp-cli-next"
|
|
6
6
|
},
|
|
@@ -42,6 +42,8 @@
|
|
|
42
42
|
"@apidevtools/swagger-parser": "10.1.0",
|
|
43
43
|
"@squiz/component-cli-lib": "1.67.0",
|
|
44
44
|
"@squiz/dxp-porter-shared": "0.4.0",
|
|
45
|
+
"@squiz/local-component-dev-ui": "^0.2.2",
|
|
46
|
+
"@squiz/render-runtime-lib": "^1.69.0",
|
|
45
47
|
"axios": "1.1.3",
|
|
46
48
|
"cli-color": "2.0.3",
|
|
47
49
|
"commander": "9.4.0",
|