mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
fix(cli): inject version from package.json, fix docker hint, add --port to dev
- version.ts: replace hardcoded "0.1.0" with __CLI_VERSION__ injected by tsup at build time from package.json — fixes version mismatch where `hyperframes --version` reported 0.1.0 while package was 0.1.4 - tsup.config.ts: add define.__CLI_VERSION__ using package.json version - render.ts: renderDocker error handler showed "Try --docker" even when already using --docker — changed to "Check Docker is running: docker info" - dev.ts: add missing --port arg to embedded mode; findAvailablePort now starts from the user-supplied port instead of hardcoded 3002 Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
committed by
Miguel Ángel
co-authored by
Claude Sonnet 4.6
parent
fd9d56f7e9
commit
9d2362990b
@@ -37,9 +37,11 @@ export default defineCommand({
|
|||||||
meta: { name: "dev", description: "Start the studio for local development" },
|
meta: { name: "dev", description: "Start the studio for local development" },
|
||||||
args: {
|
args: {
|
||||||
dir: { type: "positional", description: "Project directory", required: false },
|
dir: { type: "positional", description: "Project directory", required: false },
|
||||||
|
port: { type: "string", description: "Port to run the dev server on", default: "3002" },
|
||||||
},
|
},
|
||||||
async run({ args }) {
|
async run({ args }) {
|
||||||
const dir = resolve(args.dir ?? ".");
|
const dir = resolve(args.dir ?? ".");
|
||||||
|
const startPort = parseInt(args.port ?? "3002", 10);
|
||||||
|
|
||||||
if (isDevMode()) {
|
if (isDevMode()) {
|
||||||
return runDevMode(dir);
|
return runDevMode(dir);
|
||||||
@@ -50,7 +52,7 @@ export default defineCommand({
|
|||||||
return runLocalStudioMode(dir);
|
return runLocalStudioMode(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
const port = await findAvailablePort(3002);
|
const port = await findAvailablePort(startPort);
|
||||||
return runEmbeddedMode(dir, port);
|
return runEmbeddedMode(dir, port);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ async function renderDocker(
|
|||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
trackRenderError({ fps: options.fps, quality: options.quality, docker: true });
|
trackRenderError({ fps: options.fps, quality: options.quality, docker: true });
|
||||||
const message = error instanceof Error ? error.message : String(error);
|
const message = error instanceof Error ? error.message : String(error);
|
||||||
errorBox("Render failed", message, "Try --docker for containerized rendering");
|
errorBox("Render failed", message, "Check Docker is running: docker info");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
export const VERSION = "0.1.0";
|
declare const __CLI_VERSION__: string;
|
||||||
|
export const VERSION = __CLI_VERSION__;
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
import { defineConfig } from "tsup";
|
import { defineConfig } from "tsup";
|
||||||
import { resolve } from "node:path";
|
import { resolve } from "node:path";
|
||||||
|
import { readFileSync } from "node:fs";
|
||||||
|
|
||||||
|
const pkg = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf-8")) as {
|
||||||
|
version: string;
|
||||||
|
};
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
entry: ["src/cli.ts"],
|
entry: ["src/cli.ts"],
|
||||||
@@ -44,6 +49,9 @@ const __dirname = __hf_dirname(__filename);`,
|
|||||||
"is-unicode-supported",
|
"is-unicode-supported",
|
||||||
"citty",
|
"citty",
|
||||||
],
|
],
|
||||||
|
define: {
|
||||||
|
__CLI_VERSION__: JSON.stringify(pkg.version),
|
||||||
|
},
|
||||||
esbuildOptions(options) {
|
esbuildOptions(options) {
|
||||||
options.alias = {
|
options.alias = {
|
||||||
"@hyperframes/producer": resolve(__dirname, "../producer/src/index.ts"),
|
"@hyperframes/producer": resolve(__dirname, "../producer/src/index.ts"),
|
||||||
|
|||||||
Reference in New Issue
Block a user