mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-09-17 18:06:10 +08:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ffcc6c9c96 | ||
![]() |
b00b3144a3 | ||
![]() |
d3ee908227 | ||
![]() |
5302c8968f | ||
![]() |
5740a3315c | ||
![]() |
4a11a4118f | ||
![]() |
feb1128748 | ||
![]() |
8fd74d76b1 |
6
cli.json
6
cli.json
@@ -84,6 +84,12 @@
|
||||
|
||||
"packageVersion": {
|
||||
"hasValue": true
|
||||
},
|
||||
"minPackageVersion": {
|
||||
"hasValue": true
|
||||
},
|
||||
"maxPackageVersion": {
|
||||
"hasValue": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-update-cli",
|
||||
"version": "1.25.0",
|
||||
"version": "1.30.0",
|
||||
"description": "Command tools for javaScript updater with `pushy` service for react native apps.",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
@@ -12,7 +12,7 @@
|
||||
"cli.json"
|
||||
],
|
||||
"scripts": {
|
||||
"prepublish": "babel src --out-dir lib"
|
||||
"prepublish": "babel src --out-dir lib && chmod +x lib/index.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -36,6 +36,7 @@
|
||||
"cgbi-to-png": "^1.0.7",
|
||||
"cli-arguments": "^0.2.1",
|
||||
"commander": "^7.2.0",
|
||||
"compare-versions": "^6.1.1",
|
||||
"filesize-parser": "^1.5.0",
|
||||
"fs-extra": "8",
|
||||
"gradle-to-js": "^2.0.1",
|
||||
|
3874
pnpm-lock.yaml
generated
3874
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -54,6 +54,7 @@ async function runReactNativeBundleCommand(
|
||||
let cliPath = require.resolve('react-native/local-cli/cli.js', {
|
||||
paths: [process.cwd()],
|
||||
});
|
||||
let usingExpo = false;
|
||||
try {
|
||||
require.resolve('expo-router', {
|
||||
paths: [process.cwd()],
|
||||
@@ -64,10 +65,9 @@ async function runReactNativeBundleCommand(
|
||||
cliPath = require.resolve('@expo/cli', {
|
||||
paths: [process.cwd()],
|
||||
});
|
||||
usingExpo = true;
|
||||
} catch (e) {}
|
||||
const bundleCommand = cliPath.includes('@expo/cli')
|
||||
? 'export:embed'
|
||||
: 'bundle';
|
||||
const bundleCommand = usingExpo ? 'export:embed' : 'bundle';
|
||||
|
||||
Array.prototype.push.apply(reactNativeBundleArgs, [
|
||||
cliPath,
|
||||
@@ -204,7 +204,7 @@ async function compileHermesByteCode(
|
||||
}
|
||||
|
||||
const hermesCommand = `${hermesPath}/hermesc`;
|
||||
|
||||
|
||||
const args = [
|
||||
'-emit-binary',
|
||||
'-out',
|
||||
|
@@ -28,8 +28,8 @@ const commands = {
|
||||
};
|
||||
|
||||
function run() {
|
||||
printVersionCommand();
|
||||
if (process.argv.indexOf('-v') >= 0 || process.argv[2] === 'version') {
|
||||
printVersionCommand();
|
||||
process.exit();
|
||||
}
|
||||
|
||||
|
@@ -3,6 +3,7 @@ import os from 'os';
|
||||
import path from 'path';
|
||||
import pkg from '../../package.json';
|
||||
import AppInfoParser from './app-info-parser';
|
||||
import semverLt from 'semver/functions/lt';
|
||||
|
||||
import read from 'read';
|
||||
|
||||
@@ -83,7 +84,7 @@ export async function getApkInfo(fn) {
|
||||
}
|
||||
if (buildTime == 0) {
|
||||
throw new Error(
|
||||
'无法获取此包的编译时间戳。请更新react-native-update到最新版本后重新打包上传。',
|
||||
'无法获取此包的编译时间戳。请更新 react-native-update 到最新版本后重新打包上传。',
|
||||
);
|
||||
}
|
||||
return { versionName, buildTime, ...appCredential };
|
||||
@@ -119,7 +120,7 @@ export async function getIpaInfo(fn) {
|
||||
}
|
||||
if (!buildTimeTxtBuffer) {
|
||||
throw new Error(
|
||||
'无法获取此包的编译时间戳。请更新react-native-update到最新版本后重新打包上传。',
|
||||
'无法获取此包的编译时间戳。请更新 react-native-update 到最新版本后重新打包上传。',
|
||||
);
|
||||
}
|
||||
const buildTime = buildTimeTxtBuffer.toString().replace('\n', '');
|
||||
@@ -137,6 +138,7 @@ export function saveToLocal(originPath, destName) {
|
||||
|
||||
export function printVersionCommand() {
|
||||
console.log('react-native-update-cli: ' + pkg.version);
|
||||
let pushyVersion = '';
|
||||
try {
|
||||
const PACKAGE_JSON_PATH = require.resolve(
|
||||
'react-native-update/package.json',
|
||||
@@ -144,10 +146,23 @@ export function printVersionCommand() {
|
||||
paths: [process.cwd()],
|
||||
},
|
||||
);
|
||||
console.log('react-native-update: ' + require(PACKAGE_JSON_PATH).version);
|
||||
pushyVersion = require(PACKAGE_JSON_PATH).version;
|
||||
console.log('react-native-update: ' + pushyVersion);
|
||||
} catch (e) {
|
||||
console.log('react-native-update: 无法获取版本号,请在项目目录中运行命令');
|
||||
}
|
||||
if (pushyVersion) {
|
||||
if (semverLt(pushyVersion, '8.5.1')) {
|
||||
console.warn(
|
||||
'当前版本已不再支持,请至少升级到 v8 的最新小版本后重新打包(代码无需改动): npm i react-native-update@8',
|
||||
);
|
||||
}
|
||||
if (semverLt(pushyVersion, '9.2.1')) {
|
||||
console.warn(
|
||||
'当前版本已不再支持,请至少升级到 v9 的最新小版本后重新打包(代码无需改动): npm i react-native-update@9',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const pricingPageUrl = 'https://pushy.reactnative.cn/pricing.html';
|
||||
|
@@ -3,6 +3,7 @@ import { question, saveToLocal } from './utils';
|
||||
|
||||
import { checkPlatform, getSelectedApp } from './app';
|
||||
import { choosePackage } from './package';
|
||||
import { compare } from 'compare-versions';
|
||||
|
||||
async function showVersion(appId, offset) {
|
||||
const { data, count } = await get(`/app/${appId}/version/list`);
|
||||
@@ -127,6 +128,8 @@ export const commands = {
|
||||
|
||||
let pkgId;
|
||||
let pkgVersion = options.packageVersion;
|
||||
let minPkgVersion = options.minPackageVersion;
|
||||
let maxPkgVersion = options.maxPackageVersion;
|
||||
if (pkgVersion) {
|
||||
pkgVersion = pkgVersion.trim();
|
||||
const { data } = await get(`/app/${appId}/package/list?limit=1000`);
|
||||
@@ -137,6 +140,42 @@ export const commands = {
|
||||
throw new Error(`未查询到匹配原生版本:${pkgVersion}`);
|
||||
}
|
||||
}
|
||||
if (minPkgVersion) {
|
||||
minPkgVersion = String(minPkgVersion).trim();
|
||||
const { data } = await get(`/app/${appId}/package/list?limit=1000`);
|
||||
const pkgs = data.filter((d) => compare(d.name, minPkgVersion, '>='));
|
||||
if (pkgs.length === 0) {
|
||||
throw new Error(
|
||||
`未查询到 >= ${minPkgVersion} 的原生版本`,
|
||||
);
|
||||
}
|
||||
for (const pkg of pkgs) {
|
||||
await put(`/app/${appId}/package/${pkg.id}`, {
|
||||
versionId,
|
||||
});
|
||||
console.log(`已将版本 ${versionId} 绑定到原生版本 ${pkg.name}`);
|
||||
}
|
||||
console.log(`操作完成,共已绑定 ${pkgs.length} 个原生版本`);
|
||||
return;
|
||||
}
|
||||
if (maxPkgVersion) {
|
||||
maxPkgVersion = String(maxPkgVersion).trim();
|
||||
const { data } = await get(`/app/${appId}/package/list?limit=1000`);
|
||||
const pkgs = data.filter((d) => compare(d.name, maxPkgVersion, '<='));
|
||||
if (pkgs.length === 0) {
|
||||
throw new Error(
|
||||
`未查询到 <= ${maxPkgVersion} 的原生版本`,
|
||||
);
|
||||
}
|
||||
for (const pkg of pkgs) {
|
||||
await put(`/app/${appId}/package/${pkg.id}`, {
|
||||
versionId,
|
||||
});
|
||||
console.log(`已将版本 ${versionId} 绑定到原生版本 ${pkg.name}`);
|
||||
}
|
||||
console.log(`操作完成,共已绑定 ${pkgs.length} 个原生版本`);
|
||||
return;
|
||||
}
|
||||
if (!pkgId) {
|
||||
pkgId = options.packageId || (await choosePackage(appId)).id;
|
||||
}
|
||||
|
Reference in New Issue
Block a user