Add support for ignoring .env files with # WRANGLER_IGNORE comment#12724
Add support for ignoring .env files with # WRANGLER_IGNORE comment#12724dario-piotrowicz wants to merge 3 commits intomainfrom
.env files with # WRANGLER_IGNORE comment#12724Conversation
🦋 Changeset detectedLatest commit: b5323bb The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
fe6fd9f to
5d11d88
Compare
.env files with # WRANGLER_IGNORE comment
|
✅ All changesets look good |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
5d11d88 to
2473414
Compare
petebacondarwin
left a comment
There was a problem hiding this comment.
Will the Cloudflare vite-plugin generate a .env that contains this comment or is it up to the user to add it? Will then know when it is necessary? Is there an issue related to this?
|
|
||
| // Check if file should be ignored | ||
| if (shouldIgnoreEnvFile(contents)) { | ||
| logger.info( |
There was a problem hiding this comment.
| logger.info( | |
| logger.debug( |
Note that we have a silent parameter that suggests that we should not be outputting logs when true.
So if you do want to use logger.log here, you should wrap it in a if (!silent) block.
There was a problem hiding this comment.
if (!silent) added 🫡
|
I removed my approval because I've thought about it a bit more and I'm less sure this is a good idea. For one, |
I'm glad you are thinking about this more. I felt uncomfortable about it as a solution but couldn't put my finger on why so didn't want to block. |
No it doesn't, this change applies across the board, so it applies to
They sure can and that's a valid comment here, however I'd like to push back saying that asking users to work around these sort of thing is not a great DX. In my opinion it would be a much nicer DX for them if they could be allowed to tell wrangler not to use |
Ah, I hadn't appreciated that it's the same |
This PR adds support for ignoring
.envfiles with# WRANGLER_IGNOREcommentA picture of a cute animal (not mandatory, but encouraged)