-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDevShortcuts.ps1
More file actions
339 lines (315 loc) · 18.7 KB
/
Copy pathDevShortcuts.ps1
File metadata and controls
339 lines (315 loc) · 18.7 KB
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# ============================================================
# Ultimate Dev Command Shortcuts
# Spring Boot, Flask, FastAPI, Python, React, Next.js, MERN,
# CMake, Rust, Go + Docker, Django, Angular, Node, TS,
# Terraform, Kubernetes, Ansible, Firebase/Supabase, helpers
# ============================================================
# -----------------------------------------------------------
# 🔧 HELPER: reload this profile
# -----------------------------------------------------------
function reload-profile { . $PROFILE; Write-Host "✅ Profile reloaded" -ForegroundColor Green }
# -----------------------------------------------------------
# ☕ SPRING BOOT (Maven)
# -----------------------------------------------------------
function sbrun { mvn spring-boot:run @args }
function sbrunq { mvn spring-boot:run -q @args }
function sbbuild { mvn clean package @args }
function sbbuildskip { mvn clean package -DskipTests @args }
function sbtest { mvn test @args }
function sbtest1 { param($t) mvn test -Dtest=$t @args }
function sbclean { mvn clean @args }
function sbinstall { mvn clean install @args }
function sbdeploy { mvn clean deploy @args }
function sbverify { mvn verify @args }
function sbdeps { mvn dependency:tree @args }
function sboutdated { mvn versions:display-dependency-updates @args }
function sbwrapper { mvn wrapper:wrapper @args }
function sbrunprof { param($p) mvn spring-boot:run -Dspring-boot.run.profiles=$p @args }
function sbbootrun { mvn spring-boot:run @args }
# -----------------------------------------------------------
# 🐍 FLASK
# -----------------------------------------------------------
function flaskrun {
if (-not $env:FLASK_APP) { $env:FLASK_APP = "app.py" }
flask run @args
}
function flaskrundev { $env:FLASK_ENV = "development"; flaskrun }
function flaskrunhost { param($host="0.0.0.0", $port=5000) flask run --host=$host --port=$port @args }
function flaskshell { flask shell @args }
function flaskdbinit { flask db init @args }
function flaskdbmigrate { flask db migrate -m $args[0] }
function flaskdbupgrade { flask db upgrade @args }
function flaskdowngrade { flask db downgrade @args }
function flasktest { python -m pytest @args }
function flasklint { flake8 @args }
function flaskfreeze { pip freeze > requirements.txt }
function flaskreqinstall { pip install -r requirements.txt }
# -----------------------------------------------------------
# ⚡ FASTAPI
# -----------------------------------------------------------
function fastrun { param([string]$app = "main:app") uvicorn $app --reload @args }
function fastrunprod { param([string]$app = "main:app") uvicorn $app --host 0.0.0.0 --port 8000 --workers 4 @args }
function fasttest { python -m pytest @args }
function fastlint { flake8 @args }
function fastformat { black . @args }
function fastreqinstall { pip install -r requirements.txt }
function fastfreeze { pip freeze > requirements.txt }
# -----------------------------------------------------------
# 🐍 GENERIC PYTHON
# -----------------------------------------------------------
function pyrun { param([string]$script = "main.py") python $script @args }
function pyvenv { python -m venv venv }
function pyactivate { .\venv\Scripts\Activate.ps1 }
function pydeactivate { deactivate }
function pyinstall { pip install -r requirements.txt @args }
function pyfreeze { pip freeze > requirements.txt }
function pytests { python -m pytest @args }
function pylint { pylint @args }
function pyformat { black . @args }
function pyclean { Remove-Item -Recurse -Force __pycache__ -ErrorAction SilentlyContinue; Remove-Item -Recurse -Force *.pyc -ErrorAction SilentlyContinue }
function pytypecheck { mypy . @args }
# -----------------------------------------------------------
# ⚛️ REACT
# -----------------------------------------------------------
function reactrun { npm start @args }
function reactrundev { npm run dev @args }
function reactbuild { npm run build @args }
function reacttest { npm test @args }
function reacttestc { npm test -- --coverage @args }
function reactlint { npx eslint . @args }
function reactformat { npx prettier --write . @args }
function reacteject { npm run eject @args }
function reactstory { npm run storybook @args }
function reactanalyze { npm run build -- --analyze @args }
function reactdepcheck { npx depcheck @args }
function reactclean { Remove-Item -Recurse -Force node_modules -ErrorAction SilentlyContinue; Remove-Item -Force package-lock.json -ErrorAction SilentlyContinue }
# -----------------------------------------------------------
# 🖥️ NEXT.JS
# -----------------------------------------------------------
function nextrun { npm run dev @args }
function nextrunp { param($p=3000) next dev -p $p @args }
function nextbuild { npm run build @args }
function nextstart { npm start @args }
function nextlint { npm run lint @args }
function nextexport { npm run export @args }
function nexttypecheck { npx tsc --noEmit @args }
function nextdepcheck { npx depcheck @args }
function nextclean { Remove-Item -Recurse -Force .next -ErrorAction SilentlyContinue; Remove-Item -Recurse -Force node_modules -ErrorAction SilentlyContinue }
# -----------------------------------------------------------
# 📦 MERN STACK
# -----------------------------------------------------------
function merndev { Write-Host "Starting backend and frontend concurrently..." -ForegroundColor Cyan; npx concurrently -n BE,FE -c blue,green "cd backend && npm run dev" "cd frontend && npm start" @args }
function merndevsplit { wt -w 0 split-pane -H cmd /c "cd backend && npm run dev"; wt -w 0 split-pane -V cmd /c "cd frontend && npm start" }
function mernbuild { Write-Host "Building backend and frontend..." -ForegroundColor Cyan; Push-Location backend; npm run build; Pop-Location; Push-Location frontend; npm run build; Pop-Location }
function merninstall { Write-Host "Installing all dependencies..." -ForegroundColor Cyan; Push-Location backend; npm install; Pop-Location; Push-Location frontend; npm install; Pop-Location }
function mernclean { Write-Host "Removing node_modules..." -ForegroundColor Yellow; Remove-Item -Recurse -Force backend\node_modules -ErrorAction SilentlyContinue; Remove-Item -Recurse -Force frontend\node_modules -ErrorAction SilentlyContinue }
function mernstartback { Push-Location backend; npm start @args; Pop-Location }
function mernstartfront { Push-Location frontend; npm start @args; Pop-Location }
function merntestback { Push-Location backend; npm test @args; Pop-Location }
function merntestfront { Push-Location frontend; npm test @args; Pop-Location }
# -----------------------------------------------------------
# 🔨 CMAKE
# -----------------------------------------------------------
function cmakeconfig { cmake -S . -B build @args }
function cmakebuild { cmake --build build @args }
function cmakerun { cmake --build build --target run @args }
function cmaketest { cmake --build build --target test @args }
function cmakepackage { cmake --build build --target package @args }
function cmakeinstall { cmake --install build @args }
function cmakeclean { Remove-Item -Recurse -Force build -ErrorAction SilentlyContinue }
function cmakefresh { cmakeclean; cmakeconfig @args }
function cmakerelease { cmake -S . -B build -DCMAKE_BUILD_TYPE=Release @args }
function cmakedebug { cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug @args }
function cmakebuildrel { cmake -S . -B build -DCMAKE_BUILD_TYPE=Release; cmake --build build @args }
# -----------------------------------------------------------
# 🦀 RUST
# -----------------------------------------------------------
function rrun { cargo run @args }
function rbuild { cargo build @args }
function rrelease { cargo build --release @args }
function rtest { cargo test @args }
function rtest1 { param($t) cargo test $t @args }
function rcheck { cargo check @args }
function rfmt { cargo fmt @args }
function rclippy { cargo clippy @args }
function rclean { cargo clean @args }
function rupdate { cargo update @args }
function rwatch { cargo watch -x run @args }
function rwcheck { cargo watch -x check @args }
function rinstall { cargo install --path . @args }
function rnew { param($name) cargo new $name @args }
# -----------------------------------------------------------
# 🐹 GO
# -----------------------------------------------------------
function gorun { param($file="main.go") go run $file @args }
function gobuild { go build @args }
function goinstall { go install @args }
function gotest { go test ./... @args }
function gotestv { go test -v ./... @args }
function gobench { go test -bench=. ./... @args }
function goclean { go clean @args }
function gofmt { go fmt ./... @args }
function govet { go vet ./... @args }
function golint { golangci-lint run @args }
function gomodtidy { go mod tidy @args }
function gomodvendor { go mod vendor @args }
function godoc { godoc -http=:6060 @args }
function goget { go get @args }
function goupdate { go get -u ./... @args }
# -----------------------------------------------------------
# 🐳 DOCKER
# -----------------------------------------------------------
function dup { docker compose up @args }
function dupd { docker compose up -d @args }
function ddown { docker compose down @args }
function dbuild { docker compose build @args }
function dps { docker ps @args }
function dlogs { param($svc) docker compose logs -f $svc @args }
function dsh { param($svc, $sh="sh") docker compose exec $svc $sh @args }
function dprune { docker system prune -a --volumes @args }
# -----------------------------------------------------------
# 🐍 DJANGO
# -----------------------------------------------------------
function djrun { python manage.py runserver @args }
function djmigrate { python manage.py migrate @args }
function djmakemig { python manage.py makemigrations @args }
function djshell { python manage.py shell @args }
function djtest { python manage.py test @args }
function djcreatesu { python manage.py createsuperuser @args }
function djstatic { python manage.py collectstatic --noinput @args }
# -----------------------------------------------------------
# 🅰️ ANGULAR
# -----------------------------------------------------------
function ngnew { param($name) ng new $name @args }
function ngs { ng serve @args }
function ngsopen { ng serve --open @args }
function ngbuild { ng build @args }
function ngtest { ng test @args }
function nglint { ng lint @args }
function ngadd { param($pkg) ng add $pkg @args }
# -----------------------------------------------------------
# 🟢 NODE.JS (generic)
# -----------------------------------------------------------
function noderun { param($file="index.js") node $file @args }
function npmdev { npm run dev @args }
function npmbuild { npm run build @args }
function npmstart { npm start @args }
function npmtest { npm test @args }
function npminst { npm install @args }
function npminstsave { param($pkg) npm install $pkg --save @args }
function npminstdev { param($pkg) npm install $pkg --save-dev @args }
function npmupdate { npm update @args }
# -----------------------------------------------------------
# 🟦 𝙏𝙎 TYPESCRIPT
# -----------------------------------------------------------
function tscwatch { npx tsc --watch @args }
function tscbuild { npx tsc @args }
function tscinit { npx tsc --init @args }
# -----------------------------------------------------------
# 🧪 TERRAFORM
# -----------------------------------------------------------
function tfinfo { terraform init @args }
function tfplan { terraform plan @args }
function tfapply { terraform apply @args }
function tfdestroy { terraform destroy @args }
function tfoutput { terraform output @args }
function tffmt { terraform fmt -recursive @args }
function tfval { terraform validate @args }
# -----------------------------------------------------------
# ☸️ KUBERNETES (kubectl)
# -----------------------------------------------------------
function k { kubectl @args }
function kgp { kubectl get pods @args }
function kgs { kubectl get services @args }
function kgd { kubectl get deployments @args }
function klog { param($pod) kubectl logs $pod @args }
function kexec { param($pod, $cmd="/bin/sh") kubectl exec -it $pod -- $cmd @args }
function kctx { param($ctx) kubectl config use-context $ctx @args }
function kns { param($ns) kubectl config set-context --current --namespace=$ns @args }
# -----------------------------------------------------------
# 📜 ANSIBLE
# -----------------------------------------------------------
function ansplay { ansible-playbook @args }
function ansinv { ansible-inventory --list @args }
function ansgal { ansible-galaxy install -r requirements.yml @args }
function ansvault { ansible-vault @args }
# -----------------------------------------------------------
# 🔥 FIREBASE / SUPABASE
# -----------------------------------------------------------
function fbdeploy { firebase deploy @args }
function fbserve { firebase serve @args }
function fbemulators { firebase emulators:start @args }
function sbstart { npx supabase start @args }
# -----------------------------------------------------------
# 🧰 GENERAL PRODUCTIVITY
# -----------------------------------------------------------
function .. { Set-Location .. }
function ... { Set-Location ..\.. }
function .... { Set-Location ..\..\.. }
function mkcd { param($d) New-Item -ItemType Directory $d -Force; Set-Location $d }
function which { param($cmd) Get-Command $cmd }
function touch { param($f) New-Item -ItemType File $f }
# -----------------------------------------------------------
# 🛠️ GIT
# -----------------------------------------------------------
function gs { git status }
function ga { git add . }
function gc { param($m) git commit -m "$m" }
function gp { git push }
function gl { git log --oneline --graph --decorate -10 }
function gco { param($b) git checkout $b }
function gcb { param($b) git checkout -b $b }
function gpl { git pull }
# -----------------------------------------------------------
# 📋 SHOW ALL COMMANDS
# -----------------------------------------------------------
function show-commands {
Write-Host "`n🚀 Ultimate Shortcut List" -ForegroundColor Cyan
Write-Host "================================="
Write-Host "Spring Boot:" -ForegroundColor Yellow
Write-Host " sbrun, sbbuild, sbtest, sbtest1, sbclean, sbinstall, sbdeps, sboutdated, sbwrapper, sbrunprof"
Write-Host "Flask:" -ForegroundColor Yellow
Write-Host " flaskrun, flaskrundev, flaskrunhost, flaskshell, flaskdb*, flasktest, flasklint, flaskfreeze"
Write-Host "FastAPI:" -ForegroundColor Yellow
Write-Host " fastrun, fastrunprod, fasttest, fastlint, fastformat, fastfreeze"
Write-Host "Python:" -ForegroundColor Yellow
Write-Host " pyrun, pyvenv, pyactivate, pyinstall, pyfreeze, pytests, pylint, pyformat, pyclean"
Write-Host "React:" -ForegroundColor Yellow
Write-Host " reactrun, reactbuild, reacttest, reactlint, reactformat, reactstory, reactclean"
Write-Host "Next.js:" -ForegroundColor Yellow
Write-Host " nextrun, nextrunp, nextbuild, nextstart, nextlint, nextexport, nextclean"
Write-Host "MERN:" -ForegroundColor Yellow
Write-Host " merndev, merndevsplit, mernbuild, merninstall, mernclean, mernstartback/front, merntestback/front"
Write-Host "CMake:" -ForegroundColor Yellow
Write-Host " cmakeconfig, cmakebuild, cmakerun, cmaketest, cmakepackage, cmakeinstall, cmakeclean, cmakefresh, cmakerelease, cmakedebug, cmakebuildrel"
Write-Host "Rust:" -ForegroundColor Yellow
Write-Host " rrun, rbuild, rrelease, rtest, rtest1, rcheck, rfmt, rclippy, rclean, rupdate, rwatch, rwcheck, rinstall, rnew"
Write-Host "Go:" -ForegroundColor Yellow
Write-Host " gorun, gobuild, goinstall, gotest, gotestv, gobench, goclean, gofmt, govet, golint, gomodtidy, gomodvendor, godoc, goget, goupdate"
Write-Host "Docker:" -ForegroundColor Yellow
Write-Host " dup, dupd, ddown, dbuild, dps, dlogs, dsh, dprune"
Write-Host "Django:" -ForegroundColor Yellow
Write-Host " djrun, djmigrate, djmakemig, djshell, djtest, djcreatesu, djstatic"
Write-Host "Angular:" -ForegroundColor Yellow
Write-Host " ngnew, ngs, ngsopen, ngbuild, ngtest, nglint, ngadd"
Write-Host "Node.js:" -ForegroundColor Yellow
Write-Host " noderun, npmdev, npmbuild, npmstart, npmtest, npminst, npminstsave, npminstdev, npmupdate"
Write-Host "TypeScript:" -ForegroundColor Yellow
Write-Host " tscwatch, tscbuild, tscinit"
Write-Host "Terraform:" -ForegroundColor Yellow
Write-Host " tfinfo, tfplan, tfapply, tfdestroy, tfoutput, tffmt, tfval"
Write-Host "Kubernetes:" -ForegroundColor Yellow
Write-Host " k, kgp, kgs, kgd, klog, kexec, kctx, kns"
Write-Host "Ansible:" -ForegroundColor Yellow
Write-Host " ansplay, ansinv, ansgal, ansvault"
Write-Host "Firebase/Supabase:" -ForegroundColor Yellow
Write-Host " fbdeploy, fbserve, fbemulators, sbstart"
Write-Host "General:" -ForegroundColor Yellow
Write-Host " .., ..., ...., mkcd, which, touch"
Write-Host "Git:" -ForegroundColor Yellow
Write-Host " gs, ga, gc, gp, gl, gco, gcb, gpl"
Write-Host "Other:" -ForegroundColor Yellow
Write-Host " reload-profile, show-commands"
Write-Host "=================================`n"
}
Write-Host "✅ All commands loaded! Type 'show-commands' to see them." -ForegroundColor Green