Skip to content

Commit

Permalink
remove "main" package.json entries and build step
Browse files Browse the repository at this point in the history
Summary:
Conform to the style of other packages that are built using the monorepo build script, which don't use the `"main"` field.  Instead these utilise:

- root level `index.flow.js` → `src/`
- .flowconfig (both github and other) to resolve the module.

Changelog: [Internal]

Differential Revision: D56879279
  • Loading branch information
blakef authored and facebook-github-bot committed May 3, 2024
1 parent 9445d50 commit 5e88de6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ munge_underscores=true
module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/packages/react-native/index.js'
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/packages/react-native/\1'
module.name_mapper='^@react-native/dev-middleware$' -> '<PROJECT_ROOT>/packages/dev-middleware'
module.name_mapper='^@react-native/core-cli-utils\(.*\)$' -> '<PROJECT_ROOT>/packages/core-cli-utils/\1'
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/packages/react-native/Libraries/Image/RelativeImageStub'

suppress_type=$FlowIssue
Expand Down
12 changes: 12 additions & 0 deletions packages/core-cli-utils/index.js.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
* @oncall react_native
*/

export * from './src';
1 change: 0 additions & 1 deletion packages/core-cli-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "0.75.0-main",
"description": "React Native CLI library for Frameworks to build on",
"license": "MIT",
"main": "./src/index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/facebook/react-native.git",
Expand Down
4 changes: 0 additions & 4 deletions scripts/build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,6 @@ async function rewritePackageExports(packageName /*: string */) {
}
pkg.exports = rewriteExportsField(pkg.exports);

if (pkg.main != null) {
pkg.main = rewriteExportsTarget(pkg.main);
}

await fs.writeFile(packageJsonPath, JSON.stringify(pkg, null, 2) + '\n');
}

Expand Down

0 comments on commit 5e88de6

Please sign in to comment.