Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prune NPM metadata fields from packages before re-publishing #14617

Merged
merged 1 commit into from Jan 17, 2019

Conversation

bvaughn
Copy link
Contributor

@bvaughn bvaughn commented Jan 17, 2019

The latest React release has some weird fields in the package JSON that weren't there in the canary. These fields (all beginning with "_") contain package registry meta data.

It's not ideal that we publish package with these fields still around. Technically, they aren't even valid since NPM rules and the packages JSON spec say that field names beginning with underscores are reserved.

So this PR adds a step that prunes these fields as part of preparing a stable release.

JSON diff before

1a2,25
>   "_from": "react@0.0.0-3e15b1c69",
>   "_id": "react@0.0.0-3e15b1c69",
>   "_inBundle": false,
>   "_integrity": "sha512-jGp8MiBrV1FuT0kLcUlb7zjZiaWAcaQ001qCbUen7SHHtnE3Apdl7d7fHshrEOytgoPWSm2pc7vdz1nICqmIDw==",
>   "_location": "/react",
>   "_phantomChildren": {},
>   "_requested": {
>     "type": "version",
>     "registry": true,
>     "raw": "react@0.0.0-3e15b1c69",
>     "name": "react",
>     "escapedName": "react",
>     "rawSpec": "0.0.0-3e15b1c69",
>     "saveSpec": null,
>     "fetchSpec": "0.0.0-3e15b1c69"
>   },
>   "_requiredBy": [
>     "#USER",
>     "/"
>   ],
>   "_resolved": "https://registry.npmjs.org/react/-/react-0.0.0-3e15b1c69.tgz",
>   "_shasum": "a10d5c3fd611046fd5ab65503e6df0b37db99fc0",
>   "_spec": "react@0.0.0-3e15b1c69",
>   "_where": "/Users/bvaughn/Documents/git/react/build/node_modules",
7c31,34
<   "bugs": "https://github.com/facebook/react/issues",
---
>   "bugs": {
>     "url": "https://github.com/facebook/react/issues"
>   },
>   "bundleDependencies": false,
12,13c39,42
<     "scheduler": "0.0.0-3e15b1c69"
<   },  "description": "React is a JavaScript library for building user interfaces.",
---
>     "scheduler": "^0.13.0"
>   },
>   "deprecated": false,
>   "description": "React is a JavaScript library for building user interfaces.",
32,34c61,66
<   "repository": "facebook/react",
<   "version": "0.0.0-3e15b1c69"
< }
\ No newline at end of file
---
>   "repository": {
>     "type": "git",
>     "url": "git+https://github.com/facebook/react.git"
>   },
>   "version": "16.8.0"
> }

JSON diff after

7c7,10
<   "bugs": "https://github.com/facebook/react/issues",
---
>   "bugs": {
>     "url": "https://github.com/facebook/react/issues"
>   },
>   "bundleDependencies": false,
12,13c15,18
<     "scheduler": "0.0.0-3e15b1c69"
<   },  "description": "React is a JavaScript library for building user interfaces.",
---
>     "scheduler": "^0.13.0"
>   },
>   "deprecated": false,
>   "description": "React is a JavaScript library for building user interfaces.",
32,34c37,42
<   "repository": "facebook/react",
<   "version": "0.0.0-3e15b1c69"
< }
\ No newline at end of file
---
>   "repository": {
>     "type": "git",
>     "url": "git+https://github.com/facebook/react.git"
>   },
>   "version": "16.8.0"
> }

@bvaughn bvaughn force-pushed the release-script-prune-package-json branch from 9e62076 to 925989d Compare January 17, 2019 22:24
@bvaughn bvaughn merged commit 4846809 into facebook:master Jan 17, 2019
@bvaughn bvaughn deleted the release-script-prune-package-json branch January 17, 2019 22:34
n8schloss pushed a commit to n8schloss/react that referenced this pull request Jan 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants