decap-cms-backend-github 3.0.1 → 3.0.2

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.
@@ -339,12 +339,12 @@ class GitHub {
339
339
  files[_decapCmsLibUtil.CURSOR_COMPATIBILITY_SYMBOL] = cursor;
340
340
  return files;
341
341
  }
342
- async allEntriesByFolder(folder, extension, depth) {
342
+ async allEntriesByFolder(folder, extension, depth, pathRegex) {
343
343
  const repoURL = this.api.originRepoURL;
344
344
  const listFiles = () => this.api.listFiles(folder, {
345
345
  repoURL,
346
346
  depth
347
- }).then(files => files.filter(file => (0, _decapCmsLibUtil.filterByExtension)(file, extension)));
347
+ }).then(files => files.filter(file => (!pathRegex || pathRegex.test(file.path)) && (0, _decapCmsLibUtil.filterByExtension)(file, extension)));
348
348
  const readFile = (path, id) => {
349
349
  return this.api.readFile(path, id, {
350
350
  repoURL
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "decap-cms-backend-github",
3
3
  "description": "GitHub backend for Decap CMS",
4
- "version": "3.0.1",
4
+ "version": "3.0.2",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/decaporg/decap-cms/tree/master/packages/decap-cms-backend-github",
7
7
  "bugs": "https://github.com/decaporg/decap-cms/issues",
@@ -40,5 +40,5 @@
40
40
  "prop-types": "^15.7.2",
41
41
  "react": "^16.8.4 || ^17.0.0"
42
42
  },
43
- "gitHead": "2f0f9dbd1654868da59cbdbaa2c9dce1d1bcb2c6"
43
+ "gitHead": "45447cef915f2e6edfaf55ad402535c687f95f37"
44
44
  }
@@ -401,14 +401,18 @@ export default class GitHub implements Implementation {
401
401
  return files;
402
402
  }
403
403
 
404
- async allEntriesByFolder(folder: string, extension: string, depth: number) {
404
+ async allEntriesByFolder(folder: string, extension: string, depth: number, pathRegex?: RegExp) {
405
405
  const repoURL = this.api!.originRepoURL;
406
406
 
407
407
  const listFiles = () =>
408
408
  this.api!.listFiles(folder, {
409
409
  repoURL,
410
410
  depth,
411
- }).then(files => files.filter(file => filterByExtension(file, extension)));
411
+ }).then(files =>
412
+ files.filter(
413
+ file => (!pathRegex || pathRegex.test(file.path)) && filterByExtension(file, extension),
414
+ ),
415
+ );
412
416
 
413
417
  const readFile = (path: string, id: string | null | undefined) => {
414
418
  return this.api!.readFile(path, id, { repoURL }) as Promise<string>;