Skip to content

Commit

Permalink
feat: add runtime API version property (netlify/zip-it-and-ship-it#1575)
Browse files Browse the repository at this point in the history
* feat: add runtime API version property

* fix: remove only from test
  • Loading branch information
jenae-janzen authored Sep 25, 2023
1 parent 7ec51fb commit 6625a2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/zip-it-and-ship-it/src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type { FunctionResult } from './utils/format_result.js'
import type { Route } from './utils/routes.js'

interface ManifestFunction {
buildData?: Record<string, unknown>
invocationMode?: InvocationMode
mainFile: string
name: string
Expand Down Expand Up @@ -55,13 +56,15 @@ const formatFunctionForManifest = ({
routes,
runtime,
runtimeVersion,
runtimeAPIVersion,
schedule,
}: FunctionResult): ManifestFunction => {
const manifestFunction: ManifestFunction = {
bundler,
displayName,
generator,
invocationMode,
buildData: { runtimeAPIVersion },
mainFile,
name,
runtimeVersion,
Expand Down
3 changes: 2 additions & 1 deletion packages/zip-it-and-ship-it/tests/v2api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ describe.runIf(semver.gte(nodeVersion, '18.13.0'))('V2 functions API', () => {
},
})

expect.assertions(files.length + 1)
expect.assertions(files.length + 2)

for (const file of files) {
switch (file.name) {
Expand Down Expand Up @@ -256,6 +256,7 @@ describe.runIf(semver.gte(nodeVersion, '18.13.0'))('V2 functions API', () => {
const manifestString = await readFile(manifestPath, { encoding: 'utf8' })
const manifest = JSON.parse(manifestString)
expect(manifest.functions[0].routes[0].methods).toEqual(['GET', 'POST'])
expect(manifest.functions[0].buildData.runtimeAPIVersion).toEqual(2)
})

test('Flags invalid values of the `path` in-source configuration property as user errors', async () => {
Expand Down

0 comments on commit 6625a2b

Please sign in to comment.