Skip to content

Commit d004b88

Browse files
committed
fix: windows issues
1 parent a92f9f5 commit d004b88

3 files changed

Lines changed: 76 additions & 7 deletions

File tree

build.ts

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,44 @@ async function typeCheck() {
106106
async function buildCLI() {
107107
logger.start("Compiling CLI with bun...");
108108

109+
const externalDependencies = [
110+
// Node.js built-ins
111+
"fs",
112+
"path",
113+
"os",
114+
"util",
115+
"events",
116+
"stream",
117+
"buffer",
118+
"crypto",
119+
// Problematic packages that cause editions-autoloader errors
120+
"version-compare",
121+
"editions",
122+
"errlop",
123+
"istextorbinary",
124+
// Large dependencies that should remain external
125+
"typescript",
126+
"commander",
127+
"chalk",
128+
"ansis",
129+
// All npm dependencies (alternative approach)
130+
...Object.keys(packageJson.dependencies || {}),
131+
...Object.keys(packageJson.devDependencies || {}),
132+
];
133+
109134
const result = await build({
110135
entrypoints: ["src/cli.ts"],
111136
outdir: "bin/build",
112137
target: "node",
113138
define: {
114139
__VERSION__: `"${version}"`,
115140
},
141+
external: externalDependencies,
142+
minify: false,
143+
sourcemap: "none",
144+
splitting: false,
145+
format: "esm",
146+
packages: "external",
116147
});
117148

118149
if (result.success) {
@@ -302,10 +333,19 @@ async function createExecutable() {
302333
const executableContent = `#!/usr/bin/env node
303334
${builtCode}`;
304335

305-
writeFileSync("bin/axogen", executableContent);
306-
chmodSync("bin/axogen", "755");
336+
// Create the main JavaScript executable
337+
writeFileSync("bin/axogen.js", executableContent);
338+
chmodSync("bin/axogen.js", "755");
339+
340+
// Create Windows batch launcher
341+
const windowsLauncher = `@echo off
342+
rem Windows launcher for axogen
343+
node "%~dp0axogen.js" %*
344+
`;
345+
writeFileSync("bin/axogen.cmd", windowsLauncher);
307346

308-
logger.file("Executable created", "bin/axogen");
347+
logger.success("Executable created: bin/axogen.js");
348+
logger.success("Windows launcher created: bin/axogen.cmd");
309349
}
310350

311351
function cleanup() {

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@axonotes/axogen",
3-
"version": "0.5.1",
3+
"version": "0.5.5",
44
"description": "TypeScript-native configuration system that unifies typed environment variables, code generation, and task management for any project",
55
"type": "module",
66
"main": "dist/index.cjs",
@@ -19,17 +19,18 @@
1919
}
2020
},
2121
"bin": {
22-
"axogen": "./bin/axogen"
22+
"axogen": "./bin/axogen.js"
2323
},
2424
"files": [
25-
"bin",
25+
"bin/axogen.js",
26+
"bin/axogen.cmd",
2627
"dist"
2728
],
2829
"scripts": {
2930
"build": "bun run build.ts",
3031
"preview": "bun run format && bun test && bun run build && bun link",
3132
"pub": "bun run format && bun test && bun run build && bun publish",
32-
"test:local": "bun run build && ./bin/axogen --version",
33+
"test:local": "bun run build && ./bin/axogen.js --version",
3334
"docs:start": "cd website && bun run start",
3435
"docs:build": "cd website && bun run build",
3536
"docs:serve": "cd website && bun run serve",

website/docs/09-windows.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: Windows
3+
description: How to use Axogen on Windows
4+
keywords: [advanced axogen, windows configuration, axogen windows setup]
5+
sidebar_position: 9
6+
---
7+
8+
# Windows
9+
10+
Sadly, Windows is not a first-class citizen in the Axogen world. But you can
11+
still use it with some workarounds.
12+
13+
## Using Axogen on Windows
14+
15+
On Linux and macOS, you would run Axogen like this:
16+
17+
```bash
18+
axogen generate
19+
```
20+
21+
On Windows, you need to use `npx` (or your package manager's equivalent):
22+
23+
```bash npm2yarn
24+
npx @axonotes/axogen generate
25+
```
26+
27+
This is the same for all commands. Just prepend `npx @axonotes/axogen` to the
28+
command you want to run instead of `axogen`.

0 commit comments

Comments
 (0)