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

Compare commits

..

1 Commits

Author SHA1 Message Date
sunnylqm
795093479f v1.21.0 2024-03-07 15:09:49 +08:00
7 changed files with 1709 additions and 2204 deletions

View File

@@ -84,12 +84,6 @@
"packageVersion": {
"hasValue": true
},
"minPackageVersion": {
"hasValue": true
},
"maxPackageVersion": {
"hasValue": true
}
}
},

View File

@@ -1,6 +1,6 @@
{
"name": "react-native-update-cli",
"version": "1.29.0",
"version": "1.21.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 && chmod +x lib/index.js"
"prepublish": "babel src --out-dir lib"
},
"repository": {
"type": "git",
@@ -36,7 +36,6 @@
"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",

3830
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -54,7 +54,6 @@ 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()],
@@ -65,9 +64,10 @@ async function runReactNativeBundleCommand(
cliPath = require.resolve('@expo/cli', {
paths: [process.cwd()],
});
usingExpo = true;
} catch (e) {}
const bundleCommand = usingExpo ? 'export:embed' : 'bundle';
const bundleCommand = cliPath.includes('@expo/cli')
? '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',
@@ -235,7 +235,7 @@ async function pack(dir, output) {
}
const childs = fs.readdirSync(root);
for (const name of childs) {
if (name === '.' || name === '..' || name === 'index.bundlejs.map') {
if (name === '.' || name === '..') {
continue;
}
const fullPath = path.join(root, name);

View File

@@ -28,8 +28,8 @@ const commands = {
};
function run() {
printVersionCommand();
if (process.argv.indexOf('-v') >= 0 || process.argv[2] === 'version') {
printVersionCommand();
process.exit();
}

View File

@@ -3,7 +3,6 @@ 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';
@@ -84,7 +83,7 @@ export async function getApkInfo(fn) {
}
if (buildTime == 0) {
throw new Error(
'无法获取此包的编译时间戳。请更新 react-native-update 到最新版本后重新打包上传。',
'无法获取此包的编译时间戳。请更新react-native-update到最新版本后重新打包上传。',
);
}
return { versionName, buildTime, ...appCredential };
@@ -120,7 +119,7 @@ export async function getIpaInfo(fn) {
}
if (!buildTimeTxtBuffer) {
throw new Error(
'无法获取此包的编译时间戳。请更新 react-native-update 到最新版本后重新打包上传。',
'无法获取此包的编译时间戳。请更新react-native-update到最新版本后重新打包上传。',
);
}
const buildTime = buildTimeTxtBuffer.toString().replace('\n', '');
@@ -138,7 +137,6 @@ 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',
@@ -146,23 +144,10 @@ export function printVersionCommand() {
paths: [process.cwd()],
},
);
pushyVersion = require(PACKAGE_JSON_PATH).version;
console.log('react-native-update: ' + pushyVersion);
console.log('react-native-update: ' + require(PACKAGE_JSON_PATH).version);
} 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';

View File

@@ -3,7 +3,6 @@ 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`);
@@ -128,8 +127,6 @@ 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`);
@@ -140,42 +137,6 @@ 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;
}