-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve .babelrc files in a monorepo. (#4132)
* Resolve .babelrc files in a monorepo. * Resolve .babelrc files in a monorepo. * Add a unit test. Co-authored-by: Jasper De Moor <[email protected]>
- Loading branch information
1 parent
7418b91
commit bb5ad3d
Showing
14 changed files
with
107 additions
and
1 deletion.
There are no files selected for viewing
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
13 changes: 13 additions & 0 deletions
13
...ges/core/integration-tests/test/integration/babel-config-monorepo/babel-plugin-dummy-1.js
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,13 @@ | ||
module.exports = () => { | ||
return { | ||
visitor: { | ||
StringLiteral(path, state) { | ||
const opts = state.opts; | ||
|
||
if (path.node.value === 'REPLACE_ME') { | ||
path.node.value = 'string from a plugin in babel.config.json'; | ||
} | ||
} | ||
} | ||
}; | ||
}; |
4 changes: 4 additions & 0 deletions
4
packages/core/integration-tests/test/integration/babel-config-monorepo/babel.config.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 @@ | ||
{ | ||
"plugins": ["./babel-plugin-dummy-1"] | ||
} | ||
|
5 changes: 5 additions & 0 deletions
5
packages/core/integration-tests/test/integration/babel-config-monorepo/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,5 @@ | ||
{ | ||
"name": "monorepo-babel-config", | ||
"private": true, | ||
"workspaces": ["pkg-a", "pkg-b"] | ||
} |
4 changes: 4 additions & 0 deletions
4
...ges/core/integration-tests/test/integration/babel-config-monorepo/packages/pkg-a/.babelrc
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 @@ | ||
{ | ||
"plugins": ["./babel-plugin-dummy-2"] | ||
} | ||
|
13 changes: 13 additions & 0 deletions
13
...ation-tests/test/integration/babel-config-monorepo/packages/pkg-a/babel-plugin-dummy-2.js
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,13 @@ | ||
module.exports = () => { | ||
return { | ||
visitor: { | ||
StringLiteral(path, state) { | ||
const opts = state.opts; | ||
|
||
if (path.node.value === 'ANOTHER_THING_TO_REPLACE') { | ||
path.node.value = 'string from a plugin in .babelrc'; | ||
} | ||
} | ||
} | ||
}; | ||
}; |
3 changes: 3 additions & 0 deletions
3
...core/integration-tests/test/integration/babel-config-monorepo/packages/pkg-a/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": "pkg-a" | ||
} |
6 changes: 6 additions & 0 deletions
6
...core/integration-tests/test/integration/babel-config-monorepo/packages/pkg-a/src/index.js
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,6 @@ | ||
module.exports = function() { | ||
const thing1 = "REPLACE_ME"; | ||
const thing2 = "ANOTHER_THING_TO_REPLACE" | ||
const thing3 = "SOMETHING ELSE" | ||
return thing1 + thing2 + thing3; | ||
} |
4 changes: 4 additions & 0 deletions
4
...ges/core/integration-tests/test/integration/babel-config-monorepo/packages/pkg-b/.babelrc
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 @@ | ||
{ | ||
"plugins": ["./babel-plugin-dummy-3"] | ||
} | ||
|
13 changes: 13 additions & 0 deletions
13
...ation-tests/test/integration/babel-config-monorepo/packages/pkg-b/babel-plugin-dummy-3.js
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,13 @@ | ||
module.exports = () => { | ||
return { | ||
visitor: { | ||
StringLiteral(path, state) { | ||
const opts = state.opts; | ||
|
||
if (path.node.value === 'ANOTHER_THING_TO_REPLACE') { | ||
path.node.value = 'string from a plugin from a different sub-package'; | ||
} | ||
} | ||
} | ||
}; | ||
}; |
3 changes: 3 additions & 0 deletions
3
...core/integration-tests/test/integration/babel-config-monorepo/packages/pkg-b/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": "pkg-b" | ||
} |
6 changes: 6 additions & 0 deletions
6
...core/integration-tests/test/integration/babel-config-monorepo/packages/pkg-b/src/index.js
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,6 @@ | ||
module.exports = function() { | ||
const thing1 = "REPLACE_ME"; | ||
const thing2 = "ANOTHER_THING_TO_REPLACE" | ||
const thing3 = "SOMETHING ELSE" | ||
return thing1 + thing2 + thing3; | ||
} |
Empty file.
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