mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-09-16 01:41:37 +08:00
Update version to 1.45.4, add dryRun option in cli.json and versions.ts, and enhance localization for dryRun messages
This commit is contained in:
3
cli.json
3
cli.json
@@ -92,6 +92,9 @@
|
||||
},
|
||||
"rollout": {
|
||||
"hasValue": true
|
||||
},
|
||||
"dryRun": {
|
||||
"default": false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-update-cli",
|
||||
"version": "1.45.3",
|
||||
"version": "1.45.4",
|
||||
"description": "command line tool for react-native-update (remote updates for react native)",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
|
@@ -129,4 +129,5 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
||||
versionMetaInfoQuestion: 'Enter custom meta info:',
|
||||
updateNativePackageQuestion: 'Bind to native package now?(Y/N)',
|
||||
unnamed: '(Unnamed)',
|
||||
dryRun: 'Below is the dry-run result, no actual operation will be performed:',
|
||||
};
|
||||
|
@@ -122,4 +122,5 @@ export default {
|
||||
versionMetaInfoQuestion: '输入自定义的 meta info:',
|
||||
updateNativePackageQuestion: '是否现在将此热更应用到原生包上?(Y/N)',
|
||||
unnamed: '(未命名)',
|
||||
dryRun: '以下是 dry-run 模拟运行结果,不会实际执行任何操作:',
|
||||
};
|
||||
|
@@ -8,6 +8,7 @@ import { depVersions } from './utils/dep-versions';
|
||||
import { getCommitInfo } from './utils/git';
|
||||
import type { Package, Platform, Version } from 'types';
|
||||
import { satisfies } from 'compare-versions';
|
||||
import chalk from 'chalk';
|
||||
|
||||
interface CommandOptions {
|
||||
name?: string;
|
||||
@@ -21,6 +22,7 @@ interface CommandOptions {
|
||||
maxPackageVersion?: string;
|
||||
packageVersionRange?: string;
|
||||
rollout?: string;
|
||||
dryRun?: boolean;
|
||||
}
|
||||
|
||||
async function showVersion(appId: string, offset: number) {
|
||||
@@ -107,22 +109,29 @@ export const bindVersionToPackages = async ({
|
||||
versionId,
|
||||
pkgs,
|
||||
rollout,
|
||||
dryRun,
|
||||
}: {
|
||||
appId: string;
|
||||
versionId: string;
|
||||
pkgs: Package[];
|
||||
rollout?: number;
|
||||
dryRun?: boolean;
|
||||
}) => {
|
||||
if (dryRun) {
|
||||
console.log(chalk.yellow(t('dryRun')));
|
||||
}
|
||||
if (rollout !== undefined) {
|
||||
const rolloutConfig: Record<string, number> = {};
|
||||
for (const pkg of pkgs) {
|
||||
rolloutConfig[pkg.name] = rollout;
|
||||
}
|
||||
await put(`/app/${appId}/version/${versionId}`, {
|
||||
config: {
|
||||
rollout: rolloutConfig,
|
||||
},
|
||||
});
|
||||
if (!dryRun) {
|
||||
await put(`/app/${appId}/version/${versionId}`, {
|
||||
config: {
|
||||
rollout: rolloutConfig,
|
||||
},
|
||||
});
|
||||
}
|
||||
console.log(
|
||||
`${t('rolloutConfigSet', {
|
||||
versions: pkgs.map((pkg: Package) => pkg.name).join(', '),
|
||||
@@ -131,9 +140,11 @@ export const bindVersionToPackages = async ({
|
||||
);
|
||||
}
|
||||
for (const pkg of pkgs) {
|
||||
await put(`/app/${appId}/package/${pkg.id}`, {
|
||||
versionId,
|
||||
});
|
||||
if (!dryRun) {
|
||||
await put(`/app/${appId}/package/${pkg.id}`, {
|
||||
versionId,
|
||||
});
|
||||
}
|
||||
console.log(
|
||||
`${t('versionBind', {
|
||||
version: versionId,
|
||||
@@ -294,6 +305,7 @@ export const commands = {
|
||||
versionId,
|
||||
pkgs: pkgsToBind,
|
||||
rollout,
|
||||
dryRun: options.dryRun,
|
||||
});
|
||||
console.log(t('operationSuccess'));
|
||||
},
|
||||
|
Reference in New Issue
Block a user