lwr 0.9.2 → 0.9.4
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/build/cjs/cli/utils.cjs +10 -2
- package/build/es/cli/utils.d.ts +1 -0
- package/build/es/cli/utils.js +9 -2
- package/package.json +8 -8
package/build/cjs/cli/utils.cjs
CHANGED
|
@@ -28,7 +28,8 @@ __export(exports, {
|
|
|
28
28
|
getModeOption: () => getModeOption,
|
|
29
29
|
getPortOption: () => getPortOption,
|
|
30
30
|
getTargetOption: () => getTargetOption,
|
|
31
|
-
launch: () => launch
|
|
31
|
+
launch: () => launch,
|
|
32
|
+
parseNumArg: () => parseNumArg
|
|
32
33
|
});
|
|
33
34
|
var import_os = __toModule(require("os"));
|
|
34
35
|
var import_commander = __toModule(require("commander"));
|
|
@@ -51,7 +52,7 @@ function getTargetOption() {
|
|
|
51
52
|
return new import_commander.Option("-t, --target <target>", "[string] configured target for deployment").choices(["default", "mrt", "netlify"]).default("default");
|
|
52
53
|
}
|
|
53
54
|
function getPortOption() {
|
|
54
|
-
return new import_commander.Option("-p, --port <
|
|
55
|
+
return new import_commander.Option("-p, --port <number>", `[number] set port`).env("PORT").argParser(parseNumArg);
|
|
55
56
|
}
|
|
56
57
|
function getModeOption() {
|
|
57
58
|
return new import_commander.Option("-m, --mode <mode>", "[string] server mode").env("MODE").choices(["dev", "compat", "prod-compat", "prod"]);
|
|
@@ -64,3 +65,10 @@ function getDefaultBuildDirectory(rootDir, configFile, target) {
|
|
|
64
65
|
}
|
|
65
66
|
return buildDir;
|
|
66
67
|
}
|
|
68
|
+
function parseNumArg(value) {
|
|
69
|
+
const parsedValue = parseInt(value, 10);
|
|
70
|
+
if (isNaN(parsedValue)) {
|
|
71
|
+
throw new import_commander.InvalidArgumentError("Not a number.");
|
|
72
|
+
}
|
|
73
|
+
return parsedValue;
|
|
74
|
+
}
|
package/build/es/cli/utils.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export declare function getTargetOption(): Option;
|
|
|
4
4
|
export declare function getPortOption(): Option;
|
|
5
5
|
export declare function getModeOption(): Option;
|
|
6
6
|
export declare function getDefaultBuildDirectory(rootDir: string, configFile: string, target: string): string;
|
|
7
|
+
export declare function parseNumArg(value: string): number;
|
|
7
8
|
//# sourceMappingURL=utils.d.ts.map
|
package/build/es/cli/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { release } from 'os';
|
|
2
|
-
import { Option } from 'commander';
|
|
2
|
+
import { Option, InvalidArgumentError } from 'commander';
|
|
3
3
|
import { getLwrConfigFromFile } from '@lwrjs/config';
|
|
4
4
|
export async function launch(port, https) {
|
|
5
5
|
const { exec } = await import('child_process');
|
|
@@ -23,7 +23,7 @@ export function getTargetOption() {
|
|
|
23
23
|
.default('default');
|
|
24
24
|
}
|
|
25
25
|
export function getPortOption() {
|
|
26
|
-
return new Option('-p, --port <
|
|
26
|
+
return new Option('-p, --port <number>', `[number] set port`).env('PORT').argParser(parseNumArg);
|
|
27
27
|
}
|
|
28
28
|
export function getModeOption() {
|
|
29
29
|
return new Option('-m, --mode <mode>', '[string] server mode')
|
|
@@ -40,4 +40,11 @@ export function getDefaultBuildDirectory(rootDir, configFile, target) {
|
|
|
40
40
|
}
|
|
41
41
|
return buildDir;
|
|
42
42
|
}
|
|
43
|
+
export function parseNumArg(value) {
|
|
44
|
+
const parsedValue = parseInt(value, 10);
|
|
45
|
+
if (isNaN(parsedValue)) {
|
|
46
|
+
throw new InvalidArgumentError('Not a number.');
|
|
47
|
+
}
|
|
48
|
+
return parsedValue;
|
|
49
|
+
}
|
|
43
50
|
//# sourceMappingURL=utils.js.map
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"type": "module",
|
|
20
20
|
"types": "build/es/index.d.ts",
|
|
21
|
-
"version": "0.9.
|
|
21
|
+
"version": "0.9.4",
|
|
22
22
|
"module": "build/es/index.js",
|
|
23
23
|
"main": "build/cjs/index.cjs",
|
|
24
24
|
"files": [
|
|
@@ -41,21 +41,21 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@lwrjs/config": "0.9.
|
|
45
|
-
"@lwrjs/core": "0.9.
|
|
46
|
-
"@lwrjs/diagnostics": "0.9.
|
|
47
|
-
"@lwrjs/shared-utils": "0.9.
|
|
48
|
-
"@lwrjs/tools": "0.9.
|
|
44
|
+
"@lwrjs/config": "0.9.4",
|
|
45
|
+
"@lwrjs/core": "0.9.4",
|
|
46
|
+
"@lwrjs/diagnostics": "0.9.4",
|
|
47
|
+
"@lwrjs/shared-utils": "0.9.4",
|
|
48
|
+
"@lwrjs/tools": "0.9.4",
|
|
49
49
|
"chalk": "^4.1.0",
|
|
50
50
|
"commander": "^10.0.0",
|
|
51
51
|
"fs-extra": "^11.1.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@commander-js/extra-typings": "^10.0.2",
|
|
55
|
-
"@lwrjs/types": "0.9.
|
|
55
|
+
"@lwrjs/types": "0.9.4"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
|
58
58
|
"node": ">=16.0.0 <20"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "2a3b831e4ff9c0e45fe3a178b41286d87ec4c1e0"
|
|
61
61
|
}
|