-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: populate Blobs context in build plugins (#5571)
* feat: populate Blobs context in build plugins * chore: fix test * chore: update test * chore: fix test * chore: fix formatting * chore: fix test * chore: update test * chore: update tests
- Loading branch information
1 parent
e4e9787
commit e037fbf
Showing
13 changed files
with
130 additions
and
140 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
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
Binary file not shown.
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
2 changes: 2 additions & 0 deletions
2
packages/build/tests/plugins/fixtures/blobs_read/manifest.yml
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,2 @@ | ||
name: test | ||
inputs: [] |
2 changes: 2 additions & 0 deletions
2
packages/build/tests/plugins/fixtures/blobs_read/netlify.toml
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,2 @@ | ||
[[plugins]] | ||
package = "./plugin" |
18 changes: 18 additions & 0 deletions
18
packages/build/tests/plugins/fixtures/blobs_read/plugin.js
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,18 @@ | ||
import { version as nodeVersion } from "process" | ||
|
||
import { getDeployStore } from '@netlify/blobs' | ||
import semver from 'semver' | ||
|
||
export const onPreBuild = async function ({netlifyConfig}) { | ||
const storeOptions = {} | ||
|
||
if (semver.lt(nodeVersion, '18.0.0')) { | ||
const nodeFetch = await import('node-fetch') | ||
storeOptions.fetch = nodeFetch.default | ||
} | ||
|
||
const store = getDeployStore(storeOptions) | ||
const value = await store.get("my-key") | ||
|
||
netlifyConfig.build.command = `echo "${value}"` | ||
} |
Oops, something went wrong.