Skip to content

Commit

Permalink
feat(deps): globby@^11.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
evocateur committed Nov 17, 2020
1 parent e0e74d4 commit 6cb5bbe
Show file tree
Hide file tree
Showing 13 changed files with 585 additions and 896 deletions.
2 changes: 1 addition & 1 deletion commands/create/package.json
Expand Up @@ -41,7 +41,7 @@
"camelcase": "^5.0.0",
"dedent": "^0.7.0",
"fs-extra": "^8.1.0",
"globby": "^9.2.0",
"globby": "^11.0.1",
"init-package-json": "^2.0.1",
"npm-package-arg": "^8.1.0",
"p-reduce": "^2.1.0",
Expand Down
11 changes: 6 additions & 5 deletions core/project/index.js
Expand Up @@ -132,16 +132,17 @@ class Project {
const search = globby.sync(Project.LICENSE_GLOB, {
cwd: this.rootPath,
absolute: true,
case: false,
caseSensitiveMatch: false,
// Project license is always a sibling of the root manifest
deep: false,
// POSIX results always need to be normalized
transform: (fp) => path.normalize(fp),
deep: 0,
});

licensePath = search.shift();

if (licensePath) {
// POSIX results always need to be normalized
licensePath = path.normalize(licensePath);

// redefine getter to lazy-loaded value
Object.defineProperty(this, "licensePath", {
value: licensePath,
Expand Down Expand Up @@ -186,7 +187,7 @@ class Project {
}

getPackageLicensePaths() {
return this.fileFinder(Project.LICENSE_GLOB, null, { case: false });
return this.fileFinder(Project.LICENSE_GLOB, null, { caseSensitiveMatch: false });
}

isIndependent() {
Expand Down
21 changes: 16 additions & 5 deletions core/project/lib/make-file-finder.js
Expand Up @@ -8,14 +8,19 @@ const ValidationError = require("@lerna/validation-error");
module.exports.makeFileFinder = makeFileFinder;
module.exports.makeSyncFileFinder = makeSyncFileFinder;

/**
* @param {string[]} results
*/
function normalize(results) {
return results.map((fp) => path.normalize(fp));
}

function getGlobOpts(rootPath, packageConfigs) {
const globOpts = {
cwd: rootPath,
absolute: true,
expandDirectories: false,
followSymlinkedDirectories: false,
// POSIX results always need to be normalized
transform: (fp) => path.normalize(fp),
followSymbolicLinks: false,
};

if (packageConfigs.some((cfg) => cfg.indexOf("**") > -1)) {
Expand Down Expand Up @@ -44,11 +49,14 @@ function makeFileFinder(rootPath, packageConfigs) {
const promise = pMap(
Array.from(packageConfigs).sort(),
(globPath) => {
let chain = globby(path.join(globPath, fileName), options);
let chain = globby(path.posix.join(globPath, fileName), options);

// fast-glob does not respect pattern order, so we re-sort by absolute path
chain = chain.then((results) => results.sort());

// POSIX results always need to be normalized
chain = chain.then(normalize);

if (fileMapper) {
chain = chain.then(fileMapper);
}
Expand All @@ -68,10 +76,13 @@ function makeSyncFileFinder(rootPath, packageConfigs) {

return (fileName, fileMapper, customGlobOpts) => {
const options = Object.assign({}, customGlobOpts, globOpts);
const patterns = packageConfigs.map((globPath) => path.join(globPath, fileName)).sort();
const patterns = packageConfigs.map((globPath) => path.posix.join(globPath, fileName)).sort();

let results = globby.sync(patterns, options);

// POSIX results always need to be normalized
results = normalize(results);

/* istanbul ignore else */
if (fileMapper) {
results = results.map(fileMapper);
Expand Down
2 changes: 1 addition & 1 deletion core/project/package.json
Expand Up @@ -38,7 +38,7 @@
"dedent": "^0.7.0",
"dot-prop": "^4.2.0",
"glob-parent": "^5.0.0",
"globby": "^9.2.0",
"globby": "^11.0.1",
"load-json-file": "^6.2.0",
"npmlog": "^4.1.2",
"p-map": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion helpers/load-manifests/index.js
Expand Up @@ -18,7 +18,7 @@ function loadPkgManifests(cwd) {
{
cwd,
absolute: true,
followSymlinkedDirectories: false,
followSymbolicLinks: false,
}
).then((files) => Promise.all(files.sort().map((fp) => loadJsonFile(fp))));
}
2 changes: 1 addition & 1 deletion helpers/load-manifests/package.json
Expand Up @@ -6,7 +6,7 @@
"private": true,
"license": "MIT",
"dependencies": {
"globby": "^9.2.0",
"globby": "^11.0.1",
"load-json-file": "^6.2.0"
}
}
2 changes: 1 addition & 1 deletion integration/lerna-bootstrap-hoist.test.js
Expand Up @@ -42,7 +42,7 @@ package-3 cli2 package-2 OK
const config = {
cwd,
absolute: true,
followSymlinkedDirectories: false,
followSymbolicLinks: false,
};
const lockfiles = await globby(["**/package-lock.json"], config);
const [lock3, rootLock] = await Promise.all(lockfiles.sort().map((fp) => fs.readJson(fp)));
Expand Down
Expand Up @@ -134,7 +134,7 @@ Successfully published:
const changelogFilePaths = await globby(["**/CHANGELOG.md"], {
cwd,
absolute: true,
followSymlinkedDirectories: false,
followSymbolicLinks: false,
});
const [
rootChangelog,
Expand Down
2 changes: 1 addition & 1 deletion integration/lerna-publish-conventional-fixed.test.js
Expand Up @@ -59,7 +59,7 @@ Successfully published:
const changelogFilePaths = await globby(["**/CHANGELOG.md"], {
cwd,
absolute: true,
followSymlinkedDirectories: false,
followSymbolicLinks: false,
});
const [
rootChangelog,
Expand Down
Expand Up @@ -156,7 +156,7 @@ Successfully published:
const changelogFilePaths = await globby(["**/CHANGELOG.md"], {
cwd,
absolute: true,
followSymlinkedDirectories: false,
followSymbolicLinks: false,
});
const [
// no root changelog
Expand Down
2 changes: 1 addition & 1 deletion integration/lerna-publish-conventional-independent.test.js
Expand Up @@ -59,7 +59,7 @@ Successfully published:
const changelogFilePaths = await globby(["**/CHANGELOG.md"], {
cwd,
absolute: true,
followSymlinkedDirectories: false,
followSymbolicLinks: false,
});
const [
// no root changelog
Expand Down

0 comments on commit 6cb5bbe

Please sign in to comment.