mirror of
				https://gitcode.com/github-mirrors/react-native-update-cli.git
				synced 2025-10-31 06:43:10 +08:00 
			
		
		
		
	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:
		| @@ -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": { | ||||
|   | ||||
| @@ -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 }); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 sunny.ll
					sunny.ll