diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d49c42a..705d712 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,7 +40,7 @@ jobs: cache: false min-node-version: 18 rust: true - only: darwin-arm64,darwin-x64,linux-arm64,linux-x64 + only: darwin-arm64,darwin-x64,linux-arm64,linux-x64,windows-x64 # Need this, now that libdatadog packages libunwind as a submodule prebuild: '(command -v apk >/dev/null && apk add autoconf automake libtool) || (command -v apt-get >/dev/null && apt-get update && apt-get install -y autoconf automake libtool) || true' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c6abf54..1734f68 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,7 +28,7 @@ jobs: cache: false min-node-version: 18 rust: true - only: darwin-arm64,darwin-x64,linux-arm64,linux-x64 + only: darwin-arm64,darwin-x64,linux-arm64,linux-x64,windows-x64 publish: runs-on: ubuntu-latest diff --git a/load.js b/load.js index 69cdca5..ae18c07 100644 --- a/load.js +++ b/load.js @@ -10,6 +10,7 @@ const PLATFORM = os.platform() const ARCH = process.arch const LIBC = PLATFORM === 'linux' ? (existsSync('/etc/alpine-release') ? 'musl' : 'glibc') : '' const ABI = process.versions.modules +const EXE_SUFFIX = PLATFORM === 'win32' ? '.exe' : '' const inWebpack = typeof __webpack_require__ === 'function' const runtimeRequire = inWebpack ? __non_webpack_require__ : require @@ -52,7 +53,7 @@ function find (name, binary = false) { // Only apply hyphen-to-underscore conversion for .node libraries, not binaries const transformedName = binary ? name : name.replaceAll('-', '_') - const filename = binary ? transformedName : `${transformedName}.node` + const filename = binary ? `${transformedName}${EXE_SUFFIX}` : `${transformedName}.node` const build = `${root}/build/Release/${filename}` if (existsSync(build)) return build @@ -84,7 +85,7 @@ function findFolder (root) { function findFile (root, name, binary = false) { const files = readdirSync(root) - if (binary) return files.find(f => f === name) + if (binary) return files.find(f => f === `${name}${EXE_SUFFIX}`) return files.find(f => f === `${name}-${ABI}.node`) || files.find(f => f === `${name}-napi.node`) diff --git a/scripts/copy-artifacts.js b/scripts/copy-artifacts.js index e765123..83cd839 100644 --- a/scripts/copy-artifacts.js +++ b/scripts/copy-artifacts.js @@ -13,13 +13,15 @@ const lineReader = readline.createInterface({ input: fs.createReadStream(outPath), }) +const exeSuffix = process.platform === 'win32' ? '.exe' : '' + lineReader.on('line', function (line) { const { filenames, reason, target } = JSON.parse(line) if (reason !== 'compiler-artifact') return if (!target.src_path.startsWith(cratesPath)) return - const filename = target.kind[0] === 'bin' ? target.name : `${target.name}.node` + const filename = target.kind[0] === 'bin' ? `${target.name}${exeSuffix}` : `${target.name}.node` const filePath = path.join(buildPath, filename) fs.mkdirSync(buildPath, { recursive: true })