esa-cli 1.0.8-beta.2 → 1.0.8-beta.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.
@@ -36,13 +36,26 @@ export function handleCheckVersion() {
36
36
  */
37
37
  export function checkCLIVersion(currentCommand) {
38
38
  return __awaiter(this, void 0, void 0, function* () {
39
+ if (process.env.ESA_NO_UPDATE_CHECK) {
40
+ return true;
41
+ }
39
42
  try {
40
43
  const __dirname = getDirName(import.meta.url);
41
44
  const packageJsonPath = path.join(__dirname, '..', '..', 'package.json');
42
45
  const jsonString = yield fs.readFile(packageJsonPath, 'utf-8');
43
46
  const packageJson = JSON.parse(jsonString);
44
47
  const currentVersion = packageJson.version;
45
- const response = yield fetch('https://registry.npmjs.org/esa-cli/latest');
48
+ const controller = new AbortController();
49
+ const fetchTimeout = setTimeout(() => controller.abort(), 5000);
50
+ let response;
51
+ try {
52
+ response = yield fetch('https://registry.npmjs.org/esa-cli/latest', {
53
+ signal: controller.signal
54
+ });
55
+ }
56
+ finally {
57
+ clearTimeout(fetchTimeout);
58
+ }
46
59
  if (!response.ok) {
47
60
  return true;
48
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esa-cli",
3
- "version": "1.0.8-beta.2",
3
+ "version": "1.0.8-beta.4",
4
4
  "description": "A CLI for operating Alibaba Cloud ESA Functions and Pages.",
5
5
  "main": "bin/enter.cjs",
6
6
  "type": "module",