mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-09-17 18:06:10 +08:00
Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6a053c6428 | ||
![]() |
f202fc590d | ||
![]() |
0f8cf3c399 | ||
![]() |
6a0d82c7a5 | ||
![]() |
eed19992d8 | ||
![]() |
1b5078831c | ||
![]() |
bc9aff343a | ||
![]() |
7aaa32a5a2 | ||
![]() |
ab7920fe38 | ||
![]() |
d912ace4a7 | ||
![]() |
8af4d314ce | ||
![]() |
f2d5269512 |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-update-cli",
|
||||
"version": "1.12.0",
|
||||
"version": "1.17.0",
|
||||
"description": "Command tools for javaScript updater with `pushy` service for react native apps.",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
|
973
pnpm-lock.yaml
generated
973
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,7 @@ import { checkPlatform } from './app';
|
||||
const { spawn, spawnSync } = require('child_process');
|
||||
const g2js = require('gradle-to-js/lib/parser');
|
||||
const os = require('os');
|
||||
const properties = require('properties');
|
||||
|
||||
var bsdiff, hdiff, diff;
|
||||
try {
|
||||
@@ -49,7 +50,9 @@ async function runReactNativeBundleCommand(
|
||||
fs.emptyDirSync(outputFolder);
|
||||
|
||||
Array.prototype.push.apply(reactNativeBundleArgs, [
|
||||
path.join('node_modules', 'react-native', 'local-cli', 'cli.js'),
|
||||
require.resolve('react-native/local-cli/cli.js', {
|
||||
paths: [process.cwd()],
|
||||
}), // 'react-native' package may be symlinked
|
||||
'bundle',
|
||||
'--assets-dest',
|
||||
outputFolder,
|
||||
@@ -94,10 +97,34 @@ async function runReactNativeBundleCommand(
|
||||
),
|
||||
);
|
||||
} else {
|
||||
if (
|
||||
(platform === 'android' && gradleConfig.enableHermes) ||
|
||||
(platform === 'ios' && fs.existsSync('ios/Pods/hermes-engine'))
|
||||
let hermesEnabled = false;
|
||||
|
||||
if (platform === 'android') {
|
||||
const gradlePropeties = await new Promise((resolve) => {
|
||||
properties.parse(
|
||||
'./android/gradle.properties',
|
||||
{ path: true },
|
||||
function (error, props) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
resolve(null);
|
||||
}
|
||||
|
||||
resolve(props);
|
||||
},
|
||||
);
|
||||
});
|
||||
hermesEnabled = gradlePropeties.hermesEnabled;
|
||||
|
||||
if (typeof hermesEnabled !== 'boolean')
|
||||
hermesEnabled = gradleConfig.enableHermes;
|
||||
} else if (
|
||||
platform === 'ios' &&
|
||||
fs.existsSync('ios/Pods/hermes-engine')
|
||||
) {
|
||||
hermesEnabled = true;
|
||||
}
|
||||
if (hermesEnabled) {
|
||||
await compileHermesByteCode(
|
||||
bundleName,
|
||||
outputFolder,
|
||||
@@ -146,7 +173,16 @@ async function compileHermesByteCode(
|
||||
) {
|
||||
console.log(`Hermes enabled, now compiling to hermes bytecode:\n`);
|
||||
// >= rn 0.69
|
||||
let hermesCommand = `node_modules/react-native/sdks/hermesc/${getHermesOSBin()}/hermesc`;
|
||||
const rnDir = path.dirname(
|
||||
require.resolve('react-native', {
|
||||
paths: [process.cwd()],
|
||||
}),
|
||||
);
|
||||
const hermesCommand = path.join(
|
||||
rnDir,
|
||||
`/sdks/hermesc/${getHermesOSBin()}/hermesc`,
|
||||
);
|
||||
|
||||
// < rn 0.69
|
||||
if (!fs.existsSync(hermesCommand)) {
|
||||
const hermesPackage = fs.existsSync('node_modules/hermes-engine')
|
||||
|
@@ -65,7 +65,7 @@ export const commands = {
|
||||
} = await getIpaInfo(fn);
|
||||
const { appId, appKey } = await getSelectedApp('ios');
|
||||
|
||||
if (appIdInPkg && appIdInPkg !== appId) {
|
||||
if (appIdInPkg && appIdInPkg != appId) {
|
||||
throw new Error(
|
||||
`appId不匹配!当前ipa: ${appIdInPkg}, 当前update.json: ${appId}`,
|
||||
);
|
||||
@@ -100,7 +100,7 @@ export const commands = {
|
||||
} = await getApkInfo(fn);
|
||||
const { appId, appKey } = await getSelectedApp('android');
|
||||
|
||||
if (appIdInPkg && appIdInPkg !== appId) {
|
||||
if (appIdInPkg && appIdInPkg != appId) {
|
||||
throw new Error(
|
||||
`appId不匹配!当前apk: ${appIdInPkg}, 当前update.json: ${appId}`,
|
||||
);
|
||||
|
@@ -43,7 +43,11 @@ export function translateOptions(options) {
|
||||
|
||||
export function getRNVersion() {
|
||||
const version = JSON.parse(
|
||||
fs.readFileSync(path.resolve('node_modules/react-native/package.json')),
|
||||
fs.readFileSync(
|
||||
require.resolve('react-native/package.json', {
|
||||
paths: [process.cwd()],
|
||||
}),
|
||||
),
|
||||
).version;
|
||||
|
||||
// We only care about major and minor version.
|
||||
@@ -106,9 +110,8 @@ export async function getIpaInfo(fn) {
|
||||
if (updateJsonFile) {
|
||||
appCredential = JSON.parse(updateJsonFile.toString()).ios;
|
||||
}
|
||||
const {
|
||||
CFBundleShortVersionString: versionName,
|
||||
} = await appInfoParser.parse();
|
||||
const { CFBundleShortVersionString: versionName } =
|
||||
await appInfoParser.parse();
|
||||
let buildTimeTxtBuffer = await appInfoParser.parser.getEntry(
|
||||
/payload\/.+?\.app\/pushy_build_time.txt/,
|
||||
);
|
||||
@@ -139,11 +142,11 @@ export function saveToLocal(originPath, destName) {
|
||||
export function printVersionCommand() {
|
||||
console.log('react-native-update-cli: ' + pkg.version);
|
||||
try {
|
||||
const PACKAGE_JSON_PATH = path.resolve(
|
||||
process.cwd(),
|
||||
'node_modules',
|
||||
'react-native-update',
|
||||
'package.json',
|
||||
const PACKAGE_JSON_PATH = require.resolve(
|
||||
'react-native-update/package.json',
|
||||
{
|
||||
paths: [process.cwd()],
|
||||
},
|
||||
);
|
||||
console.log('react-native-update: ' + require(PACKAGE_JSON_PATH).version);
|
||||
} catch (e) {
|
||||
|
Reference in New Issue
Block a user