diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..7e47fee --- /dev/null +++ b/.npmignore @@ -0,0 +1,12 @@ +Cargo.lock +Cargo.toml +.git +.github +.idea +node_modules/ +npm/ +scripts/ +target/ + +package-lock.json +yarn.lock diff --git a/npm/darwin/package.json b/npm/darwin/package.json index 0de111b..0a4be1f 100644 --- a/npm/darwin/package.json +++ b/npm/darwin/package.json @@ -1,5 +1,5 @@ { - "name": "rs-diff", + "name": "rs-diff-darwin", "version": "0.0.1", "description": "Template project for writing node package with napi-rs", "repository": "https://git.trj.tw/nodejs/rs-diff.git", diff --git a/npm/linux/package.json b/npm/linux/package.json index b58fada..30e688d 100644 --- a/npm/linux/package.json +++ b/npm/linux/package.json @@ -1,5 +1,5 @@ { - "name": "rs-diff", + "name": "rs-diff-linux", "version": "0.0.1", "description": "Template project for writing node package with napi-rs", "repository": "https://git.trj.tw/nodejs/rs-diff.git", diff --git a/npm/win32/package.json b/npm/win32/package.json index 84dd4c4..4c1051e 100644 --- a/npm/win32/package.json +++ b/npm/win32/package.json @@ -1,5 +1,5 @@ { - "name": "rs-diff", + "name": "rs-diff-win32", "version": "0.0.1", "description": "Template project for writing node package with napi-rs", "repository": "https://git.trj.tw/nodejs/rs-diff.git", diff --git a/package.json b/package.json index 7f1c2a1..2c53bb6 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,6 @@ }, "optionalDependencies": { "rs-diff-darwin": "^0.0.1", - "rs-diff-linux": "^0.0.1", - "rs-diff-win32": "^0.0.1" + "rs-diff-linux": "^0.0.1" } } diff --git a/scripts/platforms.js b/scripts/platforms.js index bf54c65..d57b58c 100644 --- a/scripts/platforms.js +++ b/scripts/platforms.js @@ -1 +1 @@ -module.exports = ['darwin', 'linux', 'win32'] +module.exports = ['darwin', 'linux'] diff --git a/scripts/publish.js b/scripts/publish.js index 874fd6e..bc84f9c 100644 --- a/scripts/publish.js +++ b/scripts/publish.js @@ -17,6 +17,7 @@ updatePackageJson(path.join(__dirname, '..', 'package.json'), { for (const name of platforms) { const pkgDir = path.join(__dirname, '..', 'npm', name) const filename = `index.${name}.node` + if (!fs.existsSync(path.join(__dirname, '..', filename))) continue const bindingFile = fs.readFileSync(path.join(__dirname, '..', filename)) fs.writeFileSync(path.join(pkgDir, filename), bindingFile) execSync('npm publish', {