mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-09-17 18:06:10 +08:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ac13464d4d | ||
![]() |
f82bab887a | ||
![]() |
07ff19fbe5 |
6
cli.json
6
cli.json
@@ -66,6 +66,12 @@
|
||||
"options": {
|
||||
"appId": {
|
||||
"hasValue": true
|
||||
},
|
||||
"packageVersion": {
|
||||
"hasValue": true
|
||||
},
|
||||
"packageId": {
|
||||
"hasValue": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -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": {
|
||||
|
@@ -39,9 +39,9 @@ export class ModuleManager {
|
||||
module.init(this.provider);
|
||||
}
|
||||
|
||||
console.log(
|
||||
`Module '${module.name}' (v${module.version}) registered successfully`,
|
||||
);
|
||||
// console.log(
|
||||
// `Module '${module.name}' (v${module.version}) registered successfully`,
|
||||
// );
|
||||
}
|
||||
|
||||
unregisterModule(moduleName: string): void {
|
||||
|
@@ -217,10 +217,9 @@ export const packageCommands = {
|
||||
options,
|
||||
}: {
|
||||
args: string[];
|
||||
options: { appId?: string };
|
||||
options: { appId?: string, packageId?: string, packageVersion?: string };
|
||||
}) => {
|
||||
let packageId = args[0];
|
||||
let { appId } = options;
|
||||
let { appId, packageId, packageVersion } = options;
|
||||
|
||||
if (!appId) {
|
||||
const platform = await getPlatform();
|
||||
@@ -229,7 +228,14 @@ export const packageCommands = {
|
||||
|
||||
// If no packageId provided as argument, let user choose from list
|
||||
if (!packageId) {
|
||||
const selectedPackage = await choosePackage(appId);
|
||||
const allPkgs = await getAllPackages(appId);
|
||||
if (!allPkgs) {
|
||||
throw new Error(t('noPackagesFound', { appId }));
|
||||
}
|
||||
const selectedPackage = allPkgs.find((pkg) => pkg.version === packageVersion);
|
||||
if (!selectedPackage) {
|
||||
throw new Error(t('packageNotFound', { packageVersion }));
|
||||
}
|
||||
packageId = selectedPackage.id;
|
||||
}
|
||||
|
||||
|
@@ -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