style: naming refactor in napi.js
This commit is contained in:
parent
c5d57969fe
commit
fce24f0566
2 changed files with 7 additions and 8 deletions
|
@ -118,9 +118,8 @@ Because libraries that depend on this crate must be loaded into a Node executabl
|
||||||
To run tests:
|
To run tests:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd test_module
|
yarn --cwd ./test_module build
|
||||||
npm run build
|
yarn test
|
||||||
npm test
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Features table
|
## Features table
|
||||||
|
|
|
@ -63,17 +63,17 @@ const targetDir = argv.release ? 'release' : 'debug'
|
||||||
|
|
||||||
const platformName = argv.musl ? '.musl' : argv.platform ? `.${platform}` : ''
|
const platformName = argv.musl ? '.musl' : argv.platform ? `.${platform}` : ''
|
||||||
|
|
||||||
let subcommand =
|
let distModulePath =
|
||||||
argv._[0] ||
|
argv._[0] ||
|
||||||
path.join('target', targetDir, `${moduleName}${platformName}.node`)
|
path.join('target', targetDir, `${moduleName}${platformName}.node`)
|
||||||
const parsedDist = path.parse(subcommand)
|
const parsedDist = path.parse(distModulePath)
|
||||||
|
|
||||||
if (!parsedDist.name || parsedDist.name === '.') {
|
if (!parsedDist.name || parsedDist.name === '.') {
|
||||||
subcommand = moduleName
|
distModulePath = moduleName
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!parsedDist.ext) {
|
if (!parsedDist.ext) {
|
||||||
subcommand = `${subcommand}${platformName}.node`
|
distModulePath = `${distModulePath}${platformName}.node`
|
||||||
}
|
}
|
||||||
|
|
||||||
const pos = __dirname.indexOf('node_modules')
|
const pos = __dirname.indexOf('node_modules')
|
||||||
|
@ -87,4 +87,4 @@ const dylibContent = fs.readFileSync(
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
fs.writeFileSync(subcommand, dylibContent)
|
fs.writeFileSync(distModulePath, dylibContent)
|
||||||
|
|
Loading…
Reference in a new issue