11/*---------------------------------------------------------------------------------------------
2- * Component update tasks (moved from publishRoslynCopilot.ts)
2+ * Copyright (c) Microsoft Corporation. All rights reserved.
3+ * Licensed under the MIT License. See License.txt in the project root for license information.
34 *--------------------------------------------------------------------------------------------*/
45
56import * as gulp from 'gulp' ;
@@ -16,7 +17,7 @@ type Options = {
1617 email ?: string ;
1718} ;
1819
19- function git ( args : string [ ] , printCommand = true ) : Promise < string > {
20+ async function git ( args : string [ ] , printCommand = true ) : Promise < string > {
2021 if ( printCommand ) {
2122 console . log ( `git ${ args . join ( ' ' ) } ` ) ;
2223 }
@@ -39,7 +40,7 @@ function git(args: string[], printCommand = true): Promise<string> {
3940
4041gulp . task ( 'publish roslyn copilot' , async ( ) => {
4142 const parsedArgs = minimist < Options > ( process . argv . slice ( 2 ) ) ;
42-
43+
4344 // Get staging directory from environment variable passed from pipeline
4445 const stagingDir = process . env [ 'STAGING_DIRECTORY' ] ;
4546 if ( ! stagingDir ) {
@@ -54,8 +55,8 @@ gulp.task('publish roslyn copilot', async () => {
5455
5556 // Find the Roslyn zip file in the staging directory (we know it was copied here)
5657 const files = fs . readdirSync ( stagingDir ) ;
57- const zipFile = files . find ( file => / R o s l y n \. L a n g u a g e S e r v e r .* \. z i p $ / i. test ( file ) ) ;
58-
58+ const zipFile = files . find ( ( file ) => / R o s l y n \. L a n g u a g e S e r v e r .* \. z i p $ / i. test ( file ) ) ;
59+
5960 if ( ! zipFile ) {
6061 console . log ( `No Roslyn LanguageServer zip file found in ${ stagingDir } ; skipping package.json update.` ) ;
6162 return ;
@@ -88,7 +89,10 @@ gulp.task('publish roslyn copilot', async () => {
8889 const dep = pkg . runtimeDependencies [ i ] ;
8990 if ( dep && dep . id === 'RoslynCopilot' ) {
9091 const oldUrl = dep . url as string ;
91- const newUrl = oldUrl . replace ( / M i c r o s o f t \. V i s u a l S t u d i o \. C o p i l o t \. R o s l y n \. L a n g u a g e S e r v e r - [ ^ / ] + ?\. z i p / , `Microsoft.VisualStudio.Copilot.Roslyn.LanguageServer-${ version } .zip` ) ;
92+ const newUrl = oldUrl . replace (
93+ / M i c r o s o f t \. V i s u a l S t u d i o \. C o p i l o t \. R o s l y n \. L a n g u a g e S e r v e r - [ ^ / ] + ?\. z i p / ,
94+ `Microsoft.VisualStudio.Copilot.Roslyn.LanguageServer-${ version } .zip`
95+ ) ;
9296 if ( oldUrl !== newUrl ) {
9397 pkg . runtimeDependencies [ i ] . url = newUrl ;
9498 updated = true ;
@@ -132,12 +136,7 @@ gulp.task('publish roslyn copilot', async () => {
132136
133137 const remoteRepoAlias = 'targetRepo' ;
134138 await git (
135- [
136- 'remote' ,
137- 'add' ,
138- remoteRepoAlias ,
139- `https://${ parsedArgs . userName } :${ pat } @github.com/dotnet/vscode-csharp.git` ,
140- ] ,
139+ [ 'remote' , 'add' , remoteRepoAlias , `https://${ parsedArgs . userName } :${ pat } @github.com/dotnet/vscode-csharp.git` ] ,
141140 // Note: don't print PAT to console
142141 false
143142 ) ;
@@ -146,9 +145,7 @@ gulp.task('publish roslyn copilot', async () => {
146145 const lsRemote = await git ( [ 'ls-remote' , remoteRepoAlias , 'refs/head/' + branch ] ) ;
147146 if ( lsRemote . trim ( ) !== '' ) {
148147 // If the localization branch of this commit already exists, don't try to create another one.
149- console . log (
150- `##vso[task.logissue type=error]${ branch } already exists in dotnet/vscode-csharp. Skip pushing.`
151- ) ;
148+ console . log ( `##vso[task.logissue type=error]${ branch } already exists in dotnet/vscode-csharp. Skip pushing.` ) ;
152149 } else {
153150 await git ( [ 'push' , '-u' , remoteRepoAlias ] ) ;
154151 }
@@ -158,7 +155,7 @@ gulp.task('publish roslyn copilot', async () => {
158155 const octokit = new Octokit ( { auth : pat } ) ;
159156 const listPullRequest = await octokit . rest . pulls . list ( {
160157 owner : 'dotnet' ,
161- repo : 'vscode-csharp' ,
158+ repo : 'vscode-csharp' ,
162159 } ) ;
163160
164161 if ( listPullRequest . status != 200 ) {
@@ -180,7 +177,7 @@ gulp.task('publish roslyn copilot', async () => {
180177 title : title ,
181178 head : branch ,
182179 base : 'main' ,
183- body : body
180+ body : body ,
184181 } ) ;
185182 console . log ( `Created pull request: ${ pullRequest . data . html_url } ` ) ;
186183 } catch ( e ) {
0 commit comments