mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-09-17 18:06:10 +08:00
Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ba3d88627a | ||
![]() |
3987a5191f | ||
![]() |
9903fb97e4 | ||
![]() |
834c0bb351 | ||
![]() |
fa8ba44bfa | ||
![]() |
6e4e89428c | ||
![]() |
e018761fc8 | ||
![]() |
6534379d81 | ||
![]() |
bb777bf973 | ||
![]() |
ea05d4ab66 | ||
![]() |
a259ff671d | ||
![]() |
3f68fa0f11 | ||
![]() |
fa750ba157 | ||
![]() |
91fc0caa07 | ||
![]() |
36e1be084d | ||
![]() |
e099002629 | ||
![]() |
5dd3b64720 |
47
.github/workflows/lint.yml
vendored
Normal file
47
.github/workflows/lint.yml
vendored
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
name: lint
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
# Cancel a currently running workflow from the same PR/branch/tag
|
||||||
|
# when a new workflow is triggered
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [20.x]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: oven-sh/setup-bun@v2
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20.x'
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
|
||||||
|
- name: Get yarn cache directory path
|
||||||
|
id: yarn-cache-dir-path
|
||||||
|
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Install Dependency
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
NODE_OPTIONS: '--max_old_space_size=4096'
|
||||||
|
run: bun install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Run lint
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
NODE_OPTIONS: '--max_old_space_size=4096'
|
||||||
|
run: bun lint
|
22
.github/workflows/publish.yml
vendored
Normal file
22
.github/workflows/publish.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
name: Publish Package to npmjs
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: oven-sh/setup-bun@v2
|
||||||
|
# Setup .npmrc file to publish to npm
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20.x'
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
- run: bun install --frozen-lockfile
|
||||||
|
- run: npm publish --access public
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
27
cli.json
27
cli.json
@@ -3,11 +3,9 @@
|
|||||||
"defaultCommand": "help",
|
"defaultCommand": "help",
|
||||||
"commands": {
|
"commands": {
|
||||||
"help": {},
|
"help": {},
|
||||||
|
|
||||||
"login": {},
|
"login": {},
|
||||||
"logout": {},
|
"logout": {},
|
||||||
"me": {},
|
"me": {},
|
||||||
|
|
||||||
"createApp": {
|
"createApp": {
|
||||||
"options": {
|
"options": {
|
||||||
"name": {
|
"name": {
|
||||||
@@ -33,7 +31,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"uploadIpa": {},
|
"uploadIpa": {},
|
||||||
"uploadApk": {},
|
"uploadApk": {},
|
||||||
"parseIpa": {},
|
"parseIpa": {},
|
||||||
@@ -45,7 +42,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"publish": {
|
"publish": {
|
||||||
"options": {
|
"options": {
|
||||||
"platform": {
|
"platform": {
|
||||||
@@ -69,7 +65,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"update": {
|
"update": {
|
||||||
"options": {
|
"options": {
|
||||||
"platform": {
|
"platform": {
|
||||||
@@ -95,7 +90,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"updateVersionInfo": {
|
"updateVersionInfo": {
|
||||||
"options": {
|
"options": {
|
||||||
"platform": {
|
"platform": {
|
||||||
@@ -118,7 +112,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"build": {
|
"build": {
|
||||||
"description": "Bundle javascript and copy assets."
|
"description": "Bundle javascript and copy assets."
|
||||||
},
|
},
|
||||||
@@ -201,6 +194,24 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"hdiffFromPPK": {
|
||||||
|
"description": "Create hdiff patch from a Prepare package(.ppk)",
|
||||||
|
"options": {
|
||||||
|
"output": {
|
||||||
|
"default": ".pushy/output/hdiff-${time}.ppk-patch",
|
||||||
|
"hasValue": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"hdiffFromApp": {
|
||||||
|
"description": "Create hdiff patch from a Harmony package(.app)",
|
||||||
|
"options": {
|
||||||
|
"output": {
|
||||||
|
"default": ".pushy/output/hdiff-${time}.app-patch",
|
||||||
|
"hasValue": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"hdiffFromIpa": {
|
"hdiffFromIpa": {
|
||||||
"description": "Create hdiff patch from a iOS package(.ipa)",
|
"description": "Create hdiff patch from a iOS package(.ipa)",
|
||||||
"options": {
|
"options": {
|
||||||
@@ -216,4 +227,4 @@
|
|||||||
"default": false
|
"default": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
5
index.js
5
index.js
@@ -1,4 +1 @@
|
|||||||
/**
|
module.exports = require('./lib');
|
||||||
* Created by tdzl2003 on 2/22/16.
|
|
||||||
*/
|
|
||||||
module.exports = require('./lib');
|
|
||||||
|
20
package.json
20
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-native-update-cli",
|
"name": "react-native-update-cli",
|
||||||
"version": "1.31.2",
|
"version": "1.37.0",
|
||||||
"description": "Command tools for javaScript updater with `pushy` service for react native apps.",
|
"description": "Command tools for javaScript updater with `pushy` service for react native apps.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
"react-native",
|
"react-native",
|
||||||
"ios",
|
"ios",
|
||||||
"android",
|
"android",
|
||||||
|
"harmony",
|
||||||
"update"
|
"update"
|
||||||
],
|
],
|
||||||
"author": "reactnativecn",
|
"author": "reactnativecn",
|
||||||
@@ -32,13 +33,16 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/reactnativecn/react-native-pushy/tree/master/react-native-pushy-cli",
|
"homepage": "https://github.com/reactnativecn/react-native-pushy/tree/master/react-native-pushy-cli",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@badisi/latest-version": "^7.0.10",
|
||||||
"bplist-parser": "^0.3.2",
|
"bplist-parser": "^0.3.2",
|
||||||
"bytebuffer": "^5.0.1",
|
"bytebuffer": "^5.0.1",
|
||||||
"cgbi-to-png": "^1.0.7",
|
"cgbi-to-png": "^1.0.7",
|
||||||
|
"chalk": "4",
|
||||||
"cli-arguments": "^0.2.1",
|
"cli-arguments": "^0.2.1",
|
||||||
"commander": "^12.1.0",
|
"commander": "^12.1.0",
|
||||||
"compare-versions": "^6.1.1",
|
"compare-versions": "^6.1.1",
|
||||||
"filesize-parser": "^1.5.1",
|
"filesize-parser": "^1.5.1",
|
||||||
|
"form-data": "^4.0.1",
|
||||||
"fs-extra": "8",
|
"fs-extra": "8",
|
||||||
"gradle-to-js": "^2.0.1",
|
"gradle-to-js": "^2.0.1",
|
||||||
"isomorphic-unzip": "^1.1.5",
|
"isomorphic-unzip": "^1.1.5",
|
||||||
@@ -52,17 +56,17 @@
|
|||||||
"tty-table": "4.2",
|
"tty-table": "4.2",
|
||||||
"update-notifier": "^5.1.0",
|
"update-notifier": "^5.1.0",
|
||||||
"yauzl": "^3.2.0",
|
"yauzl": "^3.2.0",
|
||||||
"yazl": "3.3.0"
|
"yazl": "3.3.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 10"
|
"node": ">= 10"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@swc/cli": "^0.5.0",
|
"@swc/cli": "^0.5.1",
|
||||||
"@swc/core": "^1.9.2",
|
"@swc/core": "^1.9.3",
|
||||||
"@types/node": "^22.9.0",
|
"@types/node": "^22.9.3",
|
||||||
"oxlint": "^0.11.1",
|
"oxlint": "^0.13.1",
|
||||||
"typescript": "^5.6.3"
|
"typescript": "^5.7.2"
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@1.22.21+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72"
|
"packageManager": "yarn@1.22.22"
|
||||||
}
|
}
|
||||||
|
@@ -1,20 +1,22 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
const defaultEndpoint = 'https://update.reactnative.cn/api';
|
import fs from 'node:fs';
|
||||||
let host = process.env.PUSHY_REGISTRY || defaultEndpoint;
|
import util from 'node:util';
|
||||||
import fs from 'fs';
|
import path from 'node:path';
|
||||||
import request from 'request';
|
|
||||||
import ProgressBar from 'progress';
|
import ProgressBar from 'progress';
|
||||||
import packageJson from '../package.json';
|
import packageJson from '../package.json';
|
||||||
import tcpp from 'tcp-ping';
|
import tcpp from 'tcp-ping';
|
||||||
import util from 'util';
|
|
||||||
import path from 'path';
|
|
||||||
import filesizeParser from 'filesize-parser';
|
import filesizeParser from 'filesize-parser';
|
||||||
import { pricingPageUrl } from './utils';
|
import { pricingPageUrl } from './utils';
|
||||||
|
import { Session } from 'types';
|
||||||
|
import FormData from 'form-data';
|
||||||
|
|
||||||
const tcpPing = util.promisify(tcpp.ping);
|
const tcpPing = util.promisify(tcpp.ping);
|
||||||
|
|
||||||
let session = undefined;
|
let session: Session | undefined;
|
||||||
let savedSession = undefined;
|
let savedSession: Session | undefined;
|
||||||
|
|
||||||
|
const defaultEndpoint = 'https://update.reactnative.cn/api';
|
||||||
|
let host = process.env.PUSHY_REGISTRY || defaultEndpoint;
|
||||||
|
|
||||||
const userAgent = `react-native-update-cli/${packageJson.version}`;
|
const userAgent = `react-native-update-cli/${packageJson.version}`;
|
||||||
|
|
||||||
@@ -22,7 +24,7 @@ export const getSession = function () {
|
|||||||
return session;
|
return session;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const replaceSession = function (newSession) {
|
export const replaceSession = function (newSession: { token: string }) {
|
||||||
session = newSession;
|
session = newSession;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -59,7 +61,7 @@ export const closeSession = function () {
|
|||||||
host = process.env.PUSHY_REGISTRY || defaultEndpoint;
|
host = process.env.PUSHY_REGISTRY || defaultEndpoint;
|
||||||
};
|
};
|
||||||
|
|
||||||
async function query(url, options) {
|
async function query(url: string, options: fetch.RequestInit) {
|
||||||
const resp = await fetch(url, options);
|
const resp = await fetch(url, options);
|
||||||
const text = await resp.text();
|
const text = await resp.text();
|
||||||
let json;
|
let json;
|
||||||
@@ -74,18 +76,13 @@ async function query(url, options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (resp.status !== 200) {
|
if (resp.status !== 200) {
|
||||||
throw Object.assign(
|
throw new Error(`${resp.status}: ${resp.statusText}`);
|
||||||
new Error(json.message || json.error || resp.statusText),
|
|
||||||
{
|
|
||||||
status: resp.status,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
function queryWithoutBody(method) {
|
function queryWithoutBody(method: string) {
|
||||||
return function (api) {
|
return function (api: string) {
|
||||||
return query(host + api, {
|
return query(host + api, {
|
||||||
method,
|
method,
|
||||||
headers: {
|
headers: {
|
||||||
@@ -96,8 +93,8 @@ function queryWithoutBody(method) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function queryWithBody(method) {
|
function queryWithBody(method: string) {
|
||||||
return function (api, body) {
|
return function (api: string, body: Record<string, any>) {
|
||||||
return query(host + api, {
|
return query(host + api, {
|
||||||
method,
|
method,
|
||||||
headers: {
|
headers: {
|
||||||
@@ -115,12 +112,11 @@ export const post = queryWithBody('POST');
|
|||||||
export const put = queryWithBody('PUT');
|
export const put = queryWithBody('PUT');
|
||||||
export const doDelete = queryWithBody('DELETE');
|
export const doDelete = queryWithBody('DELETE');
|
||||||
|
|
||||||
export async function uploadFile(fn, key) {
|
export async function uploadFile(fn: string, key?: string) {
|
||||||
const { url, backupUrl, formData, maxSize } = await post('/upload', {
|
const { url, backupUrl, formData, maxSize } = await post('/upload', {
|
||||||
ext: path.extname(fn),
|
ext: path.extname(fn),
|
||||||
});
|
});
|
||||||
let realUrl = url;
|
let realUrl = url;
|
||||||
|
|
||||||
if (backupUrl) {
|
if (backupUrl) {
|
||||||
if (global.USE_ACC_OSS) {
|
if (global.USE_ACC_OSS) {
|
||||||
realUrl = backupUrl;
|
realUrl = backupUrl;
|
||||||
@@ -141,9 +137,9 @@ export async function uploadFile(fn, key) {
|
|||||||
const fileSize = fs.statSync(fn).size;
|
const fileSize = fs.statSync(fn).size;
|
||||||
if (maxSize && fileSize > filesizeParser(maxSize)) {
|
if (maxSize && fileSize > filesizeParser(maxSize)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`此文件大小${(fileSize / 1048576).toFixed(
|
`此文件大小 ${(fileSize / 1048576).toFixed(
|
||||||
1,
|
1,
|
||||||
)}m, 超出当前额度${maxSize}。您可以考虑升级付费业务以提升此额度。详情请访问: ${pricingPageUrl}`,
|
)}m , 超出当前额度 ${maxSize} 。您可以考虑升级付费业务以提升此额度。详情请访问: ${pricingPageUrl}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,34 +149,30 @@ export async function uploadFile(fn, key) {
|
|||||||
total: fileSize,
|
total: fileSize,
|
||||||
});
|
});
|
||||||
|
|
||||||
const info = await new Promise((resolve, reject) => {
|
const form = new FormData();
|
||||||
if (key) {
|
|
||||||
formData.key = key;
|
|
||||||
}
|
|
||||||
formData.file = fs.createReadStream(fn);
|
|
||||||
|
|
||||||
formData.file.on('data', function (data) {
|
Object.entries(formData).forEach(([k, v]) => {
|
||||||
bar.tick(data.length);
|
form.append(k, v);
|
||||||
});
|
|
||||||
request.post(
|
|
||||||
realUrl,
|
|
||||||
{
|
|
||||||
formData,
|
|
||||||
},
|
|
||||||
(err, resp, body) => {
|
|
||||||
if (err) {
|
|
||||||
return reject(err);
|
|
||||||
}
|
|
||||||
if (resp.statusCode > 299) {
|
|
||||||
return reject(
|
|
||||||
Object.assign(new Error(body), {
|
|
||||||
status: resp.statusCode,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
resolve({ hash: formData.key });
|
|
||||||
},
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
return info;
|
const fileStream = fs.createReadStream(fn);
|
||||||
|
fileStream.on('data', function (data) {
|
||||||
|
bar.tick(data.length);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (key) {
|
||||||
|
form.append('key', key);
|
||||||
|
}
|
||||||
|
form.append('file', fileStream);
|
||||||
|
|
||||||
|
const res = await fetch(realUrl, {
|
||||||
|
method: 'POST',
|
||||||
|
body: form,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res.status > 299) {
|
||||||
|
throw new Error(`${res.status}: ${res.statusText}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// const body = await response.json();
|
||||||
|
return { hash: key || formData.key };
|
||||||
}
|
}
|
@@ -7,6 +7,7 @@ import { post, get, doDelete } from './api';
|
|||||||
const validPlatforms = {
|
const validPlatforms = {
|
||||||
ios: 1,
|
ios: 1,
|
||||||
android: 1,
|
android: 1,
|
||||||
|
harmony: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function checkPlatform(platform) {
|
export function checkPlatform(platform) {
|
||||||
@@ -74,7 +75,7 @@ export const commands = {
|
|||||||
const name = options.name || (await question('应用名称:'));
|
const name = options.name || (await question('应用名称:'));
|
||||||
const { downloadUrl } = options;
|
const { downloadUrl } = options;
|
||||||
const platform = checkPlatform(
|
const platform = checkPlatform(
|
||||||
options.platform || (await question('平台(ios/android):')),
|
options.platform || (await question('平台(ios/android/harmony):')),
|
||||||
);
|
);
|
||||||
const { id } = await post('/app/create', { name, platform });
|
const { id } = await post('/app/create', { name, platform });
|
||||||
console.log(`已成功创建应用(id: ${id})`);
|
console.log(`已成功创建应用(id: ${id})`);
|
||||||
@@ -98,7 +99,7 @@ export const commands = {
|
|||||||
},
|
},
|
||||||
selectApp: async function ({ args, options }) {
|
selectApp: async function ({ args, options }) {
|
||||||
const platform = checkPlatform(
|
const platform = checkPlatform(
|
||||||
options.platform || (await question('平台(ios/android):')),
|
options.platform || (await question('平台(ios/android/harmony):')),
|
||||||
);
|
);
|
||||||
const id = args[0] ? parseInt(args[0]) : (await chooseApp(platform)).id;
|
const id = args[0] ? parseInt(args[0]) : (await chooseApp(platform)).id;
|
||||||
|
|
||||||
|
233
src/bundle.js
233
src/bundle.js
@@ -1,14 +1,15 @@
|
|||||||
import path from 'path';
|
import path from 'node:path';
|
||||||
import { getRNVersion, translateOptions } from './utils';
|
import { getRNVersion, translateOptions } from './utils';
|
||||||
import * as fs from 'fs-extra';
|
import * as fs from 'fs-extra';
|
||||||
import { ZipFile } from 'yazl';
|
import { ZipFile } from 'yazl';
|
||||||
import { open as openZipFile } from 'yauzl';
|
import { open as openZipFile } from 'yauzl';
|
||||||
import { question, printVersionCommand } from './utils';
|
import { question, printVersionCommand } from './utils';
|
||||||
import { checkPlatform } from './app';
|
import { checkPlatform } from './app';
|
||||||
import { spawn, spawnSync } from 'child_process';
|
import { spawn, spawnSync } from 'node:child_process';
|
||||||
const g2js = require('gradle-to-js/lib/parser');
|
const g2js = require('gradle-to-js/lib/parser');
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
const properties = require('properties');
|
const properties = require('properties');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
let bsdiff, hdiff, diff;
|
let bsdiff, hdiff, diff;
|
||||||
try {
|
try {
|
||||||
@@ -53,57 +54,70 @@ async function runReactNativeBundleCommand(
|
|||||||
|
|
||||||
let cliPath;
|
let cliPath;
|
||||||
|
|
||||||
try {
|
|
||||||
// rn >= 0.75
|
|
||||||
cliPath = require.resolve('@react-native-community/cli/build/bin.js', {
|
|
||||||
paths: [process.cwd()],
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
// rn < 0.75
|
|
||||||
cliPath = require.resolve('react-native/local-cli/cli.js', {
|
|
||||||
paths: [process.cwd()],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
let usingExpo = false;
|
let usingExpo = false;
|
||||||
try {
|
try {
|
||||||
require.resolve('expo-router', {
|
|
||||||
paths: [process.cwd()],
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(`expo-router detected, will use @expo/cli to bundle.\n`);
|
|
||||||
// if using expo-router, use expo-cli
|
|
||||||
cliPath = require.resolve('@expo/cli', {
|
cliPath = require.resolve('@expo/cli', {
|
||||||
paths: [process.cwd()],
|
paths: [process.cwd()],
|
||||||
});
|
});
|
||||||
usingExpo = true;
|
usingExpo = true;
|
||||||
} catch (e) {}
|
} catch (e) {
|
||||||
const bundleCommand = usingExpo ? 'export:embed' : 'bundle';
|
try {
|
||||||
|
// rn >= 0.75
|
||||||
Array.prototype.push.apply(reactNativeBundleArgs, [
|
cliPath = require.resolve('@react-native-community/cli/build/bin.js', {
|
||||||
cliPath,
|
paths: [process.cwd()],
|
||||||
bundleCommand,
|
});
|
||||||
'--assets-dest',
|
} catch (e) {
|
||||||
outputFolder,
|
// rn < 0.75
|
||||||
'--bundle-output',
|
cliPath = require.resolve('react-native/local-cli/cli.js', {
|
||||||
path.join(outputFolder, bundleName),
|
paths: [process.cwd()],
|
||||||
'--dev',
|
});
|
||||||
development,
|
}
|
||||||
'--entry-file',
|
|
||||||
entryFile,
|
|
||||||
'--platform',
|
|
||||||
platform,
|
|
||||||
'--reset-cache',
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (sourcemapOutput) {
|
|
||||||
reactNativeBundleArgs.push('--sourcemap-output', sourcemapOutput);
|
|
||||||
}
|
}
|
||||||
|
const bundleCommand = usingExpo ? 'export:embed' : platform === 'harmony' ? 'bundle-harmony' : 'bundle';
|
||||||
|
if (platform == 'harmony') {
|
||||||
|
Array.prototype.push.apply(reactNativeBundleArgs, [
|
||||||
|
cliPath,
|
||||||
|
bundleCommand,
|
||||||
|
'--dev',
|
||||||
|
development,
|
||||||
|
'--entry-file',
|
||||||
|
entryFile,
|
||||||
|
]);
|
||||||
|
|
||||||
if (config) {
|
if (sourcemapOutput) {
|
||||||
reactNativeBundleArgs.push('--config', config);
|
reactNativeBundleArgs.push('--sourcemap-output', sourcemapOutput);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config) {
|
||||||
|
reactNativeBundleArgs.push('--config', config);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
Array.prototype.push.apply(reactNativeBundleArgs, [
|
||||||
|
cliPath,
|
||||||
|
bundleCommand,
|
||||||
|
'--assets-dest',
|
||||||
|
outputFolder,
|
||||||
|
'--bundle-output',
|
||||||
|
path.join(outputFolder, bundleName),
|
||||||
|
'--dev',
|
||||||
|
development,
|
||||||
|
'--entry-file',
|
||||||
|
entryFile,
|
||||||
|
'--platform',
|
||||||
|
platform,
|
||||||
|
'--reset-cache',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (sourcemapOutput) {
|
||||||
|
reactNativeBundleArgs.push('--sourcemap-output', sourcemapOutput);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config) {
|
||||||
|
reactNativeBundleArgs.push('--config', config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const reactNativeBundleProcess = spawn('node', reactNativeBundleArgs);
|
const reactNativeBundleProcess = spawn('node', reactNativeBundleArgs);
|
||||||
console.log(
|
console.log(
|
||||||
`Running bundle command: node ${reactNativeBundleArgs.join(' ')}`,
|
`Running bundle command: node ${reactNativeBundleArgs.join(' ')}`,
|
||||||
@@ -152,6 +166,8 @@ async function runReactNativeBundleCommand(
|
|||||||
fs.existsSync('ios/Pods/hermes-engine')
|
fs.existsSync('ios/Pods/hermes-engine')
|
||||||
) {
|
) {
|
||||||
hermesEnabled = true;
|
hermesEnabled = true;
|
||||||
|
}else if (platform === 'harmony') {
|
||||||
|
await copyHarmonyBundle(outputFolder);
|
||||||
}
|
}
|
||||||
if (hermesEnabled) {
|
if (hermesEnabled) {
|
||||||
await compileHermesByteCode(
|
await compileHermesByteCode(
|
||||||
@@ -166,6 +182,21 @@ async function runReactNativeBundleCommand(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function copyHarmonyBundle(outputFolder) {
|
||||||
|
const harmonyRawPath = 'harmony/entry/src/main/resources/rawfile';
|
||||||
|
|
||||||
|
try {
|
||||||
|
await fs.ensureDir(outputFolder);
|
||||||
|
await fs.copy(harmonyRawPath, outputFolder);
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
`Successfully copied from ${harmonyRawPath} to ${outputFolder}`,
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error in copyHarmonyBundle:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getHermesOSBin() {
|
function getHermesOSBin() {
|
||||||
if (os.platform() === 'win32') return 'win64-bin';
|
if (os.platform() === 'win32') return 'win64-bin';
|
||||||
if (os.platform() === 'darwin') return 'osx-bin';
|
if (os.platform() === 'darwin') return 'osx-bin';
|
||||||
@@ -226,6 +257,10 @@ async function compileHermesByteCode(
|
|||||||
'-O',
|
'-O',
|
||||||
];
|
];
|
||||||
if (sourcemapOutput) {
|
if (sourcemapOutput) {
|
||||||
|
fs.copyFileSync(
|
||||||
|
sourcemapOutput,
|
||||||
|
path.join(outputFolder, bundleName + '.txt.map'),
|
||||||
|
);
|
||||||
args.push('-output-source-map');
|
args.push('-output-source-map');
|
||||||
}
|
}
|
||||||
console.log(
|
console.log(
|
||||||
@@ -234,6 +269,28 @@ async function compileHermesByteCode(
|
|||||||
spawnSync(hermesCommand, args, {
|
spawnSync(hermesCommand, args, {
|
||||||
stdio: 'ignore',
|
stdio: 'ignore',
|
||||||
});
|
});
|
||||||
|
if (sourcemapOutput) {
|
||||||
|
const composerPath =
|
||||||
|
'node_modules/react-native/scripts/compose-source-maps.js';
|
||||||
|
if (!fs.existsSync(composerPath)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log(`Composing source map`);
|
||||||
|
spawnSync(
|
||||||
|
'node',
|
||||||
|
[
|
||||||
|
composerPath,
|
||||||
|
path.join(outputFolder, bundleName + '.txt.map'),
|
||||||
|
path.join(outputFolder, bundleName + '.map'),
|
||||||
|
'-o',
|
||||||
|
sourcemapOutput,
|
||||||
|
],
|
||||||
|
{
|
||||||
|
stdio: 'ignore',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
fs.removeSync(path.join(outputFolder, bundleName + '.txt.map'));
|
||||||
}
|
}
|
||||||
|
|
||||||
async function pack(dir, output) {
|
async function pack(dir, output) {
|
||||||
@@ -315,7 +372,7 @@ async function diffFromPPK(origin, next, output) {
|
|||||||
// isFile
|
// isFile
|
||||||
originMap[entry.crc32] = entry.fileName;
|
originMap[entry.crc32] = entry.fileName;
|
||||||
|
|
||||||
if (entry.fileName === 'index.bundlejs') {
|
if (entry.fileName === 'index.bundlejs' || entry.fileName === 'bundle.harmony.js') {
|
||||||
// This is source.
|
// This is source.
|
||||||
return readEntire(entry, zipFile).then((v) => (originSource = v));
|
return readEntire(entry, zipFile).then((v) => (originSource = v));
|
||||||
}
|
}
|
||||||
@@ -377,6 +434,16 @@ async function diffFromPPK(origin, next, output) {
|
|||||||
);
|
);
|
||||||
//console.log('End diff');
|
//console.log('End diff');
|
||||||
});
|
});
|
||||||
|
}else if (entry.fileName === 'bundle.harmony.js') {
|
||||||
|
//console.log('Found bundle');
|
||||||
|
return readEntire(entry, nextZipfile).then((newSource) => {
|
||||||
|
//console.log('Begin diff');
|
||||||
|
zipfile.addBuffer(
|
||||||
|
diff(originSource, newSource),
|
||||||
|
'bundle.harmony.js.patch',
|
||||||
|
);
|
||||||
|
//console.log('End diff');
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
// If same file.
|
// If same file.
|
||||||
const originEntry = originEntries[entry.fileName];
|
const originEntry = originEntries[entry.fileName];
|
||||||
@@ -499,7 +566,17 @@ async function diffFromPackage(
|
|||||||
);
|
);
|
||||||
//console.log('End diff');
|
//console.log('End diff');
|
||||||
});
|
});
|
||||||
} else {
|
} else if (entry.fileName === 'bundle.harmony.js') {
|
||||||
|
//console.log('Found bundle');
|
||||||
|
return readEntire(entry, nextZipfile).then((newSource) => {
|
||||||
|
//console.log('Begin diff');
|
||||||
|
zipfile.addBuffer(
|
||||||
|
diff(originSource, newSource),
|
||||||
|
'bundle.harmony.js.patch',
|
||||||
|
);
|
||||||
|
//console.log('End diff');
|
||||||
|
});
|
||||||
|
}else {
|
||||||
// If same file.
|
// If same file.
|
||||||
if (originEntries[entry.fileName] === entry.crc32) {
|
if (originEntries[entry.fileName] === entry.crc32) {
|
||||||
copies[entry.fileName] = '';
|
copies[entry.fileName] = '';
|
||||||
@@ -531,22 +608,53 @@ async function diffFromPackage(
|
|||||||
await writePromise;
|
await writePromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
function enumZipEntries(zipFn, callback) {
|
async function enumZipEntries(zipFn, callback, nestedPath = '') {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
openZipFile(zipFn, { lazyEntries: true }, (err, zipfile) => {
|
openZipFile(zipFn, { lazyEntries: true }, async (err, zipfile) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return reject(err);
|
return reject(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
zipfile.on('end', resolve);
|
zipfile.on('end', resolve);
|
||||||
zipfile.on('error', reject);
|
zipfile.on('error', reject);
|
||||||
zipfile.on('entry', (entry) => {
|
zipfile.on('entry', async (entry) => {
|
||||||
const result = callback(entry, zipfile);
|
const fullPath = nestedPath + entry.fileName;
|
||||||
if (result && typeof result.then === 'function') {
|
|
||||||
result.then(() => zipfile.readEntry());
|
try {
|
||||||
} else {
|
if (
|
||||||
zipfile.readEntry();
|
!entry.fileName.endsWith('/') &&
|
||||||
|
entry.fileName.toLowerCase().endsWith('.hap')
|
||||||
|
) {
|
||||||
|
const tempDir = path.join(os.tmpdir(), 'nested_zip_' + Date.now());
|
||||||
|
await fs.ensureDir(tempDir);
|
||||||
|
const tempZipPath = path.join(tempDir, 'temp.zip');
|
||||||
|
|
||||||
|
await new Promise((res, rej) => {
|
||||||
|
zipfile.openReadStream(entry, async (err, readStream) => {
|
||||||
|
if (err) return rej(err);
|
||||||
|
const writeStream = fs.createWriteStream(tempZipPath);
|
||||||
|
readStream.pipe(writeStream);
|
||||||
|
writeStream.on('finish', res);
|
||||||
|
writeStream.on('error', rej);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
await enumZipEntries(tempZipPath, callback, fullPath + '/');
|
||||||
|
|
||||||
|
await fs.remove(tempDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = callback(entry, zipfile, fullPath);
|
||||||
|
if (result && typeof result.then === 'function') {
|
||||||
|
await result;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('处理文件时出错:', error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
zipfile.readEntry();
|
||||||
});
|
});
|
||||||
|
|
||||||
zipfile.readEntry();
|
zipfile.readEntry();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -591,7 +699,7 @@ function diffArgsCheck(args, options, diffFn) {
|
|||||||
export const commands = {
|
export const commands = {
|
||||||
bundle: async function ({ options }) {
|
bundle: async function ({ options }) {
|
||||||
const platform = checkPlatform(
|
const platform = checkPlatform(
|
||||||
options.platform || (await question('平台(ios/android):')),
|
options.platform || (await question('平台(ios/android/harmony):')),
|
||||||
);
|
);
|
||||||
|
|
||||||
let { bundleName, entryFile, intermediaDir, output, dev, sourcemap } =
|
let { bundleName, entryFile, intermediaDir, output, dev, sourcemap } =
|
||||||
@@ -680,6 +788,21 @@ export const commands = {
|
|||||||
console.log(`${realOutput} generated.`);
|
console.log(`${realOutput} generated.`);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async hdiffFromApp({ args, options }) {
|
||||||
|
const { origin, next, realOutput } = diffArgsCheck(
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
'hdiffFromApp',
|
||||||
|
);
|
||||||
|
await diffFromPackage(
|
||||||
|
origin,
|
||||||
|
next,
|
||||||
|
realOutput,
|
||||||
|
'resources/rawfile/bundle.harmony.js',
|
||||||
|
);
|
||||||
|
console.log(`${realOutput} generated.`);
|
||||||
|
},
|
||||||
|
|
||||||
async diffFromIpa({ args, options }) {
|
async diffFromIpa({ args, options }) {
|
||||||
const { origin, next, realOutput } = diffArgsCheck(
|
const { origin, next, realOutput } = diffArgsCheck(
|
||||||
args,
|
args,
|
||||||
|
@@ -5,9 +5,13 @@ import updateNotifier from 'update-notifier';
|
|||||||
import { printVersionCommand } from './utils/index.js';
|
import { printVersionCommand } from './utils/index.js';
|
||||||
import pkg from '../package.json';
|
import pkg from '../package.json';
|
||||||
|
|
||||||
updateNotifier({ pkg }).notify({ isGlobal: true });
|
updateNotifier({ pkg }).notify({
|
||||||
|
isGlobal: true,
|
||||||
|
message:
|
||||||
|
'建议运行 `{updateCommand}` 来更新命令行工具以获得功能、性能和安全性的持续改进',
|
||||||
|
});
|
||||||
|
|
||||||
function printUsage({ args }) {
|
function printUsage() {
|
||||||
// const commandName = args[0];
|
// const commandName = args[0];
|
||||||
// TODO: print usage of commandName, or print global usage.
|
// TODO: print usage of commandName, or print global usage.
|
||||||
|
|
||||||
@@ -27,8 +31,8 @@ const commands = {
|
|||||||
help: printUsage,
|
help: printUsage,
|
||||||
};
|
};
|
||||||
|
|
||||||
function run() {
|
async function run() {
|
||||||
printVersionCommand();
|
await printVersionCommand();
|
||||||
if (process.argv.indexOf('-v') >= 0 || process.argv[2] === 'version') {
|
if (process.argv.indexOf('-v') >= 0 || process.argv[2] === 'version') {
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
@@ -138,7 +138,7 @@ export const commands = {
|
|||||||
},
|
},
|
||||||
packages: async function ({ options }) {
|
packages: async function ({ options }) {
|
||||||
const platform = checkPlatform(
|
const platform = checkPlatform(
|
||||||
options.platform || (await question('平台(ios/android):')),
|
options.platform || (await question('平台(ios/android/harmony):')),
|
||||||
);
|
);
|
||||||
const { appId } = await getSelectedApp(platform);
|
const { appId } = await getSelectedApp(platform);
|
||||||
await listPackage(appId);
|
await listPackage(appId);
|
||||||
|
8
src/types.ts
Normal file
8
src/types.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
declare global {
|
||||||
|
var NO_INTERACTIVE: boolean;
|
||||||
|
var USE_ACC_OSS: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Session {
|
||||||
|
token: string;
|
||||||
|
}
|
@@ -1,26 +1,23 @@
|
|||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import os from 'os';
|
import os from 'node:os';
|
||||||
import path from 'path';
|
import path from 'node:path';
|
||||||
import pkg from '../../package.json';
|
import pkg from '../../package.json';
|
||||||
import AppInfoParser from './app-info-parser';
|
import AppInfoParser from './app-info-parser';
|
||||||
import semverSatisfies from 'semver/functions/satisfies';
|
import semverSatisfies from 'semver/functions/satisfies';
|
||||||
|
import chalk from 'chalk';
|
||||||
|
import latestVersion from '@badisi/latest-version';
|
||||||
|
|
||||||
import read from 'read';
|
import { read } from 'read';
|
||||||
|
|
||||||
export function question(query, password) {
|
export async function question(query, password) {
|
||||||
if (NO_INTERACTIVE) {
|
if (NO_INTERACTIVE) {
|
||||||
return Promise.resolve('');
|
return '';
|
||||||
}
|
}
|
||||||
return new Promise((resolve, reject) =>
|
return read({
|
||||||
read(
|
prompt: query,
|
||||||
{
|
silent: password,
|
||||||
prompt: query,
|
replace: password ? '*' : undefined,
|
||||||
silent: password,
|
});
|
||||||
replace: password ? '*' : undefined,
|
|
||||||
},
|
|
||||||
(err, result) => (err ? reject(err) : resolve(result)),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function translateOptions(options) {
|
export function translateOptions(options) {
|
||||||
@@ -136,8 +133,23 @@ export function saveToLocal(originPath, destName) {
|
|||||||
// fs.copyFileSync(originPath, destPath);
|
// fs.copyFileSync(originPath, destPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function printVersionCommand() {
|
async function getLatestVersion(pkgName) {
|
||||||
console.log('react-native-update-cli: ' + pkg.version);
|
return Promise.race([
|
||||||
|
latestVersion(pkgName)
|
||||||
|
.then((p) => p.latest)
|
||||||
|
.catch(() => ''),
|
||||||
|
new Promise((resolve) => setTimeout(() => resolve(''), 2000)),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function printVersionCommand() {
|
||||||
|
let latestPushyCliVersion = await getLatestVersion('react-native-update-cli');
|
||||||
|
latestPushyCliVersion = latestPushyCliVersion
|
||||||
|
? ` (最新:${chalk.green(latestPushyCliVersion)})`
|
||||||
|
: '';
|
||||||
|
console.log(
|
||||||
|
`react-native-update-cli: ${pkg.version}${latestPushyCliVersion}`,
|
||||||
|
);
|
||||||
let pushyVersion = '';
|
let pushyVersion = '';
|
||||||
try {
|
try {
|
||||||
const PACKAGE_JSON_PATH = require.resolve(
|
const PACKAGE_JSON_PATH = require.resolve(
|
||||||
@@ -147,21 +159,29 @@ export function printVersionCommand() {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
pushyVersion = require(PACKAGE_JSON_PATH).version;
|
pushyVersion = require(PACKAGE_JSON_PATH).version;
|
||||||
console.log('react-native-update: ' + pushyVersion);
|
let latestPushyVersion = await getLatestVersion('react-native-update');
|
||||||
|
latestPushyVersion = latestPushyVersion
|
||||||
|
? ` (最新:${chalk.green(latestPushyVersion)})`
|
||||||
|
: '';
|
||||||
|
console.log(`react-native-update: ${pushyVersion}${latestPushyVersion}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('react-native-update: 无法获取版本号,请在项目目录中运行命令');
|
console.log('react-native-update: 无法获取版本号,请在项目目录中运行命令');
|
||||||
}
|
}
|
||||||
if (pushyVersion) {
|
if (pushyVersion) {
|
||||||
if (semverSatisfies(pushyVersion, '<8.5.1')) {
|
if (semverSatisfies(pushyVersion, '<8.5.2')) {
|
||||||
console.warn(
|
console.warn(
|
||||||
`当前版本已不再支持,请至少升级到 v8 的最新小版本后重新打包(代码无需改动): npm i react-native-update@8 .
|
`当前版本已不再支持,请至少升级到 v8 的最新小版本后重新打包(代码无需改动): npm i react-native-update@8 .
|
||||||
如有使用安装 apk 的功能,请注意添加所需权限 https://pushy.reactnative.cn/docs/api#async-function-downloadandinstallapkurl`,
|
如有使用安装 apk 的功能,请注意添加所需权限 https://pushy.reactnative.cn/docs/api#async-function-downloadandinstallapkurl`,
|
||||||
);
|
);
|
||||||
} else if (semverSatisfies(pushyVersion, '9.0.0 - 9.2.0')) {
|
} else if (semverSatisfies(pushyVersion, '9.0.0 - 9.2.1')) {
|
||||||
console.warn(
|
console.warn(
|
||||||
`当前版本已不再支持,请至少升级到 v9 的最新小版本后重新打包(代码无需改动): npm i react-native-update@9 .
|
`当前版本已不再支持,请至少升级到 v9 的最新小版本后重新打包(代码无需改动,可直接热更): npm i react-native-update@9 .
|
||||||
如有使用安装 apk 的功能,请注意添加所需权限 https://pushy.reactnative.cn/docs/api#async-function-downloadandinstallapkurl`,
|
如有使用安装 apk 的功能,请注意添加所需权限 https://pushy.reactnative.cn/docs/api#async-function-downloadandinstallapkurl`,
|
||||||
);
|
);
|
||||||
|
} else if (semverSatisfies(pushyVersion, '10.0.0 - 10.17.0')) {
|
||||||
|
console.warn(
|
||||||
|
`当前版本已不再支持,请升级到 v10 的最新小版本(代码无需改动,可直接热更): npm i react-native-update@10`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -86,12 +86,12 @@ export const commands = {
|
|||||||
|
|
||||||
if (!fn || !fn.endsWith('.ppk')) {
|
if (!fn || !fn.endsWith('.ppk')) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'使用方法: pushy publish ppk后缀文件 --platform ios|android',
|
'使用方法: pushy publish ppk后缀文件 --platform ios|android|harmony',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const platform = checkPlatform(
|
const platform = checkPlatform(
|
||||||
options.platform || (await question('平台(ios/android):')),
|
options.platform || (await question('平台(ios/android/harmony):')),
|
||||||
);
|
);
|
||||||
const { appId } = await getSelectedApp(platform);
|
const { appId } = await getSelectedApp(platform);
|
||||||
|
|
||||||
@@ -114,14 +114,14 @@ export const commands = {
|
|||||||
},
|
},
|
||||||
versions: async function ({ options }) {
|
versions: async function ({ options }) {
|
||||||
const platform = checkPlatform(
|
const platform = checkPlatform(
|
||||||
options.platform || (await question('平台(ios/android):')),
|
options.platform || (await question('平台(ios/android/harmony):')),
|
||||||
);
|
);
|
||||||
const { appId } = await getSelectedApp(platform);
|
const { appId } = await getSelectedApp(platform);
|
||||||
await listVersions(appId);
|
await listVersions(appId);
|
||||||
},
|
},
|
||||||
update: async function ({ args, options }) {
|
update: async function ({ args, options }) {
|
||||||
const platform = checkPlatform(
|
const platform = checkPlatform(
|
||||||
options.platform || (await question('平台(ios/android):')),
|
options.platform || (await question('平台(ios/android/harmony):')),
|
||||||
);
|
);
|
||||||
const { appId } = await getSelectedApp(platform);
|
const { appId } = await getSelectedApp(platform);
|
||||||
let versionId = options.versionId || (await chooseVersion(appId)).id;
|
let versionId = options.versionId || (await chooseVersion(appId)).id;
|
||||||
@@ -255,7 +255,7 @@ export const commands = {
|
|||||||
},
|
},
|
||||||
updateVersionInfo: async function ({ args, options }) {
|
updateVersionInfo: async function ({ args, options }) {
|
||||||
const platform = checkPlatform(
|
const platform = checkPlatform(
|
||||||
options.platform || (await question('平台(ios/android):')),
|
options.platform || (await question('平台(ios/android/harmony):')),
|
||||||
);
|
);
|
||||||
const { appId } = await getSelectedApp(platform);
|
const { appId } = await getSelectedApp(platform);
|
||||||
const versionId = options.versionId || (await chooseVersion(appId)).id;
|
const versionId = options.versionId || (await chooseVersion(appId)).id;
|
||||||
|
Reference in New Issue
Block a user