Files
codeql-action/node_modules/github-linguist/src/utils.ts
Andrew Eisenberg c4a84a93d4 Add the github-linguist package
This commit only adds a single package and all of its transitive
dependencies. The github-linguist package will be used for counting
lines of code as a baseline for databases we are analyzing.
2021-04-22 15:59:49 -07:00

26 lines
555 B
TypeScript

import fs from 'fs';
import path from 'path';
// @ts-ignore
import slash from 'slash2';
const packagePath = slash(path.join(__dirname, '../', 'package.json'));
/**
* Get package version.
*
* @export getVersion
* @returns {string}
*/
export function getVersion(): string {
const packageInfo = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
return (packageInfo && packageInfo.version) || 'invalid version!';
}
export const ExtensionJustify = {
'.ts': 'typescript',
'.jsx': 'javascript',
'.js': 'javascript',
'.tsx': 'typescript',
};