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 5 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 }
22 changes: 22 additions & 0 deletions tests/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2174,6 +2174,28 @@ test('Creates a manifest file with the list of created functions if the `manifes
})
})

testMany(
netlify-team-account-1 marked this conversation as resolved.
Show resolved Hide resolved
'Includes `schedule` config in manifest',
['bundler_default', 'bundler_esbuild', 'bundler_esbuild_zisi', 'bundler_nft'],
async (options, t) => {
const { path: tmpDir } = await getTmpDir({ prefix: 'zip-it-test' })
const manifestPath = join(tmpDir, 'manifest.json')
await zipNode(t, 'simple', {
opts: merge(options, {
manifest: manifestPath,
config: {
function: {
schedule: '@daily',
},
},
}),
})

const manifest = require(manifestPath)
t.is(manifest.functions[0].schedule, '@daily')
},
)

testMany('Correctly follows node_modules via symlink', ['bundler_esbuild', 'todo:bundler_nft'], async (options, t) => {
const fixtureName = 'node-module-symlinks'
const opts = merge(options, {
Expand Down