Skip to content

Commit 13041cb

Browse files
biilmannclaude
andcommitted
refactor: rename VERCEL_SKEW_PROTECTION_ENABLED to NEXT_SKEW_PROTECTION_ENABLED
Updated environment variable name to use NEXT_ prefix instead of VERCEL_ for better Netlify branding consistency while maintaining the same functionality. Changes: - src/index.ts: Updated env var check and warning message - src/build/functions/edge.ts: Updated env var checks in two locations - tests/integration/skew-protection.test.ts: Updated test env setup - CLAUDE.md: Updated documentation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 40a3f39 commit 13041cb

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ The `PluginContext` class (`src/build/plugin-context.ts`) centralizes build conf
7070

7171
### Skew Protection
7272

73-
When `VERCEL_SKEW_PROTECTION_ENABLED=1` is set, the plugin automatically:
73+
When `NEXT_SKEW_PROTECTION_ENABLED=1` is set, the plugin automatically:
7474

7575
1. **Sets deployment ID**: Maps `NETLIFY_DEPLOY_ID` to `VERCEL_DEPLOYMENT_ID` for Next.js compatibility
7676
2. **Creates edge function**: Generates a skew protection edge function at `___netlify-skew-protection`
@@ -105,7 +105,7 @@ Extensive test fixtures cover scenarios like:
105105
- `NETLIFY_NEXT_PLUGIN_SKIP` - Skip plugin execution entirely
106106
- `NEXT_PRIVATE_STANDALONE` - Enabled automatically for builds
107107
- `IS_LOCAL` - Indicates local development vs deployment
108-
- `VERCEL_SKEW_PROTECTION_ENABLED` - Enable Next.js skew protection (set to '1')
108+
- `NEXT_SKEW_PROTECTION_ENABLED` - Enable Next.js skew protection (set to '1')
109109
- `VERCEL_DEPLOYMENT_ID` - Set automatically from `NETLIFY_DEPLOY_ID` when skew protection is enabled
110110

111111
## Build Tools

src/build/functions/edge.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export const createEdgeHandlers = async (ctx: PluginContext) => {
214214
const edgeHandlerPromises = nextDefinitions.map((def) => createEdgeHandler(ctx, def))
215215

216216
// Create skew protection handler if enabled
217-
if (process.env.VERCEL_SKEW_PROTECTION_ENABLED === '1') {
217+
if (process.env.NEXT_SKEW_PROTECTION_ENABLED === '1') {
218218
edgeHandlerPromises.push(createSkewProtectionHandler(ctx))
219219
}
220220

@@ -223,7 +223,7 @@ export const createEdgeHandlers = async (ctx: PluginContext) => {
223223
const netlifyDefinitions = nextDefinitions.flatMap((def) => buildHandlerDefinition(ctx, def))
224224

225225
// Add skew protection handler to manifest if enabled
226-
if (process.env.VERCEL_SKEW_PROTECTION_ENABLED === '1') {
226+
if (process.env.NEXT_SKEW_PROTECTION_ENABLED === '1') {
227227
const skewProtectionDefinition: ManifestFunction = {
228228
function: SKEW_PROTECTION_HANDLER_NAME,
229229
name: 'Next.js Skew Protection Handler',

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ export const onPreBuild = async (options: NetlifyPluginOptions) => {
5454
process.env.NEXT_PRIVATE_STANDALONE = 'true'
5555

5656
// Set up skew protection if enabled
57-
if (process.env.VERCEL_SKEW_PROTECTION_ENABLED === '1') {
57+
if (process.env.NEXT_SKEW_PROTECTION_ENABLED === '1') {
5858
// Use Netlify's deploy ID as the deployment ID for Next.js
5959
const deployId = process.env.NETLIFY_DEPLOY_ID
6060
if (deployId) {
6161
process.env.VERCEL_DEPLOYMENT_ID = deployId
6262
console.log('[Skew Protection] Enabled with deployment ID:', deployId)
6363
} else {
64-
console.warn('[Skew Protection] VERCEL_SKEW_PROTECTION_ENABLED is set but NETLIFY_DEPLOY_ID is not available')
64+
console.warn('[Skew Protection] NEXT_SKEW_PROTECTION_ENABLED is set but NETLIFY_DEPLOY_ID is not available')
6565
}
6666
}
6767

tests/integration/skew-protection.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('skew protection', () => {
99
ctx = new FixtureTestContext({
1010
name: 'skew-protection',
1111
env: {
12-
VERCEL_SKEW_PROTECTION_ENABLED: '1',
12+
NEXT_SKEW_PROTECTION_ENABLED: '1',
1313
NETLIFY_DEPLOY_ID: 'test-deploy-123',
1414
},
1515
})

0 commit comments

Comments
 (0)