-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.bat
135 lines (101 loc) · 2.71 KB
/
install.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
@echo off
echo "installation start"
cd /D "%~dp0"
echo %cd%
pause
set /p projectName="Enter projectName(new-project default): "
IF NOT DEFINED projectName SET "projectName=new-project"
echo %projectName%
set /p nginxVersion="Enter NginxVersion (1.20 default): "
IF NOT DEFINED nginxVersion SET "nginxVersion=1.20"
echo %nginxVersion%
set /p phpVersion="Enter PhpVersion (8.1.4 default): "
IF NOT DEFINED phpVersion SET "phpVersion=8.1.4"
echo %phpVersion%
mkdir %projectName%
cd %projectName%
mkdir docker
mkdir docs
mkdir source
cd source
mkdir prod
mkdir dev
mkdir stage
mkdir frontend
git init
echo .idea > .gitignore
echo .prod >> .gitignore
echo .dev >> .gitignore
echo .stage >> .gitignore
echo .frontend >> .gitignore
echo Readme.md >> .gitignore
git add .
git commit -m "start project"
git checkout -b prod
git checkout master
git worktree add prod prod
git checkout -b stage
git checkout master
git worktree add stage stage
git checkout -b dev
git checkout master
git worktree add dev dev
git checkout -b frontend
git checkout master
git worktree add frontend frontend
cd prod
mkdir public
cd public
echo ^<^? phpinfo(); > index.php
cd ../../dev
mkdir public
cd public
echo ^<^? phpinfo(); > index.php
cd ../../stage
mkdir public
cd public
echo ^<^? phpinfo(); > index.php
cd ../../frontend
mkdir dist
mkdir src
call npm init -y
call npm install laravel-mix --save-dev
call npm install normalize.css
REM npm v8
call npm pkg set scripts.dev="npm run development"
call npm pkg set scripts.watch="mix watch"
call npm pkg set scripts.prod="npm run production"
call npm pkg set scripts.production="mix --production"
echo const mix = require('laravel-mix'); > webpack.mix.js
echo mix.options({ processCssUrls: false }) >> webpack.mix.js
echo mix.js('src/js/app.js', 'dist/js') >> webpack.mix.js
echo .sass('src/scss/app.scss', 'dist/css'); >> webpack.mix.js
cd src
mkdir js
cd js
copy NUL app.js
cd ../
mkdir scss
cd scss
copy NUL app.scss
cd ../../dist
mkdir img
mkdir fonts
copy NUL index.php
cd ../../../docker
call git clone https://github.com/gelid/docker-php.git .
call git remote remove origin
echo PROJECT_NAME=%projectName% > .env.tmp
echo COMPOSE_PROJECT_NAME=%projectName% >> .env.tmp
echo NGINX_VERSION=%nginxVersion% >> .env.tmp
echo PHP_VERSION=%phpVersion% >> .env.tmp
type .env >> .env.tmp
type .env.tmp > .env
del .env.tmp
docker-compose up -d --build
cd /D C:\Windows\System32\drivers\etc
echo 127.0.0.1 dev.%projectName%.lc >> hosts
echo 127.0.0.1 stage.%projectName%.lc >> hosts
echo 127.0.0.1 prod.%projectName%.lc >> hosts
echo 127.0.0.1 frontend.%projectName%.lc >> hosts
pause