-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(expo-module-scripts): add cli-specific babel and jest configs (…
…#25458) # Why This is a follow-up to both deprecate `@expo/babel-preset-cli` and allow all `@expo/*` or CLI packages to use `expo-module-scripts` within this repository. An open question here would be, do we want all Expo Config Plugins also to reuse this new Node target babel config. These plugins should always execute in the same environment as the CLI tooling, so I see no reason why it should extend the `babel-preset-expo`, which targets Metro/RN. Alternatively, if we don't want to merge `@expo/babel-preset-cli` inside `expo-module-scripts`, we can still move over `@expo/babel-preset-cli` and keep it around for now. # How - Added `babel.config.node.js`, which is specific to our Node CLI target. - Added `jest-preset-node.js` that uses the `babel.config.node.js` by default. # Test Plan See if CI passes. If this PR gets accepted, I'll rebase the huge list of #25426 and ensure the config is good to go. # Checklist <!-- Please check the appropriate items below if they apply to your diff. This is required for changes to Expo modules. --> - [x] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). --------- Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
- Loading branch information
Showing
9 changed files
with
54 additions
and
10 deletions.
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
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,27 @@ | ||
module.exports = function (api) { | ||
api.cache(true); | ||
return { | ||
presets: [ | ||
[ | ||
require('@babel/preset-env'), | ||
{ | ||
modules: false, // Disable the default `modules-commonjs`, to enable lazy evaluation | ||
targets: { | ||
node: '12.0.0', | ||
}, | ||
}, | ||
], | ||
require('@babel/preset-typescript'), | ||
], | ||
plugins: [ | ||
require('babel-plugin-dynamic-import-node'), | ||
require('@babel/plugin-proposal-export-namespace-from'), | ||
[ | ||
require('@babel/plugin-transform-modules-commonjs'), | ||
{ | ||
lazy: /* istanbul ignore next */ (source) => true, | ||
}, | ||
], | ||
], | ||
}; | ||
}; |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module.exports = function(api) { | ||
module.exports = function (api) { | ||
api.cache(true); | ||
return { | ||
plugins: ['@babel/plugin-transform-flow-strip-types'], | ||
plugins: ['@babel/plugin-transform-flow-strip-types'], | ||
}; | ||
}; |
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,12 @@ | ||
/** @type {import('jest').Config} */ | ||
module.exports = { | ||
testEnvironment: 'node', | ||
testRegex: '/__tests__/.*(test|spec)\\.[jt]sx?$', | ||
transform: { | ||
'^.+\\.[jt]sx?$': ['babel-jest', { configFile: require.resolve('./babel.config.cli.js') }], | ||
}, | ||
watchPlugins: [ | ||
require.resolve('jest-watch-typeahead/filename'), | ||
require.resolve('jest-watch-typeahead/testname'), | ||
], | ||
}; |
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
Submodule react-native
updated
3969 files
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