@@ -24,20 +24,21 @@ task Clean {
2424# "githubrepo": "puppet-editor-services",
2525# "githubuser": "glennsarti"
2626# }
27- # "editorServices": {
27+ # "editorServices": {
2828# "githubrepo": "puppet-editor-services",
2929# "githubref": "glennsarti:spike-rearch-langserver"
3030# },
31- task VendorEditorServices {
31+ task VendorEditorServices - precondition { ! ( Test-Path ( Join-Path $PSScriptRoot ' vendor/languageserver ' )) } {
3232 $githubrepo = $config.editorComponents.editorServices.githubrepo ?? ' puppet-editor-services'
3333 $githubuser = $config.editorComponents.editorServices.githubuser ?? ' puppetlabs'
3434
35- if ($config.editorComponents.editorServices.release ){
35+ if ($config.editorComponents.editorServices.release ) {
3636 $releasenumber = $config.editorComponents.editorServices.release
3737 $uri = " https://github.com/${githubuser} /${githubrepo} /releases/download/${releasenumber} /puppet_editor_services_${releasenumber} .zip" ;
38- }else {
38+ }
39+ else {
3940 $githubref = $config.editorComponents.editorServices.githubref ;
40- if ($githubref -notcontains ' :' ){
41+ if ($githubref -notcontains ' :' ) {
4142 throw " Invalid githubref. Must be in user:branch format like glennsarti:spike-rearch-langserver"
4243 }
4344 $githubuser = $githubref.split (" :" )[0 ]
@@ -47,7 +48,8 @@ task VendorEditorServices {
4748
4849 if ($config.editorComponents.editorServices.directory ) {
4950 Copy-Item - Path $config.editorComponents.editorServices.directory - Destination $languageServerPath - Recurse - Force
50- }elseif ($config.editorComponents.editorServices.release ) {
51+ }
52+ elseif ($config.editorComponents.editorServices.release ) {
5153 Invoke-RestMethod - Uri $uri - OutFile $languageServerZip - ErrorAction Stop
5254 Expand-Archive - Path $languageServerZip - DestinationPath $languageServerPath - ErrorAction Stop
5355 Remove-Item - Path $languageServerZip - Force
@@ -64,19 +66,9 @@ task VendorEditorServices {
6466 }
6567}
6668
67- task VendorEditorSyntax {
68- if ($config.editorComponents.editorSyntax.githubuser ) {
69- $githubuser = $config.editorComponents.editorSyntax.githubuser
70- }
71- else {
72- $githubuser = ' lingua-pupuli'
73- }
74- if ($config.editorComponents.editorSyntax.githubrepo ) {
75- $githubrepo = $config.editorComponents.editorSyntax.githubrepo
76- }
77- else {
78- $githubrepo = ' puppet-editor-syntax'
79- }
69+ task VendorEditorSyntax - precondition { ! (Test-Path (Join-Path $PSScriptRoot ' syntaxes/puppet.tmLanguage' )) } {
70+ $githubrepo = $config.editorComponents.editorSyntax.githubrepo ?? ' puppet-editor-syntax'
71+ $githubuser = $config.editorComponents.editorSyntax.githubuser ?? ' puppetlabs'
8072
8173 if ($config.editorComponents.editorSyntax.directory ) {
8274 $source = Join-Path ($config.editorComponents.editorSyntax.directory , ' syntaxes/puppet.tmLanguage' )
@@ -99,7 +91,7 @@ task VendorEditorSyntax {
9991 Invoke-RestMethod - Uri $uri - OutFile $syntaxFilePath - ErrorAction Stop
10092}
10193
102- task VendorCytoscape {
94+ task VendorCytoscape - precondition { ! ( Test-Path ( Join-Path $PSScriptRoot ' vendor\cytoscape ' )) } {
10395 $cyto = Join-Path $PSScriptRoot ' node_modules\cytoscape\dist'
10496 $vendorCytoPath = (Join-Path $PSScriptRoot ' vendor\cytoscape' )
10597 Copy-Item - Path $cyto - Recurse - Destination $vendorCytoPath
@@ -113,14 +105,12 @@ task Bump {
113105 exec { npm version -- no- git- tag- version $packageVersion }
114106}
115107
116- task Npm {
108+ task Npm - precondition { ! ( Test-Path ( Join-Path $PSScriptRoot ' node_modules ' )) } {
117109 exec { npm install }
118110}
119111
120112task Vendor - depends VendorEditorServices, VendorEditorSyntax, VendorCytoscape
121113
122- task Build - depends Clean , Npm, Vendor, CompileTypeScript
123-
124- task Initial - depends Clean , Vendor
114+ task Build - depends Npm, Vendor, CompileTypeScript
125115
126116task default - depends Build
0 commit comments