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

Compare commits

..

5 Commits

4 changed files with 41 additions and 40 deletions

View File

@@ -1,17 +1,13 @@
{
"name": "react-native-update-cli",
"version": "2.3.0",
"version": "2.4.2",
"description": "command line tool for react-native-update (remote updates for react native)",
"main": "index.js",
"bin": {
"pushy": "lib/index.js",
"cresc": "lib/index.js"
},
"files": [
"lib",
"src",
"cli.json"
],
"files": ["lib", "src", "cli.json"],
"scripts": {
"build": "swc src -d lib --strip-leading-paths",
"prepublishOnly": "npm run build && chmod +x lib/index.js",
@@ -21,13 +17,7 @@
"type": "git",
"url": "git+https://github.com/reactnativecn/react-native-update-cli.git"
},
"keywords": [
"react-native",
"ios",
"android",
"harmony",
"update"
],
"keywords": ["react-native", "ios", "android", "harmony", "update"],
"author": "reactnativecn",
"license": "BSD-3-Clause",
"bugs": {
@@ -81,8 +71,5 @@
"@types/yazl": "^2.4.6",
"typescript": "^5.8.3"
},
"trustedDependencies": [
"@biomejs/biome",
"@swc/core"
]
"trustedDependencies": ["@biomejs/biome", "@swc/core"]
}

View File

@@ -85,14 +85,30 @@ async function runReactNativeBundleCommand({
const getExpoCli = () => {
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', {
paths: [process.cwd()],
paths: searchPaths,
});
const expoCliVersion = JSON.parse(
fs
.readFileSync(
require.resolve('@expo/cli/package.json', {
paths: [process.cwd()],
paths: searchPaths,
}),
)
.toString(),
@@ -256,6 +272,19 @@ async function runReactNativeBundleCommand({
!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);
}
});
@@ -549,7 +578,6 @@ async function diffFromPPK(origin: string, next: string, output: string) {
}
const copies = {};
const copiesv2 = {};
const zipfile = new YazlZipFile();
@@ -611,7 +639,6 @@ async function diffFromPPK(origin: string, next: string, output: string) {
addEntry(base);
}
copies[entry.fileName] = originMap[entry.crc32];
copiesv2[entry.crc32] = entry.fileName;
return;
}
@@ -644,7 +671,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
//console.log({copies, deletes});
zipfile.addBuffer(
Buffer.from(JSON.stringify({ copies, copiesv2, deletes })),
Buffer.from(JSON.stringify({ copies, deletes })),
'__diff.json',
);
zipfile.end();
@@ -689,7 +716,6 @@ async function diffFromPackage(
}
const copies = {};
const copiesv2 = {};
const zipfile = new YazlZipFile();
@@ -725,7 +751,6 @@ async function diffFromPackage(
// If moved from other place
if (originMap[entry.crc32]) {
copies[entry.fileName] = originMap[entry.crc32];
copiesv2[entry.crc32] = entry.fileName;
return;
}
@@ -744,10 +769,7 @@ async function diffFromPackage(
}
});
zipfile.addBuffer(
Buffer.from(JSON.stringify({ copies, copiesv2 })),
'__diff.json',
);
zipfile.addBuffer(Buffer.from(JSON.stringify({ copies })), '__diff.json');
zipfile.end();
await writePromise;
}

View File

@@ -1,4 +1,5 @@
import { defaultEndpoints } from './constants';
import fetch from 'node-fetch';
// const baseUrl = `http://localhost:9000`;
// let baseUrl = SERVER.main[0];

View File

@@ -122,17 +122,6 @@ export const bindVersionToPackages = async ({
console.log(chalk.yellow(t('dryRun')));
}
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(
`${t('rolloutConfigSet', {
versions: pkgs.map((pkg: Package) => pkg.name).join(', '),
@@ -142,8 +131,10 @@ export const bindVersionToPackages = async ({
}
for (const pkg of pkgs) {
if (!dryRun) {
await put(`/app/${appId}/package/${pkg.id}`, {
await post(`/app/${appId}/binding`, {
versionId,
rollout,
packageId: pkg.id,
});
}
console.log(