Skip to content

Fix/multiple build target#10

Merged
Armadillidiid merged 8 commits into
mainfrom
fix/multiple-build-target
May 21, 2026
Merged

Fix/multiple build target#10
Armadillidiid merged 8 commits into
mainfrom
fix/multiple-build-target

Conversation

@Armadillidiid

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings May 12, 2026 12:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds npm packaging + install-time staging to support distributing a native SEA-built cmdly binary, and updates the release workflow to use versioned asset names.

Changes:

  • Add a prepack staging script to copy the default binary into ./bin/cmdly.
  • Add a postinstall script intended to swap in the correct platform binary from dist/<target>/cmdly.
  • Update package.json metadata/scripts for publishing and update the release workflow’s artifact naming.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
scripts/stage-default-bin.mjs Stages dist/linux-x64/cmdly into bin/cmdly prior to packing/publishing.
scripts/postinstall.mjs Installs the target-specific binary into bin/cmdly at install time.
package.json Adds bin mapping + files allowlist; adjusts build/staging/publish scripts.
.github/workflows/release.yml Uses pnpm build and versioned asset names for release artifacts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/postinstall.mjs
Comment on lines +47 to +52
if (!target) {
console.warn(
`[postinstall] skipping unsupported target ${process.platform}-${process.arch}; supported: ${supportedTargets.join(", ")}`,
);
return;
}
Comment thread scripts/postinstall.mjs Outdated
Comment thread package.json
Comment thread package.json
Armadillidiid and others added 2 commits May 12, 2026 19:39
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

const __dirname = dirname(__filename);
const rootDir = resolve(__dirname, "..");

const source = join(rootDir, "dist", "linux-x64", "cmdly");
Comment thread scripts/publish.mjs
Comment on lines +12 to +20
const run = (cmd, args, opts) => {
const result = spawnSync(cmd, args, {
cwd: rootDir,
stdio: "inherit",
...opts,
});
if (result.status !== 0) {
process.exit(result.status ?? 1);
}
Comment thread scripts/publish.mjs

run("pnpm", ["build"]);
run("pnpm", ["stage:bin"]);
run("pnpm", ["vitest"]);
Comment thread scripts/postinstall.mjs
Comment on lines +63 to +64
const sourcePath = join(packageRoot, "dist", target, "cmdly");
installBinary(sourcePath);
Comment thread package.json
Comment on lines +24 to +31
"bin": {
"cmdly": "./bin/cmdly"
},
"files": [
"bin/cmdly",
"dist",
"scripts/postinstall.mjs"
],

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Comment on lines +9 to +16
const source = join(rootDir, "dist", "linux-x64", "cmdly");
const targetDir = join(rootDir, "bin");
const target = join(targetDir, "cmdly");

mkdirSync(targetDir, { recursive: true });
rmSync(target, { force: true });
copyFileSync(source, target);
chmodSync(target, 0o755);
Comment thread scripts/postinstall.mjs
Comment on lines +63 to +77
const sourcePath = join(packageRoot, "dist", target, "cmdly");
installBinary(sourcePath);

console.log(`[postinstall] installed ${target} binary`);
};

try {
main();
} catch (error) {
const target = detectTarget();
const message = error instanceof Error ? error.message : String(error);

if (target) {
console.error(`[postinstall] native install failed for ${target}: ${message}`);
process.exit(1);
Comment thread scripts/publish.mjs
Comment on lines +36 to +38
const savedDevEnginesPackageManager = JSON.parse(
JSON.stringify(pkg.devEngines?.packageManager),
);
Comment thread scripts/publish.mjs
Comment on lines +40 to +55
original.scripts.postinstall = "node scripts/postinstall.mjs";
original.packageManager = `npm@${npmVersion}`;
if (original.devEngines) {
original.devEngines.packageManager = {
name: "npm",
version: npmVersion,
};
}
writeFileSync(pkgPath, `${JSON.stringify(original, null, "\t")}\n`, "utf8");

run("pnpm", ["build"]);
run("pnpm", ["stage:bin"]);
run("pnpm", ["vitest"]);
run("changeset", ["publish"]);
run("changeset", ["tag"]);
run("git", ["push", "--tags"]);
Comment thread package.json
"prepack": "pnpm build && pnpm stage:bin",
"prepare": "effect-language-service patch",
"clean": "rm -rf dist .sea",
"clean": "rm -rf dist",
Comment thread scripts/publish.mjs
encoding: "utf8",
stdio: "pipe",
});
return result.stdout.trim();
@Armadillidiid Armadillidiid force-pushed the fix/multiple-build-target branch from c0deb10 to 3dd19e9 Compare May 21, 2026 10:03
@Armadillidiid Armadillidiid merged commit c2c6f91 into main May 21, 2026
3 checks passed
@Armadillidiid Armadillidiid deleted the fix/multiple-build-target branch May 21, 2026 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants