xshell 1.2.33 → 1.2.34

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/file.js +5 -13
  2. package/package.json +6 -6
package/file.js CHANGED
@@ -289,22 +289,14 @@ export async function fdelete(fp, { print = true } = {}) {
289
289
  }
290
290
  /** 清空文件夹中的内容,实际为删除该文件夹后新建 */
291
291
  export async function fdclear(fpd, { print = true, permission = false } = {}) {
292
+ const need_permission = permission && process.platform !== 'win32';
292
293
  let stat;
293
- if (permission && process.platform !== 'win32')
294
+ if (need_permission)
294
295
  stat = await fstat(fpd);
295
296
  await fdelete(fpd, noprint);
296
- await fmkdir(fpd, noprint);
297
- if (stat) {
298
- let handle;
299
- try {
300
- handle = await fopen(fpd, 'w');
301
- await handle.chown(Number(stat.uid), Number(stat.gid));
302
- await handle.chmod(Number(stat.mode));
303
- }
304
- finally {
305
- handle?.close();
306
- }
307
- }
297
+ await fmkdir(fpd, need_permission ? { print: false, mode: Number(stat.mode) } : noprint);
298
+ if (need_permission)
299
+ await fsp.chown(fpd, Number(stat.uid), Number(stat.gid));
308
300
  if (print)
309
301
  console.log(`清空了文件夹 ${fpd}`);
310
302
  return fpd;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.2.33",
3
+ "version": "1.2.34",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -57,9 +57,9 @@
57
57
  "@svgr/webpack": "^8.1.0",
58
58
  "@types/sass-loader": "^8.0.9",
59
59
  "@types/ws": "^8.18.1",
60
- "@typescript-eslint/eslint-plugin": "^8.29.0",
61
- "@typescript-eslint/parser": "^8.29.0",
62
- "@typescript-eslint/utils": "^8.29.0",
60
+ "@typescript-eslint/eslint-plugin": "^8.29.1",
61
+ "@typescript-eslint/parser": "^8.29.1",
62
+ "@typescript-eslint/utils": "^8.29.1",
63
63
  "archiver": "^7.0.1",
64
64
  "chalk": "^5.4.1",
65
65
  "cli-table3": "^0.6.5",
@@ -98,7 +98,7 @@
98
98
  "undici": "^7.7.0",
99
99
  "vinyl": "^3.0.0",
100
100
  "vinyl-fs": "^4.0.0",
101
- "webpack": "^5.98.0",
101
+ "webpack": "^5.99.5",
102
102
  "webpack-bundle-analyzer": "^4.10.2",
103
103
  "ws": "^8.18.1"
104
104
  },
@@ -118,7 +118,7 @@
118
118
  "@types/tough-cookie": "^4.0.5",
119
119
  "@types/ua-parser-js": "^0.7.39",
120
120
  "@types/vinyl-fs": "^3.0.5",
121
- "@types/vscode": "^1.99.0",
121
+ "@types/vscode": "^1.99.1",
122
122
  "@types/webpack-bundle-analyzer": "^4.7.0"
123
123
  },
124
124
  "pnpm": {