@ffflorian/jszip-cli
Advanced tools
@@ -13,3 +13,3 @@ import { TerminalOptions } from './interfaces.js'; | ||
| constructor(options: Required<TerminalOptions>); | ||
| add(rawEntries: string[]): BuildService; | ||
| add(rawEntries: string[]): Promise<BuildService>; | ||
| save(): Promise<BuildService>; | ||
@@ -16,0 +16,0 @@ /** |
@@ -6,3 +6,3 @@ import path from 'node:path'; | ||
| import progress from 'progress'; | ||
| import { globSync } from 'glob'; | ||
| import { glob } from 'glob'; | ||
| import { FileService } from './FileService.js'; | ||
@@ -30,13 +30,14 @@ export class BuildService { | ||
| } | ||
| add(rawEntries) { | ||
| async add(rawEntries) { | ||
| this.logger.info(`Adding ${rawEntries.length} entr${rawEntries.length === 1 ? 'y' : 'ies'} to ZIP file.`); | ||
| const normalizedEntries = this.normalizePaths(rawEntries); | ||
| this.entries = globSync(normalizedEntries).map(rawEntry => { | ||
| this.entries = []; | ||
| for (const rawEntry of await glob(normalizedEntries)) { | ||
| const resolvedPath = path.resolve(rawEntry); | ||
| const baseName = path.basename(rawEntry); | ||
| return { | ||
| this.entries.push({ | ||
| resolvedPath, | ||
| zipPath: baseName, | ||
| }; | ||
| }); | ||
| }); | ||
| } | ||
| return this; | ||
@@ -43,0 +44,0 @@ } |
+1
-1
@@ -53,3 +53,3 @@ #!/usr/bin/env node | ||
| }); | ||
| jszip.add(entries); | ||
| await jszip.add(entries); | ||
| const { outputFile, compressedFilesCount } = await jszip.save(); | ||
@@ -56,0 +56,0 @@ if (options.output && !options.quiet) { |
@@ -18,3 +18,3 @@ import { BuildService } from './BuildService.js'; | ||
| */ | ||
| add(rawEntries?: string[]): BuildService; | ||
| add(rawEntries?: string[]): Promise<BuildService>; | ||
| /** | ||
@@ -21,0 +21,0 @@ * Add files and directories to the ZIP file. |
+2
-1
@@ -72,3 +72,4 @@ import { cosmiconfigSync } from 'cosmiconfig'; | ||
| if (this.options.mode === 'add') { | ||
| const { outputFile, compressedFilesCount } = await this.add().save(); | ||
| const buildService = await this.add(); | ||
| const { outputFile, compressedFilesCount } = await buildService.save(); | ||
| if (this.options.outputEntry && !this.options.quiet) { | ||
@@ -75,0 +76,0 @@ console.info(`Done compressing ${compressedFilesCount} files to "${outputFile}".`); |
+2
-2
@@ -45,4 +45,4 @@ { | ||
| "type": "module", | ||
| "version": "3.10.0", | ||
| "gitHead": "7af92a4eda3264ed76c22915d30080c4f12dbf55" | ||
| "version": "3.10.1", | ||
| "gitHead": "eedb2984fd69190a0b69a992d18fe451e714e04d" | ||
| } |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
68349
0.16%734
0.27%