This repository has been archived by the owner on May 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for manifest file (#601)
* feat: add support for manifest file * chore: add `manifest` to README * chore: update README * refactor: make path property absolute * chore: fix test * chore: doh * refactor: propagate errors from manifest creation * refactor: conditionally create manifest
- Loading branch information
1 parent
e6490d6
commit 65c4b94
Showing
6 changed files
with
79 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const { resolve } = require('path') | ||
const { arch, platform } = require('process') | ||
|
||
const { writeFile } = require('./utils/fs') | ||
|
||
const MANIFEST_VERSION = 1 | ||
|
||
const createManifest = async ({ functions, path }) => { | ||
const formattedFunctions = functions.map(formatFunction) | ||
const payload = { | ||
functions: formattedFunctions, | ||
system: { arch, platform }, | ||
timestamp: Date.now(), | ||
version: MANIFEST_VERSION, | ||
} | ||
|
||
await writeFile(path, JSON.stringify(payload)) | ||
} | ||
|
||
const formatFunction = (fn) => ({ ...fn, path: resolve(fn.path) }) | ||
|
||
module.exports = { createManifest } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65c4b94
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⏱ Benchmark results
largeDepsEsbuild: 12.9s
largeDepsZisi: 1m 15s