ipa-rename
Advanced tools
Comparing version 1.0.1 to 1.1.0
27
index.js
@@ -16,3 +16,3 @@ // 获取证书名称 | ||
} catch (err) { | ||
console.error(err); | ||
console.error(`文件${filepath}处理出错`); | ||
} | ||
@@ -23,10 +23,14 @@ }; | ||
const getIpasAndRename = async filepath => { | ||
const isAbsolute = path.isAbsolute(filepath); | ||
if (!isAbsolute) { | ||
filepath = path.join(process.cwd(), filepath); | ||
try { | ||
const isAbsolute = path.isAbsolute(filepath); | ||
if (!isAbsolute) { | ||
filepath = path.join(process.cwd(), filepath); | ||
} | ||
const ipaFilepaths = getIpas(filepath); | ||
for (let i = 0, len = ipaFilepaths.length; i < len; i++) { | ||
await rename(ipaFilepaths[i]); | ||
} | ||
} catch (err) { | ||
console.error(err); | ||
} | ||
const ipaFilepaths = getIpas(filepath); | ||
for (let i = 0, len = ipaFilepaths.length; i < len; i++) { | ||
await rename(ipaFilepaths[i]); | ||
} | ||
}; | ||
@@ -36,3 +40,4 @@ | ||
module.exports = () => { | ||
if (process.argv.length === 2) { | ||
const argv = process.argv; | ||
if (argv.length === 2) { | ||
console.log('请指定目录或ipa文件'); | ||
@@ -42,2 +47,6 @@ return process.exit(0); | ||
if (argv.length === 3 && ['-v', '-V', '--version'].indexOf(argv[2]) > -1) { | ||
return console.log(require(path.join(__dirname, '../package.json')).version); | ||
} | ||
const filepaths = process.argv.slice(2); | ||
@@ -44,0 +53,0 @@ |
@@ -8,10 +8,14 @@ // 遍历目录,读取所有的ipa文件路径 | ||
const walk = d => { | ||
const stats = fse.statSync(d); | ||
if (stats.isFile()) { | ||
if (/\.ipa$/i.test(d)) { | ||
list.push(d); | ||
try { | ||
const stats = fse.statSync(d); | ||
if (stats.isFile()) { | ||
if (/\.ipa$/i.test(d)) { | ||
list.push(d); | ||
} | ||
} else { | ||
const dirs = fse.readdirSync(d); | ||
dirs.forEach(el => walk(path.join(d, el))); | ||
} | ||
} else { | ||
const dirs = fse.readdirSync(d); | ||
dirs.forEach(el => walk(path.join(d, el))); | ||
} catch (err) { | ||
console.log(`${d}目录不存在`); | ||
} | ||
@@ -18,0 +22,0 @@ } |
@@ -5,11 +5,12 @@ | ||
const fse = require('fs-extra'); | ||
const temp = require('./tempPath'); | ||
module.exports = async () => { | ||
return new Promise((resolve, reject) => { | ||
const dirs = fse.readdirSync(path.join(__dirname, '../temp/Payload')); | ||
const dirs = fse.readdirSync(path.join(temp, 'Payload')); | ||
const appDir = dirs.find(el => /\.app$/i.test(el)); | ||
if (!appDir) return reject('未找到`*.app`目录'); | ||
const mobileprovisionPath = path.join(__dirname, `../temp/Payload/${appDir}/embedded.mobileprovision`); | ||
const plistPath = path.join(__dirname, '../temp/ipaInfo.plist'); | ||
const mobileprovisionPath = path.join(temp, `Payload/${appDir}/embedded.mobileprovision`); | ||
const plistPath = path.join(temp, 'ipaInfo.plist'); | ||
@@ -16,0 +17,0 @@ const cmd = `security cms -D -i ${mobileprovisionPath} > ${plistPath}`; |
// 获取证书名称 | ||
const cp = require('child_process'); | ||
const fse = require('fs-extra'); | ||
const temp = require('./tempPath'); | ||
module.exports = filepath => { | ||
return new Promise((resolve, reject) => { | ||
fse.ensureDirSync('./temp'); | ||
fse.emptyDirSync('./temp'); | ||
const unzip = cp.spawn('unzip', [filepath, '-d', './temp']); | ||
fse.emptyDirSync(temp); | ||
const unzip = cp.spawn('unzip', [filepath, '-d', temp]); | ||
@@ -11,0 +11,0 @@ unzip.stdout.on('data', (data) => { |
{ | ||
"name": "ipa-rename", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "将ipa文件重命名,重命名的格式`[ipa包名]--[证书名].ipa`。只支持macOS系统!", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
5446
10
133
7