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

feat: support symlink

This commit is contained in:
sunnylqm
2024-01-29 19:01:11 +08:00
parent d912ace4a7
commit ab7920fe38
2 changed files with 4 additions and 9 deletions

View File

@@ -43,7 +43,7 @@ export function translateOptions(options) {
export function getRNVersion() {
const version = JSON.parse(
fs.readFileSync(path.resolve('node_modules/react-native/package.json')),
fs.readFileSync(require.resolve('react-native/package.json')),
).version;
// We only care about major and minor version.
@@ -139,12 +139,7 @@ export function saveToLocal(originPath, destName) {
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',
);
const PACKAGE_JSON_PATH = require.resolve('react-native-update/package.json');
console.log('react-native-update: ' + require(PACKAGE_JSON_PATH).version);
} catch (e) {
console.log('react-native-update: 无法获取版本号,请在项目目录中运行命令');