Skip to content

Instantly share code, notes, and snippets.

@fluxdigital
Created August 14, 2019 22:31
Show Gist options
  • Save fluxdigital/c47e6be6b98f7cf19e4be275b2bd450d to your computer and use it in GitHub Desktop.
Save fluxdigital/c47e6be6b98f7cf19e4be275b2bd450d to your computer and use it in GitHub Desktop.
Create component datasource based on component base path and template path and names
function Create-Component-Datasource([string]$componentBasePath, [string]$templateBasePath, [string]$componentFolderName, [string]$componentName, [string]$componentFolderTemplateName, [string]$componentTemplateName){
###create component folder item###
Write-Host "Creating component folder: $($componentBasePath)/$($componentFolderName) with template: $($templateBasePath)/$($componentFolderTemplateName)"
$componentFolderItem = New-Item -Path $componentBasePath -Name $componentFolderName -ItemType "$($templateBasePath)/$($componentFolderTemplateName)"
###create component item###
Write-Host "Creating component: $($componentBasePath)/$($componentFolderItem.Name)/$($componentName) with template: $($templateBasePath)/$($componentTemplateName)"
$componentItem = New-Item -Path "$($componentBasePath)/$($componentFolderItem.Name)" -Name $componentName -ItemType "$($templateBasePath)/$($componentTemplateName)"
Write-Host "Component Datasource Created: " $componentTemplateName
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment