Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/build/src/core/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ const tExecBuild = async function ({
enhancedSecretScan,
edgeFunctionsBootstrapURL,
eventHandlers,
skewProtectionToken,
}) {
const configOpts = getConfigOpts({
config,
Expand All @@ -107,6 +108,7 @@ const tExecBuild = async function ({
buildId,
testOpts,
featureFlags,
skewProtectionToken,
})

const {
Expand Down
2 changes: 2 additions & 0 deletions packages/build/src/core/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const getConfigOpts = function ({
buildId,
testOpts,
featureFlags,
skewProtectionToken,
}) {
return {
config,
Expand All @@ -58,6 +59,7 @@ export const getConfigOpts = function ({
env: envOpt,
testOpts,
featureFlags,
skewProtectionToken,
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/build/src/log/messages/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const INTERNAL_FLAGS = [
'edgeFunctionsBootstrapURL',
'eventHandlers',
'logger',
'skewProtectionToken',
]
const HIDDEN_FLAGS = [...SECURE_FLAGS, ...TEST_FLAGS, ...INTERNAL_FLAGS]
const HIDDEN_DEBUG_FLAGS = [...SECURE_FLAGS, ...TEST_FLAGS, 'eventHandlers', 'logger']
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name: test
inputs: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[[plugins]]
package = "./plugin.js"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const onPreBuild = function () {
console.log(JSON.stringify(process.env))
}
8 changes: 8 additions & 0 deletions packages/build/tests/core/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,14 @@ test('--node-path is not used by core plugins', async (t) => {
t.snapshot(normalizeOutput(output))
})

test('--skew-protection-token', async (t) => {
const output = await new Fixture('./fixtures/plugin_echo_env')
.withFlags({ skewProtectionToken: 'foobar' })
.runWithBuild()

t.true(output.includes(`"NETLIFY_SKEW_PROTECTION_TOKEN":"foobar"`))
})

test('featureFlags can be used programmatically', async (t) => {
const output = await new Fixture('./fixtures/empty')
.withFlags({ featureFlags: { test: true, testTwo: false } })
Expand Down
Loading