Skip to content

Commit d977771

Browse files
committed
fix(windows): set win32 os metadata for platform binary package
1 parent f738f0c commit d977771

File tree

3 files changed

+34
-18
lines changed

3 files changed

+34
-18
lines changed

bun.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@
5353
"typescript-eslint": "^8.44.1",
5454
},
5555
"optionalDependencies": {
56-
"codemachine-darwin-arm64": "0.6.2",
57-
"codemachine-darwin-x64": "0.6.2",
58-
"codemachine-linux-x64": "0.6.2",
59-
"codemachine-windows-x64": "0.6.2",
56+
"codemachine-darwin-arm64": "0.6.4",
57+
"codemachine-darwin-x64": "0.6.4",
58+
"codemachine-linux-x64": "0.6.4",
59+
"codemachine-windows-x64": "0.6.4",
6060
},
6161
},
6262
},

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codemachine",
3-
"version": "0.6.3",
3+
"version": "0.6.4",
44
"description": "Multi-Agent Workflow Orchestration.",
55
"type": "module",
66
"bin": {
@@ -17,10 +17,10 @@
1717
"bun": "1.3.3"
1818
},
1919
"optionalDependencies": {
20-
"codemachine-linux-x64": "0.6.3",
21-
"codemachine-darwin-arm64": "0.6.3",
22-
"codemachine-darwin-x64": "0.6.3",
23-
"codemachine-windows-x64": "0.6.3"
20+
"codemachine-linux-x64": "0.6.4",
21+
"codemachine-darwin-arm64": "0.6.4",
22+
"codemachine-darwin-x64": "0.6.4",
23+
"codemachine-windows-x64": "0.6.4"
2424
},
2525
"scripts": {
2626
"_comment_dev": "Development: Run from source (no build needed)",

scripts/build-binaries.mjs

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,19 @@ if (watcherVersion) {
9393

9494
// Map platform/arch to target names
9595
const platformMap = {
96-
'linux-x64': { target: 'bun-linux-x64', os: 'linux', arch: 'x64', ext: '' },
97-
'darwin-arm64': { target: 'bun-darwin-arm64', os: 'darwin', arch: 'arm64', ext: '' },
98-
'darwin-x64': { target: 'bun-darwin-x64', os: 'darwin', arch: 'x64', ext: '' },
99-
'win32-x64': { target: 'bun-windows-x64', os: 'windows', arch: 'x64', ext: '.exe' },
96+
'linux-x64': { target: 'bun-linux-x64', pkgOs: 'linux', npmOs: 'linux', arch: 'x64', ext: '' },
97+
'darwin-arm64': { target: 'bun-darwin-arm64', pkgOs: 'darwin', npmOs: 'darwin', arch: 'arm64', ext: '' },
98+
'darwin-x64': { target: 'bun-darwin-x64', pkgOs: 'darwin', npmOs: 'darwin', arch: 'x64', ext: '' },
99+
// NOTE: npm expects `win32` in the package.json `os` field; using `windows` causes the
100+
// optional dependency to be skipped entirely on Windows. Keep the package name as
101+
// `codemachine-windows-x64`, but set the npm metadata to `win32` so it installs.
102+
'win32-x64': {
103+
target: 'bun-windows-x64',
104+
pkgOs: 'windows',
105+
npmOs: 'win32',
106+
arch: 'x64',
107+
ext: '.exe',
108+
},
100109
};
101110

102111
// Determine which targets to build
@@ -133,8 +142,15 @@ const outputRoot = process.env.OUTPUT_DIR || process.env.OUTPUT_ROOT || './binar
133142

134143
try {
135144
for (const targetConfig of targets) {
136-
const { target, os, arch: archName, ext = '', key } = targetConfig;
137-
const outdir = join(outputRoot, `codemachine-${os}-${archName}`);
145+
const {
146+
target,
147+
pkgOs = targetConfig.os,
148+
npmOs = targetConfig.pkgOs ?? targetConfig.os,
149+
arch: archName,
150+
ext = '',
151+
key,
152+
} = targetConfig;
153+
const outdir = join(outputRoot, `codemachine-${pkgOs}-${archName}`);
138154

139155
console.log(`${cyan}${reset} Building executables for ${dim}${target}${reset}...`);
140156
mkdirSync(outdir, { recursive: true });
@@ -200,7 +216,7 @@ try {
200216
console.log(` ${green}${reset} ${dim}Workflow runner built${reset}`);
201217

202218
// Create package.json for the platform-specific package
203-
const pkgName = `codemachine-${os}-${archName}`;
219+
const pkgName = `codemachine-${pkgOs}-${archName}`;
204220
const binEntries = {
205221
codemachine: `codemachine${ext}`,
206222
'codemachine-workflow': `codemachine-workflow${ext}`,
@@ -210,8 +226,8 @@ try {
210226
const pkg = {
211227
name: pkgName,
212228
version: mainVersion,
213-
description: `${mainPackage.description} (prebuilt ${os}-${archName} binaries)`,
214-
os: [os],
229+
description: `${mainPackage.description} (prebuilt ${pkgOs}-${archName} binaries)`,
230+
os: [npmOs],
215231
cpu: [archName],
216232
files: ['codemachine' + ext, 'codemachine-workflow' + ext],
217233
bin: binEntries,

0 commit comments

Comments
 (0)