Skip to content

Commit d1cf584

Browse files
huntiefacebook-github-bot
authored andcommitted
Replace .npmignore files, ignore all test/fixture/docs directories (#50784)
Summary: Pull Request resolved: #50784 Migrates us from several `.npmignore` files to `package.json#files`, for the main `react-native` package. This reduces the size of our npm package by 38 files — in particular, catching previously missed `__tests__` and `__docs__` directories. ```diff - npm notice package size: 4.4 MB - npm notice unpacked size: 23.7 MB - npm notice total files: 4533 + npm notice package size: 4.4 MB + npm notice unpacked size: 23.7 MB + npm notice total files: 4533 ``` NOTE: `"files"` or `.npmignore` — one or the other! - Having `.npmignore` at the package root does not behave(!). Having `"files"` as one source of truth is better and safer. See npm/cli#6221. Changelog: [Internal] Reviewed By: hoxyq Differential Revision: D73185321 fbshipit-source-id: 429c9fec4f447d63440a38bb8e3f3ce3bd155414
1 parent cd5991c commit d1cf584

File tree

9 files changed

+25
-34
lines changed

9 files changed

+25
-34
lines changed

packages/react-native/Libraries/.npmignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/react-native/ReactAndroid/.npmignore

Lines changed: 0 additions & 9 deletions
This file was deleted.

packages/react-native/ReactAndroid/external-artifacts/.npmignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/react-native/ReactAndroid/hermes-engine/.npmignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/react-native/package.json

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,48 +49,61 @@
4949
"React",
5050
"!React/Fabric/RCTThirdPartyFabricComponentsProvider.*",
5151
"ReactAndroid",
52+
"!ReactAndroid/.cxx",
53+
"!ReactAndroid/build",
54+
"!ReactAndroid/external-artifacts/artifacts",
55+
"!ReactAndroid/external-artifacts/build",
56+
"!ReactAndroid/hermes-engine/.cxx",
57+
"!ReactAndroid/hermes-engine/build",
58+
"!ReactAndroid/src/main/third-party",
59+
"!ReactAndroid/src/test",
5260
"ReactApple",
5361
"ReactCommon",
5462
"README.md",
5563
"rn-get-polyfills.js",
64+
"scripts/bundle.js",
65+
"scripts/cocoapods",
66+
"scripts/codegen",
5667
"scripts/compose-source-maps.js",
5768
"scripts/find-node-for-xcode.sh",
58-
"scripts/bundle.js",
5969
"scripts/generate-codegen-artifacts.js",
6070
"scripts/generate-provider-cli.js",
6171
"scripts/generate-specs-cli.js",
62-
"scripts/codegen",
63-
"!scripts/codegen/__tests__",
64-
"!scripts/codegen/__test_fixtures__",
6572
"scripts/hermes/hermes-utils.js",
6673
"scripts/hermes/prepare-hermes-for-build.js",
6774
"scripts/ios-configure-glog.sh",
68-
"scripts/xcode/ccache-clang++.sh",
69-
"scripts/xcode/ccache-clang.sh",
70-
"scripts/xcode/ccache.conf",
71-
"scripts/xcode/with-environment.sh",
7275
"scripts/native_modules.rb",
7376
"scripts/node-binary.sh",
74-
"scripts/packager.sh",
7577
"scripts/packager-reporter.js",
78+
"scripts/packager.sh",
7679
"scripts/react_native_pods_utils/script_phases.rb",
7780
"scripts/react_native_pods_utils/script_phases.sh",
7881
"scripts/react_native_pods.rb",
79-
"scripts/cocoapods",
80-
"!scripts/cocoapods/__tests__",
8182
"scripts/react-native-xcode.sh",
83+
"scripts/xcode/ccache-clang.sh",
84+
"scripts/xcode/ccache-clang++.sh",
85+
"scripts/xcode/ccache.conf",
86+
"scripts/xcode/with-environment.sh",
8287
"sdks/.hermesversion",
8388
"sdks/hermes-engine",
8489
"sdks/hermesc",
8590
"settings.gradle.kts",
8691
"src",
92+
"!src/private/testing",
8793
"template.config.js",
8894
"template",
8995
"!template/node_modules",
9096
"!template/package-lock.json",
9197
"!template/yarn.lock",
9298
"third-party-podspecs",
93-
"types"
99+
"types",
100+
"!**/__docs__/**",
101+
"!**/__fixtures__/**",
102+
"!**/__flowtests__/**",
103+
"!**/__mocks__/**",
104+
"!**/__test_fixtures__/**",
105+
"!**/__tests__/**",
106+
"!**/__typetests__/**"
94107
],
95108
"scripts": {
96109
"prepack": "node ./scripts/prepack.js",

packages/react-native/scripts/.npmignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

packages/react-native/src/.npmignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

packages/react-native/src/private/devsupport/rndevtools/.npmignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/react-native/types/.npmignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)