@zwa73/dev-utils 1.0.16 → 1.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,6 +19,7 @@ const CmdMapPath = (program) => program
19
19
  .option("-do, --duplicate-output <dir>", "移动重命名的重名文件的目录", "Duplicates")
20
20
  .option("-r, --recursive", "是否处理子目录", false)
21
21
  .option("-c, --copy", "复制而不是重命名文件", false)
22
+ .option("-t, --test", "不对文件进行实际操作, 在控制台输出映射结果", false)
22
23
  .action(async (regexStr, replacement, options) => {
23
24
  const regex = new RegExp(regexStr);
24
25
  const excludeRegex = options.exclude ? new RegExp(options.exclude) : null;
@@ -34,6 +35,8 @@ const CmdMapPath = (program) => program
34
35
  const mapPath = async (source, target) => {
35
36
  const dir = path_1.default.parse(target).dir;
36
37
  await utils_1.UtilFT.ensurePathExists(dir, { dir: true });
38
+ if (options.test)
39
+ return utils_1.SLogger.info(`${source} -> ${target}`);
37
40
  if (options.copy)
38
41
  await fs_1.default.promises.copyFile(source, target);
39
42
  else
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zwa73/dev-utils",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "编译与调试工具",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -15,7 +15,7 @@
15
15
  "author": "zwa73",
16
16
  "license": "ISC",
17
17
  "dependencies": {
18
- "@zwa73/utils": "^1.0.109",
18
+ "@zwa73/utils": "^1.0.110",
19
19
  "commander": "^11.1.0",
20
20
  "ts-node": "^10.9.2",
21
21
  "tsconfig-paths": "^4.2.0",
@@ -17,6 +17,7 @@ export const CmdMapPath = (program: Command) => program
17
17
  .option("-do, --duplicate-output <dir>", "移动重命名的重名文件的目录", "Duplicates")
18
18
  .option("-r, --recursive", "是否处理子目录", false)
19
19
  .option("-c, --copy", "复制而不是重命名文件", false)
20
+ .option("-t, --test", "不对文件进行实际操作, 在控制台输出映射结果", false)
20
21
  .action(async (regexStr, replacement, options) => {
21
22
  const regex = new RegExp(regexStr);
22
23
  const excludeRegex = options.exclude ? new RegExp(options.exclude) : null;
@@ -33,6 +34,7 @@ export const CmdMapPath = (program: Command) => program
33
34
  const mapPath = async (source:string,target:string)=>{
34
35
  const dir = path.parse(target).dir;
35
36
  await UtilFT.ensurePathExists(dir,{dir:true});
37
+ if(options.test) return SLogger.info(`${source} -> ${target}`);
36
38
  if (options.copy)
37
39
  await fs.promises.copyFile(source, target);
38
40
  else