Rather than scour the documentation, which may or may not be scenario focused, here is a quick list of common scenarios and recipes.
You can use the special PSDependOptions node for default options:
@{
PSDependOptions = @{
Target = 'C:\MyProject'
DependencyType = 'PSGalleryNuget'
}
'PSDeploy' = 'latest'
'BuildHelpers' = 'latest'
'Pester' = 'latest'
'InvokeBuild' = 'latest'
}
This downloads any dependency without an explicit override to C:\MyProject
, using PSGalleryNuget
You can specify the following in PSDependOptions:
- Parameters
- Source
- Target
- AddToPath
- Tags
- DependsOn
- PreScripts
- PostScripts
You can override global defaults:
@{
PSDependOptions = @{
Target = 'C:\MyProject'
DependencyType = 'PSGalleryNuget'
}
'PSDeploy' = 'latest'
'BuildHelpers' = 'latest'
'Pester' = @{
Target = 'C:\sc'
}
'InvokeBuild' = 'latest'
}
In this example, all modules are downloaded to C:\MyProject
, apart from Pester, which has an override.
You can certainly set a target on every single dependency, or:
@{
PSDependOptions = @{
Target = 'C:\MyTarget' # <<<<<<<
}
PSDeploy = 'latest'
'darkoperator/ADAudit' = 'dev'
}
Just specify a target under PSDependOptions, this will be used as the default target unless you override it.
If you want to specify one target for most dependencies, with a few exceptions:
@{
PSDependOptions = @{
Target = 'C:\MyTarget' # <<<<<<<
}
PSDeploy = 'latest'
PSSlack = 'latest'
PSJira = @{
Target = 'C:\OtherTarget'
}
'darkoperator/ADAudit' = 'dev'
}