-
Notifications
You must be signed in to change notification settings - Fork 7
/
createNode.ps1
37 lines (33 loc) · 1.58 KB
/
createNode.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
36
37
Param(
[Parameter(Mandatory = $True)]
[string]$NodeName,
[Parameter(Mandatory = $True)]
[string]$Label,
[Parameter(Mandatory = $True)]
[string]$FuncName,
[Parameter(Mandatory = $True)]
[string]$Category,
[Parameter(Mandatory = $True)]
[int]$Inputs,
[Parameter(Mandatory = $True)]
[int]$Outputs
)
Write-Host "============================================================================="
Write-Host " Name of the node : $NodeName"
Write-Host " Display-label value : $Label"
Write-Host " Creating func name : $FuncName"
Write-Host " Category : $Category"
Write-Host " Inputs : $Inputs"
Write-Host " Outputs : $Outputs"
Write-Host "============================================================================="
$nodeJsPath = "src/$NodeName.js"
$nodeHtmlPath = "src/$NodeName.html"
Write-Host " Copy templates..."
Copy-Item -Path "_template.js" -Destination $nodeJsPath
Copy-Item -Path "_template.html" -Destination $nodeHtmlPath
Write-host " Replacing tokens..."
(Get-Content -path $nodeJsPath -Raw).Replace('$$NAME_FUNC$$', $FuncName).Replace('$$NAME_NODE$$', $NodeName) | Set-Content -Path $nodeJsPath
(Get-Content -path $nodeHtmlPath -Raw).Replace('$$NAME_LABEL$$', $Label).Replace('$$NAME_NODE$$', $NodeName).Replace('$$NAME_UPPER$$', $NodeName.ToUpper()).Replace('$$CATEGORY$$', $Category).Replace('$$INPUTS$$', $Inputs).Replace('$$OUTPUTS$$', $Outputs) | Set-Content -Path $nodeHtmlPath
Write-host " Finished!"
Write-Host "============================================================================="
Write-Host