From accbf4d82b90457e4f0b96f220cb06f7f288b257 Mon Sep 17 00:00:00 2001 From: fan xia Date: Thu, 7 Dec 2023 00:40:15 +0800 Subject: [PATCH] pub --- addon/package.json | 74 +++++++++++++++++++++++----------------------- package.json | 5 ++-- prepub.js | 5 ++++ 3 files changed, 45 insertions(+), 39 deletions(-) create mode 100644 prepub.js diff --git a/addon/package.json b/addon/package.json index 27f59e6..90d2cd2 100644 --- a/addon/package.json +++ b/addon/package.json @@ -1,38 +1,38 @@ -{ - "name": "rubick-native-addon", - "version": "0.0.0", - "main": "index.js", - "types": "index.d.ts", - "napi": { - "name": "rubick-native-addon", - "triples": { - "additional": [ - "aarch64-unknown-linux-gnu", - "aarch64-unknown-linux-musl", - "x86_64-unknown-linux-musl", - "aarch64-apple-darwin", - "universal-apple-darwin", - "aarch64-pc-windows-msvc", - "i686-pc-windows-msvc" - ] - } - }, - "engines": { - "node": ">= 10" - }, - "scripts": { - "artifacts": "napi artifacts", - "build": "napi build --platform --release && node ./postbuild.js", - "build:debug": "napi build --platform", - "prepublishOnly": "node ./prepub.js && napi prepublish -t npm", - "universal": "napi universal", - "version": "napi version" - }, - "devDependencies": { - "@napi-rs/cli": "^2.16.5" - }, - "files": [ - "index.js", - "index.d.ts" - ] +{ + "name": "rubick-native-addon", + "version": "0.0.0", + "main": "index.js", + "types": "index.d.ts", + "napi": { + "name": "rubick-native-addon", + "triples": { + "additional": [ + "aarch64-unknown-linux-gnu", + "aarch64-unknown-linux-musl", + "x86_64-unknown-linux-musl", + "aarch64-apple-darwin", + "universal-apple-darwin", + "aarch64-pc-windows-msvc", + "i686-pc-windows-msvc" + ] + } + }, + "engines": { + "node": ">= 10" + }, + "scripts": { + "artifacts": "napi artifacts", + "build": "napi build --platform --release && node ./postbuild.js", + "build:debug": "napi build --platform", + "prepublishOnly": "node ./prepub.js && napi prepublish -t npm", + "universal": "napi universal", + "version": "napi version" + }, + "devDependencies": { + "@napi-rs/cli": "^2.16.5" + }, + "files": [ + "index.js", + "index.d.ts" + ] } \ No newline at end of file diff --git a/package.json b/package.json index 2c59b69..6f9a8dd 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,13 @@ { "name": "rubick-native", - "version": "0.0.16-beta", + "version": "0.0.16", "type": "module", "main": "dist/index.cjs", "module": "dist/index.js", "types": "dist/index.d.ts", "scripts": { - "build": "cd addon && npm run build && cd .. && tsup --cjsInterop" + "build": "cd addon && npm run build && cd .. && tsup --cjsInterop", + "prepublishOnly": "node ./prepub.js" }, "devDependencies": { "@types/node": "^20.10.3", diff --git a/prepub.js b/prepub.js new file mode 100644 index 0000000..9822df2 --- /dev/null +++ b/prepub.js @@ -0,0 +1,5 @@ +import { readFileSync, writeFileSync } from "fs" + +const pkg = { ...readFileSync('./package.json', 'utf8'), optionalDependencies: readFileSync('./addon/package.json', 'utf8').optionalDependencies } + +writeFileSync('./package.json', pkg) \ No newline at end of file