From a8d1a0b4c16bbeaa3b390ef6f23b489e7686dfd1 Mon Sep 17 00:00:00 2001 From: Jay Date: Fri, 11 Sep 2020 12:24:57 +0800 Subject: [PATCH] [feat] update package and loadbinding --- index.js | 2 +- npm/darwin/package.json | 25 +++++++++++++++++++------ npm/linux/package.json | 25 +++++++++++++++++++------ npm/win32/package.json | 25 +++++++++++++++++++------ package.json | 6 +++--- 5 files changed, 61 insertions(+), 22 deletions(-) diff --git a/index.js b/index.js index 7269193..63e9f2b 100644 --- a/index.js +++ b/index.js @@ -5,7 +5,7 @@ try { // __dirname means load native addon from current dir // 'index' means native addon name is `index` // the value of this two arguments was decided by `build` script in `package.json` - module.exports = loadBinding(path.join(__dirname, '..', `rs-diff-${process.platform}`), 'index') + module.exports = loadBinding(path.join(__dirname, 'index', '@mtfos/rs-diff') } catch (e) { try { module.exports = require(`@swc-node/core-${platform()}`) diff --git a/npm/darwin/package.json b/npm/darwin/package.json index 6a06c79..425033a 100644 --- a/npm/darwin/package.json +++ b/npm/darwin/package.json @@ -1,13 +1,26 @@ { "name": "@mtfos/rs-diff-darwin", - "version": "0.0.3", + "version": "0.0.5", "description": "Template project for writing node package with napi-rs", "repository": "https://git.trj.tw/nodejs/rs-diff.git", "license": "MIT", "author": "Jay ", - "keywords": ["napi-rs", "NAPI", "N-API", "Rust", "node-addon", "node-addon-api"], + "keywords": [ + "napi-rs", + "NAPI", + "N-API", + "Rust", + "node-addon", + "node-addon-api" + ], "main": "index.darwin.node", - "files": ["index.darwin.node"], - "os": ["darwin"], - "cpu": ["x64"] -} + "files": [ + "index.darwin.node" + ], + "os": [ + "darwin" + ], + "cpu": [ + "x64" + ] +} \ No newline at end of file diff --git a/npm/linux/package.json b/npm/linux/package.json index 911d6ac..5a7c31b 100644 --- a/npm/linux/package.json +++ b/npm/linux/package.json @@ -1,13 +1,26 @@ { "name": "@mtfos/rs-diff-linux", - "version": "0.0.3", + "version": "0.0.5", "description": "Template project for writing node package with napi-rs", "repository": "https://git.trj.tw/nodejs/rs-diff.git", "license": "MIT", "author": "Jay ", - "keywords": ["napi-rs", "NAPI", "N-API", "Rust", "node-addon", "node-addon-api"], + "keywords": [ + "napi-rs", + "NAPI", + "N-API", + "Rust", + "node-addon", + "node-addon-api" + ], "main": "index.linux.node", - "files": ["index.linux.node"], - "os": ["linux"], - "cpu": ["x64"] -} + "files": [ + "index.linux.node" + ], + "os": [ + "linux" + ], + "cpu": [ + "x64" + ] +} \ No newline at end of file diff --git a/npm/win32/package.json b/npm/win32/package.json index 5f9f0a7..146efb4 100644 --- a/npm/win32/package.json +++ b/npm/win32/package.json @@ -1,16 +1,29 @@ { "name": "@mtfos/rs-diff-win32", - "version": "0.0.1", + "version": "0.0.4", "description": "Template project for writing node package with napi-rs", "repository": "https://git.trj.tw/nodejs/rs-diff.git", "license": "MIT", "author": "Jay ", - "keywords": ["napi-rs", "NAPI", "N-API", "Rust", "node-addon", "node-addon-api"], + "keywords": [ + "napi-rs", + "NAPI", + "N-API", + "Rust", + "node-addon", + "node-addon-api" + ], "main": "index.win32.node", - "files": ["index.win32.node"], + "files": [ + "index.win32.node" + ], "publishConfig": { "@mtfos:registry": "https://gitlab.trj.tw/api/v4/projects/4/packages/npm/" }, - "os": ["win32"], - "cpu": ["x64"] -} + "os": [ + "win32" + ], + "cpu": [ + "x64" + ] +} \ No newline at end of file diff --git a/package.json b/package.json index 5d5f6d6..f718fcf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mtfos/rs-diff", - "version": "0.0.4", + "version": "0.0.5", "description": "Template project for writing node package with napi-rs", "author": "Jay ", "main": "index.js", @@ -45,7 +45,7 @@ "@node-rs/helper": "^0.4.0" }, "optionalDependencies": { - "@mtfos/rs-diff-darwin": "^0.0.3", - "@mtfos/rs-diff-linux": "^0.0.3" + "@mtfos/rs-diff-darwin": "^0.0.4", + "@mtfos/rs-diff-linux": "^0.0.4" } }