diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 7214836..79cb019 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -42,6 +42,15 @@ jobs: RAW="${{ github.event.release.tag_name || inputs.version }}" echo "value=${RAW#v}" >> "$GITHUB_OUTPUT" + # The benchmark adapter loads lambda-api from the working tree via require('../../'), + # which resolves through the root package's "main" (./dist/cjs/index.js). That path + # only exists after a build, so the root package must be installed and built first. + - name: Install root dependencies + run: npm ci --ignore-scripts + + - name: Build dist (CJS + ESM) + run: npm run build + - name: Install benchmark dependencies working-directory: benchmarks run: npm ci diff --git a/benchmarks/frameworks/lambda-api.js b/benchmarks/frameworks/lambda-api.js index 96ed48e..67f80d8 100644 --- a/benchmarks/frameworks/lambda-api.js +++ b/benchmarks/frameworks/lambda-api.js @@ -26,4 +26,9 @@ function build() { return (event, context) => api.run(event, context); } -module.exports = { name: 'lambda-api', version: pkg.version, build }; +// package.json ships a 0.0.0-development placeholder (the real version is stamped at +// publish time), so prefer the release label the workflow passes in — same precedence +// as the run metadata in run.js. +const version = process.env.LAMBDA_API_VERSION || pkg.version; + +module.exports = { name: 'lambda-api', version, build };