-
Notifications
You must be signed in to change notification settings - Fork 2
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
migrate semantic-release to read-package-json-fast #20
Comments
PR is up semantic-release/npm#745! tests pass, but the library doesn't have too many recent commits, so hopefully we'll get a reply! |
Sadly
|
ah because they also use read-pkg-up? i had a look at how npm do that, they seem to just pair two packages: walk-up-path, and read-package-json-fast i suspect you don't actually need a package for it anymore. for example: const fileExists = (...p) => stat(resolve(...p))
.then((st) => st.isFile())
.catch(() => false);
for (const path of walkUp(cwd)) {
const hasPackageJson = await fileExists(path, 'package.json');
if (hasPackageJson) {
return await readPackage(path);
}
} personally i'd take that over a deep chain of packages, but not all maintainers will want to maintain their own for loop for it. |
not in
|
seems to come from here: it does seem a shame having to replace that with an equivalent "readPkgUp" function they would have to maintain (the for loop example in my last comment) but looking through equivalent packages, there's not many that do this. npm themselves and most other reliable repos just walk up using a separate package (e.g. walk-up-path) |
FYI there's also now fd-package-json: which may come in useful and is smaller than the now deprecated read-package-json-fast |
We identified upstream issue: semantic-release/semantic-release#3372 |
newer upstream discussion: semantic-release/semantic-release#3376 |
semantic-release can be found here:
https://github.com/semantic-release/npm
it currently uses read-pkg here:
https://github.com/semantic-release/npm/blob/0154fb84631cd7debd4bcd0d78824386b76ae8c1/lib/get-pkg.js#L2
we can instead use read-package-json-fast:
https://github.com/npm/read-package-json-fast
its near enough 10x smaller, is maintained by the NPM team directly, and is more standard because of that.
The text was updated successfully, but these errors were encountered: