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

feat: support libc field for package.json #4605

Merged
merged 5 commits into from
May 10, 2022
Merged

Conversation

fireairforce
Copy link
Member

@fireairforce fireairforce commented Apr 21, 2022

closes: #4454

This PR support for a filed named libc in package.json, it will taken into account when filter optional dependencies.

@fireairforce fireairforce changed the title (WIP)feat: support libc filed for package.json feat: support libc filed for package.json Apr 21, 2022
@fireairforce fireairforce changed the title feat: support libc filed for package.json WIP: feat: support libc filed for package.json Apr 21, 2022
@fireairforce fireairforce force-pushed the support-libc branch 3 times, most recently from 3cb856d to 41dc5e9 Compare April 21, 2022 17:33
@fireairforce fireairforce changed the title WIP: feat: support libc filed for package.json feat: support libc filed for package.json Apr 22, 2022
@fireairforce
Copy link
Member Author

I will add some test case later

@fireairforce
Copy link
Member Author

hi~ @zkochan maybe i need to change some source code of @zkochan/js-yaml because it will generate a wrong files of libc:

when i write lockfile object as:

image

it will generate:

image

@fireairforce
Copy link
Member Author

but i can't find the git repo of @zkochan/js-yaml ...

@fireairforce
Copy link
Member Author

@zkochan I complete the test case, please take a look when u feel free~

@zkochan zkochan changed the title feat: support libc filed for package.json feat: support libc field for package.json May 9, 2022
let osOk = true
let cpuOk = true
const { platform, arch } = process
const currentLibc = getLibcFamilySync() ?? 'unknown'
Copy link
Member

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.

Copy link
Member Author

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() ?

Copy link
Member Author

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?

Copy link
Member Author

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?

@zkochan
Copy link
Member

zkochan commented May 10, 2022

but i can't find the git repo of @zkochan/js-yaml ...

https://github.com/pnpm/js-yaml

branch features-for-pnpm

Copy link
Member

@zkochan zkochan left a 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

@fireairforce
Copy link
Member Author

but i can't find the git repo of @zkochan/js-yaml ...

https://github.com/pnpm/js-yaml

branch features-for-pnpm

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
Copy link
Member Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, published

@zkochan
Copy link
Member

zkochan commented Jun 29, 2022

We need to document this new field in the docs https://pnpm.io/package_json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support libc field in package.json
4 participants