mirror of
https://github.com/hanzoai/frames.git
synced 2026-09-24 00:08:03 +00:00
chore(lambda): publish-readiness for @hyperframes/aws-lambda
The Lambda adapter has been on `main` since PR #909 but its package manifest still shipped TypeScript source (`main: ./src/index.ts`, `build: tsc --noEmit`, `version: 0.0.1`) and the publish workflow didn't list it. This wires it up to publish alongside the other `@hyperframes/*` packages on the next `v*` tag. Changes: - **packages/aws-lambda/build.mjs (new)** — mirrors `packages/producer/build.mjs`: esbuild bundles four entry points (`src/index.ts`, `src/handler.ts`, `src/sdk/index.ts`, `src/cdk/index.ts`) → `dist/`, then `tsc --emitDeclarationOnly` emits .d.ts via `tsconfig.build.json`. All runtime/peer deps (@aws-sdk/*, @hyperframes/producer*, @sparticuz/chromium, aws-cdk-lib, constructs, ffmpeg-static, ffprobe-static, puppeteer-core, tar) are external so consumers resolve them through their own node_modules. - **packages/aws-lambda/tsconfig.build.json (new)** — drops the workspace `paths` overrides so `@hyperframes/producer*` resolves through node_modules to producer's already-built `dist/` types instead of pulling its full source tree into emit (which would violate `rootDir`). - **packages/aws-lambda/tsconfig.json** — keeps `noEmit: true` + workspace `paths` for fast in-place typechecks; also excludes `src/**/__fixtures__/**` so test-only helpers (fakeS3) don't leak into emitted declarations. - **packages/aws-lambda/package.json**: * version bumped 0.0.1 → 0.6.18 (matches the repo's lockstep release cadence) * main / types / exports map points at `dist/...` * files: ["dist/", "scripts/", "README.md"] (scripts/ kept whole because build-zip.ts and verify-zip-size.ts both import scripts/_formatBytes.ts) * scripts.build = `node build.mjs` - **package.json** — root `build` filter includes `aws-lambda` so `bun run build` builds it in topological order after producer. - **.github/workflows/publish.yml** — one new `publish_pkg "@hyperframes/aws-lambda" "@hyperframes/aws-lambda"` line. First publish is automatic via the `--access public` flag in `publish_pkg`; the @hyperframes scope already owns the name. Verification: bun run build # full root build green bun run verify:packed-manifests # aws-lambda passes pnpm pack packages/cli # @hyperframes/aws-lambda # rewrites workspace:* → 0.6.18 npm install -g <cli-tgz> # smoke-install still works hyperframes lambda deploy # friendly missing-package # error still fires when # aws-lambda isn't installed
This commit is contained in:
@@ -130,6 +130,7 @@ jobs:
|
||||
publish_pkg "@hyperframes/producer" "@hyperframes/producer"
|
||||
publish_pkg "@hyperframes/shader-transitions" "@hyperframes/shader-transitions"
|
||||
publish_pkg "@hyperframes/studio" "@hyperframes/studio"
|
||||
publish_pkg "@hyperframes/aws-lambda" "@hyperframes/aws-lambda"
|
||||
|
||||
# CLI is @hyperframes/cli in the monorepo but published as unscoped "hyperframes" on npm.
|
||||
# Rewrite the name in package.json before publishing, then use npm publish directly
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "bun run studio",
|
||||
"build": "bun run --filter @hyperframes/core build && bun run --filter '@hyperframes/{core,engine,producer,player,studio,shader-transitions}' build && bun run --filter @hyperframes/cli build",
|
||||
"build": "bun run --filter @hyperframes/core build && bun run --filter '@hyperframes/{core,engine,producer,player,studio,shader-transitions,aws-lambda}' build && bun run --filter @hyperframes/cli build",
|
||||
"build:producer": "bun run --filter @hyperframes/producer build",
|
||||
"studio": "bun run --filter @hyperframes/studio dev",
|
||||
"build:hyperframes-runtime": "bun run --filter @hyperframes/core build:hyperframes-runtime",
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Build script for @hyperframes/aws-lambda (public OSS package).
|
||||
*
|
||||
* Bundles each subpath barrel via esbuild → dist/, then emits .d.ts via tsc.
|
||||
*
|
||||
* Subpaths (each gets its own dist entry so adopters that import one path
|
||||
* don't load the others' transitive graphs at module-load time):
|
||||
*
|
||||
* . (the umbrella barrel: handler + sdk + cdk types re-exported)
|
||||
* ./handler (the Lambda runtime entry — what `scripts/build-zip.ts` ZIPs)
|
||||
* ./sdk (client-side helpers — AWS-SDK only, no chromium/puppeteer)
|
||||
* ./cdk (CDK L2 construct — aws-cdk-lib is a peer dep)
|
||||
*
|
||||
* All production deps and peer deps are kept external so consumers resolve
|
||||
* them via their own node_modules.
|
||||
*/
|
||||
|
||||
import { build } from "esbuild";
|
||||
import { execSync } from "node:child_process";
|
||||
import { mkdirSync, rmSync } from "node:fs";
|
||||
|
||||
rmSync("dist", { recursive: true, force: true });
|
||||
mkdirSync("dist", { recursive: true });
|
||||
|
||||
const sharedOpts = {
|
||||
bundle: true,
|
||||
platform: "node",
|
||||
target: "node22",
|
||||
format: "esm",
|
||||
minify: false,
|
||||
sourcemap: true,
|
||||
external: [
|
||||
"@aws-sdk/client-s3",
|
||||
"@aws-sdk/client-sfn",
|
||||
"@hyperframes/producer",
|
||||
"@hyperframes/producer/distributed",
|
||||
"@sparticuz/chromium",
|
||||
"aws-cdk-lib",
|
||||
"constructs",
|
||||
"ffmpeg-static",
|
||||
"ffprobe-static",
|
||||
"puppeteer-core",
|
||||
"tar",
|
||||
],
|
||||
};
|
||||
|
||||
await Promise.all([
|
||||
build({ ...sharedOpts, entryPoints: ["src/index.ts"], outfile: "dist/index.js" }),
|
||||
build({ ...sharedOpts, entryPoints: ["src/handler.ts"], outfile: "dist/handler.js" }),
|
||||
build({ ...sharedOpts, entryPoints: ["src/sdk/index.ts"], outfile: "dist/sdk/index.js" }),
|
||||
build({ ...sharedOpts, entryPoints: ["src/cdk/index.ts"], outfile: "dist/cdk/index.js" }),
|
||||
]);
|
||||
|
||||
// esbuild doesn't emit .d.ts. tsc does, with a build-only tsconfig that
|
||||
// drops the workspace `paths` overrides so `@hyperframes/producer` resolves
|
||||
// through node_modules to the sibling package's already-built `dist/`
|
||||
// types instead of pulling its full source tree into emit (which would
|
||||
// violate rootDir).
|
||||
execSync("tsc -p tsconfig.build.json --emitDeclarationOnly", { stdio: "inherit" });
|
||||
|
||||
console.log("[Build] Complete: dist/{index,handler,sdk/index,cdk/index}.js + .d.ts");
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hyperframes/aws-lambda",
|
||||
"version": "0.0.1",
|
||||
"version": "0.6.18",
|
||||
"description": "AWS Lambda adapter for HyperFrames distributed rendering — handler, client-side SDK, and CDK construct.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -8,25 +8,37 @@
|
||||
"directory": "packages/aws-lambda"
|
||||
},
|
||||
"files": [
|
||||
"src/",
|
||||
"dist/",
|
||||
"scripts/",
|
||||
"README.md"
|
||||
],
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./handler": "./src/handler.ts",
|
||||
"./sdk": "./src/sdk/index.ts",
|
||||
"./cdk": "./src/cdk/index.ts"
|
||||
".": {
|
||||
"import": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"./handler": {
|
||||
"import": "./dist/handler.js",
|
||||
"types": "./dist/handler.d.ts"
|
||||
},
|
||||
"./sdk": {
|
||||
"import": "./dist/sdk/index.js",
|
||||
"types": "./dist/sdk/index.d.ts"
|
||||
},
|
||||
"./cdk": {
|
||||
"import": "./dist/cdk/index.js",
|
||||
"types": "./dist/cdk/index.d.ts"
|
||||
}
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc --noEmit",
|
||||
"build": "node build.mjs",
|
||||
"build:zip": "tsx scripts/build-zip.ts",
|
||||
"probe:beginframe": "tsx scripts/probe-beginframe.ts",
|
||||
"probe:beginframe:docker": "docker build -f scripts/probe-beginframe.dockerfile -t hyperframes-lambda-probe:local ../.. && docker run --rm hyperframes-lambda-probe:local",
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"paths": {},
|
||||
"noEmit": false,
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"sourceMap": true
|
||||
}
|
||||
}
|
||||
@@ -15,5 +15,5 @@
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist", "src/**/*.test.ts", "scripts"]
|
||||
"exclude": ["node_modules", "dist", "src/**/*.test.ts", "src/**/__fixtures__/**", "scripts"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user