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