1
0
mirror of https://gitcode.com/github-mirrors/react-native-update-cli.git synced 2025-10-30 06:13:11 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

print version when bundling

This commit is contained in:
sunnylqm
2020-03-27 13:53:17 +08:00
parent 6bc7ee7091
commit 755485b4cb
3 changed files with 109 additions and 48 deletions

View File

@@ -5,6 +5,7 @@
import * as fs from 'fs-extra';
import os from 'os';
import path from 'path';
const pkg = require('../../package.json');
const AppInfoParser = require('app-info-parser');
var read = require('read');
@@ -112,3 +113,18 @@ export function saveToLocal(originPath, destName) {
// fs.ensureDirSync(path.dirname(destPath));
// fs.copyFileSync(originPath, destPath);
}
export function printVersionCommand() {
console.log('react-native-update-cli: ' + pkg.version);
try {
const PACKAGE_JSON_PATH = path.resolve(
process.cwd(),
'node_modules',
'react-native-update',
'package.json'
);
console.log('react-native-update: ' + require(PACKAGE_JSON_PATH).version);
} catch (e) {
console.log('react-native-update: 无法获取版本号,请在项目目录中运行命令')
}
}