@delicious233/dida-cli 0.2.0 → 0.2.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/bin/dida CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delicious233/dida-cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "private": false,
5
5
  "description": "Agent-friendly CLI for Dida365 / TickTick — task automation with stable JSON output.",
6
6
  "bin": {
@@ -26,7 +26,7 @@ function archName() {
26
26
 
27
27
  function requestBuffer(url) {
28
28
  return new Promise((resolve, reject) => {
29
- https.get(url, { headers: { "User-Agent": "dida-cli-npm-installer" } }, (res) => {
29
+ const req = https.get(url, { headers: { "User-Agent": "dida-cli-npm-installer" }, timeout: 60000 }, (res) => {
30
30
  if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
31
31
  requestBuffer(res.headers.location).then(resolve, reject);
32
32
  return;
@@ -39,6 +39,7 @@ function requestBuffer(url) {
39
39
  res.on("data", (chunk) => chunks.push(chunk));
40
40
  res.on("end", () => resolve(Buffer.concat(chunks)));
41
41
  }).on("error", reject);
42
+ req.on("timeout", () => { req.destroy(); reject(new Error(`request timed out: ${url}`)); });
42
43
  });
43
44
  }
44
45