Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(import): Ensure compatibility with root-level package globs (#1875)
Fixes #1872
- Loading branch information
Showing
8 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
commands/import/__tests__/__fixtures__/root-packages/lerna.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"version": "1.0.0", | ||
"packages": ["mycompany-*"] | ||
} |
3 changes: 3 additions & 0 deletions
3
commands/import/__tests__/__fixtures__/root-packages/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name": "mycompany-root" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"use strict"; | ||
|
||
const path = require("path"); | ||
const fs = require("fs-extra"); | ||
const tempy = require("tempy"); | ||
const copyFixture = require("@lerna-test/copy-fixture"); | ||
const gitAdd = require("@lerna-test/git-add"); | ||
const gitCommit = require("@lerna-test/git-commit"); | ||
const gitInit = require("@lerna-test/git-init"); | ||
|
||
module.exports = initNamedFixture; | ||
|
||
function initNamedFixture(startDir) { | ||
return (dirName, fixtureName, commitMessage = "Init commit") => { | ||
const cwd = path.join(tempy.directory(), dirName); | ||
let chain = Promise.resolve(); | ||
|
||
chain = chain.then(() => fs.ensureDir(cwd)); | ||
chain = chain.then(() => process.chdir(cwd)); | ||
chain = chain.then(() => copyFixture(cwd, fixtureName, startDir)); | ||
chain = chain.then(() => gitInit(cwd, ".")); | ||
|
||
if (commitMessage) { | ||
chain = chain.then(() => gitAdd(cwd, "-A")); | ||
chain = chain.then(() => gitCommit(cwd, commitMessage)); | ||
} | ||
|
||
return chain.then(() => cwd); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "@lerna-test/init-named-fixture", | ||
"version": "0.0.0-test-only", | ||
"description": "A local test helper", | ||
"main": "index.js", | ||
"private": true, | ||
"license": "MIT", | ||
"dependencies": { | ||
"@lerna-test/copy-fixture": "file:../copy-fixture", | ||
"@lerna-test/git-add": "file:../git-add", | ||
"@lerna-test/git-commit": "file:../git-commit", | ||
"@lerna-test/git-init": "file:../git-init", | ||
"tempy": "^0.2.1", | ||
"fs-extra": "^7.0.0" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters