Skip to content

Commit

Permalink
fix: set rootDir token to workspace root
Browse files Browse the repository at this point in the history
  • Loading branch information
sbekrin authored and danez committed Nov 13, 2019
1 parent ff54966 commit 1806570
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion packages/spire/lib/create-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ function createResolver(context, core) {
typeof entryPathOrFn === 'string'
? requireFrom(
context.cwd,
entryPathOrFn.replace(/<rootDir>/g, context.cwd)
entryPathOrFn.replace(
/<rootDir>/g,
// `INIT_CWD` is set by both npm and yarn, which represent an actual path
// where the command was executed from. We'll use it if set to properly
// resolve workspace root.
context.env.INIT_CWD || context.cwd
)
)
: entryPathOrFn;
validatePlugin(createEntry);
Expand Down
2 changes: 1 addition & 1 deletion packages/spire/tests/config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('spire', () => {
'package.json': JSON.stringify({
name: 'spire-test-config',
spire: {
extends: '<rootDir>/spire-config-baz.js',
extends: './spire-config-baz.js',
},
}),
});
Expand Down
2 changes: 1 addition & 1 deletion packages/spire/tests/hooks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('spire', () => {
'package.json': JSON.stringify({
name: 'spire-test-hooks',
spire: {
extends: '<rootDir>/spire-config.js',
extends: './spire-config.js',
},
}),
});
Expand Down

0 comments on commit 1806570

Please sign in to comment.