1
0
mirror of https://gitcode.com/github-mirrors/react-native-update-cli.git synced 2025-09-16 01:41:37 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

Update version to 2.1.1 in package.json and improve error handling for package loading in dep-versions.ts

This commit is contained in:
sunny.ll
2025-09-10 11:05:24 +08:00
parent a4467717bc
commit 07ff19fbe5
2 changed files with 11 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "react-native-update-cli",
"version": "2.1.0",
"version": "2.1.1",
"description": "command line tool for react-native-update (remote updates for react native)",
"main": "index.js",
"bin": {

View File

@@ -1,4 +1,9 @@
const currentPackage = require(`${process.cwd()}/package.json`);
let currentPackage = null;
try {
currentPackage = require(`${process.cwd()}/package.json`);
} catch (e) {
// console.warn('No package.json file were found');
}
const _depVersions: Record<string, string> = {};
@@ -24,12 +29,9 @@ if (currentPackage) {
export const depVersions = Object.keys(_depVersions)
.sort() // Sort the keys alphabetically
.reduce(
(obj, key) => {
obj[key] = _depVersions[key]; // Rebuild the object with sorted keys
return obj;
},
{} as Record<string, string>,
);
.reduce((obj, key) => {
obj[key] = _depVersions[key]; // Rebuild the object with sorted keys
return obj;
}, {} as Record<string, string>);
// console.log({ depVersions });