Skip to content

Commit

Permalink
chore: add/improve npm ignore configs (#328)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kayhadrin authored and facebook-github-bot committed Jan 19, 2022
1 parent 4469556 commit fcf2390
Show file tree
Hide file tree
Showing 12 changed files with 116 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ yarn-error.log
.flow-results
# file checksums used by gulp-once
.checksums
# Ignore npm pack files generated during npm publish testing
**.tgz

# MacOS
.DS_Store
Expand Down
48 changes: 44 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ List of changes for each released npm package version.
- [fb-tiger-hash versions](#fb-tiger-hash-versions)
- [fb-babel-plugin-utils versions](#fb-babel-plugin-utils-versions)
- [gulp-rewrite-flowtyped-modules versions](#gulp-rewrite-flowtyped-modules-versions)
- [gulp-strip-docblock-pragmas versions](#gulp-strip-docblock-pragmas-versions)
- [react-native-fbt versions](#react-native-fbt-versions)
- [fbt-rn-android-native versions [Deprecated]](#fbt-rn-android-native-versions-deprecated)

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

- [chore] Add `.npmignore` config (avoid exporting some build, debug & test files)

</details>

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

- [chore] Improve `.npmignore` config (avoid exporting some build, debug & test files)

0.21.0-rc8-beta
- [fix]! Prevent `fbt.sameParam` from referring to a non-existent token name or a plural construct token
- [fix]! Prevent token name collisions among fbt constructs across all nesting levels
Expand Down Expand Up @@ -307,11 +312,12 @@ List of changes for each released npm package version.
<details>
<summary>
Unreleased changes that have landed in main. Click to see more.

- [chore] Update fbtRuntime-test.js after the definition of `hash_key` in
fbtJenkinsHash.js was modified
- [refactor] Move clear token replacement logic to babel-plugin-fbt/src/FbtUtil.js
</summary>

- [chore] Improve `.npmignore` config (avoid exporting some build, debug & test files)
- [chore] Update fbtRuntime-test.js after the definition of `hash_key` in
fbtJenkinsHash.js was modified
- [refactor] Move clear token replacement logic to babel-plugin-fbt/src/FbtUtil.js
</details>

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

- [chore] Improve `.npmignore` config (avoid exporting some build, debug & test files)

</details>

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

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

</details>
Expand All @@ -424,6 +433,8 @@ List of changes for each released npm package version.
<summary>
Unreleased changes that have landed in main. Click to see more.
</summary>

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

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

### gulp-rewrite-flowtyped-modules versions

<details>
<summary>
Unreleased changes that have landed in main. Click to see more.
</summary>

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

- 0.0.9:
- Initial commit

### gulp-strip-docblock-pragmas versions

<details>
<summary>
Unreleased changes that have landed in main. Click to see more.
</summary>

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

- 0.0.3:
- Initial release

### react-native-fbt versions

<details>
<summary>
Unreleased changes that have landed in main. Click to see more.
</summary>

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

- 0.0.1:
- New React Native package that enables the FBT library for both iOS and Android

Expand Down
7 changes: 6 additions & 1 deletion packages/babel-plugin-fbt-runtime/.npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Since .gitignore is not considered when .npmignore is present
node_modules

__tests__
.yarnrc
**.log
**.tgz
**/__fixtures__
**/__mocks__
**/__tests__
5 changes: 4 additions & 1 deletion packages/babel-plugin-fbt/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ node_modules
# Example of expected npm output files: P150537602
**
!dist/**
**/__tests__
.yarnrc
**.log
**.tgz
**/__fixtures__
**/__mocks__
**/__tests__
9 changes: 9 additions & 0 deletions packages/default-collection-transform/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Since .gitignore is not considered when .npmignore is present
node_modules

.yarnrc
**.log
**.tgz
**/__fixtures__
**/__mocks__
**/__tests__
9 changes: 9 additions & 0 deletions packages/fb-babel-plugin-utils/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Since .gitignore is not considered when .npmignore is present
node_modules

.yarnrc
**.log
**.tgz
**/__fixtures__
**/__mocks__
**/__tests__
9 changes: 8 additions & 1 deletion packages/fb-tiger-hash/.npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
src/__tests__
# Since .gitignore is not considered when .npmignore is present
node_modules

.yarnrc
**.log
**.tgz
**/__fixtures__
**/__mocks__
**/__tests__
9 changes: 9 additions & 0 deletions packages/fbt/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Since .gitignore is not considered when .npmignore is present
node_modules

.yarnrc
**.log
**.tgz
**/__fixtures__
**/__mocks__
**/__tests__
5 changes: 0 additions & 5 deletions packages/fbt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
],
"homepage": "https://facebook.github.io/fbt/",
"bugs": "https://github.com/facebook/fbt/issues",
"files": [
"dist/",
"lib/",
"LICENSE"
],
"main": "lib/FbtPublic.js",
"style": "dist/fbt.css",
"repository": {
Expand Down
10 changes: 8 additions & 2 deletions packages/gulp-rewrite-flowtyped-modules/.npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
src/__tests__
# Since .gitignore is not considered when .npmignore is present
node_modules

.yarnrc
*.log
**.log
**.tgz
**/__fixtures__
**/__mocks__
**/__tests__
10 changes: 8 additions & 2 deletions packages/gulp-strip-docblock-pragmas/.npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
src/__tests__
# Since .gitignore is not considered when .npmignore is present
node_modules

.yarnrc
*.log
**.log
**.tgz
**/__fixtures__
**/__mocks__
**/__tests__
9 changes: 9 additions & 0 deletions packages/react-native-fbt/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Since .gitignore is not considered when .npmignore is present
node_modules

.yarnrc
**.log
**.tgz
**/__fixtures__
**/__mocks__
**/__tests__

0 comments on commit fcf2390

Please sign in to comment.