Skip to content

Commit

Permalink
Add support for src directory in react-native (facebook#42385)
Browse files Browse the repository at this point in the history
Summary:

This adds support for having JS files in a `src` directory within the `react-native` package. The plan is to have 2 subdirectories there:
* `react-native/src/private` for private modules, with any nested directories (e.g.: `react-native/src/private/dom/nodes/ReadOnlyNode.js`).
* `react-native/src/public` for public modules, without nested directories. The plan is that the individual modules created in this directory will be public through the index module or directly via something like `react-native/View` (mapped to `react-native/src/public/View`, or a `dist` directory in the published npm package—details TBD).

The enforcement of private modules being inaccessible from outside the `react-native` package will be added soon by huntie.

Changelog: [internal]

Reviewed By: huntie

Differential Revision: D52875999
  • Loading branch information
rubennorte authored and facebook-github-bot committed Jan 19, 2024
1 parent fd0ca4d commit 7d2ee3b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ module.exports = {
},
},
{
files: ['packages/react-native/Libraries/**/*.js'],
files: [
'packages/react-native/Libraries/**/*.js',
'packages/react-native/src/**/*.js',
],
rules: {
'@react-native/platform-colors': 2,
'@react-native/specs/react-native-modules': 2,
Expand Down
5 changes: 4 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ module.exports = {
'denodeify',
],
testEnvironment: 'node',
collectCoverageFrom: ['packages/react-native/Libraries/**/*.js'],
collectCoverageFrom: [
'packages/react-native/Libraries/**/*.js',
'packages/react-native/src/**/*.js',
],
coveragePathIgnorePatterns: [
'/__tests__/',
'/vendor/',
Expand Down
1 change: 1 addition & 0 deletions packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"sdks/hermes-engine",
"sdks/hermesc",
"settings.gradle.kts",
"src",
"template.config.js",
"template",
"!template/node_modules",
Expand Down

0 comments on commit 7d2ee3b

Please sign in to comment.