From 3b48e464cb159e463c498983907dbd3096aa605c Mon Sep 17 00:00:00 2001 From: LongYinan Date: Mon, 16 Mar 2020 11:26:21 +0800 Subject: [PATCH] fix(scripts): find target folder near by node_modules folder --- scripts/napi.js | 5 +++-- test_module/yarn.lock | 15 --------------- 2 files changed, 3 insertions(+), 17 deletions(-) delete mode 100644 test_module/yarn.lock diff --git a/scripts/napi.js b/scripts/napi.js index 15019338..77f829d6 100755 --- a/scripts/napi.js +++ b/scripts/napi.js @@ -6,7 +6,6 @@ const os = require('os') const toml = require('toml') const fs = require('fs') - let tomlContentString let tomlContent let moduleName @@ -74,8 +73,10 @@ if (!parsedDist.ext) { subcommand = `${subcommand}.node` } +const pos = __dirname.indexOf('node_modules') + const dylibContent = fs.readFileSync(path.join( - process.cwd(), + __dirname.substring(0, pos), 'target', targetDir, `${dylibName}${libExt}`, diff --git a/test_module/yarn.lock b/test_module/yarn.lock deleted file mode 100644 index ecd58b0d..00000000 --- a/test_module/yarn.lock +++ /dev/null @@ -1,15 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -minimist@^1.2.0: - version "1.2.0" - resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" - integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= - -napi-rs@^0.1.0: - version "0.1.1" - resolved "https://registry.npmjs.org/napi-rs/-/napi-rs-0.1.1.tgz#00c823423be5f070e4d5a01b143e4e848f4a2512" - integrity sha512-eYHtHpqneoL3coE0kLr5hbRR9Z3hx97qfNdzXneuUWR3eFs8qNaJZRX2dln2gWieJaYrqUWs+rvR4+jdBlse6Q== - dependencies: - minimist "^1.2.0"