mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-11-23 08:43:37 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
818907f811 | ||
|
|
6751daf8e0 | ||
|
|
b973ace443 |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-native-update-cli",
|
"name": "react-native-update-cli",
|
||||||
"version": "2.3.0",
|
"version": "2.4.0",
|
||||||
"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": {
|
||||||
|
|||||||
@@ -85,14 +85,30 @@ async function runReactNativeBundleCommand({
|
|||||||
|
|
||||||
const getExpoCli = () => {
|
const getExpoCli = () => {
|
||||||
try {
|
try {
|
||||||
|
const searchPaths = [process.cwd()];
|
||||||
|
|
||||||
|
// 尝试添加 expo 包的路径作为额外的搜索路径
|
||||||
|
try {
|
||||||
|
const expoPath = require.resolve('expo/package.json', {
|
||||||
|
paths: [process.cwd()],
|
||||||
|
});
|
||||||
|
// 获取 expo 包的目录路径
|
||||||
|
const expoDir = expoPath.replace(/\/package\.json$/, '');
|
||||||
|
searchPaths.push(expoDir);
|
||||||
|
} catch {
|
||||||
|
// expo 包不存在,忽略
|
||||||
|
}
|
||||||
|
|
||||||
|
// 尝试从搜索路径中解析 @expo/cli
|
||||||
cliPath = require.resolve('@expo/cli', {
|
cliPath = require.resolve('@expo/cli', {
|
||||||
paths: [process.cwd()],
|
paths: searchPaths,
|
||||||
});
|
});
|
||||||
|
|
||||||
const expoCliVersion = JSON.parse(
|
const expoCliVersion = JSON.parse(
|
||||||
fs
|
fs
|
||||||
.readFileSync(
|
.readFileSync(
|
||||||
require.resolve('@expo/cli/package.json', {
|
require.resolve('@expo/cli/package.json', {
|
||||||
paths: [process.cwd()],
|
paths: searchPaths,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.toString(),
|
.toString(),
|
||||||
@@ -256,6 +272,19 @@ async function runReactNativeBundleCommand({
|
|||||||
!isSentry,
|
!isSentry,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (platform === 'harmony') {
|
||||||
|
const harmonyRawAssetsPath =
|
||||||
|
'harmony/entry/src/main/resources/rawfile/assets';
|
||||||
|
// copy all files in outputFolder to harmonyRawPath
|
||||||
|
// assets should be in rawfile/assets
|
||||||
|
fs.ensureDirSync(harmonyRawAssetsPath);
|
||||||
|
fs.copySync(outputFolder, harmonyRawAssetsPath, { overwrite: true });
|
||||||
|
fs.moveSync(
|
||||||
|
`${harmonyRawAssetsPath}/bundle.harmony.js`,
|
||||||
|
`${harmonyRawAssetsPath}/../bundle.harmony.js`,
|
||||||
|
{ overwrite: true },
|
||||||
|
);
|
||||||
|
}
|
||||||
resolve(null);
|
resolve(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -122,17 +122,6 @@ export const bindVersionToPackages = async ({
|
|||||||
console.log(chalk.yellow(t('dryRun')));
|
console.log(chalk.yellow(t('dryRun')));
|
||||||
}
|
}
|
||||||
if (rollout !== undefined) {
|
if (rollout !== undefined) {
|
||||||
const rolloutConfig: Record<string, number> = {};
|
|
||||||
for (const pkg of pkgs) {
|
|
||||||
rolloutConfig[pkg.name] = rollout;
|
|
||||||
}
|
|
||||||
if (!dryRun) {
|
|
||||||
await put(`/app/${appId}/version/${versionId}`, {
|
|
||||||
config: {
|
|
||||||
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(', '),
|
||||||
@@ -142,8 +131,10 @@ export const bindVersionToPackages = async ({
|
|||||||
}
|
}
|
||||||
for (const pkg of pkgs) {
|
for (const pkg of pkgs) {
|
||||||
if (!dryRun) {
|
if (!dryRun) {
|
||||||
await put(`/app/${appId}/package/${pkg.id}`, {
|
await post(`/app/${appId}/binding`, {
|
||||||
versionId,
|
versionId,
|
||||||
|
rollout,
|
||||||
|
packageId: pkg.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
console.log(
|
console.log(
|
||||||
|
|||||||
Reference in New Issue
Block a user