Skip to content

Commit a67f24b

Browse files
authored
Major upgrade globby (#1716)
* Major upgrade globby * Fix
1 parent ebafd63 commit a67f24b

File tree

4 files changed

+81
-30
lines changed

4 files changed

+81
-30
lines changed

package-lock.json

Lines changed: 72 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"dotenv": "17.x",
3636
"execa": "5.x.x",
3737
"fs-extra": "11.x.x",
38-
"globby": "11.x.x",
38+
"globby": "^16.0.0",
3939
"js-yaml": "4.x.x",
4040
"jsonpointer": "5.x.x",
4141
"micromatch": "4.x.x",

src/job.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {handler} from "./handler.js";
1616
import * as yaml from "js-yaml";
1717
import {Parser} from "./parser.js";
1818
import {resolveIncludeLocal, validateIncludeLocal} from "./parser-includes.js";
19-
import globby from "globby";
19+
import {globbySync} from "globby";
2020
import terminalLink from "terminal-link";
2121
import * as crypto from "crypto";
2222
import * as path from "path";
@@ -63,6 +63,8 @@ export interface Need {
6363
project?: string;
6464
}
6565

66+
const isGlob = (str: string) => /[*?{}(|)[\]]/.test(str);
67+
6668
const dateFormatter = new Intl.DateTimeFormat(undefined, {
6769
year: undefined,
6870
month: undefined,
@@ -1325,11 +1327,11 @@ If you know what you're doing and would like to suppress this warning, use one o
13251327
}
13261328

13271329
let path = _path;
1328-
if (globby.hasMagic(path) && !path.endsWith("*")) {
1330+
if (isGlob(path) && !path.endsWith("*")) {
13291331
path = `${path}/**`;
13301332
}
13311333

1332-
let numOfFiles = globby.sync(path, {
1334+
let numOfFiles = globbySync(path, {
13331335
dot: true,
13341336
onlyFiles: false,
13351337
cwd: `${this.argv.cwd}/${stateDir}/cache/${cacheName}`,
@@ -1340,7 +1342,7 @@ If you know what you're doing and would like to suppress this warning, use one o
13401342
continue;
13411343
}
13421344

1343-
if (!globby.hasMagic(path)) numOfFiles++; // add one because the pattern itself is a folder
1345+
if (!isGlob(path)) numOfFiles++; // add one because the pattern itself is a folder
13441346

13451347
writeStreams.stdout(`${_path}: found ${numOfFiles} artifact files and directories\n`);
13461348
}

src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import execa from "execa";
99
import assert from "assert";
1010
import {CICDVariable} from "./variables-from-files.js";
1111
import {GitData} from "./git-data.js";
12-
import globby from "globby";
12+
import {globbySync} from "globby";
1313
import micromatch from "micromatch";
1414
import {AxiosRequestConfig} from "axios";
1515
import path from "path";
@@ -329,7 +329,7 @@ export class Utils {
329329
if (pattern == "") {
330330
continue;
331331
}
332-
if (globby.sync(pattern, {dot: true, cwd}).length > 0) {
332+
if (globbySync(pattern, {dot: true, cwd}).length > 0) {
333333
return true;
334334
}
335335
}

0 commit comments

Comments
 (0)