-
Notifications
You must be signed in to change notification settings - Fork 244
Expose workflow manifest via HTTP when WORKFLOW_PUBLIC_MANIFEST=1
#963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| "@workflow/sveltekit": patch | ||
| "@workflow/builders": patch | ||
| "@workflow/astro": patch | ||
| "@workflow/nitro": patch | ||
| "@workflow/nest": patch | ||
| "@workflow/next": patch | ||
| --- | ||
|
|
||
| Expose workflow manifest via HTTP when `WORKFLOW_PUBLIC_MANIFEST=1` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { constants } from 'node:fs'; | ||
| import { access, mkdir, stat, writeFile } from 'node:fs/promises'; | ||
| import { access, copyFile, mkdir, stat, writeFile } from 'node:fs/promises'; | ||
| import { extname, join, resolve } from 'node:path'; | ||
| import Watchpack from 'watchpack'; | ||
|
|
||
|
|
@@ -62,12 +62,26 @@ export async function getNextBuilder() { | |
|
|
||
| // Write unified manifest to workflow generated directory | ||
| const workflowBundlePath = join(workflowGeneratedDir, 'flow/route.js'); | ||
| await this.createManifest({ | ||
| const manifestJson = await this.createManifest({ | ||
| workflowBundlePath, | ||
| manifestDir: workflowGeneratedDir, | ||
| manifest, | ||
| }); | ||
|
|
||
| // Expose manifest as a static file when WORKFLOW_PUBLIC_MANIFEST=1. | ||
| // Next.js serves files from public/ at the root URL. | ||
| if (this.shouldExposePublicManifest && manifestJson) { | ||
| const publicManifestDir = join( | ||
| this.config.workingDir, | ||
| 'public/.well-known/workflow/v1' | ||
| ); | ||
| await mkdir(publicManifestDir, { recursive: true }); | ||
| await copyFile( | ||
| join(workflowGeneratedDir, 'manifest.json'), | ||
| join(publicManifestDir, 'manifest.json') | ||
| ); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of placing this in a static folder which won't get cleaned up if this is added for one run but not on a successive run and then could get deployed it feels more correct for the That would reduce additional endpoint being exposed as well, similar to what we did for the health check |
||
| } | ||
|
|
||
| await this.writeFunctionsConfig(outputDir); | ||
|
|
||
| if (this.config.watch) { | ||
|
|
||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.