@ffflorian/jszip-cli 3.9.0 → 3.10.0

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.
@@ -1,5 +1,5 @@
1
1
  import path from 'node:path';
2
- import fs from 'fs-extra';
2
+ import { promises as fs } from 'node:fs';
3
3
  import JSZip from 'jszip';
4
4
  import logdown from 'logdown';
5
5
  import progress from 'progress';
@@ -1,6 +1,6 @@
1
+ import fs from 'node:fs/promises';
1
2
  import os from 'node:os';
2
3
  import path from 'node:path';
3
- import fs from 'fs-extra';
4
4
  import JSZip from 'jszip';
5
5
  import logdown from 'logdown';
6
6
  import progress from 'progress';
@@ -26,7 +26,10 @@ export class ExtractService {
26
26
  for (const entry of rawEntries) {
27
27
  const jszip = new JSZip();
28
28
  if (this.outputDir) {
29
- await fs.ensureDir(this.outputDir);
29
+ try {
30
+ await fs.mkdir(this.outputDir, { recursive: true });
31
+ }
32
+ catch (_a) { }
30
33
  }
31
34
  const resolvedPath = path.resolve(entry);
32
35
  const data = await fs.readFile(resolvedPath);
@@ -45,10 +48,14 @@ export class ExtractService {
45
48
  }
46
49
  });
47
50
  let lastPercent = 0;
48
- await Promise.all(entries.map(async ([filePath, entry], index) => {
51
+ let index = 0;
52
+ for (const [filePath, entry] of entries) {
49
53
  const resolvedFilePath = path.join(this.outputDir, filePath);
50
54
  if (entry.dir) {
51
- await fs.ensureDir(resolvedFilePath);
55
+ try {
56
+ await fs.mkdir(resolvedFilePath, { recursive: true });
57
+ }
58
+ catch (_b) { }
52
59
  }
53
60
  else {
54
61
  const data = await entry.async('nodebuffer');
@@ -70,7 +77,8 @@ export class ExtractService {
70
77
  else if (entry.unixPermissions) {
71
78
  await fs.chmod(resolvedFilePath, entry.unixPermissions);
72
79
  }
73
- }));
80
+ index++;
81
+ }
74
82
  }
75
83
  return this;
76
84
  }
@@ -1,5 +1,5 @@
1
+ import fs from 'node:fs/promises';
1
2
  import path from 'node:path';
2
- import fs from 'fs-extra';
3
3
  import logdown from 'logdown';
4
4
  export class FileService {
5
5
  constructor(options) {
@@ -25,7 +25,10 @@ export class FileService {
25
25
  catch (_b) {
26
26
  this.logger.info(`Directory "${dirPath}" doesn't exist.`, this.options.force ? 'Creating.' : 'Not creating.');
27
27
  if (this.options.force) {
28
- await fs.ensureDir(dirPath);
28
+ try {
29
+ await fs.mkdir(dirPath, { recursive: true });
30
+ }
31
+ catch (_c) { }
29
32
  return true;
30
33
  }
31
34
  return false;
package/dist/cli.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
+ import fs from 'node:fs';
2
3
  import path from 'node:path';
3
4
  import { program as commander } from 'commander';
4
- import fs from 'fs-extra';
5
5
  import { JSZipCLI } from './JSZipCLI.js';
6
6
  const __dirname = import.meta.dirname;
7
7
  const packageJsonPath = path.join(__dirname, '../package.json');
8
- const { description, name, version } = fs.readJSONSync(packageJsonPath);
8
+ const { description, name, version } = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
9
9
  commander
10
10
  .name(name.replace(/^@[^/]+\//, ''))
11
11
  .description(description)
package/package.json CHANGED
@@ -4,7 +4,6 @@
4
4
  "dependencies": {
5
5
  "commander": "14.0.2",
6
6
  "cosmiconfig": "9.0.0",
7
- "fs-extra": "11.3.2",
8
7
  "glob": "11.0.3",
9
8
  "jszip": "3.10.1",
10
9
  "logdown": "3.3.1",
@@ -12,7 +11,6 @@
12
11
  },
13
12
  "description": "A zip CLI based on jszip.",
14
13
  "devDependencies": {
15
- "@types/fs-extra": "11.0.4",
16
14
  "@types/progress": "2.0.7",
17
15
  "cross-env": "10.1.0",
18
16
  "rimraf": "6.1.0",
@@ -44,6 +42,6 @@
44
42
  "test": "vitest run"
45
43
  },
46
44
  "type": "module",
47
- "version": "3.9.0",
48
- "gitHead": "710af5a32b89acf0765daa81ced41e5031f67116"
45
+ "version": "3.10.0",
46
+ "gitHead": "7af92a4eda3264ed76c22915d30080c4f12dbf55"
49
47
  }