repo-util 1.21.1 → 1.22.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repo-util",
3
- "version": "1.21.1",
3
+ "version": "1.22.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -24,7 +24,7 @@
24
24
  "aggregation-repository-provider": "^5.2.34",
25
25
  "bitbucket-repository-provider": "^4.2.7",
26
26
  "commander": "^9.3.0",
27
- "etag-cache-leveldb": "^1.0.7",
27
+ "etag-cache-leveldb": "^1.0.8",
28
28
  "gitea-repository-provider": "^2.2.5",
29
29
  "github-repository-provider": "^7.30.7",
30
30
  "leveldown": "^6.1.1",
@@ -32,7 +32,6 @@ const { version, description } = JSON.parse(
32
32
  })
33
33
  );
34
34
 
35
-
36
35
  const properties = {};
37
36
 
38
37
  program
@@ -40,6 +39,7 @@ program
40
39
  .version(version)
41
40
  .option("--trace", "log level trace")
42
41
  .option("--debug", "log level debug")
42
+ .option("--cache", "cache requests")
43
43
  .option("-D --define <a=b>", "define property", str =>
44
44
  Object.assign(properties, Object.fromEntries([str.split(/=/)]))
45
45
  );
@@ -179,10 +179,9 @@ async function list(provider, names, options, slot, attributes, actions) {
179
179
  }
180
180
  }
181
181
 
182
- async function createCache()
183
- {
182
+ async function createCache() {
184
183
  const dir = join(homedir(), ".cache/repository-provider");
185
- await mkdir(dir,{ recursive: true });
184
+ await mkdir(dir, { recursive: true });
186
185
  const db = await levelup(leveldown(dir));
187
186
  return new ETagCacheLevelDB(db);
188
187
  }
@@ -194,8 +193,10 @@ async function prepareProvider(options) {
194
193
  process.env
195
194
  );
196
195
 
197
- const cache = await createCache();
198
- provider._providers.forEach(p => p.cache = cache);
196
+ if (options.cache) {
197
+ const cache = await createCache();
198
+ provider._providers.forEach(p => (p.cache = cache));
199
+ }
199
200
 
200
201
  provider.messageDestination = {
201
202
  trace: () => {},