conductor-node 11.6.0 → 11.6.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/dist/package.json +1 -1
- package/dist/src/utils/checkForUpdates.js +21 -26
- package/package.json +1 -1
package/dist/package.json
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.createFramedMessage = exports.checkForUpdates = void 0;
|
|
7
7
|
const package_json_1 = __importDefault(require("../../package.json"));
|
|
8
8
|
const env_1 = require("../utils/env");
|
|
9
|
-
const
|
|
9
|
+
const axios_1 = __importDefault(require("axios"));
|
|
10
10
|
function checkForUpdates() {
|
|
11
11
|
if (process.env.NODE_ENV === "test") {
|
|
12
12
|
return;
|
|
@@ -16,32 +16,27 @@ function checkForUpdates() {
|
|
|
16
16
|
if ((0, env_1.isEnvironmentVariableTruthy)("CONDUCTOR_HIDE_UPDATE_MESSAGE")) {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
// Exit early if `npm` is not installed.
|
|
20
|
-
try {
|
|
21
|
-
node_child_process_1.default.execSync("npm --version", {
|
|
22
|
-
// Prevent the shell from internally logging the error message.
|
|
23
|
-
stdio: "ignore",
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
19
|
const currentVersion = package_json_1.default.version;
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
.
|
|
33
|
-
.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
20
|
+
const packageName = encodeURIComponent(package_json_1.default.name);
|
|
21
|
+
axios_1.default
|
|
22
|
+
.get(`https://registry.npmjs.org/-/package/${packageName}/dist-tags`)
|
|
23
|
+
.then((response) => {
|
|
24
|
+
const latestVersion = response.data.latest;
|
|
25
|
+
if (currentVersion !== latestVersion) {
|
|
26
|
+
const updateCommand = process.env["npm_execpath"]?.includes("yarn") === true
|
|
27
|
+
? "yarn add"
|
|
28
|
+
: "npm install";
|
|
29
|
+
console.warn(createFramedMessage([
|
|
30
|
+
`🟡 Update available for Conductor! ${currentVersion} -> ${latestVersion}`,
|
|
31
|
+
"",
|
|
32
|
+
"Run the following to update:",
|
|
33
|
+
` ${updateCommand} ${packageName}@latest`,
|
|
34
|
+
]));
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
.catch((error) => {
|
|
38
|
+
console.debug("Failed to check for updates:", error);
|
|
39
|
+
});
|
|
45
40
|
}
|
|
46
41
|
exports.checkForUpdates = checkForUpdates;
|
|
47
42
|
function createFramedMessage(messageLines) {
|