mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-09-16 09:41:38 +08:00
fix: version name
This commit is contained in:
14
package.json
14
package.json
@@ -12,7 +12,6 @@
|
||||
"cli.json"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"prepublish": "babel src --out-dir lib"
|
||||
},
|
||||
"repository": {
|
||||
@@ -32,7 +31,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/reactnativecn/react-native-pushy/tree/master/react-native-pushy-cli",
|
||||
"dependencies": {
|
||||
"app-info-parser": "^1.0.0",
|
||||
"app-info-parser": "^1.1.6",
|
||||
"cli-arguments": "^0.2.1",
|
||||
"filesize-parser": "^1.5.0",
|
||||
"fs-extra": "8",
|
||||
@@ -43,8 +42,8 @@
|
||||
"read": "^1.0.7",
|
||||
"request": "^2.88.2",
|
||||
"tcp-ping": "^0.1.1",
|
||||
"tty-table": "4.1",
|
||||
"update-notifier": "^4.1.1",
|
||||
"tty-table": "4.2",
|
||||
"update-notifier": "^5.1.0",
|
||||
"yauzl": "^2.10.0",
|
||||
"yazl": "2.5.1"
|
||||
},
|
||||
@@ -56,6 +55,11 @@
|
||||
"babel-plugin-transform-object-rest-spread": "^6.26.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
"node": ">= 10"
|
||||
},
|
||||
"pnpm": {
|
||||
"patchedDependencies": {
|
||||
"app-info-parser@1.1.6": "patches/app-info-parser@1.1.6.patch"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
17
patches/app-info-parser@1.1.6.patch
Normal file
17
patches/app-info-parser@1.1.6.patch
Normal file
@@ -0,0 +1,17 @@
|
||||
diff --git a/src/xml-parser/binary.js b/src/xml-parser/binary.js
|
||||
index e20cc96e8131078ea81afeb31af46142a52da58e..f0f788cc555046f0dab47f8854f26344e0d5d714 100644
|
||||
--- a/src/xml-parser/binary.js
|
||||
+++ b/src/xml-parser/binary.js
|
||||
@@ -547,8 +547,10 @@ var BinaryXmlParser = /*#__PURE__*/function () {
|
||||
attr.nodeName = attr.name = this.strings[nameRef];
|
||||
if (valueRef > 0) {
|
||||
// some apk have versionName with special characters
|
||||
- if (attr.name === 'versionName') {
|
||||
- this.strings[valueRef] = this.strings[valueRef].replace(/[^\d\w-.]/g, '');
|
||||
+ if (attr.name === 'versionName') {
|
||||
+ // only keep printable characters
|
||||
+ // https://www.ascii-code.com/characters/printable-characters
|
||||
+ this.strings[valueRef] = this.strings[valueRef].replace(/[^\x21-\x7E]/g, '')
|
||||
}
|
||||
attr.value = this.strings[valueRef];
|
||||
}
|
324
pnpm-lock.yaml
generated
324
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
50
src/api.js
50
src/api.js
@@ -1,13 +1,13 @@
|
||||
const fetch = require('node-fetch');
|
||||
import fetch from 'node-fetch';
|
||||
const defaultEndpoint = 'https://update.reactnative.cn/api';
|
||||
let host = process.env.PUSHY_REGISTRY || defaultEndpoint;
|
||||
const fs = require('fs');
|
||||
import fs from 'fs';
|
||||
import request from 'request';
|
||||
import ProgressBar from 'progress';
|
||||
const packageJson = require('../package.json');
|
||||
const tcpp = require('tcp-ping');
|
||||
const util = require('util');
|
||||
const path = require('path');
|
||||
import packageJson from '../package.json';
|
||||
import tcpp from 'tcp-ping';
|
||||
import util from 'util';
|
||||
import path from 'path';
|
||||
import filesizeParser from 'filesize-parser';
|
||||
import { pricingPageUrl } from './utils';
|
||||
|
||||
@@ -18,10 +18,18 @@ let savedSession = undefined;
|
||||
|
||||
const userAgent = `react-native-update-cli/${packageJson.version}`;
|
||||
|
||||
exports.loadSession = async function () {
|
||||
export const getSession = function () {
|
||||
return session;
|
||||
};
|
||||
|
||||
export const replaceSession = function (newSession) {
|
||||
session = newSession;
|
||||
};
|
||||
|
||||
export const loadSession = async function () {
|
||||
if (fs.existsSync('.update')) {
|
||||
try {
|
||||
exports.replaceSession(JSON.parse(fs.readFileSync('.update', 'utf8')));
|
||||
replaceSession(JSON.parse(fs.readFileSync('.update', 'utf8')));
|
||||
savedSession = session;
|
||||
} catch (e) {
|
||||
console.error(
|
||||
@@ -32,15 +40,7 @@ exports.loadSession = async function () {
|
||||
}
|
||||
};
|
||||
|
||||
exports.getSession = function () {
|
||||
return session;
|
||||
};
|
||||
|
||||
exports.replaceSession = function (newSession) {
|
||||
session = newSession;
|
||||
};
|
||||
|
||||
exports.saveSession = function () {
|
||||
export const saveSession = function () {
|
||||
// Only save on change.
|
||||
if (session !== savedSession) {
|
||||
const current = session;
|
||||
@@ -50,7 +50,7 @@ exports.saveSession = function () {
|
||||
}
|
||||
};
|
||||
|
||||
exports.closeSession = function () {
|
||||
export const closeSession = function () {
|
||||
if (fs.existsSync('.update')) {
|
||||
fs.unlinkSync('.update');
|
||||
savedSession = undefined;
|
||||
@@ -103,13 +103,13 @@ function queryWithBody(method) {
|
||||
};
|
||||
}
|
||||
|
||||
exports.get = queryWithoutBody('GET');
|
||||
exports.post = queryWithBody('POST');
|
||||
exports.put = queryWithBody('PUT');
|
||||
exports.doDelete = queryWithBody('DELETE');
|
||||
export const get = queryWithoutBody('GET');
|
||||
export const post = queryWithBody('POST');
|
||||
export const put = queryWithBody('PUT');
|
||||
export const doDelete = queryWithBody('DELETE');
|
||||
|
||||
async function uploadFile(fn, key) {
|
||||
const { url, backupUrl, formData, maxSize } = await exports.post('/upload', {
|
||||
export async function uploadFile(fn, key) {
|
||||
const { url, backupUrl, formData, maxSize } = await post('/upload', {
|
||||
ext: path.extname(fn),
|
||||
});
|
||||
let realUrl = url;
|
||||
@@ -175,5 +175,3 @@ async function uploadFile(fn, key) {
|
||||
});
|
||||
return info;
|
||||
}
|
||||
|
||||
exports.uploadFile = uploadFile;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { question } from './utils';
|
||||
import fs from 'fs';
|
||||
const Table = require('tty-table');
|
||||
import Table from 'tty-table';
|
||||
|
||||
const { post, get, doDelete } = require('./api');
|
||||
import { post, get, doDelete } from './api';
|
||||
|
||||
const validPlatforms = {
|
||||
ios: 1,
|
||||
|
@@ -1,16 +1,16 @@
|
||||
const path = require('path');
|
||||
import path from 'path';
|
||||
import { getRNVersion, translateOptions } from './utils';
|
||||
import * as fs from 'fs-extra';
|
||||
import { ZipFile } from 'yazl';
|
||||
import { open as openZipFile } from 'yauzl';
|
||||
import { question, printVersionCommand } from './utils';
|
||||
import { checkPlatform } from './app';
|
||||
const { spawn, spawnSync } = require('child_process');
|
||||
import { spawn, spawnSync } from 'child_process';
|
||||
const g2js = require('gradle-to-js/lib/parser');
|
||||
const os = require('os');
|
||||
import os from 'os';
|
||||
const properties = require('properties');
|
||||
|
||||
var bsdiff, hdiff, diff;
|
||||
let bsdiff, hdiff, diff;
|
||||
try {
|
||||
bsdiff = require('node-bsdiff').diff;
|
||||
} catch (e) {}
|
||||
@@ -196,7 +196,7 @@ async function compileHermesByteCode(
|
||||
paths: [process.cwd()],
|
||||
}),
|
||||
);
|
||||
const hermesCommand = path.join(
|
||||
let hermesCommand = path.join(
|
||||
rnDir,
|
||||
`/sdks/hermesc/${getHermesOSBin()}/hermesc`,
|
||||
);
|
||||
@@ -234,7 +234,7 @@ async function pack(dir, output) {
|
||||
console.log('Packing');
|
||||
fs.ensureDirSync(path.dirname(output));
|
||||
await new Promise((resolve, reject) => {
|
||||
var zipfile = new ZipFile();
|
||||
const zipfile = new ZipFile();
|
||||
|
||||
function addDirectory(root, rel) {
|
||||
if (rel) {
|
||||
@@ -324,7 +324,7 @@ async function diffFromPPK(origin, next, output) {
|
||||
|
||||
const copies = {};
|
||||
|
||||
var zipfile = new ZipFile();
|
||||
const zipfile = new ZipFile();
|
||||
|
||||
const writePromise = new Promise((resolve, reject) => {
|
||||
zipfile.outputStream.on('error', (err) => {
|
||||
@@ -409,7 +409,7 @@ async function diffFromPPK(origin, next, output) {
|
||||
|
||||
const deletes = {};
|
||||
|
||||
for (var k in originEntries) {
|
||||
for (let k in originEntries) {
|
||||
if (!newEntries[k]) {
|
||||
console.log('Delete ' + k);
|
||||
deletes[k] = 1;
|
||||
@@ -466,7 +466,7 @@ async function diffFromPackage(
|
||||
|
||||
const copies = {};
|
||||
|
||||
var zipfile = new ZipFile();
|
||||
const zipfile = new ZipFile();
|
||||
|
||||
const writePromise = new Promise((resolve, reject) => {
|
||||
zipfile.outputStream.on('error', (err) => {
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const { loadSession } = require('./api');
|
||||
const updateNotifier = require('update-notifier');
|
||||
import { loadSession } from './api';
|
||||
import updateNotifier from 'update-notifier';
|
||||
import { printVersionCommand } from './utils/index.js';
|
||||
const pkg = require('../package.json');
|
||||
import pkg from '../package.json';
|
||||
|
||||
updateNotifier({ pkg }).notify({ isGlobal: true });
|
||||
|
||||
|
@@ -1,14 +1,10 @@
|
||||
/**
|
||||
* Created by tdzl2003 on 4/2/16.
|
||||
*/
|
||||
|
||||
const { get, post, uploadFile } = require('./api');
|
||||
import { get, post, uploadFile } from './api';
|
||||
import { question, saveToLocal } from './utils';
|
||||
|
||||
import { checkPlatform, getSelectedApp } from './app';
|
||||
|
||||
import { getApkInfo, getIpaInfo } from './utils';
|
||||
const Table = require('tty-table');
|
||||
import Table from 'tty-table';
|
||||
|
||||
export async function listPackage(appId) {
|
||||
const { data } = await get(`/app/${appId}/package/list?limit=1000`);
|
||||
@@ -85,7 +81,9 @@ export const commands = {
|
||||
buildTime,
|
||||
});
|
||||
saveToLocal(fn, `${appId}/package/${id}.ipa`);
|
||||
console.log(`已成功上传ipa原生包(id: ${id})`);
|
||||
console.log(
|
||||
`已成功上传ipa原生包(id: ${id}, version: ${versionName}, buildTime: ${buildTime})`,
|
||||
);
|
||||
},
|
||||
uploadApk: async function ({ args }) {
|
||||
const fn = args[0];
|
||||
@@ -120,7 +118,9 @@ export const commands = {
|
||||
buildTime,
|
||||
});
|
||||
saveToLocal(fn, `${appId}/package/${id}.apk`);
|
||||
console.log(`已成功上传apk原生包(id: ${id})`);
|
||||
console.log(
|
||||
`已成功上传apk原生包(id: ${id}, version: ${versionName}, buildTime: ${buildTime})`,
|
||||
);
|
||||
},
|
||||
parseIpa: async function ({ args }) {
|
||||
const fn = args[0];
|
||||
|
22
src/user.js
22
src/user.js
@@ -1,25 +1,15 @@
|
||||
/**
|
||||
* Created by tdzl2003 on 2/13/16.
|
||||
*/
|
||||
|
||||
import { question } from './utils';
|
||||
const {
|
||||
post,
|
||||
get,
|
||||
replaceSession,
|
||||
saveSession,
|
||||
closeSession,
|
||||
} = require('./api');
|
||||
const crypto = require('crypto');
|
||||
import { post, get, replaceSession, saveSession, closeSession } from './api';
|
||||
import crypto from 'crypto';
|
||||
|
||||
function md5(str) {
|
||||
return crypto.createHash('md5').update(str).digest('hex');
|
||||
}
|
||||
|
||||
exports.commands = {
|
||||
export const commands = {
|
||||
login: async function ({ args }) {
|
||||
const email = args[0] || await question('email:');
|
||||
const pwd = args[1] || await question('password:', true);
|
||||
const email = args[0] || (await question('email:'));
|
||||
const pwd = args[1] || (await question('password:', true));
|
||||
const { token, info } = await post('/user/login', {
|
||||
email,
|
||||
pwd: md5(pwd),
|
||||
@@ -40,4 +30,4 @@ exports.commands = {
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
@@ -1,14 +1,10 @@
|
||||
/**
|
||||
* Created by tdzl2003 on 2/13/16.
|
||||
*/
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
const pkg = require('../../package.json');
|
||||
const AppInfoParser = require('app-info-parser');
|
||||
import pkg from '../../package.json';
|
||||
import AppInfoParser from 'app-info-parser';
|
||||
|
||||
var read = require('read');
|
||||
import read from 'read';
|
||||
|
||||
export function question(query, password) {
|
||||
if (NO_INTERACTIVE) {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
const { get, post, put, uploadFile } = require('./api');
|
||||
import { get, post, put, uploadFile } from './api';
|
||||
import { question, saveToLocal } from './utils';
|
||||
|
||||
import { checkPlatform, getSelectedApp } from './app';
|
||||
|
Reference in New Issue
Block a user