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

Commit

Permalink
feat: simplify manifest format (#614)
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoboucas committed Aug 19, 2021
1 parent d9c0334 commit ccea887
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ const createManifest = async ({ functions, path }) => {
await writeFile(path, JSON.stringify(payload))
}

const formatFunction = (fn) => ({ ...fn, path: resolve(fn.path) })
const formatFunction = ({ mainFile, name, path, runtime }) => ({ mainFile, name, path: resolve(path), runtime })

module.exports = { createManifest }
12 changes: 9 additions & 3 deletions tests/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1789,12 +1789,18 @@ test('Creates a manifest file with the list of created functions if the `manifes
// eslint-disable-next-line import/no-dynamic-require, node/global-require
const manifest = require(manifestPath)

t.deepEqual(files, manifest.functions)
t.is(manifest.version, 1)
t.is(manifest.system.arch, arch)
t.is(manifest.system.platform, platform)
t.is(typeof manifest.timestamp, 'number')

// The `path` property of each function must be an absolute path.
manifest.functions.every(({ path }) => isAbsolute(path))
manifest.functions.forEach((fn, index) => {
const file = files[index]

t.true(isAbsolute(fn.path))
t.is(fn.mainFile, file.mainFile)
t.is(fn.name, file.name)
t.is(fn.runtime, file.runtime)
t.is(fn.path, file.path)
})
})

1 comment on commit ccea887

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⏱ Benchmark results

largeDepsEsbuild: 13.3s

largeDepsZisi: 1m 12.5s

Please sign in to comment.