Skip to content

Commit

Permalink
fix(cli): don't prepend message about .env.local if creating .env.loc…
Browse files Browse the repository at this point in the history
…al (#7288)
  • Loading branch information
SimeonGriggs authored and cngonzalez committed Aug 20, 2024
1 parent 711fd19 commit 2654d88
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/@sanity/cli/src/actions/init-project/initProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1281,8 +1281,7 @@ export default async function initSanity(
'# Warning: Do not add secrets (API keys and similar) to this file, as it source controlled!',
'# Use `.env.local` for any secrets, and ensure it is not added to source control',
].join('\n')
const shouldPrependWarning = !existingEnv.includes(warningComment)
// prepend warning comment to the env vars if one does not exist
const shouldPrependWarning = filename !== '.env.local' && !existingEnv.includes(warningComment)
if (shouldPrependWarning) {
await fs.writeFile(fileOutputPath, `${warningComment}\n\n${updatedEnv}`, {
encoding: 'utf8',
Expand Down

0 comments on commit 2654d88

Please sign in to comment.