Skip to content

Commit

Permalink
Merge pull request #186 from BadJacky/feature/remove-default-env-file…
Browse files Browse the repository at this point in the history
…-with-generating-automatic

Remove default env file and generating by postinstall
  • Loading branch information
kanyxmo authored Jun 17, 2024
2 parents 8085569 + 0143e9d commit dbf3f7a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
File renamed without changes.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ node_modules
dist
dist-ssr
*.local
.idea
.idea
.env
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"build": "vite build",
"preview": "vite preview",
"tailwind": "tailwind-config-viewer -o -c tailwind.config.cjs",
"generate:version": "generate-version-file dist public"
"generate:version": "generate-version-file dist public",
"postinstall": "node ./scripts/postinstall.js"
},
"dependencies": {
"@arco-design/color": "^0.4.0",
Expand Down
10 changes: 10 additions & 0 deletions scripts/postinstall.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {access, constants, copyFile} from 'fs';

access('.env', constants.F_OK, (err) => {
if (err) {
copyFile('.env.example', '.env', (err) => {
if (err) throw err;
console.log('.env.example was copied to .env');
});
}
});

0 comments on commit dbf3f7a

Please sign in to comment.