UNPKG

@atao60/fse-cli

Version:
37 lines (35 loc) 1.06 kB
import sourceMapSupport from "source-map-support"; sourceMapSupport.install(); import fse from 'fs-extra'; const { existsSync, readFileSync } = fse; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; import * as logger from '../logger.js'; const __dirname = dirname(fileURLToPath(import.meta.url)); const versionDef = { name: 'version', spec: {}, 'default': {}, options: _ => ({}), questions: _ => [] }; const shrinkwrapPath = join(__dirname, '../../npm-shrinkwrap.json'); const packagelockPath = join(__dirname, '../../package-lock.json'); export const def = versionDef; export function job() { const packagePath = existsSync(shrinkwrapPath) ? shrinkwrapPath : packagelockPath; const content = readFileSync(packagePath, { encoding: 'utf8' }); const { version, dependencies } = JSON.parse(content); const cliVersion = version; const libVersion = dependencies['fs-extra'].version; logger.info(`@atao60/fse-cli ${cliVersion} (fs-extra ${libVersion})`); } //# sourceMappingURL=version.js.map