-
Notifications
You must be signed in to change notification settings - Fork 48.5k
Apply "files" npm whitelist at build time #11257
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
Comments
Hi I'd like to work on this. Im a beginner and I would appreciate any pointers on where to start |
If you run You will see that I want to make sure that we respect You can check that your change works with this example: #11254
Before the change, After the change, the |
Thanks for that!. That was really helpful! The solution I am thinking involves parsing the package.json file for each of the packages and comparing the files/directories that are copied over to this parsed array. Am I on the right track? |
Sounds about right. |
…" in package.json, only copy whitelisted files/folders to build
Sorry, didn't mean to hijack the issue from @apravink, was just playing with a possible fix and pushed to my repo :). |
@yu-tian113 Haven't had a chance to work on this so if you have a working solution, please go ahead :) |
Thanks for informing @apravink, I'll pick it up then. Please feel free to share any ideas or suggestions. |
…" in package.json, only copy whitelisted files/folders to build
…" in package.json, only copy whitelisted files/folders to build (+1 squashed commit) Squashed commits: [d400198] handle directories in files list - e.g. "libs/"
…" in package.json, only copy whitelisted files/folders to build (+1 squashed commit) Squashed commits: [d400198] handle directories in files list - e.g. "libs/"
…" in package.json, only copy whitelisted files/folders to build (+1 squashed commit) Squashed commits: [d400198] handle directories in files list - e.g. "libs/"
…" in package.json, only copy whitelisted files/folders to build (+1 squashed commit) Squashed commits: [d400198] handle directories in files list - e.g. "libs/" (+1 squashed commit) Squashed commits: [52a4d3b] Add in file check to make sure all entry points have equivalent files in ./npm folder. Fail the build if any equivalent missing.
…" in package.json, only copy whitelisted files/folders to build (+1 squashed commit) Squashed commits: [d400198] handle directories in files list - e.g. "libs/" (+1 squashed commit) Squashed commits: [52a4d3b] Add in file check to make sure all entry points have equivalent files in ./npm folder. Fail the build if any equivalent missing.
…" in package.json, only copy whitelisted files/folders to build (+1 squashed commit) Squashed commits: [d400198] handle directories in files list - e.g. "libs/" (+1 squashed commit) Squashed commits: [52a4d3b] Add in file check to make sure all entry points have equivalent files in ./npm folder. Fail the build if any equivalent missing. (+1 squashed commit) Squashed commits: [e2d1516] Update glob to exclude *.fb.js, replace the check in if statement
…" in package.json, only copy whitelisted files/folders to build (+1 squashed commit) Squashed commits: [d400198] handle directories in files list - e.g. "libs/" (+1 squashed commit) Squashed commits: [52a4d3b] Add in file check to make sure all entry points have equivalent files in ./npm folder. Fail the build if any equivalent missing. (+1 squashed commit) Squashed commits: [e2d1516] Update glob to exclude *.fb.js, replace the check in if statement
…" in package.json, only copy whitelisted files/folders to build (+1 squashed commit) Squashed commits: [d400198] handle directories in files list - e.g. "libs/" (+1 squashed commit) Squashed commits: [52a4d3b] Add in file check to make sure all entry points have equivalent files in ./npm folder. Fail the build if any equivalent missing. (+1 squashed commit) Squashed commits: [e2d1516] Update glob to exclude *.fb.js, replace the check in if statement (+1 squashed commit) Squashed commits: [b4ddd28] Code refactor as per peer review.
…" in package.json, only copy whitelisted files/folders to build (+1 squashed commit) Squashed commits: [d400198] handle directories in files list - e.g. "libs/" (+1 squashed commit) Squashed commits: [52a4d3b] Add in file check to make sure all entry points have equivalent files in ./npm folder. Fail the build if any equivalent missing. (+1 squashed commit) Squashed commits: [e2d1516] Update glob to exclude *.fb.js, replace the check in if statement (+1 squashed commit) Squashed commits: [b4ddd28] Code refactor as per peer review.
…" in package.json, only copy whitelisted files/folders to build (+1 squashed commit) Squashed commits: [d400198] handle directories in files list - e.g. "libs/" (+1 squashed commit) Squashed commits: [52a4d3b] Add in file check to make sure all entry points have equivalent files in ./npm folder. Fail the build if any equivalent missing. (+1 squashed commit) Squashed commits: [e2d1516] Update glob to exclude *.fb.js, replace the check in if statement (+1 squashed commit) Squashed commits: [b4ddd28] Code refactor as per peer review.
# This is the 1st commit message: Issue facebook#11257 - compare files/folders in package/npm to "files" in package.json, only copy whitelisted files/folders to build (+1 squashed commit) Squashed commits: [d400198] handle directories in files list - e.g. "libs/" (+1 squashed commit) Squashed commits: [52a4d3b] Add in file check to make sure all entry points have equivalent files in ./npm folder. Fail the build if any equivalent missing. (+1 squashed commit) Squashed commits: [e2d1516] Update glob to exclude *.fb.js, replace the check in if statement (+1 squashed commit) Squashed commits: [b4ddd28] Code refactor as per peer review. (+2 squashed commits) Squashed commits: [854373f] Remove the else after the hard exit, make the code after unintended. [e97dff1] Update to handle patterns in 'files' field, terminate the build if entry point not whitelisted, terminate the build if 'files' field is missing from package.json # This is the commit message facebook#2: Remove the else after the hard exit, make the code after unintended.
…itelist-at-build-time
…unpacking (#11750) * Change build process to include npm pack and unpacking generated packages to corresponding build directories. * Update function name, change to use os's default temp directory * appending uuid to temp npm packaging directory.
Fixed by #11750. |
We should make our build step apply the same logic as npm does with whitelisting
"files"
field. This way issues like #11254 would get caught early.The text was updated successfully, but these errors were encountered: