mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-09-16 01:41:37 +08:00
Refactor command exports to use specific command groups for app, bundle, package, user, and version modules
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-update-cli",
|
||||
"version": "1.46.0",
|
||||
"version": "1.46.1",
|
||||
"description": "command line tool for react-native-update (remote updates for react native)",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
|
@@ -66,7 +66,7 @@ export async function chooseApp(platform: Platform) {
|
||||
}
|
||||
}
|
||||
|
||||
export const commands = {
|
||||
export const appCommands = {
|
||||
createApp: async function ({
|
||||
options,
|
||||
}: {
|
||||
|
@@ -908,7 +908,7 @@ function diffArgsCheck(args: string[], options: any, diffFn: string) {
|
||||
};
|
||||
}
|
||||
|
||||
export const commands = {
|
||||
export const bundleCommands = {
|
||||
bundle: async ({ options }) => {
|
||||
const platform = await getPlatform(options.platform);
|
||||
|
||||
|
15
src/index.ts
15
src/index.ts
@@ -3,6 +3,11 @@
|
||||
import { loadSession } from './api';
|
||||
import { printVersionCommand } from './utils';
|
||||
import { t } from './utils/i18n';
|
||||
import { bundleCommands } from './bundle';
|
||||
import { versionCommands } from './versions';
|
||||
import { userCommands } from './user';
|
||||
import { appCommands } from './app';
|
||||
import { packageCommands } from './package';
|
||||
|
||||
function printUsage() {
|
||||
// const commandName = args[0];
|
||||
@@ -15,11 +20,11 @@ function printUsage() {
|
||||
}
|
||||
|
||||
const commands = {
|
||||
...require('./user').commands,
|
||||
...require('./bundle').commands,
|
||||
...require('./app').commands,
|
||||
...require('./package').commands,
|
||||
...require('./versions').commands,
|
||||
...userCommands,
|
||||
...bundleCommands,
|
||||
...appCommands,
|
||||
...packageCommands,
|
||||
...versionCommands,
|
||||
help: printUsage,
|
||||
};
|
||||
|
||||
|
@@ -52,7 +52,7 @@ export async function choosePackage(appId: string) {
|
||||
}
|
||||
}
|
||||
|
||||
export const commands = {
|
||||
export const packageCommands = {
|
||||
uploadIpa: async ({ args }: { args: string[] }) => {
|
||||
const fn = args[0];
|
||||
if (!fn || !fn.endsWith('.ipa')) {
|
||||
|
@@ -7,7 +7,7 @@ function md5(str: string) {
|
||||
return crypto.createHash('md5').update(str).digest('hex');
|
||||
}
|
||||
|
||||
export const commands = {
|
||||
export const userCommands = {
|
||||
login: async ({ args }: { args: string[] }) => {
|
||||
const email = args[0] || (await question('email:'));
|
||||
const pwd = args[1] || (await question('password:', true));
|
||||
|
Reference in New Issue
Block a user