-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.ps1
35 lines (33 loc) · 1.12 KB
/
build.ps1
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
# .SYNOPSIS
# BoxOptimizer build script
# .DESCRIPTION
# A build script that uses a builder module 🗿
# .LINK
# https://github.com/alainQtec/BoxOptimizer/blob/main/build.ps1
# .NOTES
# Author : Alain Herve
# Copyright: Copyright © 2024 Alain Herve. All rights reserved.
# License : MIT
[cmdletbinding(DefaultParameterSetName = 'task')]
param(
[parameter(Position = 0, ParameterSetName = 'task')]
[ValidateScript({
$task_seq = [string[]]$_; $IsValid = $true
$Tasks = @('Init', 'Clean', 'Compile', 'Import', 'Test', 'Deploy')
ForEach ($name in $task_seq) {
$IsValid = $IsValid -and ($name -in $Tasks)
}
if ($IsValid) {
return $true
} else {
throw [System.ArgumentException]::new('Task', "ValidSet: $($Tasks -join ', ').")
}
}
)][ValidateNotNullOrEmpty()]
[string[]]$Task = @('Init', 'Clean', 'Compile', 'Import'),
[parameter(ParameterSetName = 'help')]
[Alias('-Help')]
[switch]$Help
)
# Import the "buider module" and use Build-Module cmdlet to build this module:
Import-Module PsCraft; Build-Module -Task $Task