mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
fix(cloudrun): publish adapter contract
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
* ./server (the Cloud Run runtime entry — what the Dockerfile runs)
|
||||
* ./sdk (client-side helpers — GCS + Workflows clients only, no
|
||||
* chromium/puppeteer)
|
||||
* ./terraform (stable resolver for the packaged Terraform module)
|
||||
*
|
||||
* All production deps are kept external so consumers (and the container
|
||||
* image) resolve them via their own node_modules.
|
||||
@@ -46,6 +47,7 @@ await Promise.all([
|
||||
build({ ...sharedOpts, entryPoints: ["src/index.ts"], outfile: "dist/index.js" }),
|
||||
build({ ...sharedOpts, entryPoints: ["src/server.ts"], outfile: "dist/server.js" }),
|
||||
build({ ...sharedOpts, entryPoints: ["src/sdk/index.ts"], outfile: "dist/sdk/index.js" }),
|
||||
build({ ...sharedOpts, entryPoints: ["src/terraform.ts"], outfile: "dist/terraform.js" }),
|
||||
]);
|
||||
|
||||
// esbuild doesn't emit .d.ts. tsc does, with a build-only tsconfig that
|
||||
@@ -55,4 +57,4 @@ await Promise.all([
|
||||
// violate rootDir).
|
||||
execSync("tsc -p tsconfig.build.json --emitDeclarationOnly", { stdio: "inherit" });
|
||||
|
||||
console.log("[Build] Complete: dist/{index,server,sdk/index}.js + .d.ts");
|
||||
console.log("[Build] Complete: dist/{index,server,sdk/index,terraform}.js + .d.ts");
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
"runtime": "./dist/sdk/index.js",
|
||||
"types": "./dist/sdk/index.d.ts",
|
||||
"environments": ["bun", "node"]
|
||||
},
|
||||
"./terraform": {
|
||||
"source": "./src/terraform.ts",
|
||||
"runtime": "./dist/terraform.js",
|
||||
"types": "./dist/terraform.d.ts",
|
||||
"environments": ["bun", "node"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,11 @@
|
||||
"bun": "./src/sdk/index.ts",
|
||||
"import": "./src/sdk/index.ts",
|
||||
"types": "./src/sdk/index.ts"
|
||||
},
|
||||
"./terraform": {
|
||||
"bun": "./src/terraform.ts",
|
||||
"import": "./src/terraform.ts",
|
||||
"types": "./src/terraform.ts"
|
||||
}
|
||||
},
|
||||
"publishConfig": {
|
||||
@@ -47,6 +52,10 @@
|
||||
"./sdk": {
|
||||
"import": "./dist/sdk/index.js",
|
||||
"types": "./dist/sdk/index.d.ts"
|
||||
},
|
||||
"./terraform": {
|
||||
"import": "./dist/terraform.js",
|
||||
"types": "./dist/terraform.d.ts"
|
||||
}
|
||||
},
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
|
||||
@@ -62,3 +62,4 @@ export {
|
||||
type RenderCost,
|
||||
} from "./sdk/costAccounting.js";
|
||||
export { InvalidConfigError, validateDistributedRenderConfig } from "./sdk/validateConfig.js";
|
||||
export { getTerraformModuleDir } from "./terraform.js";
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { existsSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getTerraformModuleDir } from "./terraform.js";
|
||||
|
||||
describe("getTerraformModuleDir", () => {
|
||||
it("resolves the adapter-owned Terraform assets through public code", () => {
|
||||
const directory = getTerraformModuleDir();
|
||||
expect(existsSync(join(directory, "main.tf"))).toBe(true);
|
||||
expect(existsSync(join(directory, "workflow.yaml"))).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { dirname, resolve } from "node:path";
|
||||
|
||||
/**
|
||||
* Absolute path to the Terraform module shipped with this adapter.
|
||||
*
|
||||
* This module is built as `dist/terraform.js`, preserving the same one-level
|
||||
* relationship to the package-owned `terraform/` directory as the source
|
||||
* file. Consumers should use this API instead of resolving package.json,
|
||||
* which is not a stable public subpath.
|
||||
*/
|
||||
export function getTerraformModuleDir(): string {
|
||||
return resolve(dirname(fileURLToPath(import.meta.url)), "..", "terraform");
|
||||
}
|
||||
Reference in New Issue
Block a user