From f3d45bad17dbba25137958fe96320a7989bb0f54 Mon Sep 17 00:00:00 2001 From: Hyko Date: Tue, 14 Apr 2026 20:01:55 -0400 Subject: [PATCH] feat(cli): auto-copy .env from @zen/core template after install Automatically copies `.env.example` from the installed `@zen/core` package to `.env` in the project root if it doesn't already exist. This removes the need for users to manually locate and configure environment variables. Updated the post-install instructions to reflect the new behavior. --- bin/cli.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/cli.js b/bin/cli.js index e570eef..93cc70c 100644 --- a/bin/cli.js +++ b/bin/cli.js @@ -127,9 +127,15 @@ export default nextConfig; execSync('npm install @zen/core', { stdio: 'inherit' }); done('@zen/core installed'); + const envExample = path.resolve(process.cwd(), 'node_modules/@zen/core/.env.example'); + const envDest = path.resolve(process.cwd(), '.env'); + if (fs.existsSync(envExample) && !fs.existsSync(envDest)) { + fs.copyFileSync(envExample, envDest); + done('Created .env from @zen/core template'); + } + console.log(`\n ${c.green}${c.bold}Project ready.${c.reset} Next steps:\n`); - console.log(` ${c.dim}1.${c.reset} Configure environment variables`); - console.log(` ${c.dim}https://git.hyko.cx/zen/core${c.reset}`); + console.log(` ${c.dim}1.${c.reset} Fill in the environment variables in ${c.cyan}.env${c.reset}`); console.log(` ${c.dim}2.${c.reset} Initialize the database`); console.log(` ${c.dim}npx zen-db init${c.reset}\n`);