From 107023c7d0a50ae62e841847961596d679f6e330 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Thu, 22 Jul 2021 16:47:08 -0700 Subject: [PATCH] Fix update typings pipeline to work for us (#16404) * Update publish types pipeline * update yarn tool * Use fork * Remove hardcoded * Sync up with upstream * update email --- .../publish-types/publish-types.yml | 83 ++++++++++--------- .../publish-types/update-types.js | 24 +++--- .../publish-types/update-types.ts | 24 +++--- 3 files changed, 73 insertions(+), 58 deletions(-) diff --git a/build/azure-pipelines/publish-types/publish-types.yml b/build/azure-pipelines/publish-types/publish-types.yml index df8b665fbc..683f20b254 100644 --- a/build/azure-pipelines/publish-types/publish-types.yml +++ b/build/azure-pipelines/publish-types/publish-types.yml @@ -11,25 +11,25 @@ steps: inputs: versionSpec: "14.x" - - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2 + - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@3 inputs: versionSpec: "1.x" - - bash: | - TAG_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`) - CHANNEL="G1C14HJ2F" + # - bash: | + # TAG_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`) + # CHANNEL="G1C14HJ2F" - if [ "$TAG_VERSION" == "1.999.0" ]; then - MESSAGE=". Someone pushed 1.999.0 tag. Please delete it ASAP from remote and local." + # if [ "$TAG_VERSION" == "1.999.0" ]; then + # MESSAGE=". Someone pushed 1.999.0 tag. Please delete it ASAP from remote and local." - curl -X POST -H "Authorization: Bearer $(SLACK_TOKEN)" \ - -H 'Content-type: application/json; charset=utf-8' \ - --data '{"channel":"'"$CHANNEL"'", "link_names": true, "text":"'"$MESSAGE"'"}' \ - https://slack.com/api/chat.postMessage + # curl -X POST -H "Authorization: Bearer $(SLACK_TOKEN)" \ + # -H 'Content-type: application/json; charset=utf-8' \ + # --data '{"channel":"'"$CHANNEL"'", "link_names": true, "text":"'"$MESSAGE"'"}' \ + # https://slack.com/api/chat.postMessage - exit 1 - fi - displayName: Check 1.999.0 tag + # exit 1 + # fi + # displayName: Check 1.999.0 tag - bash: | # Install build dependencies @@ -37,47 +37,54 @@ steps: node build/azure-pipelines/publish-types/check-version.js displayName: Check version + # {{SQL CARBON EDIT}} Modify to fit our own scenario - specifically currently we need to use a fork of the repo since we don't + # have an account with push access to DT - bash: | - git config --global user.email "vscode@microsoft.com" - git config --global user.name "VSCode" + git config --global user.email "azuredatastudio@microsoft.com" + git config --global user.name "Azure Data Studio" - git clone https://$(GITHUB_TOKEN)@github.com/DefinitelyTyped/DefinitelyTyped.git --depth=1 + git clone https://$(GITHUB_TOKEN)@$(REPO) --depth=1 node build/azure-pipelines/publish-types/update-types.js TAG_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`) cd DefinitelyTyped + # Sync up to latest from the DT repo + git remote add upstream https://github.com/DefinitelyTyped/DefinitelyTyped.git + git merge upstream/master + git push origin + git diff --color | cat git add -A git status - git checkout -b "vscode-types-$TAG_VERSION" - git commit -m "VS Code $TAG_VERSION Extension API" - git push origin "vscode-types-$TAG_VERSION" + git checkout -b "azdata-types-$TAG_VERSION" + git commit -m "Azure Data Studio $TAG_VERSION Extension API" + git push origin "azdata-types-$TAG_VERSION" displayName: Push update to DefinitelyTyped - - bash: | - TAG_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`) - CHANNEL="G1C14HJ2F" + # - bash: | + # TAG_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`) + # CHANNEL="G1C14HJ2F" - MESSAGE="DefinitelyTyped/DefinitelyTyped#vscode-types-$TAG_VERSION created. Endgame champion, please open this link, examine changes and create a PR:" - LINK="https://github.com/DefinitelyTyped/DefinitelyTyped/compare/vscode-types-$TAG_VERSION?quick_pull=1&body=Updating%20VS%20Code%20Extension%20API.%20See%20https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fvscode%2Fissues%2F70175%20for%20details." - MESSAGE2="[@eamodio, @jrieken, @kmaetzel, @egamma]. Please review and merge PR to publish @types/vscode." + # MESSAGE="DefinitelyTyped/DefinitelyTyped#vscode-types-$TAG_VERSION created. Endgame champion, please open this link, examine changes and create a PR:" + # LINK="https://github.com/DefinitelyTyped/DefinitelyTyped/compare/vscode-types-$TAG_VERSION?quick_pull=1&body=Updating%20VS%20Code%20Extension%20API.%20See%20https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fvscode%2Fissues%2F70175%20for%20details." + # MESSAGE2="[@eamodio, @jrieken, @kmaetzel, @egamma]. Please review and merge PR to publish @types/vscode." - curl -X POST -H "Authorization: Bearer $(SLACK_TOKEN)" \ - -H 'Content-type: application/json; charset=utf-8' \ - --data '{"channel":"'"$CHANNEL"'", "link_names": true, "text":"'"$MESSAGE"'"}' \ - https://slack.com/api/chat.postMessage + # curl -X POST -H "Authorization: Bearer $(SLACK_TOKEN)" \ + # -H 'Content-type: application/json; charset=utf-8' \ + # --data '{"channel":"'"$CHANNEL"'", "link_names": true, "text":"'"$MESSAGE"'"}' \ + # https://slack.com/api/chat.postMessage - curl -X POST -H "Authorization: Bearer $(SLACK_TOKEN)" \ - -H 'Content-type: application/json; charset=utf-8' \ - --data '{"channel":"'"$CHANNEL"'", "link_names": true, "text":"'"$LINK"'"}' \ - https://slack.com/api/chat.postMessage + # curl -X POST -H "Authorization: Bearer $(SLACK_TOKEN)" \ + # -H 'Content-type: application/json; charset=utf-8' \ + # --data '{"channel":"'"$CHANNEL"'", "link_names": true, "text":"'"$LINK"'"}' \ + # https://slack.com/api/chat.postMessage - curl -X POST -H "Authorization: Bearer $(SLACK_TOKEN)" \ - -H 'Content-type: application/json; charset=utf-8' \ - --data '{"channel":"'"$CHANNEL"'", "link_names": true, "text":"'"$MESSAGE2"'"}' \ - https://slack.com/api/chat.postMessage + # curl -X POST -H "Authorization: Bearer $(SLACK_TOKEN)" \ + # -H 'Content-type: application/json; charset=utf-8' \ + # --data '{"channel":"'"$CHANNEL"'", "link_names": true, "text":"'"$MESSAGE2"'"}' \ + # https://slack.com/api/chat.postMessage - displayName: Send message on Slack + # displayName: Send message on Slack diff --git a/build/azure-pipelines/publish-types/update-types.js b/build/azure-pipelines/publish-types/update-types.js index 175472a1f1..6fc1d6b990 100644 --- a/build/azure-pipelines/publish-types/update-types.js +++ b/build/azure-pipelines/publish-types/update-types.js @@ -13,11 +13,11 @@ try { .execSync('git describe --tags `git rev-list --tags --max-count=1`') .toString() .trim(); - const dtsUri = `https://raw.githubusercontent.com/microsoft/vscode/${tag}/src/vs/vscode.d.ts`; - const outPath = path.resolve(process.cwd(), 'DefinitelyTyped/types/vscode/index.d.ts'); + const dtsUri = `https://raw.githubusercontent.com/microsoft/azuredatastudio/${tag}/src/sql/azdata.d.ts`; // {{SQL CARBON EDIT}} Use our typings + const outPath = path.resolve(process.cwd(), 'DefinitelyTyped/types/azdata/index.d.ts'); // {{SQL CARBON EDIT}} Use our typings cp.execSync(`curl ${dtsUri} --output ${outPath}`); updateDTSFile(outPath, tag); - console.log(`Done updating vscode.d.ts at ${outPath}`); + console.log(`Done updating azdata.d.ts at ${outPath}`); // {{SQL CARBON EDIT}} Use our typings } catch (err) { console.error(err); @@ -51,21 +51,25 @@ function getNewFileContent(content, tag) { function getNewFileHeader(tag) { const [major, minor] = tag.split('.'); const shorttag = `${major}.${minor}`; + // {{SQL CARBON EDIT}} Use our own header const header = [ - `// Type definitions for Visual Studio Code ${shorttag}`, - `// Project: https://github.com/microsoft/vscode`, - `// Definitions by: Visual Studio Code Team, Microsoft `, + `// Type definitions for Azure Data Studio ${shorttag}`, + `// Project: https://github.com/microsoft/azuredatastudio`, + `// Definitions by: Charles Gagnon `, + `// Alan Ren: `, + `// Karl Burtram: `, + `// Ken Van Hyning: `, `// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped`, ``, `/*---------------------------------------------------------------------------------------------`, ` * Copyright (c) Microsoft Corporation. All rights reserved.`, - ` * Licensed under the Source EULA.`, - ` * See https://github.com/Microsoft/vscode/blob/main/LICENSE.txt for license information.`, + ` * Licensed under the MIT License.`, + ` * See https://github.com/Microsoft/azuredatastudio/blob/main/LICENSE.txt for license information.`, ` *--------------------------------------------------------------------------------------------*/`, ``, `/**`, - ` * Type Definition for Visual Studio Code ${shorttag} Extension API`, - ` * See https://code.visualstudio.com/api for more information`, + ` * Type Definition for Azure Data Studio ${shorttag} Extension API`, + ` * See https://docs.microsoft.com/sql/azure-data-studio/extensibility-apis for more information`, ` */` ].join('\n'); return header; diff --git a/build/azure-pipelines/publish-types/update-types.ts b/build/azure-pipelines/publish-types/update-types.ts index af92ebd51c..fd1ab41301 100644 --- a/build/azure-pipelines/publish-types/update-types.ts +++ b/build/azure-pipelines/publish-types/update-types.ts @@ -16,13 +16,13 @@ try { .toString() .trim(); - const dtsUri = `https://raw.githubusercontent.com/microsoft/vscode/${tag}/src/vs/vscode.d.ts`; - const outPath = path.resolve(process.cwd(), 'DefinitelyTyped/types/vscode/index.d.ts'); + const dtsUri = `https://raw.githubusercontent.com/microsoft/azuredatastudio/${tag}/src/sql/azdata.d.ts`; // {{SQL CARBON EDIT}} Use our typings + const outPath = path.resolve(process.cwd(), 'DefinitelyTyped/types/azdata/index.d.ts'); // {{SQL CARBON EDIT}} Use our typings cp.execSync(`curl ${dtsUri} --output ${outPath}`); updateDTSFile(outPath, tag); - console.log(`Done updating vscode.d.ts at ${outPath}`); + console.log(`Done updating azdata.d.ts at ${outPath}`); // {{SQL CARBON EDIT}} Use our typings } catch (err) { console.error(err); console.error('Failed to update types'); @@ -63,21 +63,25 @@ function getNewFileHeader(tag: string) { const [major, minor] = tag.split('.'); const shorttag = `${major}.${minor}`; + // {{SQL CARBON EDIT}} Use our own header const header = [ - `// Type definitions for Visual Studio Code ${shorttag}`, - `// Project: https://github.com/microsoft/vscode`, - `// Definitions by: Visual Studio Code Team, Microsoft `, + `// Type definitions for Azure Data Studio ${shorttag}`, + `// Project: https://github.com/microsoft/azuredatastudio`, + `// Definitions by: Charles Gagnon `, + `// Alan Ren: `, + `// Karl Burtram: `, + `// Ken Van Hyning: `, `// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped`, ``, `/*---------------------------------------------------------------------------------------------`, ` * Copyright (c) Microsoft Corporation. All rights reserved.`, - ` * Licensed under the Source EULA.`, - ` * See https://github.com/Microsoft/vscode/blob/main/LICENSE.txt for license information.`, + ` * Licensed under the MIT License.`, + ` * See https://github.com/Microsoft/azuredatastudio/blob/main/LICENSE.txt for license information.`, ` *--------------------------------------------------------------------------------------------*/`, ``, `/**`, - ` * Type Definition for Visual Studio Code ${shorttag} Extension API`, - ` * See https://code.visualstudio.com/api for more information`, + ` * Type Definition for Azure Data Studio ${shorttag} Extension API`, + ` * See https://docs.microsoft.com/sql/azure-data-studio/extensibility-apis for more information`, ` */` ].join('\n');