[feat] update package and loadbinding

This commit is contained in:
Jay 2020-09-11 12:24:57 +08:00
parent 0b00b55244
commit a8d1a0b4c1
5 changed files with 61 additions and 22 deletions

View File

@ -5,7 +5,7 @@ try {
// __dirname means load native addon from current dir // __dirname means load native addon from current dir
// 'index' means native addon name is `index` // 'index' means native addon name is `index`
// the value of this two arguments was decided by `build` script in `package.json` // 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) { } catch (e) {
try { try {
module.exports = require(`@swc-node/core-${platform()}`) module.exports = require(`@swc-node/core-${platform()}`)

View File

@ -1,13 +1,26 @@
{ {
"name": "@mtfos/rs-diff-darwin", "name": "@mtfos/rs-diff-darwin",
"version": "0.0.3", "version": "0.0.5",
"description": "Template project for writing node package with napi-rs", "description": "Template project for writing node package with napi-rs",
"repository": "https://git.trj.tw/nodejs/rs-diff.git", "repository": "https://git.trj.tw/nodejs/rs-diff.git",
"license": "MIT", "license": "MIT",
"author": "Jay <jay@trj.tw>", "author": "Jay <jay@trj.tw>",
"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", "main": "index.darwin.node",
"files": ["index.darwin.node"], "files": [
"os": ["darwin"], "index.darwin.node"
"cpu": ["x64"] ],
"os": [
"darwin"
],
"cpu": [
"x64"
]
} }

View File

@ -1,13 +1,26 @@
{ {
"name": "@mtfos/rs-diff-linux", "name": "@mtfos/rs-diff-linux",
"version": "0.0.3", "version": "0.0.5",
"description": "Template project for writing node package with napi-rs", "description": "Template project for writing node package with napi-rs",
"repository": "https://git.trj.tw/nodejs/rs-diff.git", "repository": "https://git.trj.tw/nodejs/rs-diff.git",
"license": "MIT", "license": "MIT",
"author": "Jay <jay@trj.tw>", "author": "Jay <jay@trj.tw>",
"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", "main": "index.linux.node",
"files": ["index.linux.node"], "files": [
"os": ["linux"], "index.linux.node"
"cpu": ["x64"] ],
"os": [
"linux"
],
"cpu": [
"x64"
]
} }

View File

@ -1,16 +1,29 @@
{ {
"name": "@mtfos/rs-diff-win32", "name": "@mtfos/rs-diff-win32",
"version": "0.0.1", "version": "0.0.4",
"description": "Template project for writing node package with napi-rs", "description": "Template project for writing node package with napi-rs",
"repository": "https://git.trj.tw/nodejs/rs-diff.git", "repository": "https://git.trj.tw/nodejs/rs-diff.git",
"license": "MIT", "license": "MIT",
"author": "Jay <jay@trj.tw>", "author": "Jay <jay@trj.tw>",
"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", "main": "index.win32.node",
"files": ["index.win32.node"], "files": [
"index.win32.node"
],
"publishConfig": { "publishConfig": {
"@mtfos:registry": "https://gitlab.trj.tw/api/v4/projects/4/packages/npm/" "@mtfos:registry": "https://gitlab.trj.tw/api/v4/projects/4/packages/npm/"
}, },
"os": ["win32"], "os": [
"cpu": ["x64"] "win32"
],
"cpu": [
"x64"
]
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@mtfos/rs-diff", "name": "@mtfos/rs-diff",
"version": "0.0.4", "version": "0.0.5",
"description": "Template project for writing node package with napi-rs", "description": "Template project for writing node package with napi-rs",
"author": "Jay <jay@trj.tw>", "author": "Jay <jay@trj.tw>",
"main": "index.js", "main": "index.js",
@ -45,7 +45,7 @@
"@node-rs/helper": "^0.4.0" "@node-rs/helper": "^0.4.0"
}, },
"optionalDependencies": { "optionalDependencies": {
"@mtfos/rs-diff-darwin": "^0.0.3", "@mtfos/rs-diff-darwin": "^0.0.4",
"@mtfos/rs-diff-linux": "^0.0.3" "@mtfos/rs-diff-linux": "^0.0.4"
} }
} }