@infomaximum/package-cli 1.4.0 → 1.4.2
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/dist/arguments.js +1 -1
- package/dist/configs/webpack/devServer.js +1 -0
- package/dist/utils.js +15 -4
- package/package.json +1 -1
package/dist/arguments.js
CHANGED
|
@@ -15,7 +15,7 @@ const registerWidgetCommands = (cli) => {
|
|
|
15
15
|
.description("Запускает проект в dev режиме")
|
|
16
16
|
.option("-e, --entry <path>", "Путь до entrypoint")
|
|
17
17
|
.option("-p, --port <port>", "Порт на котором будет доступен виджет", "5555")
|
|
18
|
-
.option("--host <host>", "host на котором будет доступен виджет", "
|
|
18
|
+
.option("--host <host>", "host на котором будет доступен виджет", "localhost")
|
|
19
19
|
.action((options) => runDevServer(options));
|
|
20
20
|
const widgetInitCommand = widgetCommand.command("init <project-directory>");
|
|
21
21
|
widgetInitCommand
|
package/dist/utils.js
CHANGED
|
@@ -20,13 +20,17 @@ export function safeWriteFile(pathToFile, contents, options) {
|
|
|
20
20
|
}
|
|
21
21
|
export function getLatestVersionOfLibrary(libraryName) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const { stdout } = yield execPromise(`npm show -j -p ${libraryName} version
|
|
23
|
+
const { stdout } = yield execPromise(`npm show -j -p ${libraryName} version`, {
|
|
24
|
+
timeout: 5000,
|
|
25
|
+
});
|
|
24
26
|
return JSON.parse(stdout);
|
|
25
27
|
});
|
|
26
28
|
}
|
|
27
29
|
export function getLibraryVersionInProject(libraryName) {
|
|
28
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
const { stdout } = yield execPromise(`npm ls -j -p ${libraryName} version
|
|
31
|
+
const { stdout } = yield execPromise(`npm ls -j -p ${libraryName} version`, {
|
|
32
|
+
timeout: 5000,
|
|
33
|
+
});
|
|
30
34
|
return JSON.parse(stdout);
|
|
31
35
|
});
|
|
32
36
|
}
|
|
@@ -48,11 +52,15 @@ export function checkLatestVersion(libName) {
|
|
|
48
52
|
var _a, _b, _c;
|
|
49
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
54
|
const libVersionInProject = yield getLibraryVersionInProject(libName);
|
|
55
|
+
if (!libVersionInProject)
|
|
56
|
+
return;
|
|
51
57
|
const libVersionFromProject = (_c = (((_a = libVersionInProject === null || libVersionInProject === void 0 ? void 0 : libVersionInProject.dependencies) === null || _a === void 0 ? void 0 : _a[libName]) ||
|
|
52
58
|
((_b = libVersionInProject === null || libVersionInProject === void 0 ? void 0 : libVersionInProject.devDependencies) === null || _b === void 0 ? void 0 : _b[libName]))) === null || _c === void 0 ? void 0 : _c.version;
|
|
53
59
|
if (!libVersionFromProject)
|
|
54
60
|
return;
|
|
55
61
|
const latestVersion = yield getLatestVersionOfLibrary(libName);
|
|
62
|
+
if (!latestVersion)
|
|
63
|
+
return;
|
|
56
64
|
const isOldVersion = semver.gt(latestVersion, libVersionFromProject);
|
|
57
65
|
if (isOldVersion) {
|
|
58
66
|
console.error(chalk.yellow(`\n\nA new version of the ${chalk.underline(`${libName}@${latestVersion}`)} library has been released,\n` +
|
|
@@ -66,7 +74,10 @@ export function checkLatestVersion(libName) {
|
|
|
66
74
|
}
|
|
67
75
|
export function checkLatestLibsVersion() {
|
|
68
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
|
|
70
|
-
|
|
77
|
+
try {
|
|
78
|
+
yield checkLatestVersion(CUSTOM_WIDGET_LIB_NAME);
|
|
79
|
+
yield checkLatestVersion(CUSTOM_PACKAGE_CLI_LIB_NAME);
|
|
80
|
+
}
|
|
81
|
+
catch (error) { }
|
|
71
82
|
});
|
|
72
83
|
}
|