@nolto/cli 0.7.0 → 0.7.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/index.js +6 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1855,7 +1855,7 @@ Update available: ${current} \u2192 ${latest} \xB7 run \`nolto update\`
|
|
|
1855
1855
|
function isDisabled(env) {
|
|
1856
1856
|
return env["NO_UPDATE_NOTIFIER"] === "1" || env["NODE_ENV"] === "test" || Boolean(env["CI"]);
|
|
1857
1857
|
}
|
|
1858
|
-
function fetchLatestFromRegistry(timeoutMs = REQUEST_TIMEOUT_MS) {
|
|
1858
|
+
function fetchLatestFromRegistry(timeoutMs = REQUEST_TIMEOUT_MS, opts = {}) {
|
|
1859
1859
|
return new Promise((resolve) => {
|
|
1860
1860
|
const req = https.get(
|
|
1861
1861
|
`https://registry.npmjs.org/${PACKAGE}/latest`,
|
|
@@ -1878,7 +1878,9 @@ function fetchLatestFromRegistry(timeoutMs = REQUEST_TIMEOUT_MS) {
|
|
|
1878
1878
|
});
|
|
1879
1879
|
}
|
|
1880
1880
|
);
|
|
1881
|
-
|
|
1881
|
+
if (opts.unrefSocket ?? true) {
|
|
1882
|
+
req.on("socket", (s) => s.unref());
|
|
1883
|
+
}
|
|
1882
1884
|
req.on("timeout", () => {
|
|
1883
1885
|
req.destroy();
|
|
1884
1886
|
resolve(null);
|
|
@@ -1932,6 +1934,7 @@ async function notifyUpdate(opts) {
|
|
|
1932
1934
|
var PACKAGE2 = "@nolto/cli";
|
|
1933
1935
|
var UPDATE_CACHE_FILE = "update-check.json";
|
|
1934
1936
|
var UPDATE_REQUEST_TIMEOUT_MS = 1e4;
|
|
1937
|
+
var UPDATE_FETCH_OPTIONS = { unrefSocket: false };
|
|
1935
1938
|
function isNpxPath(scriptPath) {
|
|
1936
1939
|
return /[\\/]_npx[\\/]/.test(scriptPath);
|
|
1937
1940
|
}
|
|
@@ -2069,7 +2072,7 @@ async function updateCli(opts = {}) {
|
|
|
2069
2072
|
}
|
|
2070
2073
|
},
|
|
2071
2074
|
realpath,
|
|
2072
|
-
fetchLatest: () => fetchLatestFromRegistry(UPDATE_REQUEST_TIMEOUT_MS),
|
|
2075
|
+
fetchLatest: () => fetchLatestFromRegistry(UPDATE_REQUEST_TIMEOUT_MS, UPDATE_FETCH_OPTIONS),
|
|
2073
2076
|
writeCache: writeUpdateCache,
|
|
2074
2077
|
unitExists: existsSync5,
|
|
2075
2078
|
log: opts.quiet === true ? () => void 0 : (line) => process.stdout.write(line + "\n"),
|