Skip to content
This repository was archived by the owner on Nov 18, 2024. It is now read-only.

Commit fcf2390

Browse files
kayhadrinfacebook-github-bot
authored andcommitted
chore: add/improve npm ignore configs (#328)
Summary: I noticed that a bunch of test files were being bundled with npm packages. We encounter also the risk to bundle log and .tgz (npm packged module) files when running npm publish. This diff attends to this problem by improving/adding an `.npmignore` config to each sub-module. I've also updated the CHANGELOG.md file and even fixed-up some other things (like adding a missing section for one of our modules). Pull Request resolved: #328 Test Plan: Script to generate list of npm package files: ``` function packlist() { pushd "packages/$1" yarn pack > /dev/null; npx npm-packlist | sort popd > /dev/null } echo "" > packlist.log packlist babel-plugin-fbt >> packlist.log packlist babel-plugin-fbt-runtime >> packlist.log packlist babel-plugin-standalone >> packlist.log packlist default-collection-transform >> packlist.log packlist fb-babel-plugin-utils >> packlist.log packlist fb-tiger-hash >> packlist.log packlist fbt >> packlist.log packlist gulp-rewrite-flowtyped-modules >> packlist.log packlist gulp-strip-docblock-pragmas >> packlist.log packlist react-native-fbt >> packlist.log pastry < packlist.log ``` Comparison of the exported files: https://fburl.com/diffing/2gj65k9b ---- ``` yarn clean-test ``` Reviewed By: pkqinys Differential Revision: D33652464 Pulled By: kayhadrin fbshipit-source-id: ac65707a25a523f7d8d82b7923b288ad229281dd
1 parent 4469556 commit fcf2390

File tree

12 files changed

+116
-16
lines changed

12 files changed

+116
-16
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ yarn-error.log
77
.flow-results
88
# file checksums used by gulp-once
99
.checksums
10+
# Ignore npm pack files generated during npm publish testing
11+
**.tgz
1012

1113
# MacOS
1214
.DS_Store

CHANGELOG.md

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ List of changes for each released npm package version.
1212
- [fb-tiger-hash versions](#fb-tiger-hash-versions)
1313
- [fb-babel-plugin-utils versions](#fb-babel-plugin-utils-versions)
1414
- [gulp-rewrite-flowtyped-modules versions](#gulp-rewrite-flowtyped-modules-versions)
15+
- [gulp-strip-docblock-pragmas versions](#gulp-strip-docblock-pragmas-versions)
1516
- [react-native-fbt versions](#react-native-fbt-versions)
1617
- [fbt-rn-android-native versions [Deprecated]](#fbt-rn-android-native-versions-deprecated)
1718

@@ -55,6 +56,8 @@ List of changes for each released npm package version.
5556
Unreleased changes that have landed in main. Click to see more.
5657
</summary>
5758

59+
- [chore] Add `.npmignore` config (avoid exporting some build, debug & test files)
60+
5861
</details>
5962

6063
- 0.17.0:
@@ -151,6 +154,8 @@ List of changes for each released npm package version.
151154
Unreleased changes that have landed in main. Click to see more.
152155
</summary>
153156

157+
- [chore] Improve `.npmignore` config (avoid exporting some build, debug & test files)
158+
154159
0.21.0-rc8-beta
155160
- [fix]! Prevent `fbt.sameParam` from referring to a non-existent token name or a plural construct token
156161
- [fix]! Prevent token name collisions among fbt constructs across all nesting levels
@@ -307,11 +312,12 @@ List of changes for each released npm package version.
307312
<details>
308313
<summary>
309314
Unreleased changes that have landed in main. Click to see more.
310-
311-
- [chore] Update fbtRuntime-test.js after the definition of `hash_key` in
312-
fbtJenkinsHash.js was modified
313-
- [refactor] Move clear token replacement logic to babel-plugin-fbt/src/FbtUtil.js
314315
</summary>
316+
317+
- [chore] Improve `.npmignore` config (avoid exporting some build, debug & test files)
318+
- [chore] Update fbtRuntime-test.js after the definition of `hash_key` in
319+
fbtJenkinsHash.js was modified
320+
- [refactor] Move clear token replacement logic to babel-plugin-fbt/src/FbtUtil.js
315321
</details>
316322

317323
- 0.10.0:
@@ -373,6 +379,8 @@ List of changes for each released npm package version.
373379
Unreleased changes that have landed in main. Click to see more.
374380
</summary>
375381

382+
- [chore] Improve `.npmignore` config (avoid exporting some build, debug & test files)
383+
376384
</details>
377385

378386
- 0.2.0:
@@ -400,6 +408,7 @@ List of changes for each released npm package version.
400408
Unreleased changes that have landed in main. Click to see more.
401409
</summary>
402410

411+
- [chore] Improve `.npmignore` config (avoid exporting some build, debug & test files)
403412
- [chore] Update peer dependency on babel-plugin-fbt
404413

405414
</details>
@@ -424,6 +433,8 @@ List of changes for each released npm package version.
424433
<summary>
425434
Unreleased changes that have landed in main. Click to see more.
426435
</summary>
436+
437+
- [chore] Add `.npmignore` config (avoid exporting some build, debug & test files)
427438
</details>
428439

429440
- 0.13.0:
@@ -457,11 +468,40 @@ List of changes for each released npm package version.
457468

458469
### gulp-rewrite-flowtyped-modules versions
459470

471+
<details>
472+
<summary>
473+
Unreleased changes that have landed in main. Click to see more.
474+
</summary>
475+
476+
- [chore] Improve `.npmignore` config (avoid exporting some build, debug & test files)
477+
</details>
478+
460479
- 0.0.9:
461480
- Initial commit
462481

482+
### gulp-strip-docblock-pragmas versions
483+
484+
<details>
485+
<summary>
486+
Unreleased changes that have landed in main. Click to see more.
487+
</summary>
488+
489+
- [chore] Improve `.npmignore` config (avoid exporting some build, debug & test files)
490+
</details>
491+
492+
- 0.0.3:
493+
- Initial release
494+
463495
### react-native-fbt versions
464496

497+
<details>
498+
<summary>
499+
Unreleased changes that have landed in main. Click to see more.
500+
</summary>
501+
502+
- [chore] Improve `.npmignore` config (avoid exporting some build, debug & test files)
503+
</details>
504+
465505
- 0.0.1:
466506
- New React Native package that enables the FBT library for both iOS and Android
467507

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# Since .gitignore is not considered when .npmignore is present
22
node_modules
33

4-
__tests__
4+
.yarnrc
5+
**.log
6+
**.tgz
7+
**/__fixtures__
8+
**/__mocks__
9+
**/__tests__

packages/babel-plugin-fbt/.npmignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ node_modules
44
# Example of expected npm output files: P150537602
55
**
66
!dist/**
7-
**/__tests__
7+
.yarnrc
8+
**.log
9+
**.tgz
810
**/__fixtures__
911
**/__mocks__
12+
**/__tests__
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Since .gitignore is not considered when .npmignore is present
2+
node_modules
3+
4+
.yarnrc
5+
**.log
6+
**.tgz
7+
**/__fixtures__
8+
**/__mocks__
9+
**/__tests__
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Since .gitignore is not considered when .npmignore is present
2+
node_modules
3+
4+
.yarnrc
5+
**.log
6+
**.tgz
7+
**/__fixtures__
8+
**/__mocks__
9+
**/__tests__

packages/fb-tiger-hash/.npmignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
src/__tests__
1+
# Since .gitignore is not considered when .npmignore is present
2+
node_modules
3+
24
.yarnrc
5+
**.log
6+
**.tgz
7+
**/__fixtures__
8+
**/__mocks__
9+
**/__tests__

packages/fbt/.npmignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Since .gitignore is not considered when .npmignore is present
2+
node_modules
3+
4+
.yarnrc
5+
**.log
6+
**.tgz
7+
**/__fixtures__
8+
**/__mocks__
9+
**/__tests__

packages/fbt/package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@
1616
],
1717
"homepage": "https://facebook.github.io/fbt/",
1818
"bugs": "https://github.com/facebook/fbt/issues",
19-
"files": [
20-
"dist/",
21-
"lib/",
22-
"LICENSE"
23-
],
2419
"main": "lib/FbtPublic.js",
2520
"style": "dist/fbt.css",
2621
"repository": {
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
src/__tests__
1+
# Since .gitignore is not considered when .npmignore is present
2+
node_modules
3+
24
.yarnrc
3-
*.log
5+
**.log
6+
**.tgz
7+
**/__fixtures__
8+
**/__mocks__
9+
**/__tests__

0 commit comments

Comments
 (0)