@ffflorian/jszip-cli 3.10.0 → 3.10.1

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.
@@ -10,7 +10,7 @@ export declare class BuildService {
10
10
  private readonly options;
11
11
  private readonly progressBar;
12
12
  constructor(options: Required<TerminalOptions>);
13
- add(rawEntries: string[]): BuildService;
13
+ add(rawEntries: string[]): Promise<BuildService>;
14
14
  save(): Promise<BuildService>;
15
15
  /**
16
16
  * Note: glob patterns should always use / as a path separator, even on Windows systems,
@@ -3,7 +3,7 @@ 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';
6
- import { globSync } from 'glob';
6
+ import { glob } from 'glob';
7
7
  import { FileService } from './FileService.js';
8
8
  export class BuildService {
9
9
  constructor(options) {
@@ -26,17 +26,18 @@ export class BuildService {
26
26
  });
27
27
  this.compressedFilesCount = 0;
28
28
  }
29
- add(rawEntries) {
29
+ async add(rawEntries) {
30
30
  this.logger.info(`Adding ${rawEntries.length} entr${rawEntries.length === 1 ? 'y' : 'ies'} to ZIP file.`);
31
31
  const normalizedEntries = this.normalizePaths(rawEntries);
32
- this.entries = globSync(normalizedEntries).map(rawEntry => {
32
+ this.entries = [];
33
+ for (const rawEntry of await glob(normalizedEntries)) {
33
34
  const resolvedPath = path.resolve(rawEntry);
34
35
  const baseName = path.basename(rawEntry);
35
- return {
36
+ this.entries.push({
36
37
  resolvedPath,
37
38
  zipPath: baseName,
38
- };
39
- });
39
+ });
40
+ }
40
41
  return this;
41
42
  }
42
43
  async save() {
@@ -15,7 +15,7 @@ export declare class JSZipCLI {
15
15
  * @param rawEntries The entries (files, directories) to add.
16
16
  * If not specified, entries from configuration file are used.
17
17
  */
18
- add(rawEntries?: string[]): BuildService;
18
+ add(rawEntries?: string[]): Promise<BuildService>;
19
19
  /**
20
20
  * Add files and directories to the ZIP file.
21
21
  * @param rawEntries The entries (files, directories) to extract.
package/dist/JSZipCLI.js CHANGED
@@ -69,7 +69,8 @@ export class JSZipCLI {
69
69
  throw new Error('No configuration file and no mode specified.');
70
70
  }
71
71
  if (this.options.mode === 'add') {
72
- const { outputFile, compressedFilesCount } = await this.add().save();
72
+ const buildService = await this.add();
73
+ const { outputFile, compressedFilesCount } = await buildService.save();
73
74
  if (this.options.outputEntry && !this.options.quiet) {
74
75
  console.info(`Done compressing ${compressedFilesCount} files to "${outputFile}".`);
75
76
  }
package/dist/cli.js CHANGED
@@ -50,7 +50,7 @@ commander
50
50
  ...(options.quiet && { quiet: options.quiet }),
51
51
  ...(options.verbose && { verbose: options.verbose }),
52
52
  });
53
- jszip.add(entries);
53
+ await jszip.add(entries);
54
54
  const { outputFile, compressedFilesCount } = await jszip.save();
55
55
  if (options.output && !options.quiet) {
56
56
  console.info(`Done compressing ${compressedFilesCount} files to "${outputFile}".`);
package/package.json CHANGED
@@ -42,6 +42,6 @@
42
42
  "test": "vitest run"
43
43
  },
44
44
  "type": "module",
45
- "version": "3.10.0",
46
- "gitHead": "7af92a4eda3264ed76c22915d30080c4f12dbf55"
45
+ "version": "3.10.1",
46
+ "gitHead": "eedb2984fd69190a0b69a992d18fe451e714e04d"
47
47
  }