-
-
Notifications
You must be signed in to change notification settings - Fork 934
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
feat: support libc field for package.json #4605
Conversation
3cb856d
to
41dc5e9
Compare
I will add some test case later |
41dc5e9
to
2ada0c3
Compare
hi~ @zkochan maybe i need to change some source code of when i write lockfile object as: it will generate: |
but i can't find the git repo of |
@zkochan I complete the test case, please take a look when u feel free~ |
let osOk = true | ||
let cpuOk = true | ||
const { platform, arch } = process | ||
const currentLibc = getLibcFamilySync() ?? 'unknown' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it fast to read it every time? It might be better to read it only once per installation, so move it out from the function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe i need to put getLibcFamilySync()
function out of the package-is-installable
? and pass the result to the function checkPackage()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or just i use a env like process.env.libc
to keep the value at package-is-installable
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i read the source code of getLibFamilySync()
, it just get a process.report
value and deal it. Just like the process.platform
and process.arch
here, so it might not be slow?
https://github.com/pnpm/js-yaml branch features-for-pnpm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update js-yaml to stringify libc in one line
ok, i will make a pr for it. |
@@ -18,6 +18,8 @@ packages: | |||
engines: {node: '>=10', npm: \\"\\\\nfoo\\\\n\\"} | |||
cpu: [x86] | |||
os: [darwin] | |||
libc: | |||
- glibc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zkochan looks like this pr merged and publish a new package version of js-yaml, it will be fine here.
i open a pr for it: pnpm/js-yaml#1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, published
We need to document this new field in the docs https://pnpm.io/package_json |
closes: #4454
This PR support for a filed named
libc
inpackage.json
, it will taken into account when filter optional dependencies.