Skip to content

Commit 07ff19f

Browse files
committed
Update version to 2.1.1 in package.json and improve error handling for package loading in dep-versions.ts
1 parent a446771 commit 07ff19f

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-update-cli",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"description": "command line tool for react-native-update (remote updates for react native)",
55
"main": "index.js",
66
"bin": {

src/utils/dep-versions.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
const currentPackage = require(`${process.cwd()}/package.json`);
1+
let currentPackage = null;
2+
try {
3+
currentPackage = require(`${process.cwd()}/package.json`);
4+
} catch (e) {
5+
// console.warn('No package.json file were found');
6+
}
27

38
const _depVersions: Record<string, string> = {};
49

@@ -24,12 +29,9 @@ if (currentPackage) {
2429

2530
export const depVersions = Object.keys(_depVersions)
2631
.sort() // Sort the keys alphabetically
27-
.reduce(
28-
(obj, key) => {
29-
obj[key] = _depVersions[key]; // Rebuild the object with sorted keys
30-
return obj;
31-
},
32-
{} as Record<string, string>,
33-
);
32+
.reduce((obj, key) => {
33+
obj[key] = _depVersions[key]; // Rebuild the object with sorted keys
34+
return obj;
35+
}, {} as Record<string, string>);
3436

3537
// console.log({ depVersions });

0 commit comments

Comments
 (0)