diff --git a/package.json b/package.json index b524ee9..9e45930 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "types": "./dist/src/index.d.ts", "scripts": { "install": "prebuild-install --verbose || npm run build", - "build": "node-gyp rebuild && npx tsc --build && node src/clean.js", + "postinstall": "node src/clean.js", + "build": "node-gyp rebuild && npx tsc --build ", "build:dev": "node-gyp rebuild --debug" }, "author": "xiaobaidadada", @@ -34,7 +35,6 @@ "tsconfig.json", "wintun_dll/*" ], - "gypfile": true, "dependencies": { "bindings": "^1.5.0", "jmespath": "^0.16.0", diff --git a/src/clean.js b/src/clean.js index ba16658..128a9f6 100644 --- a/src/clean.js +++ b/src/clean.js @@ -20,6 +20,11 @@ switch (cpuArch) { const p = path.join(__dirname, "..","wintun_dll") const file_list = fs.readdirSync(p); for (const file of file_list) { + if (process.platform === 'win32') { + const fullPath = path.join(__dirname, "..","wintun_dll", file); + fs.unlinkSync(fullPath); + continue; + } if (!file.includes(cpuArch)) { const fullPath = path.join(__dirname, "..","wintun_dll", file); fs.unlinkSync(fullPath);