Skip to content

Commit 0d32e7b

Browse files
committed
chore: put bin back
1 parent 7746469 commit 0d32e7b

File tree

6 files changed

+27
-29
lines changed

6 files changed

+27
-29
lines changed

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
"request": "launch",
1414
"name": "openapi-ts",
1515
"skipFiles": ["<node_internals>/**"],
16+
"cwd": "${workspaceFolder}/dev",
1617
"runtimeExecutable": "node",
1718
"runtimeArgs": ["-r", "ts-node/register/transpile-only"],
18-
"program": "${workspaceFolder}/packages/openapi-ts/src/cli.ts",
19-
"args": ["-f", "${workspaceFolder}/dev/openapi-ts.config.ts"]
19+
"program": "${workspaceFolder}/packages/openapi-ts/src/cli.ts"
2020
}
2121
]
2222
}

dev/openapi-ts.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export default defineConfig(() => {
103103
// 'tsconfig.nodenext.json',
104104
// ),
105105
// },
106-
path.resolve(__dirname, '.gen'),
106+
'.gen',
107107
],
108108
parser: {
109109
filters: {
@@ -478,7 +478,7 @@ export default defineConfig(() => {
478478
// // level: 'debug',
479479
// path: './logs',
480480
// },
481-
// output: path.resolve(__dirname, '.gen'),
481+
// output: '.gen',
482482
// },
483483
];
484484
});

packages/openapi-ts/bin/run.cmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
node "%~dp0\run.js" %*
3+

packages/openapi-ts/bin/run.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env node
2+
import { spawnSync } from 'node:child_process';
3+
import fs from 'node:fs';
4+
import path from 'node:path';
5+
import { fileURLToPath } from 'node:url';
6+
7+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
8+
const target = path.join(__dirname, '..', 'dist', 'run.js');
9+
10+
if (!fs.existsSync(target)) {
11+
console.error('openapi-ts not built (expect dist/run.js)');
12+
process.exit(1);
13+
}
14+
15+
const res = spawnSync(process.execPath, [target, ...process.argv.slice(2)], {
16+
stdio: 'inherit',
17+
});
18+
process.exit(res.status ?? 0);

packages/openapi-ts/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@
6666
"./package.json": "./package.json"
6767
},
6868
"bin": {
69-
"openapi-ts": "./dist/run.js"
69+
"openapi-ts": "./bin/run.js"
7070
},
7171
"files": [
72+
"bin",
7273
"dist",
7374
"LICENSE.md",
7475
"README.md"

scripts/examples-generate.sh

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,6 @@ ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
1111

1212
echo "⏳ Generating client code for all examples..."
1313

14-
# Build the CLI package and show diagnostics so CI can report why the bin may be missing
15-
echo "Building @hey-api/openapi-ts (required for example generation)..."
16-
if command -v pnpm >/dev/null 2>&1; then
17-
if pnpm -w -s --version >/dev/null 2>&1; then
18-
pnpm -w -s --filter "@hey-api/openapi-ts" build || pnpm -s --filter "@hey-api/openapi-ts" build || true
19-
else
20-
pnpm -s --filter "@hey-api/openapi-ts" build || true
21-
fi
22-
fi
23-
24-
CLI_PKG_DIR="$ROOT_DIR/packages/openapi-ts"
25-
echo "-> Debug: showing $CLI_PKG_DIR/package.json"
26-
if [ -f "$CLI_PKG_DIR/package.json" ]; then
27-
cat "$CLI_PKG_DIR/package.json"
28-
else
29-
echo "-> Debug: package.json missing at $CLI_PKG_DIR"
30-
fi
31-
32-
echo "-> Debug: listing $CLI_PKG_DIR top-level files"
33-
ls -la "$CLI_PKG_DIR" || true
34-
echo "-> Debug: listing $CLI_PKG_DIR/dist"
35-
ls -la "$CLI_PKG_DIR/dist" 2>/dev/null || echo "-> Debug: dist missing"
36-
37-
3814
# Find all examples with openapi-ts script and generate code in parallel
3915
# Concurrency control: adjust this number depending on CI machine resources
4016
CONCURRENCY=${CONCURRENCY:-4}

0 commit comments

Comments
 (0)