ql-publish 0.0.7 → 0.0.8

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.
Files changed (2) hide show
  1. package/package.json +1 -4
  2. package/upload/u.js +14 -2
package/package.json CHANGED
@@ -1,9 +1,6 @@
1
1
  {
2
2
  "name": "ql-publish",
3
- "version": "0.0.7",
4
- "publishConfig": {
5
- "registry": "https://registry.npmjs.org/"
6
- },
3
+ "version": "0.0.8",
7
4
  "scripts": {},
8
5
  "dependencies": {
9
6
  "@alicloud/cdn20180510": "^7.0.1",
package/upload/u.js CHANGED
@@ -465,15 +465,27 @@ const compressAction = (localPath, archiveName) => {
465
465
  return new Promise((resolve, reject) => {
466
466
  logger.warn(`正在压缩文件: ${localPath} -> ${archiveName}`);
467
467
 
468
+ // 规范化路径,移除末尾的反斜杠,防止 Windows 下双引号被转义
469
+ // 例如:'D:\path\' -> 'D:\path' 或 'D:/path'
470
+ let normalizedLocalPath = path.normalize(localPath);
471
+ if (normalizedLocalPath.endsWith(path.sep)) {
472
+ normalizedLocalPath = normalizedLocalPath.slice(0, -1);
473
+ }
474
+
475
+ // 在 Windows 上将反斜杠转换为正斜杠,避免转义问题
476
+ if (process.platform === 'win32') {
477
+ normalizedLocalPath = normalizedLocalPath.split(path.sep).join('/');
478
+ }
479
+
468
480
  // 构建压缩命令
469
481
  let command;
470
482
  if (process.platform === 'darwin') {
471
483
  // macOS: COPYFILE_DISABLE=1 和 --no-xattrs 用于防止 macOS 的扩展属性(如 com.apple.provenance)被打包
472
- command = `COPYFILE_DISABLE=1 tar --no-xattrs -czf "${archiveName}" -C "${localPath}" .`;
484
+ command = `COPYFILE_DISABLE=1 tar --no-xattrs -czf "${archiveName}" -C "${normalizedLocalPath}" .`;
473
485
  } else {
474
486
  // Windows/Linux: 标准 tar 命令
475
487
  // Windows 10+ 自带 tar.exe,支持 -czf 和 -C
476
- command = `tar -czf "${archiveName}" -C "${localPath}" .`;
488
+ command = `tar -czf "${archiveName}" -C "${normalizedLocalPath}" .`;
477
489
  }
478
490
 
479
491
  exec(command, (err) => {