Skip to content

Commit 16a61bf

Browse files
huntiefacebook-github-bot
authored andcommitted
Remove .npmignore files from other packages, add lint check (#50786)
Summary: Pull Request resolved: #50786 Follows #50784. Having any `.npmignore` files is a gotcha — remove and replace with `package.json#files`. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D73193257 fbshipit-source-id: de715d74195e4f53c817c11f244a61c79b8ce5bc
1 parent 0918749 commit 16a61bf

File tree

14 files changed

+84
-37
lines changed

14 files changed

+84
-37
lines changed

.github/actions/lint/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ runs:
2929
- name: Lint java
3030
shell: bash
3131
run: ./.github/workflow-scripts/exec_swallow_error.sh yarn lint-java --check
32+
- name: Lint file structure
33+
shell: bash
34+
run: ./.github/workflow-scripts/lint_files.sh
3235
- name: Verify not committing repo after running build
3336
shell: bash
3437
run: yarn run build --check
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
#
4+
# This source code is licensed under the MIT license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
set -e
8+
9+
if git ls-files | grep -E '\.npmignore$'; then
10+
echo "Error: Found unexpected .npmignore file(s). Please use package.json#files instead."
11+
exit 1
12+
fi

packages/assets/.npmignore

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

packages/assets/package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,14 @@
1818
"bugs": "https://github.com/facebook/react-native/issues",
1919
"engines": {
2020
"node": ">=18"
21-
}
21+
},
22+
"files": [
23+
"path-support.js",
24+
"registry.js",
25+
"README.md",
26+
"!**/__docs__/**",
27+
"!**/__fixtures__/**",
28+
"!**/__mocks__/**",
29+
"!**/__tests__/**"
30+
]
2231
}

packages/normalize-color/.npmignore

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

packages/normalize-color/package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,13 @@
1515
"normalize-colors",
1616
"react-native"
1717
],
18-
"bugs": "https://github.com/facebook/react-native/issues"
18+
"bugs": "https://github.com/facebook/react-native/issues",
19+
"files": [
20+
"index.js",
21+
"README.md",
22+
"!**/__docs__/**",
23+
"!**/__fixtures__/**",
24+
"!**/__mocks__/**",
25+
"!**/__tests__/**"
26+
]
1927
}

packages/polyfills/.npmignore

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

packages/polyfills/package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,15 @@
1919
"bugs": "https://github.com/facebook/react-native/issues",
2020
"engines": {
2121
"node": ">=18"
22-
}
22+
},
23+
"files": [
24+
"console.js",
25+
"error-guard.js",
26+
"index.js",
27+
"README.md",
28+
"!**/__docs__/**",
29+
"!**/__fixtures__/**",
30+
"!**/__mocks__/**",
31+
"!**/__tests__/**"
32+
]
2333
}

packages/react-native-babel-preset/.npmignore

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

packages/react-native-babel-preset/package.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"name": "@react-native/babel-preset",
33
"version": "0.80.0-main",
44
"description": "Babel preset for React Native applications",
5-
"main": "src/index.js",
65
"repository": {
76
"type": "git",
87
"url": "git+ssh://git@github.com/facebook/react-native.git"
@@ -13,6 +12,18 @@
1312
"react-native"
1413
],
1514
"license": "MIT",
15+
"engines": {
16+
"node": ">=18"
17+
},
18+
"main": "src/index.js",
19+
"files": [
20+
"src",
21+
"README.md",
22+
"!**/__docs__/**",
23+
"!**/__fixtures__/**",
24+
"!**/__mocks__/**",
25+
"!**/__tests__/**"
26+
],
1627
"dependencies": {
1728
"@babel/core": "^7.25.2",
1829
"@babel/plugin-proposal-export-default-from": "^7.24.7",
@@ -62,8 +73,5 @@
6273
},
6374
"peerDependencies": {
6475
"@babel/core": "*"
65-
},
66-
"engines": {
67-
"node": ">=18"
6876
}
6977
}

packages/react-native-babel-transformer/.npmignore

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

packages/react-native-babel-transformer/package.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"name": "@react-native/metro-babel-transformer",
33
"version": "0.80.0-main",
44
"description": "Babel transformer for React Native applications.",
5-
"main": "src/index.js",
65
"repository": {
76
"type": "git",
87
"url": "git+ssh://git@github.com/facebook/react-native.git",
@@ -14,6 +13,18 @@
1413
"metro"
1514
],
1615
"license": "MIT",
16+
"engines": {
17+
"node": ">=18"
18+
},
19+
"main": "src/index.js",
20+
"files": [
21+
"src",
22+
"README.md",
23+
"!**/__docs__/**",
24+
"!**/__fixtures__/**",
25+
"!**/__mocks__/**",
26+
"!**/__tests__/**"
27+
],
1728
"dependencies": {
1829
"@babel/core": "^7.25.2",
1930
"@react-native/babel-preset": "0.80.0-main",
@@ -22,8 +33,5 @@
2233
},
2334
"peerDependencies": {
2435
"@babel/core": "*"
25-
},
26-
"engines": {
27-
"node": ">=18"
2836
}
2937
}

packages/virtualized-lists/.npmignore

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

packages/virtualized-lists/package.json

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
"version": "0.80.0-main",
44
"description": "Virtualized lists for React Native.",
55
"license": "MIT",
6-
"exports": {
7-
".": "./index.js",
8-
"./package.json": "./package.json"
9-
},
106
"repository": {
117
"type": "git",
128
"url": "git+https://github.com/facebook/react-native.git",
@@ -23,6 +19,21 @@
2319
"engines": {
2420
"node": ">=18"
2521
},
22+
"exports": {
23+
".": "./index.js",
24+
"./package.json": "./package.json"
25+
},
26+
"files": [
27+
"index.js",
28+
"index.d.ts",
29+
"Lists",
30+
"README.md",
31+
"Utilities",
32+
"!**/__docs__/**",
33+
"!**/__fixtures__/**",
34+
"!**/__mocks__/**",
35+
"!**/__tests__/**"
36+
],
2637
"dependencies": {
2738
"invariant": "^2.2.4",
2839
"nullthrows": "^1.1.1"

0 commit comments

Comments
 (0)