forked from cxai/VSTS-Plugin
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added plugin name and version number in API user agent header (#72)
- Loading branch information
1 parent
cb56f81
commit 8b3e611
Showing
3 changed files
with
21 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
|
||
export class CxPluginDetails { | ||
|
||
static getPluginVersion(): string | undefined { | ||
try { | ||
const packageJson = fs.readFileSync(path.resolve(__dirname, '../../package.json'), 'utf8'); | ||
const packageData = JSON.parse(packageJson); | ||
return packageData.version; | ||
} catch (error) { | ||
console.error('Error reading package.json:', error); | ||
return undefined; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters