1
0
mirror of https://gitcode.com/github-mirrors/react-native-update-cli.git synced 2025-09-16 09:41:38 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

Refactor command exports to use specific command groups for app, bundle, package, user, and version modules

This commit is contained in:
sunnylqm
2025-06-23 11:30:36 +08:00
parent 2cfe451db5
commit 91a602979d
6 changed files with 15 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "react-native-update-cli", "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)", "description": "command line tool for react-native-update (remote updates for react native)",
"main": "index.js", "main": "index.js",
"bin": { "bin": {

View File

@@ -66,7 +66,7 @@ export async function chooseApp(platform: Platform) {
} }
} }
export const commands = { export const appCommands = {
createApp: async function ({ createApp: async function ({
options, options,
}: { }: {

View File

@@ -908,7 +908,7 @@ function diffArgsCheck(args: string[], options: any, diffFn: string) {
}; };
} }
export const commands = { export const bundleCommands = {
bundle: async ({ options }) => { bundle: async ({ options }) => {
const platform = await getPlatform(options.platform); const platform = await getPlatform(options.platform);

View File

@@ -3,6 +3,11 @@
import { loadSession } from './api'; import { loadSession } from './api';
import { printVersionCommand } from './utils'; import { printVersionCommand } from './utils';
import { t } from './utils/i18n'; 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() { function printUsage() {
// const commandName = args[0]; // const commandName = args[0];
@@ -15,11 +20,11 @@ function printUsage() {
} }
const commands = { const commands = {
...require('./user').commands, ...userCommands,
...require('./bundle').commands, ...bundleCommands,
...require('./app').commands, ...appCommands,
...require('./package').commands, ...packageCommands,
...require('./versions').commands, ...versionCommands,
help: printUsage, help: printUsage,
}; };

View File

@@ -52,7 +52,7 @@ export async function choosePackage(appId: string) {
} }
} }
export const commands = { export const packageCommands = {
uploadIpa: async ({ args }: { args: string[] }) => { uploadIpa: async ({ args }: { args: string[] }) => {
const fn = args[0]; const fn = args[0];
if (!fn || !fn.endsWith('.ipa')) { if (!fn || !fn.endsWith('.ipa')) {

View File

@@ -7,7 +7,7 @@ function md5(str: string) {
return crypto.createHash('md5').update(str).digest('hex'); return crypto.createHash('md5').update(str).digest('hex');
} }
export const commands = { export const userCommands = {
login: async ({ args }: { args: string[] }) => { login: async ({ args }: { args: string[] }) => {
const email = args[0] || (await question('email:')); const email = args[0] || (await question('email:'));
const pwd = args[1] || (await question('password:', true)); const pwd = args[1] || (await question('password:', true));