mirror of
https://github.com/pysunday/rs-reverse.git
synced 2025-04-18 23:19:40 +08:00
fix: use path.sep
This commit is contained in:
parent
cb08efe0f1
commit
ccbcbcc3fa
@ -24,7 +24,7 @@
|
||||
|
||||
**`npx rs-reverse *`与在当前目录下运行`node main.js *`相对应**
|
||||
|
||||
如npx运行的包不是最新的,可以加上-p参数后执行如:`npx -p rs-reverse@latest rs-reverse makecookie`,非官方源可能存在版本不同步问题。
|
||||
如npx运行的包不是最新的,可以加上-p参数后执行如:`npx -p rs-reverse@latest rs-reverse makecookie`,非官方源可能存在版本不同步问题,建议拉取时使用官方源:`--registry=https://registry.npmjs.org`。
|
||||
|
||||
npm包不能保证最新代码,最新代码以仓库代码为准!
|
||||
|
||||
|
6
main.js
6
main.js
@ -51,7 +51,7 @@ const commandBuilder = {
|
||||
describe: '含有nsd, cd值的json文件',
|
||||
type: 'string',
|
||||
coerce: (input) => {
|
||||
if (['1', '2'].includes(input)) input = paths.exampleResolve(`codes/${input}-\$_ts.json`);
|
||||
if (['1', '2'].includes(input)) input = paths.exampleResolve('codes', `${input}-\$_ts.json`);
|
||||
if (!fs.existsSync(input)) throw new Error(`输入文件不存在: ${input}`);
|
||||
return JSON.parse(fs.readFileSync(paths.resolve(input), 'utf8'));
|
||||
}
|
||||
@ -76,7 +76,7 @@ const commandBuilder = {
|
||||
|
||||
const commandHandler = (command, argv) => {
|
||||
debugLog(argv.level);
|
||||
const ts = argv.url?.$_ts || argv.file || require(paths.exampleResolve('codes/1-\$_ts.json'));
|
||||
const ts = argv.url?.$_ts || argv.file || require(paths.exampleResolve('codes', '1-\$_ts.json'));
|
||||
logger.trace(`传入的$_ts.nsd: ${ts.nsd}`);
|
||||
logger.trace(`传入的$_ts.cd: ${ts.cd}`);
|
||||
if (argv.url) {
|
||||
@ -123,7 +123,7 @@ module.exports = yargs
|
||||
describe: '拥有完整$_ts的json文件',
|
||||
type: 'string',
|
||||
coerce: (input) => {
|
||||
if (['1', '2'].includes(input)) return paths.exampleResolve(`codes/${input}-\$_ts-full.json`);
|
||||
if (['1', '2'].includes(input)) return paths.exampleResolve('codes', `${input}-\$_ts-full.json`);
|
||||
return input;
|
||||
}
|
||||
},
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rs-reverse",
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.3",
|
||||
"description": "瑞数算法逆向,website reverse engineering",
|
||||
"main": "main.js",
|
||||
"directories": {
|
||||
|
@ -17,7 +17,7 @@ module.exports = function (ts, immucfg) {
|
||||
{
|
||||
name: 'makecode_output_code',
|
||||
desc: '输出动态代码:',
|
||||
text: code,
|
||||
text: '// 该行标记来源,非动态代码生成: ' + JSON.stringify(ts) + '\n\n' + code,
|
||||
extend: 'js',
|
||||
},
|
||||
immucfg ? {
|
||||
|
@ -3,19 +3,19 @@ const fs = require('fs');
|
||||
|
||||
const appDirectory = (() => {
|
||||
// 返回项目根目录
|
||||
const plist = path.resolve(__dirname).split('/');
|
||||
while (!fs.existsSync(path.resolve(plist.join('/'), 'package.json'))) {
|
||||
const plist = path.resolve(__dirname).split(path.sep);
|
||||
while (!fs.existsSync(path.resolve(plist.join(path.sep), 'package.json'))) {
|
||||
plist.pop();
|
||||
if (plist.length === 0) return false;
|
||||
}
|
||||
return plist.join('/');
|
||||
return plist.join(path.sep);
|
||||
})();
|
||||
const resolveApp = (...relativePath) => path.resolve(appDirectory, ...relativePath);
|
||||
|
||||
module.exports = {
|
||||
basePath: resolveApp(''),
|
||||
modulePath: resolveApp('node_modules'),
|
||||
binPath: resolveApp('node_modules/.bin/'),
|
||||
binPath: resolveApp('node_modules', '.bin'),
|
||||
package: resolveApp('package.json'),
|
||||
resolve: resolveApp,
|
||||
srcPath: resolveApp('src'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user