mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-09-17 10:02:19 +08:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
91a602979d | ||
![]() |
2cfe451db5 | ||
![]() |
c7d0aadbf2 | ||
![]() |
2e37d6f1c7 |
42
cli.json
42
cli.json
@@ -57,6 +57,27 @@
|
|||||||
},
|
},
|
||||||
"metaInfo": {
|
"metaInfo": {
|
||||||
"hasValue": true
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"packageId": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"packageVersion": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"minPackageVersion": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"maxPackageVersion": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"packageVersionRange": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"rollout": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"dryRun": {
|
||||||
|
"default": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -175,6 +196,27 @@
|
|||||||
"metaInfo": {
|
"metaInfo": {
|
||||||
"hasValue": true,
|
"hasValue": true,
|
||||||
"description": "Meta information for publishing"
|
"description": "Meta information for publishing"
|
||||||
|
},
|
||||||
|
"packageId": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"packageVersion": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"minPackageVersion": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"maxPackageVersion": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"packageVersionRange": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"rollout": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"dryRun": {
|
||||||
|
"default": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-native-update-cli",
|
"name": "react-native-update-cli",
|
||||||
"version": "1.45.5",
|
"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": {
|
||||||
|
@@ -66,7 +66,7 @@ export async function chooseApp(platform: Platform) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const commands = {
|
export const appCommands = {
|
||||||
createApp: async function ({
|
createApp: async function ({
|
||||||
options,
|
options,
|
||||||
}: {
|
}: {
|
||||||
|
@@ -19,7 +19,7 @@ import { t } from './utils/i18n';
|
|||||||
import { tempDir } from './utils/constants';
|
import { tempDir } from './utils/constants';
|
||||||
import { checkLockFiles } from './utils/check-lockfile';
|
import { checkLockFiles } from './utils/check-lockfile';
|
||||||
import { addGitIgnore } from './utils/add-gitignore';
|
import { addGitIgnore } from './utils/add-gitignore';
|
||||||
import { commands as versionCommands } from './versions';
|
import { versionCommands } from './versions';
|
||||||
|
|
||||||
type Diff = (oldSource?: Buffer, newSource?: Buffer) => Buffer;
|
type Diff = (oldSource?: Buffer, newSource?: Buffer) => Buffer;
|
||||||
|
|
||||||
@@ -149,6 +149,14 @@ async function runReactNativeBundleCommand({
|
|||||||
const bundleParams = await checkPlugins();
|
const bundleParams = await checkPlugins();
|
||||||
const isSentry = bundleParams.sentry;
|
const isSentry = bundleParams.sentry;
|
||||||
|
|
||||||
|
if (isSentry) {
|
||||||
|
if (platform === 'ios') {
|
||||||
|
process.env.SENTRY_PROPERTIES = 'ios/sentry.properties';
|
||||||
|
} else if (platform === 'android') {
|
||||||
|
process.env.SENTRY_PROPERTIES = 'android/sentry.properties';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let bundleCommand = 'bundle';
|
let bundleCommand = 'bundle';
|
||||||
if (usingExpo) {
|
if (usingExpo) {
|
||||||
bundleCommand = 'export:embed';
|
bundleCommand = 'export:embed';
|
||||||
@@ -900,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);
|
||||||
|
|
||||||
@@ -918,6 +926,13 @@ export const commands = {
|
|||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
metaInfo,
|
metaInfo,
|
||||||
|
packageId,
|
||||||
|
packageVersion,
|
||||||
|
minPackageVersion,
|
||||||
|
maxPackageVersion,
|
||||||
|
packageVersionRange,
|
||||||
|
rollout,
|
||||||
|
dryRun,
|
||||||
} = translateOptions({
|
} = translateOptions({
|
||||||
...options,
|
...options,
|
||||||
tempDir,
|
tempDir,
|
||||||
@@ -966,6 +981,13 @@ export const commands = {
|
|||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
metaInfo,
|
metaInfo,
|
||||||
|
packageId,
|
||||||
|
packageVersion,
|
||||||
|
minPackageVersion,
|
||||||
|
maxPackageVersion,
|
||||||
|
packageVersionRange,
|
||||||
|
rollout,
|
||||||
|
dryRun: Boolean(dryRun),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
15
src/index.ts
15
src/index.ts
@@ -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,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -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')) {
|
||||||
|
@@ -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));
|
||||||
|
@@ -10,7 +10,8 @@ import type { Package, Platform, Version } from 'types';
|
|||||||
import { satisfies } from 'compare-versions';
|
import { satisfies } from 'compare-versions';
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
|
|
||||||
interface CommandOptions {
|
interface VersionCommandOptions {
|
||||||
|
appId?: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
metaInfo?: string;
|
metaInfo?: string;
|
||||||
@@ -156,13 +157,13 @@ export const bindVersionToPackages = async ({
|
|||||||
console.log(t('operationComplete', { count: pkgs.length }));
|
console.log(t('operationComplete', { count: pkgs.length }));
|
||||||
};
|
};
|
||||||
|
|
||||||
export const commands = {
|
export const versionCommands = {
|
||||||
publish: async function ({
|
publish: async function ({
|
||||||
args,
|
args,
|
||||||
options,
|
options,
|
||||||
}: {
|
}: {
|
||||||
args: string[];
|
args: string[];
|
||||||
options: CommandOptions;
|
options: VersionCommandOptions;
|
||||||
}) {
|
}) {
|
||||||
const fn = args[0];
|
const fn = args[0];
|
||||||
const { name, description, metaInfo } = options;
|
const { name, description, metaInfo } = options;
|
||||||
@@ -191,26 +192,52 @@ export const commands = {
|
|||||||
saveToLocal(fn, `${appId}/ppk/${id}.ppk`);
|
saveToLocal(fn, `${appId}/ppk/${id}.ppk`);
|
||||||
console.log(t('packageUploadSuccess', { id }));
|
console.log(t('packageUploadSuccess', { id }));
|
||||||
|
|
||||||
const v = await question(t('updateNativePackageQuestion'));
|
const {
|
||||||
if (v.toLowerCase() === 'y') {
|
packageId,
|
||||||
await this.update({ args: [], options: { versionId: id, platform } });
|
packageVersion,
|
||||||
|
packageVersionRange,
|
||||||
|
minPackageVersion,
|
||||||
|
maxPackageVersion,
|
||||||
|
rollout,
|
||||||
|
dryRun,
|
||||||
|
} = options;
|
||||||
|
|
||||||
|
if (
|
||||||
|
packageId ||
|
||||||
|
packageVersion ||
|
||||||
|
packageVersionRange ||
|
||||||
|
minPackageVersion ||
|
||||||
|
maxPackageVersion
|
||||||
|
) {
|
||||||
|
await this.update({
|
||||||
|
options: {
|
||||||
|
versionId: id,
|
||||||
|
platform,
|
||||||
|
packageId,
|
||||||
|
packageVersion,
|
||||||
|
packageVersionRange,
|
||||||
|
minPackageVersion,
|
||||||
|
maxPackageVersion,
|
||||||
|
rollout,
|
||||||
|
dryRun,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const q = await question(t('updateNativePackageQuestion'));
|
||||||
|
if (q.toLowerCase() === 'y') {
|
||||||
|
await this.update({ options: { versionId: id, platform } });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return versionName;
|
return versionName;
|
||||||
},
|
},
|
||||||
versions: async ({ options }: { options: CommandOptions }) => {
|
versions: async ({ options }: { options: VersionCommandOptions }) => {
|
||||||
const platform = await getPlatform(options.platform);
|
const platform = await getPlatform(options.platform);
|
||||||
const { appId } = await getSelectedApp(platform);
|
const { appId } = await getSelectedApp(platform);
|
||||||
await listVersions(appId);
|
await listVersions(appId);
|
||||||
},
|
},
|
||||||
update: async ({
|
update: async ({ options }: { options: VersionCommandOptions }) => {
|
||||||
args,
|
|
||||||
options,
|
|
||||||
}: {
|
|
||||||
args: string[];
|
|
||||||
options: CommandOptions;
|
|
||||||
}) => {
|
|
||||||
const platform = await getPlatform(options.platform);
|
const platform = await getPlatform(options.platform);
|
||||||
const { appId } = await getSelectedApp(platform);
|
const appId = options.appId || (await getSelectedApp(platform)).appId;
|
||||||
let versionId = options.versionId || (await chooseVersion(appId)).id;
|
let versionId = options.versionId || (await chooseVersion(appId)).id;
|
||||||
if (versionId === 'null') {
|
if (versionId === 'null') {
|
||||||
versionId = undefined;
|
versionId = undefined;
|
||||||
@@ -309,11 +336,9 @@ export const commands = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
updateVersionInfo: async ({
|
updateVersionInfo: async ({
|
||||||
args,
|
|
||||||
options,
|
options,
|
||||||
}: {
|
}: {
|
||||||
args: string[];
|
options: VersionCommandOptions;
|
||||||
options: CommandOptions;
|
|
||||||
}) => {
|
}) => {
|
||||||
const platform = await getPlatform(options.platform);
|
const platform = await getPlatform(options.platform);
|
||||||
const { appId } = await getSelectedApp(platform);
|
const { appId } = await getSelectedApp(platform);
|
||||||
|
Reference in New Issue
Block a user