"Fossies" - the Fresh Open Source Software Archive

Member "cli-1.1280.1/src/lib/version.ts" (20 Feb 2024, 510 Bytes) of package /linux/misc/snyk-cli-1.1280.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 import * as fs from 'fs';
    2 import * as path from 'path';
    3 
    4 export function getVersion(): string {
    5   const root = path.resolve(__dirname, '../..');
    6 
    7   const { version } = JSON.parse(
    8     fs.readFileSync(path.join(root, 'package.json'), 'utf8'),
    9   );
   10 
   11   return version;
   12 }
   13 
   14 /**
   15  * We use pkg to create standalone builds (binaries).
   16  * pkg uses `process.pkg` to identify itself at runtime so we can do the same.
   17  * https://github.com/vercel/pkg
   18  */
   19 export function isStandaloneBuild() {
   20   return 'pkg' in process;
   21 }