-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautomate-build.ps1
More file actions
33 lines (30 loc) · 949 Bytes
/
automate-build.ps1
File metadata and controls
33 lines (30 loc) · 949 Bytes
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
# automate-build.ps1 - Complete build automation
param(
[ValidateSet("dev", "build", "test", "deploy")]
[string]$Task = "build"
)
$packageJson = @"
{
"scripts": {
"clean": "rimraf dist",
"lint": "eslint src",
"build:css": "sass src/styles:dist/css",
"build:js": "esbuild src/index.js --bundle --outfile=dist/bundle.js",
"build": "npm-run-all clean lint build:*",
"watch:css": "sass --watch src/styles:dist/css",
"watch:js": "esbuild src/index.js --bundle --outfile=dist/bundle.js --watch",
"dev": "npm-run-all --parallel watch:*",
"test": "jest",
"test:watch": "jest --watch",
"predeploy": "npm run build",
"deploy": "gh-pages -d dist"
}
}
"@
Write-Host "Running task: $Task" -ForegroundColor Cyan
switch ($Task) {
"dev" { npm-run-all --parallel watch:* }
"build" { npm-run-all clean lint build:* }
"test" { npm-run-all test }
"deploy" { npm-run-all predeploy deploy }
}