From 970df7941025460513e21da9fbf6336f8d9ee07c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Fri, 19 Jan 2024 06:38:38 -0800 Subject: [PATCH] Add support for src directory in react-native (#42385) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .eslintrc.js | 5 ++++- jest.config.js | 5 ++++- packages/react-native/package.json | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index a72eae244cc98c..b0410b566e3456 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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, diff --git a/jest.config.js b/jest.config.js index f93c90dabb5881..35f1bffd875c9b 100644 --- a/jest.config.js +++ b/jest.config.js @@ -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/', diff --git a/packages/react-native/package.json b/packages/react-native/package.json index fd065b4eb88bbd..29efb6de5576f7 100644 --- a/packages/react-native/package.json +++ b/packages/react-native/package.json @@ -79,6 +79,7 @@ "sdks/hermes-engine", "sdks/hermesc", "settings.gradle.kts", + "src", "template.config.js", "template", "!template/node_modules",