fork of hey-api/openapi-ts because I need some additional things

chore: put bin back

Lubos 0d32e7b0 77464698

+27 -29
+2 -2
.vscode/launch.json
··· 13 13 "request": "launch", 14 14 "name": "openapi-ts", 15 15 "skipFiles": ["<node_internals>/**"], 16 + "cwd": "${workspaceFolder}/dev", 16 17 "runtimeExecutable": "node", 17 18 "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" 20 20 } 21 21 ] 22 22 }
+2 -2
dev/openapi-ts.config.ts
··· 103 103 // 'tsconfig.nodenext.json', 104 104 // ), 105 105 // }, 106 - path.resolve(__dirname, '.gen'), 106 + '.gen', 107 107 ], 108 108 parser: { 109 109 filters: { ··· 478 478 // // level: 'debug', 479 479 // path: './logs', 480 480 // }, 481 - // output: path.resolve(__dirname, '.gen'), 481 + // output: '.gen', 482 482 // }, 483 483 ]; 484 484 });
+3
packages/openapi-ts/bin/run.cmd
··· 1 + @echo off 2 + node "%~dp0\run.js" %* 3 +
+18
packages/openapi-ts/bin/run.js
··· 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);
+2 -1
packages/openapi-ts/package.json
··· 66 66 "./package.json": "./package.json" 67 67 }, 68 68 "bin": { 69 - "openapi-ts": "./dist/run.js" 69 + "openapi-ts": "./bin/run.js" 70 70 }, 71 71 "files": [ 72 + "bin", 72 73 "dist", 73 74 "LICENSE.md", 74 75 "README.md"
-24
scripts/examples-generate.sh
··· 11 11 12 12 echo "⏳ Generating client code for all examples..." 13 13 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 - 38 14 # Find all examples with openapi-ts script and generate code in parallel 39 15 # Concurrency control: adjust this number depending on CI machine resources 40 16 CONCURRENCY=${CONCURRENCY:-4}