feat(cli): add libc filed in native package.json
This commit is contained in:
parent
71f3c0ef7e
commit
ee0279e540
1 changed files with 32 additions and 25 deletions
|
@ -40,10 +40,10 @@ export class CreateNpmDirCommand extends Command {
|
||||||
const binaryFileName = `${binaryName}.${platformDetail.platformArchABI}.node`
|
const binaryFileName = `${binaryName}.${platformDetail.platformArchABI}.node`
|
||||||
const targetPackageJson = join(targetDir, 'package.json')
|
const targetPackageJson = join(targetDir, 'package.json')
|
||||||
debug(`Write file [${chalk.yellowBright(targetPackageJson)}]`)
|
debug(`Write file [${chalk.yellowBright(targetPackageJson)}]`)
|
||||||
await writeFileAsync(
|
const packageJson: {
|
||||||
targetPackageJson,
|
name: string
|
||||||
JSON.stringify(
|
libc?: string[]
|
||||||
{
|
} = {
|
||||||
name: `${packageName}-${platformDetail.platformArchABI}`,
|
name: `${packageName}-${platformDetail.platformArchABI}`,
|
||||||
version,
|
version,
|
||||||
os: [platformDetail.platform],
|
os: [platformDetail.platform],
|
||||||
|
@ -63,10 +63,17 @@ export class CreateNpmDirCommand extends Command {
|
||||||
'repository',
|
'repository',
|
||||||
'bugs',
|
'bugs',
|
||||||
),
|
),
|
||||||
},
|
}
|
||||||
null,
|
// Only works with yarn 3.1+
|
||||||
2,
|
// https://github.com/yarnpkg/berry/pull/3981
|
||||||
),
|
if (platformDetail.abi === 'gnu') {
|
||||||
|
packageJson.libc = ['glibc']
|
||||||
|
} else if (platformDetail.abi === 'musl') {
|
||||||
|
packageJson.libc = ['musl']
|
||||||
|
}
|
||||||
|
await writeFileAsync(
|
||||||
|
targetPackageJson,
|
||||||
|
JSON.stringify(packageJson, null, 2),
|
||||||
)
|
)
|
||||||
const targetReadme = join(targetDir, 'README.md')
|
const targetReadme = join(targetDir, 'README.md')
|
||||||
debug(`Write target README.md [${chalk.yellowBright(targetReadme)}]`)
|
debug(`Write target README.md [${chalk.yellowBright(targetReadme)}]`)
|
||||||
|
|
Loading…
Reference in a new issue