mirror of
https://github.com/napi-rs/napi-rs.git
synced 2025-12-08 19:56:07 +00:00
* fix(cli): use new napi config field * fix(cli): avoid using node experimental feature to read self version * fix(cli): correct linker environment * fix(cli): missing wasi register env * fix(cli): remove useless linker preset
45 lines
989 B
TypeScript
45 lines
989 B
TypeScript
export const createPackageJson = ({
|
|
name,
|
|
binaryName,
|
|
targets,
|
|
license,
|
|
engineRequirement,
|
|
cliVersion,
|
|
}: {
|
|
name: string
|
|
binaryName: string
|
|
targets: string[]
|
|
license: string
|
|
engineRequirement: string
|
|
cliVersion: string
|
|
}) => {
|
|
return `{
|
|
"name": "${name}",
|
|
"version": "1.0.0",
|
|
"main": "index.js",
|
|
"types": "index.d.ts",
|
|
"license": "${license}",
|
|
"engines": {
|
|
"node": "${engineRequirement}"
|
|
},
|
|
"napi": {
|
|
"binaryName": "${binaryName}",
|
|
"targets": [
|
|
${targets.map((t) => `"${t}"`).join(',\n ')}
|
|
]
|
|
},
|
|
"scripts": {
|
|
"test": "yarn build:debug --platform && node -e \\"assert(require('.').sum(1, 2) === 3)\\"",
|
|
"build": "napi build --release --platform --strip",
|
|
"build:debug": "napi build",
|
|
"prepublishOnly": "napi prepublish -t npm",
|
|
"artifacts": "napi artifacts",
|
|
"universal": "napi universal",
|
|
"version": "napi version"
|
|
},
|
|
"devDependencies": {
|
|
"@napi-rs/cli": "^${cliVersion}"
|
|
}
|
|
}`
|
|
}
|