@ffflorian/jszip-cli 3.6.5 → 3.7.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.
- package/dist/BuildService.d.ts +1 -1
- package/dist/BuildService.js +20 -50
- package/dist/ExtractService.d.ts +1 -1
- package/dist/ExtractService.js +20 -27
- package/dist/FileService.d.ts +1 -1
- package/dist/FileService.js +17 -24
- package/dist/JSZipCLI.d.ts +3 -3
- package/dist/JSZipCLI.js +9 -16
- package/dist/cli.js +21 -26
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -18
- package/dist/interfaces.js +1 -2
- package/package.json +9 -9
package/dist/BuildService.d.ts
CHANGED
package/dist/BuildService.js
CHANGED
|
@@ -1,53 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.BuildService = void 0;
|
|
30
|
-
const fs = __importStar(require("fs-extra"));
|
|
31
|
-
const jszip_1 = __importDefault(require("jszip"));
|
|
32
|
-
const logdown_1 = __importDefault(require("logdown"));
|
|
33
|
-
const path_1 = __importDefault(require("path"));
|
|
34
|
-
const progress_1 = __importDefault(require("progress"));
|
|
35
|
-
const FileService_1 = require("./FileService");
|
|
36
|
-
const glob_1 = require("glob");
|
|
37
|
-
class BuildService {
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import * as fs from 'fs-extra';
|
|
3
|
+
import JSZip from 'jszip';
|
|
4
|
+
import logdown from 'logdown';
|
|
5
|
+
import progress from 'progress';
|
|
6
|
+
import { globSync } from 'glob';
|
|
7
|
+
import { FileService } from './FileService.js';
|
|
8
|
+
export class BuildService {
|
|
38
9
|
constructor(options) {
|
|
39
|
-
this.fileService = new
|
|
40
|
-
this.jszip = new
|
|
10
|
+
this.fileService = new FileService(options);
|
|
11
|
+
this.jszip = new JSZip();
|
|
41
12
|
this.options = options;
|
|
42
|
-
this.logger = (
|
|
13
|
+
this.logger = logdown('jszip-cli/BuildService', {
|
|
43
14
|
logger: console,
|
|
44
15
|
markdown: false,
|
|
45
16
|
});
|
|
46
17
|
this.logger.state = { isEnabled: options.verbose };
|
|
47
18
|
this.entries = [];
|
|
48
19
|
this.ignoreEntries = this.options.ignoreEntries.map(entry => entry instanceof RegExp ? entry : new RegExp(entry.replace(/\*/g, '.*')));
|
|
49
|
-
this.outputFile = this.options.outputEntry ?
|
|
50
|
-
this.progressBar = new
|
|
20
|
+
this.outputFile = this.options.outputEntry ? path.resolve(this.options.outputEntry) : null;
|
|
21
|
+
this.progressBar = new progress('Compressing [:bar] :percent :elapseds', {
|
|
51
22
|
complete: '=',
|
|
52
23
|
incomplete: ' ',
|
|
53
24
|
total: 100,
|
|
@@ -58,9 +29,9 @@ class BuildService {
|
|
|
58
29
|
add(rawEntries) {
|
|
59
30
|
this.logger.info(`Adding ${rawEntries.length} entr${rawEntries.length === 1 ? 'y' : 'ies'} to ZIP file.`);
|
|
60
31
|
const normalizedEntries = this.normalizePaths(rawEntries);
|
|
61
|
-
this.entries =
|
|
62
|
-
const resolvedPath =
|
|
63
|
-
const baseName =
|
|
32
|
+
this.entries = globSync(normalizedEntries).map(rawEntry => {
|
|
33
|
+
const resolvedPath = path.resolve(rawEntry);
|
|
34
|
+
const baseName = path.basename(rawEntry);
|
|
64
35
|
return {
|
|
65
36
|
resolvedPath,
|
|
66
37
|
zipPath: baseName,
|
|
@@ -74,7 +45,7 @@ class BuildService {
|
|
|
74
45
|
const data = await this.getBuffer();
|
|
75
46
|
if (this.outputFile) {
|
|
76
47
|
if (!this.outputFile.match(/\.\w+$/)) {
|
|
77
|
-
this.outputFile =
|
|
48
|
+
this.outputFile = path.join(this.outputFile, 'data.zip');
|
|
78
49
|
}
|
|
79
50
|
this.logger.info(`Saving finished zip file to "${this.outputFile}" ...`);
|
|
80
51
|
await this.fileService.writeFile(data, this.outputFile);
|
|
@@ -181,9 +152,9 @@ class BuildService {
|
|
|
181
152
|
async checkOutput() {
|
|
182
153
|
if (this.outputFile) {
|
|
183
154
|
if (this.outputFile.match(/\.\w+$/)) {
|
|
184
|
-
const dirExists = await this.fileService.dirExists(
|
|
155
|
+
const dirExists = await this.fileService.dirExists(path.dirname(this.outputFile));
|
|
185
156
|
if (!dirExists) {
|
|
186
|
-
throw new Error(`Directory "${
|
|
157
|
+
throw new Error(`Directory "${path.dirname(this.outputFile)}" doesn't exist or is not writable.`);
|
|
187
158
|
}
|
|
188
159
|
const fileIsWritable = await this.fileService.fileIsWritable(this.outputFile);
|
|
189
160
|
if (!fileIsWritable) {
|
|
@@ -220,7 +191,7 @@ class BuildService {
|
|
|
220
191
|
const dirEntries = await fs.readdir(entry.resolvedPath);
|
|
221
192
|
for (const dirEntry of dirEntries) {
|
|
222
193
|
const newZipPath = entry.zipPath === '.' ? dirEntry : `${entry.zipPath}/${dirEntry}`;
|
|
223
|
-
const newResolvedPath =
|
|
194
|
+
const newResolvedPath = path.join(entry.resolvedPath, dirEntry);
|
|
224
195
|
await this.checkEntry({
|
|
225
196
|
resolvedPath: newResolvedPath,
|
|
226
197
|
zipPath: newZipPath,
|
|
@@ -228,4 +199,3 @@ class BuildService {
|
|
|
228
199
|
}
|
|
229
200
|
}
|
|
230
201
|
}
|
|
231
|
-
exports.BuildService = BuildService;
|
package/dist/ExtractService.d.ts
CHANGED
package/dist/ExtractService.js
CHANGED
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const jszip_1 = __importDefault(require("jszip"));
|
|
9
|
-
const logdown_1 = __importDefault(require("logdown"));
|
|
10
|
-
const os_1 = __importDefault(require("os"));
|
|
11
|
-
const path_1 = __importDefault(require("path"));
|
|
12
|
-
const progress_1 = __importDefault(require("progress"));
|
|
13
|
-
class ExtractService {
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import fs from 'fs-extra';
|
|
4
|
+
import JSZip from 'jszip';
|
|
5
|
+
import logdown from 'logdown';
|
|
6
|
+
import progress from 'progress';
|
|
7
|
+
export class ExtractService {
|
|
14
8
|
constructor(options) {
|
|
15
9
|
this.options = options;
|
|
16
|
-
this.logger = (
|
|
10
|
+
this.logger = logdown('jszip-cli/ExtractService', {
|
|
17
11
|
logger: console,
|
|
18
12
|
markdown: false,
|
|
19
13
|
});
|
|
20
14
|
this.logger.state.isEnabled = this.options.verbose;
|
|
21
|
-
this.outputDir = this.options.outputEntry ?
|
|
22
|
-
this.progressBar = new
|
|
15
|
+
this.outputDir = this.options.outputEntry ? path.resolve(this.options.outputEntry) : null;
|
|
16
|
+
this.progressBar = new progress('Extracting [:bar] :percent :elapseds', {
|
|
23
17
|
complete: '=',
|
|
24
18
|
incomplete: ' ',
|
|
25
19
|
total: 100,
|
|
@@ -28,14 +22,14 @@ class ExtractService {
|
|
|
28
22
|
this.extractedFilesCount = 0;
|
|
29
23
|
}
|
|
30
24
|
async extract(rawEntries) {
|
|
31
|
-
const isWin32 =
|
|
25
|
+
const isWin32 = os.platform() === 'win32';
|
|
32
26
|
for (const entry of rawEntries) {
|
|
33
|
-
const jszip = new
|
|
27
|
+
const jszip = new JSZip();
|
|
34
28
|
if (this.outputDir) {
|
|
35
|
-
await
|
|
29
|
+
await fs.ensureDir(this.outputDir);
|
|
36
30
|
}
|
|
37
|
-
const resolvedPath =
|
|
38
|
-
const data = await
|
|
31
|
+
const resolvedPath = path.resolve(entry);
|
|
32
|
+
const data = await fs.readFile(resolvedPath);
|
|
39
33
|
const entries = [];
|
|
40
34
|
await jszip.loadAsync(data, { createFolders: true });
|
|
41
35
|
if (!this.outputDir) {
|
|
@@ -52,13 +46,13 @@ class ExtractService {
|
|
|
52
46
|
});
|
|
53
47
|
let lastPercent = 0;
|
|
54
48
|
await Promise.all(entries.map(async ([filePath, entry], index) => {
|
|
55
|
-
const resolvedFilePath =
|
|
49
|
+
const resolvedFilePath = path.join(this.outputDir, filePath);
|
|
56
50
|
if (entry.dir) {
|
|
57
|
-
await
|
|
51
|
+
await fs.ensureDir(resolvedFilePath);
|
|
58
52
|
}
|
|
59
53
|
else {
|
|
60
54
|
const data = await entry.async('nodebuffer');
|
|
61
|
-
await
|
|
55
|
+
await fs.writeFile(resolvedFilePath, data, {
|
|
62
56
|
encoding: 'utf-8',
|
|
63
57
|
});
|
|
64
58
|
this.extractedFilesCount++;
|
|
@@ -70,11 +64,11 @@ class ExtractService {
|
|
|
70
64
|
}
|
|
71
65
|
if (isWin32) {
|
|
72
66
|
if (entry.dosPermissions) {
|
|
73
|
-
await
|
|
67
|
+
await fs.chmod(resolvedFilePath, entry.dosPermissions);
|
|
74
68
|
}
|
|
75
69
|
}
|
|
76
70
|
else if (entry.unixPermissions) {
|
|
77
|
-
await
|
|
71
|
+
await fs.chmod(resolvedFilePath, entry.unixPermissions);
|
|
78
72
|
}
|
|
79
73
|
}));
|
|
80
74
|
}
|
|
@@ -88,4 +82,3 @@ class ExtractService {
|
|
|
88
82
|
});
|
|
89
83
|
}
|
|
90
84
|
}
|
|
91
|
-
exports.ExtractService = ExtractService;
|
package/dist/FileService.d.ts
CHANGED
package/dist/FileService.js
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FileService = void 0;
|
|
7
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
-
const logdown_1 = __importDefault(require("logdown"));
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
10
|
-
class FileService {
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import logdown from 'logdown';
|
|
4
|
+
export class FileService {
|
|
11
5
|
constructor(options) {
|
|
12
6
|
this.options = options;
|
|
13
|
-
this.logger = (
|
|
7
|
+
this.logger = logdown('jszip-cli/FileService', {
|
|
14
8
|
logger: console,
|
|
15
9
|
markdown: false,
|
|
16
10
|
});
|
|
@@ -18,48 +12,48 @@ class FileService {
|
|
|
18
12
|
}
|
|
19
13
|
async dirExists(dirPath) {
|
|
20
14
|
try {
|
|
21
|
-
await
|
|
15
|
+
await fs.access(dirPath, fs.constants.F_OK);
|
|
22
16
|
try {
|
|
23
|
-
await
|
|
17
|
+
await fs.access(dirPath, fs.constants.W_OK);
|
|
24
18
|
return true;
|
|
25
19
|
}
|
|
26
|
-
catch (
|
|
20
|
+
catch (_error) {
|
|
27
21
|
this.logger.info(`Directory "${dirPath}" exists but is not writable.`);
|
|
28
22
|
return false;
|
|
29
23
|
}
|
|
30
24
|
}
|
|
31
|
-
catch (
|
|
25
|
+
catch (_error) {
|
|
32
26
|
this.logger.info(`Directory "${dirPath}" doesn't exist.`, this.options.force ? 'Creating.' : 'Not creating.');
|
|
33
27
|
if (this.options.force) {
|
|
34
|
-
await
|
|
28
|
+
await fs.ensureDir(dirPath);
|
|
35
29
|
return true;
|
|
36
30
|
}
|
|
37
31
|
return false;
|
|
38
32
|
}
|
|
39
33
|
}
|
|
40
34
|
async fileIsReadable(filePath) {
|
|
41
|
-
const dirExists = await this.dirExists(
|
|
35
|
+
const dirExists = await this.dirExists(path.dirname(filePath));
|
|
42
36
|
if (dirExists) {
|
|
43
37
|
try {
|
|
44
|
-
await
|
|
38
|
+
await fs.access(filePath, fs.constants.F_OK | fs.constants.R_OK);
|
|
45
39
|
return true;
|
|
46
40
|
}
|
|
47
|
-
catch (
|
|
41
|
+
catch (_error) {
|
|
48
42
|
return false;
|
|
49
43
|
}
|
|
50
44
|
}
|
|
51
45
|
return false;
|
|
52
46
|
}
|
|
53
47
|
async fileIsWritable(filePath) {
|
|
54
|
-
const dirName =
|
|
48
|
+
const dirName = path.dirname(filePath);
|
|
55
49
|
const dirExists = await this.dirExists(dirName);
|
|
56
50
|
if (dirExists) {
|
|
57
51
|
try {
|
|
58
|
-
await
|
|
52
|
+
await fs.access(filePath, fs.constants.F_OK | fs.constants.R_OK);
|
|
59
53
|
this.logger.info(`File "${filePath}" already exists.`, this.options.force ? 'Forcing overwrite.' : 'Not overwriting.');
|
|
60
54
|
return this.options.force;
|
|
61
55
|
}
|
|
62
|
-
catch (
|
|
56
|
+
catch (_error) {
|
|
63
57
|
return true;
|
|
64
58
|
}
|
|
65
59
|
}
|
|
@@ -68,10 +62,9 @@ class FileService {
|
|
|
68
62
|
async writeFile(data, filePath) {
|
|
69
63
|
const fileIsWritable = await this.fileIsWritable(filePath);
|
|
70
64
|
if (fileIsWritable) {
|
|
71
|
-
await
|
|
65
|
+
await fs.writeFile(filePath, data);
|
|
72
66
|
return this;
|
|
73
67
|
}
|
|
74
68
|
throw new Error(`File "${this.options.outputEntry}" already exists.`);
|
|
75
69
|
}
|
|
76
70
|
}
|
|
77
|
-
exports.FileService = FileService;
|
package/dist/JSZipCLI.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BuildService } from './BuildService';
|
|
2
|
-
import { ExtractService } from './ExtractService';
|
|
3
|
-
import type { TerminalOptions } from './interfaces';
|
|
1
|
+
import { BuildService } from './BuildService.js';
|
|
2
|
+
import { ExtractService } from './ExtractService.js';
|
|
3
|
+
import type { TerminalOptions } from './interfaces.js';
|
|
4
4
|
export declare class JSZipCLI {
|
|
5
5
|
private readonly buildService;
|
|
6
6
|
private readonly configExplorer;
|
package/dist/JSZipCLI.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.JSZipCLI = void 0;
|
|
7
|
-
const cosmiconfig_1 = require("cosmiconfig");
|
|
8
|
-
const logdown_1 = __importDefault(require("logdown"));
|
|
9
|
-
const BuildService_1 = require("./BuildService");
|
|
10
|
-
const ExtractService_1 = require("./ExtractService");
|
|
1
|
+
import { cosmiconfigSync } from 'cosmiconfig';
|
|
2
|
+
import logdown from 'logdown';
|
|
3
|
+
import { BuildService } from './BuildService.js';
|
|
4
|
+
import { ExtractService } from './ExtractService.js';
|
|
11
5
|
const defaultOptions = {
|
|
12
6
|
compressionLevel: 5,
|
|
13
7
|
configFile: true,
|
|
@@ -18,21 +12,21 @@ const defaultOptions = {
|
|
|
18
12
|
quiet: false,
|
|
19
13
|
verbose: false,
|
|
20
14
|
};
|
|
21
|
-
class JSZipCLI {
|
|
15
|
+
export class JSZipCLI {
|
|
22
16
|
constructor(options) {
|
|
23
17
|
this.terminalOptions = options;
|
|
24
|
-
this.logger = (
|
|
18
|
+
this.logger = logdown('jszip-cli/index', {
|
|
25
19
|
logger: console,
|
|
26
20
|
markdown: false,
|
|
27
21
|
});
|
|
28
|
-
this.configExplorer =
|
|
22
|
+
this.configExplorer = cosmiconfigSync('jszip');
|
|
29
23
|
this.options = { ...defaultOptions, ...this.terminalOptions };
|
|
30
24
|
this.logger.state.isEnabled = this.options.verbose;
|
|
31
25
|
this.logger.info('Merged options', this.options);
|
|
32
26
|
this.checkConfigFile();
|
|
33
27
|
this.logger.info('Loaded options', this.options);
|
|
34
|
-
this.buildService = new
|
|
35
|
-
this.extractService = new
|
|
28
|
+
this.buildService = new BuildService(this.options);
|
|
29
|
+
this.extractService = new ExtractService(this.options);
|
|
36
30
|
}
|
|
37
31
|
/**
|
|
38
32
|
* Add files and directories to the ZIP file.
|
|
@@ -125,4 +119,3 @@ class JSZipCLI {
|
|
|
125
119
|
this.logger.state.isEnabled = this.options.verbose;
|
|
126
120
|
}
|
|
127
121
|
}
|
|
128
|
-
exports.JSZipCLI = JSZipCLI;
|
package/dist/cli.js
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
const packageJsonPath = fs_extra_1.default.existsSync(defaultPackageJsonPath)
|
|
13
|
-
? defaultPackageJsonPath
|
|
14
|
-
: path_1.default.join(__dirname, '../package.json');
|
|
15
|
-
const { description, name, version } = fs_extra_1.default.readJSONSync(packageJsonPath);
|
|
16
|
-
commander_1.program
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { program as commander } from 'commander';
|
|
5
|
+
import fs from 'fs-extra';
|
|
6
|
+
import { JSZipCLI } from './JSZipCLI.js';
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = path.dirname(__filename);
|
|
9
|
+
const packageJsonPath = path.join(__dirname, '../package.json');
|
|
10
|
+
const { description, name, version } = fs.readJSONSync(packageJsonPath);
|
|
11
|
+
commander
|
|
17
12
|
.name(name.replace(/^@[^/]+\//, ''))
|
|
18
13
|
.description(description)
|
|
19
14
|
.option('--noconfig', "don't look for a configuration file")
|
|
@@ -30,7 +25,7 @@ commander_1.program
|
|
|
30
25
|
console.error(`\n error: invalid command \`${args[0]}'\n`);
|
|
31
26
|
process.exit(1);
|
|
32
27
|
});
|
|
33
|
-
|
|
28
|
+
commander
|
|
34
29
|
.command('add')
|
|
35
30
|
.alias('a')
|
|
36
31
|
.description('add files and directories to a new ZIP archive')
|
|
@@ -45,9 +40,9 @@ commander_1.program
|
|
|
45
40
|
.option('-V, --verbose', 'enable verbose logging', false)
|
|
46
41
|
.arguments('[entries...]')
|
|
47
42
|
.action(async (entries) => {
|
|
48
|
-
const options =
|
|
43
|
+
const options = commander.opts();
|
|
49
44
|
try {
|
|
50
|
-
const jszip = new
|
|
45
|
+
const jszip = new JSZipCLI({
|
|
51
46
|
...(options.level && { compressionLevel: Number(options.level) }),
|
|
52
47
|
...((options.config && { configFile: options.config }) || (options.noconfig && { configFile: false })),
|
|
53
48
|
...(options.dereference && { dereferenceLinks: options.dereference }),
|
|
@@ -68,7 +63,7 @@ commander_1.program
|
|
|
68
63
|
process.exit(1);
|
|
69
64
|
}
|
|
70
65
|
});
|
|
71
|
-
|
|
66
|
+
commander
|
|
72
67
|
.command('extract')
|
|
73
68
|
.alias('e')
|
|
74
69
|
.description('extract files and directories from ZIP archive(s)')
|
|
@@ -81,9 +76,9 @@ commander_1.program
|
|
|
81
76
|
.option('-q, --quiet', "don't log anything excluding errors", false)
|
|
82
77
|
.arguments('<archives...>')
|
|
83
78
|
.action(async (archives) => {
|
|
84
|
-
const options =
|
|
79
|
+
const options = commander.opts();
|
|
85
80
|
try {
|
|
86
|
-
const { outputDir, extractedFilesCount } = await new
|
|
81
|
+
const { outputDir, extractedFilesCount } = await new JSZipCLI({
|
|
87
82
|
...((options.config && { configFile: options.config }) || (options.noconfig && { configFile: false })),
|
|
88
83
|
...(options.force && { force: options.force }),
|
|
89
84
|
...(options.ignore && { ignoreEntries: [options.ignore] }),
|
|
@@ -100,7 +95,7 @@ commander_1.program
|
|
|
100
95
|
process.exit(1);
|
|
101
96
|
}
|
|
102
97
|
});
|
|
103
|
-
|
|
98
|
+
commander
|
|
104
99
|
.command('fileMode', { hidden: true, isDefault: true })
|
|
105
100
|
.option('--noconfig', "don't look for a configuration file", false)
|
|
106
101
|
.option('-c, --config <path>', 'use a configuration file (default: .jsziprc.json)')
|
|
@@ -110,12 +105,12 @@ commander_1.program
|
|
|
110
105
|
.option('-V, --verbose', 'enable verbose logging', false)
|
|
111
106
|
.option('-q, --quiet', "don't log anything excluding errors", false)
|
|
112
107
|
.action(async () => {
|
|
113
|
-
const options =
|
|
108
|
+
const options = commander.opts();
|
|
114
109
|
try {
|
|
115
110
|
if (options.noconfig) {
|
|
116
|
-
|
|
111
|
+
commander.outputHelp();
|
|
117
112
|
}
|
|
118
|
-
await new
|
|
113
|
+
await new JSZipCLI({
|
|
119
114
|
...(options.config && { configFile: options.config }),
|
|
120
115
|
...(options.force && { force: options.force }),
|
|
121
116
|
...(options.ignore && { ignoreEntries: [options.ignore] }),
|
|
@@ -134,4 +129,4 @@ commander_1.program
|
|
|
134
129
|
process.exit(1);
|
|
135
130
|
}
|
|
136
131
|
});
|
|
137
|
-
|
|
132
|
+
commander.parse(process.argv);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './JSZipCLI';
|
|
2
|
-
export * from './interfaces';
|
|
1
|
+
export * from './JSZipCLI.js';
|
|
2
|
+
export * from './interfaces.js';
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./JSZipCLI"), exports);
|
|
18
|
-
__exportStar(require("./interfaces"), exports);
|
|
1
|
+
export * from './JSZipCLI.js';
|
|
2
|
+
export * from './interfaces.js';
|
package/dist/interfaces.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"commander": "12.1.0",
|
|
6
6
|
"cosmiconfig": "9.0.0",
|
|
7
7
|
"fs-extra": "11.2.0",
|
|
8
|
-
"glob": "
|
|
8
|
+
"glob": "11.0.0",
|
|
9
9
|
"jszip": "3.10.1",
|
|
10
10
|
"logdown": "3.3.1",
|
|
11
11
|
"progress": "2.0.3"
|
|
@@ -15,13 +15,12 @@
|
|
|
15
15
|
"@types/fs-extra": "11.0.4",
|
|
16
16
|
"@types/progress": "2.0.7",
|
|
17
17
|
"cross-env": "7.0.3",
|
|
18
|
-
"rimraf": "
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"vitest": "1.6.0"
|
|
18
|
+
"rimraf": "6.0.1",
|
|
19
|
+
"typescript": "5.5.4",
|
|
20
|
+
"vitest": "2.0.5"
|
|
22
21
|
},
|
|
23
22
|
"engines": {
|
|
24
|
-
"node": ">=
|
|
23
|
+
"node": ">= 18.0"
|
|
25
24
|
},
|
|
26
25
|
"files": [
|
|
27
26
|
"dist"
|
|
@@ -33,7 +32,7 @@
|
|
|
33
32
|
"zip"
|
|
34
33
|
],
|
|
35
34
|
"license": "GPL-3.0",
|
|
36
|
-
"
|
|
35
|
+
"module": "dist/index.js",
|
|
37
36
|
"name": "@ffflorian/jszip-cli",
|
|
38
37
|
"repository": "https://github.com/ffflorian/node-packages/tree/main/packages/jszip-cli",
|
|
39
38
|
"scripts": {
|
|
@@ -43,6 +42,7 @@
|
|
|
43
42
|
"start": "cross-env NODE_DEBUG=\"jszip-cli/*\" node --loader ts-node/esm src/cli.ts",
|
|
44
43
|
"test": "vitest run"
|
|
45
44
|
},
|
|
46
|
-
"
|
|
47
|
-
"
|
|
45
|
+
"type": "module",
|
|
46
|
+
"version": "3.7.1",
|
|
47
|
+
"gitHead": "aadf648655ecd0f6bea0c989542a16ff636c71a7"
|
|
48
48
|
}
|