@oclif/plugin-update 4.6.46 → 4.7.0

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/README.md CHANGED
@@ -15,6 +15,31 @@
15
15
 
16
16
  See https://oclif.io/docs/releasing.html#autoupdater
17
17
 
18
+ ## Configuration
19
+
20
+ ### Update Check Interval
21
+
22
+ You can customize how often the plugin checks for updates by adding the `autoupdate.debounce` configuration to your `package.json`:
23
+
24
+ ```json
25
+ {
26
+ "oclif": {
27
+ "update": {
28
+ "autoupdate": {
29
+ "debounce": 7
30
+ }
31
+ }
32
+ }
33
+ }
34
+ ```
35
+
36
+ The `debounce` value is the number of days between update checks for all channels. When set, it overrides the default behavior for all channels.
37
+
38
+ If not configured, the plugin defaults to:
39
+
40
+ - Stable channel: 14 days
41
+ - Other channels: 1 day
42
+
18
43
  # Commands
19
44
 
20
45
  <!-- commands -->
@@ -56,7 +81,7 @@ EXAMPLES
56
81
  $ oclif-example update --available
57
82
  ```
58
83
 
59
- _See code: [src/commands/update.ts](https://github.com/oclif/plugin-update/blob/v4.6.46/src/commands/update.ts)_
84
+ _See code: [src/commands/update.ts](https://github.com/oclif/plugin-update/blob/v4.7.0/src/commands/update.ts)_
60
85
  <!-- commandsstop -->
61
86
 
62
87
  # Contributing
@@ -1,7 +1,7 @@
1
1
  import makeDebug from 'debug';
2
2
  import { spawn } from 'node:child_process';
3
3
  import { existsSync } from 'node:fs';
4
- import { open, stat, writeFile } from 'node:fs/promises';
4
+ import { mkdir, open, stat, writeFile } from 'node:fs/promises';
5
5
  import { join } from 'node:path';
6
6
  import { touch } from '../util.js';
7
7
  const debug = makeDebug('cli:updater');
@@ -28,12 +28,19 @@ export const init = async function (opts) {
28
28
  [config.scopedEnvVarKey('SKIP_ANALYTICS')]: '1',
29
29
  [config.scopedEnvVarKey('TIMESTAMPS')]: '1',
30
30
  };
31
+ // Ensure the cache directory exists
32
+ await mkdir(config.cacheDir, { recursive: true });
31
33
  async function autoupdateNeeded() {
32
34
  try {
33
35
  const m = await mtime(autoupdatefile);
34
36
  let days = 1;
35
37
  if (opts.config.channel === 'stable')
36
38
  days = 14;
39
+ // Check for custom update check interval in configuration
40
+ const debounce = config.pjson.oclif?.update?.autoupdate?.debounce;
41
+ if (debounce !== undefined && debounce > 0) {
42
+ days = debounce;
43
+ }
37
44
  m.setHours(m.getHours() + days * 24);
38
45
  return m < new Date();
39
46
  }
@@ -106,5 +106,5 @@
106
106
  ]
107
107
  }
108
108
  },
109
- "version": "4.6.46"
109
+ "version": "4.7.0"
110
110
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oclif/plugin-update",
3
- "version": "4.6.46",
3
+ "version": "4.7.0",
4
4
  "author": "Salesforce",
5
5
  "bugs": "https://github.com/oclif/plugin-update/issues",
6
6
  "dependencies": {