From fce24f0566c854603657c5439298d29053cb2dae Mon Sep 17 00:00:00 2001 From: LongYinan Date: Sun, 21 Jun 2020 17:00:40 +0800 Subject: [PATCH] style: naming refactor in napi.js --- README.md | 5 ++--- scripts/napi.js | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 8668922a..82427612 100644 --- a/README.md +++ b/README.md @@ -118,9 +118,8 @@ Because libraries that depend on this crate must be loaded into a Node executabl To run tests: ```sh -cd test_module -npm run build -npm test +yarn --cwd ./test_module build +yarn test ``` ## Features table diff --git a/scripts/napi.js b/scripts/napi.js index 2f5b26a6..b0951ae0 100755 --- a/scripts/napi.js +++ b/scripts/napi.js @@ -63,17 +63,17 @@ const targetDir = argv.release ? 'release' : 'debug' const platformName = argv.musl ? '.musl' : argv.platform ? `.${platform}` : '' -let subcommand = +let distModulePath = argv._[0] || path.join('target', targetDir, `${moduleName}${platformName}.node`) -const parsedDist = path.parse(subcommand) +const parsedDist = path.parse(distModulePath) if (!parsedDist.name || parsedDist.name === '.') { - subcommand = moduleName + distModulePath = moduleName } if (!parsedDist.ext) { - subcommand = `${subcommand}${platformName}.node` + distModulePath = `${distModulePath}${platformName}.node` } const pos = __dirname.indexOf('node_modules') @@ -87,4 +87,4 @@ const dylibContent = fs.readFileSync( ), ) -fs.writeFileSync(subcommand, dylibContent) +fs.writeFileSync(distModulePath, dylibContent)