Skip to content
This repository was archived by the owner on Jun 28, 2025. It is now read-only.

Commit fc5f772

Browse files
committed
feat: Add .env copy script in cms context
1 parent b9e369b commit fc5f772

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

cms/init-env.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const fs = require('fs');
2+
3+
const envFilePath = './.env';
4+
const envExampleFilePath = './.env.example';
5+
6+
// Check if the .env file exists
7+
if (!fs.existsSync(envFilePath)) {
8+
// If it doesn't exist, create it
9+
fs.writeFileSync(envFilePath, '');
10+
}
11+
12+
// Read the contents of the .env.example file
13+
const envExampleContent = fs.readFileSync(envExampleFilePath, 'utf8');
14+
15+
// Write the contents of the .env.example file to the .env file
16+
fs.writeFileSync(envFilePath, envExampleContent);
17+

cms/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"develop": "strapi develop",
88
"start": "strapi start",
99
"build": "strapi build",
10-
"strapi": "strapi"
10+
"strapi": "strapi",
11+
"init-env":"node init-env.js"
1112
},
1213
"dependencies": {
1314
"@strapi/plugin-i18n": "4.14.5",

0 commit comments

Comments
 (0)