mirror of
				https://gitcode.com/github-mirrors/react-native-update-cli.git
				synced 2025-10-31 14:53:11 +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", |   "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)", |   "description": "command line tool for react-native-update (remote updates for react native)", | ||||||
|   "main": "index.js", |   "main": "index.js", | ||||||
|   "bin": { |   "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> = {}; | const _depVersions: Record<string, string> = {}; | ||||||
|  |  | ||||||
| @@ -24,12 +29,9 @@ if (currentPackage) { | |||||||
|  |  | ||||||
| export const depVersions = Object.keys(_depVersions) | export const depVersions = Object.keys(_depVersions) | ||||||
|   .sort() // Sort the keys alphabetically |   .sort() // Sort the keys alphabetically | ||||||
|   .reduce( |   .reduce((obj, key) => { | ||||||
|     (obj, key) => { |     obj[key] = _depVersions[key]; // Rebuild the object with sorted keys | ||||||
|       obj[key] = _depVersions[key]; // Rebuild the object with sorted keys |     return obj; | ||||||
|       return obj; |   }, {} as Record<string, string>); | ||||||
|     }, |  | ||||||
|     {} as Record<string, string>, |  | ||||||
|   ); |  | ||||||
|  |  | ||||||
| // console.log({ depVersions }); | // console.log({ depVersions }); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 sunny.ll
					sunny.ll