Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] Initial check-in for supporting telemetry in vscode #6123

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add pipeline change
  • Loading branch information
RodgeFu committed Feb 21, 2025
commit ef973de07dc2dae02f5cae4272abe08652f68089
3 changes: 3 additions & 0 deletions eng/tsp-core/pipelines/jobs/build-for-publish.yml
Original file line number Diff line number Diff line change
@@ -10,6 +10,9 @@ jobs:
parameters:
useDotNet: true

- script: pnpm run update-telemetry-key $(vscode-telemetry-key)
workingDirectory: $(Build.SourcesDirectory)/packages/typespec-vscode

- template: /eng/tsp-core/pipelines/templates/build.yml

- script: pnpm run test:ci
2 changes: 1 addition & 1 deletion packages/typespec-vscode/ThirdPartyNotices.txt
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ granted herein, whether by implication, estoppel or otherwise.
4. brace-expansion version 2.0.1 (https://github.com/juliangruber/brace-expansion)
5. minimatch version 5.1.6 (https://github.com/isaacs/minimatch)
6. semver version 7.6.3 (https://github.com/npm/node-semver)
5. yaml version 2.7.0 (github:eemeli/yaml)
7. yaml version 2.7.0 (github:eemeli/yaml)


%% @nevware21/ts-async NOTICES AND INFORMATION BEGIN HERE
1 change: 1 addition & 0 deletions packages/typespec-vscode/package.json
Original file line number Diff line number Diff line change
@@ -233,6 +233,7 @@
"copy-tmlanguage": "node scripts/copy-tmlanguage.js",
"generate-language-configuration": "node scripts/generate-language-configuration.js",
"generate-third-party-notices": "typespec-build-tool generate-third-party-notices",
"update-telemetry-key": "node scripts/update-telemetry-key.js",
"package-vsix": "vsce package",
"deploy": "vsce publish",
"open-in-browser": "vscode-test-web --extensionDevelopmentPath=. .",
25 changes: 25 additions & 0 deletions packages/typespec-vscode/scripts/update-telemetry-key.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";

const newKey = process.argv[2];
if (!newKey) {
console.log("One argument for telemetry-key to use is expected. Exit without updating anything");
} else {
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const targetPackageJsonFile = path.resolve(__dirname, "../package.json");
const packageJson = JSON.parse(fs.readFileSync(targetPackageJsonFile, "utf8"));
const oldKey = packageJson.telemetryKey;

const getLastSegOfKey = (key) => key.substring(Math.max(0, newKey.length - 12));

console.log(
`Updating telemetry key from ...${getLastSegOfKey(oldKey)} to ...${getLastSegOfKey(newKey)}`,
);
packageJson.telemetryKey = newKey;

fs.writeFileSync(targetPackageJsonFile, JSON.stringify(packageJson, null, 2));

console.log("package.json updated successfully");
}
127 changes: 127 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.