Skip to content

cna: create .env.example correctly #73685

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: canary
Choose a base branch
from

Conversation

JamBalaya56562
Copy link
Contributor

@JamBalaya56562 JamBalaya56562 commented Dec 9, 2024

What?

  1. Rename .env.example to env.example in the CNA templates.
  2. Update index.ts to create .env.example correctly.
  3. Add .env.example to integration tests.

Why?

At #56469, .env.example was added to CNA templates.
However, create-next-app command doesn't make it due to dotfile.

CC: @samcx

@ijjk ijjk added create-next-app Related to our CLI tool for quickly starting a new Next.js application. tests labels Dec 9, 2024
@ijjk
Copy link
Member

ijjk commented Dec 9, 2024

Allow CI Workflow Run

  • approve CI run for commit: ec1638b

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@samcx
Copy link
Member

samcx commented Apr 6, 2025

I don't think we should switch it to env.example since the convention is with the .env.<xyz>.

However, create-next-app command doesn't make it due to dotfile.

Is it possible to fix this? 👀

@JamBalaya56562
Copy link
Contributor Author

I don't think we should switch it to env.example since the convention is with the .env.<xyz>.

However, create-next-app command doesn't make it due to dotfile.

Is it possible to fix this? 👀

You are right, but .gitignore file has already named gitignore for .gitignore conversion.

await copy(copySource, root, {
parents: true,
cwd: templatePath,
rename(name) {
switch (name) {
case "gitignore": {
return `.${name}`;
}
// README.md is ignored by webpack-asset-relocator-loader used by ncc:
// https://github.com/vercel/webpack-asset-relocator-loader/blob/e9308683d47ff507253e37c9bcbb99474603192b/src/asset-relocator.js#L227
case "README-template.md": {
return "README.md";
}
default: {
return name;
}
}
},
});

Make sure that the output env file name will be .env.example like .gitignore conversion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
create-next-app Related to our CLI tool for quickly starting a new Next.js application. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants