Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

feat: emit schedule property into manifest #768

Merged
merged 7 commits into from
Oct 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface FunctionConfig {
nodeVersion?: NodeVersion
processDynamicNodeImports?: boolean
rustTargetDirectory?: string
schedule?: string
}

type GlobPattern = string
Expand Down
3 changes: 2 additions & 1 deletion src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ const createManifest = async ({ functions, path }: { functions: FunctionResult[]
await writeFile(path, JSON.stringify(payload))
}

const formatFunctionForManifest = ({ mainFile, name, path, runtime }: FunctionResult) => ({
const formatFunctionForManifest = ({ config, mainFile, name, path, runtime }: FunctionResult) => ({
mainFile,
name,
path: resolve(path),
runtime,
schedule: config.schedule,
})

export { createManifest }
10 changes: 9 additions & 1 deletion tests/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2153,7 +2153,14 @@ test('Creates a manifest file with the list of created functions if the `manifes
const manifestPath = join(tmpDir, 'manifest.json')
const { files } = await zipNode(t, 'many-functions', {
length: FUNCTIONS_COUNT,
opts: { manifest: manifestPath },
opts: {
manifest: manifestPath,
config: {
five: {
schedule: '@daily',
},
},
},
})

const manifest = require(manifestPath)
Expand All @@ -2171,6 +2178,7 @@ test('Creates a manifest file with the list of created functions if the `manifes
t.is(fn.name, file.name)
t.is(fn.runtime, file.runtime)
t.is(fn.path, file.path)
t.is(fn.schedule, fn.name === 'five' ? '@daily' : undefined)
})
})

Expand Down