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": {
|
"options": {
|
||||||
"appId": {
|
"appId": {
|
||||||
"hasValue": true
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"packageVersion": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"packageId": {
|
||||||
|
"hasValue": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@@ -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": {
|
||||||
|
@@ -39,9 +39,9 @@ export class ModuleManager {
|
|||||||
module.init(this.provider);
|
module.init(this.provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(
|
// console.log(
|
||||||
`Module '${module.name}' (v${module.version}) registered successfully`,
|
// `Module '${module.name}' (v${module.version}) registered successfully`,
|
||||||
);
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
unregisterModule(moduleName: string): void {
|
unregisterModule(moduleName: string): void {
|
||||||
|
@@ -217,10 +217,9 @@ export const packageCommands = {
|
|||||||
options,
|
options,
|
||||||
}: {
|
}: {
|
||||||
args: string[];
|
args: string[];
|
||||||
options: { appId?: string };
|
options: { appId?: string, packageId?: string, packageVersion?: string };
|
||||||
}) => {
|
}) => {
|
||||||
let packageId = args[0];
|
let { appId, packageId, packageVersion } = options;
|
||||||
let { appId } = options;
|
|
||||||
|
|
||||||
if (!appId) {
|
if (!appId) {
|
||||||
const platform = await getPlatform();
|
const platform = await getPlatform();
|
||||||
@@ -229,7 +228,14 @@ export const packageCommands = {
|
|||||||
|
|
||||||
// If no packageId provided as argument, let user choose from list
|
// If no packageId provided as argument, let user choose from list
|
||||||
if (!packageId) {
|
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;
|
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> = {};
|
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