Add step to normalize, fix logging bug, remove backward compatibility tests#144
Merged
Add step to normalize, fix logging bug, remove backward compatibility tests#144
Conversation
2d054de to
675beab
Compare
Member
Author
|
It's time to stop doing parallel |
owlstronaut
previously approved these changes
Jul 2, 2025
Merged
This was always logging, not just only if it was doing the action
This adds the `binDir` step to `.normalize()`. This will translate `directories.bin` into a `.bin` entry. `read-package-json-fast` technically had TWO apis. You could call it as exported, or you could call `.normalize`. The only difference between the two was that `.normalize` did not include the translation of `directories.bin` into `.bin`. We don't need another top level api for this package. Adding `binDir` to the `normalize` step is the right one. That's part of preparing a package for local consumption. I'm relatively certain we have bugs we've missed here because of this. This also means any bugs we fix in `binDir` will be fixed in all use cases. The existing `binDir` step (using glob) is also preferable to the code that `read-package-json-fast` was using (using manual recursive directory walking). Ultimately this will help us finish porting existing code that uses `read-package-json-fast` to this library.
Also tweaked logging statement to help w/ debugging
read-package-json and read-package-json-fast test were initially put in place to ensure this package was fully compatible. This package is now used almost everywhere in npm, and the things we are adding to finish the removal of those other packages is MORE correct here than in those old packages, so the tests won't even work anymore.
This is a prepare step. In normalize it currently just changes it to an empty array which is fine
This is an affordance so that arborist can stop using read-package-json-fast. It currently calls read-package-json.normalize which is a synchronous function, different than read-package-json-fast() itself. We need this package to have an equivalent that skips the directories.bin expansion (which is asynchronous) and the _attribute stripping (which would break arborist)
owlstronaut
approved these changes
Jul 15, 2025
owlstronaut
pushed a commit
that referenced
this pull request
Aug 28, 2025
🤖 I have created a release *beep* *boop* --- ## [7.0.0](v6.2.0...v7.0.0) (2025-07-25) ###⚠️ BREAKING CHANGES * `package-json` now supports node `^20.17.0 || >=22.9.0` ### Features * [`9dd0eb5`](9dd0eb5) [#144](#144) add syncNormalize (@wraithgar) * [`08eae47`](08eae47) [#144](#144) add binDir step to normalize function (@wraithgar) ### Bug Fixes * [`a5e4ac3`](a5e4ac3) [#152](#152) align to npm 11 node engine range (@owlstronaut) * [`4695e87`](4695e87) [#150](#150) use `URL.canParse` instead of runtime deprecated `url.parse` api (#150) (@SuperchupuDev) * [`dbc9ef1`](dbc9ef1) [#144](#144) require an object in fromContent() (@wraithgar) * [`f06eb18`](f06eb18) [#144](#144) remove unused bundleDependenciesFalse (@wraithgar) * [`a8b1cc9`](a8b1cc9) [#144](#144) secure and unixify paths discovered via directories.bin (@wraithgar) * [`23c29a9`](23c29a9) [#144](#144) remove erroneous bundledDependencies log (@wraithgar) ### Documentation * [`14f8141`](14f8141) [#147](#147) adding sort option docs to README (#147) (@idhard) ### Dependencies * [`a0dcfde`](a0dcfde) [#152](#152) `hosted-git-info@9.0.0` * [`41128c1`](41128c1) [#152](#152) `glob@11.0.3` ### Chores * [`a179a87`](a179a87) [#144](#144) fix tests to await async normalize (@wraithgar) * [`203fec8`](203fec8) [#144](#144) remove read-package-json (@wraithgar) * [`7bde184`](7bde184) [#144](#144) remove read-package-json-fast (@wraithgar) * [`394192d`](394192d) [#144](#144) remove backward compatiblity tests (@wraithgar) * [`6e89e39`](6e89e39) [#148](#148) bump @npmcli/template-oss from 4.23.6 to 4.25.0 (#148) (@dependabot[bot], @owlstronaut) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds
binDirto thenormalizestep. See the individual commit for the full story.While adding that I noticed another bug where the
bundledDependencieslogging warning was always being emitted, even if there was nothing being done. This bug is now fixed.