Skip to content

Commit

Permalink
fix(bootstrap): respect --force-local option
Browse files Browse the repository at this point in the history
Before this change, `--force-local` option was not respected and
monorepo-local packages outside of the defined --scope were still
installed from the npm registry.

This commit fixes the code handling `--force-local` logic, so that:
- Local packages are resolved as links within the monorepo
- The following warning IS NOT printed anymore:
  _Installing local packages that do not match filters from registry_

Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
  • Loading branch information
bajtos committed May 23, 2019
1 parent 285bd7e commit 959a00a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Expand Up @@ -319,9 +319,6 @@ Object {
"bar@^2.0.0",
"foo@^1.0.0",
],
"packages/package-4": Array [
"package-3@^1.0.0",
],
}
`;

Expand All @@ -332,6 +329,21 @@ Array [
"dest": "packages/package-4/node_modules/@test/package-1",
"type": "junction",
},
Object {
"_src": "packages/package-3",
"dest": "packages/package-4/node_modules/package-3",
"type": "junction",
},
Object {
"_src": "packages/package-3/cli1.js",
"dest": "packages/package-4/node_modules/.bin/package3cli1",
"type": "exec",
},
Object {
"_src": "packages/package-3/cli2.js",
"dest": "packages/package-4/node_modules/.bin/package3cli2",
"type": "exec",
},
]
`;

Expand Down
2 changes: 1 addition & 1 deletion commands/bootstrap/index.js
Expand Up @@ -161,7 +161,7 @@ class BootstrapCommand extends Command {
chain = chain.then(filteredPackages => {
this.filteredPackages = filteredPackages;

if (filteredPackages.length !== this.targetGraph.size) {
if (filteredPackages.length !== this.targetGraph.size && !this.options.forceLocal) {
this.logger.warn("bootstrap", "Installing local packages that do not match filters from registry");

// an explicit --scope, --ignore, or --since should only symlink the targeted packages, no others
Expand Down

0 comments on commit 959a00a

Please sign in to comment.