1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-10-30 21:03:12 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
tdzl2003
2016-02-23 00:36:23 +08:00
parent 8bc608581c
commit 56495062c4
16 changed files with 254 additions and 63 deletions

28
local-cli/src/utils.js Normal file
View File

@@ -0,0 +1,28 @@
/**
* Created by tdzl2003 on 2/13/16.
*/
import * as path from 'path';
import * as fs from 'fs';
var read = require('read');
export function question(query, password) {
return new Promise((resolve, reject)=>read({
prompt: query,
silent: password,
replace: password ? '*' : undefined,
}, (err, result)=> err ? reject(err) : resolve(result)));
}
export function getRNVersion() {
const version = JSON.parse(fs.readFileSync(path.resolve('node_modules/react-native/package.json'))).version;
// We only care about major and minor version.
const match = /^(\d+)\.(\d+)\./.exec(version);
return {
version,
major: match[1] | 0,
minor: match[2] | 0,
};
}