Skip to content

Commit 5d04c38

Browse files
fix: enhance setupEnv function to conditionally generate TypeScript configuration
1 parent 714e3ef commit 5d04c38

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/tasks/setupEnv.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,19 @@ export async function setupEnv(projectName, language) {
1717

1818
const configEnvPath = path.join(process.cwd(), "src", "config", `env.config.${extension}`);
1919

20-
const configEnvContent = `
20+
const configEnvContent = language === "TypeScript" ? `
21+
import dotenv from "dotenv";
22+
23+
dotenv.config();
24+
25+
const ENV : any = {
26+
PORT: process.env.PORT || 3000,
27+
};
28+
29+
export default ENV;
30+
31+
`:
32+
`
2133
import dotenv from "dotenv";
2234
2335
dotenv.config();

0 commit comments

Comments
 (0)