This commit is contained in:
Jay 2020-08-25 15:27:30 +08:00
parent 26772cadc6
commit fa3715c748
7 changed files with 18 additions and 6 deletions

12
.npmignore Normal file
View File

@ -0,0 +1,12 @@
Cargo.lock
Cargo.toml
.git
.github
.idea
node_modules/
npm/
scripts/
target/
package-lock.json
yarn.lock

View File

@ -1,5 +1,5 @@
{ {
"name": "rs-diff", "name": "rs-diff-darwin",
"version": "0.0.1", "version": "0.0.1",
"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",

View File

@ -1,5 +1,5 @@
{ {
"name": "rs-diff", "name": "rs-diff-linux",
"version": "0.0.1", "version": "0.0.1",
"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",

View File

@ -1,5 +1,5 @@
{ {
"name": "rs-diff", "name": "rs-diff-win32",
"version": "0.0.1", "version": "0.0.1",
"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",

View File

@ -59,7 +59,6 @@
}, },
"optionalDependencies": { "optionalDependencies": {
"rs-diff-darwin": "^0.0.1", "rs-diff-darwin": "^0.0.1",
"rs-diff-linux": "^0.0.1", "rs-diff-linux": "^0.0.1"
"rs-diff-win32": "^0.0.1"
} }
} }

View File

@ -1 +1 @@
module.exports = ['darwin', 'linux', 'win32'] module.exports = ['darwin', 'linux']

View File

@ -17,6 +17,7 @@ updatePackageJson(path.join(__dirname, '..', 'package.json'), {
for (const name of platforms) { for (const name of platforms) {
const pkgDir = path.join(__dirname, '..', 'npm', name) const pkgDir = path.join(__dirname, '..', 'npm', name)
const filename = `index.${name}.node` const filename = `index.${name}.node`
if (!fs.existsSync(path.join(__dirname, '..', filename))) continue
const bindingFile = fs.readFileSync(path.join(__dirname, '..', filename)) const bindingFile = fs.readFileSync(path.join(__dirname, '..', filename))
fs.writeFileSync(path.join(pkgDir, filename), bindingFile) fs.writeFileSync(path.join(pkgDir, filename), bindingFile)
execSync('npm publish', { execSync('npm publish', {