@ffflorian/jszip-cli 3.5.1 → 3.5.3
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 → cjs/BuildService.d.ts} +1 -1
- package/dist/{BuildService.js → cjs/BuildService.js} +15 -19
- package/dist/{ExtractService.d.ts → cjs/ExtractService.d.ts} +1 -1
- package/dist/{ExtractService.js → cjs/ExtractService.js} +7 -12
- package/dist/{FileService.d.ts → cjs/FileService.d.ts} +2 -2
- package/dist/{FileService.js → cjs/FileService.js} +4 -9
- package/dist/{JSZipCLI.d.ts → cjs/JSZipCLI.d.ts} +3 -3
- package/dist/{JSZipCLI.js → cjs/JSZipCLI.js} +8 -13
- package/dist/{cli.js → cjs/cli.js} +20 -20
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/interfaces.js +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/esm/BuildService.d.ts +27 -0
- package/dist/esm/BuildService.js +201 -0
- package/dist/esm/ExtractService.d.ts +11 -0
- package/dist/esm/ExtractService.js +84 -0
- package/dist/esm/FileService.d.ts +11 -0
- package/dist/esm/FileService.js +70 -0
- package/dist/esm/JSZipCLI.d.ts +32 -0
- package/dist/esm/JSZipCLI.js +121 -0
- package/dist/esm/cli.d.ts +2 -0
- package/dist/esm/cli.js +112 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/interfaces.d.ts +28 -0
- package/dist/esm/interfaces.js +1 -0
- package/dist/esm/package.json +3 -0
- package/package.json +15 -11
- package/dist/BuildService.js.map +0 -1
- package/dist/ExtractService.js.map +0 -1
- package/dist/FileService.js.map +0 -1
- package/dist/JSZipCLI.js.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -19
- package/dist/index.js.map +0 -1
- package/dist/interfaces.js +0 -3
- package/dist/interfaces.js.map +0 -1
- /package/dist/{cli.d.ts → cjs/cli.d.ts} +0 -0
- /package/dist/{interfaces.d.ts → cjs/interfaces.d.ts} +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,18 +7,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const glob_1 = require("glob");
|
|
20
|
-
class BuildService {
|
|
10
|
+
import * as fs from 'fs-extra';
|
|
11
|
+
import JSZip from 'jszip';
|
|
12
|
+
import logdown from 'logdown';
|
|
13
|
+
import path from 'path';
|
|
14
|
+
import progress from 'progress';
|
|
15
|
+
import { FileService } from './FileService.js';
|
|
16
|
+
import { globSync } from 'glob';
|
|
17
|
+
export class BuildService {
|
|
21
18
|
constructor(options) {
|
|
22
|
-
this.fileService = new
|
|
19
|
+
this.fileService = new FileService(options);
|
|
23
20
|
this.jszip = new JSZip();
|
|
24
21
|
this.options = options;
|
|
25
22
|
this.logger = logdown('jszip-cli/BuildService', {
|
|
@@ -41,7 +38,7 @@ class BuildService {
|
|
|
41
38
|
add(rawEntries) {
|
|
42
39
|
this.logger.info(`Adding ${rawEntries.length} entr${rawEntries.length === 1 ? 'y' : 'ies'} to ZIP file.`);
|
|
43
40
|
const normalizedEntries = this.normalizePaths(rawEntries);
|
|
44
|
-
this.entries =
|
|
41
|
+
this.entries = globSync(normalizedEntries).map(rawEntry => {
|
|
45
42
|
const resolvedPath = path.resolve(rawEntry);
|
|
46
43
|
const baseName = path.basename(rawEntry);
|
|
47
44
|
return {
|
|
@@ -88,7 +85,7 @@ class BuildService {
|
|
|
88
85
|
}
|
|
89
86
|
catch (error) {
|
|
90
87
|
if (!this.options.quiet) {
|
|
91
|
-
|
|
88
|
+
this.logger.info(`Can't read file "${entry.resolvedPath}". Ignoring.`);
|
|
92
89
|
}
|
|
93
90
|
this.logger.info(error);
|
|
94
91
|
return;
|
|
@@ -114,7 +111,7 @@ class BuildService {
|
|
|
114
111
|
}
|
|
115
112
|
catch (error) {
|
|
116
113
|
if (!this.options.quiet) {
|
|
117
|
-
|
|
114
|
+
this.logger.info(`Can't read link "${entry.resolvedPath}". Ignoring.`);
|
|
118
115
|
}
|
|
119
116
|
this.logger.info(error);
|
|
120
117
|
return;
|
|
@@ -138,7 +135,7 @@ class BuildService {
|
|
|
138
135
|
}
|
|
139
136
|
catch (error) {
|
|
140
137
|
if (!this.options.quiet) {
|
|
141
|
-
|
|
138
|
+
this.logger.info(`Can't read file "${entry.resolvedPath}". Ignoring.`);
|
|
142
139
|
}
|
|
143
140
|
this.logger.info(error);
|
|
144
141
|
return;
|
|
@@ -153,6 +150,7 @@ class BuildService {
|
|
|
153
150
|
yield this.walkDir(entry);
|
|
154
151
|
}
|
|
155
152
|
else if (fileStat.isFile()) {
|
|
153
|
+
this.logger.info(`Found file "${entry.resolvedPath}".`);
|
|
156
154
|
this.logger.info(`Found file "${entry.resolvedPath}".`);
|
|
157
155
|
yield this.addFile(entry);
|
|
158
156
|
}
|
|
@@ -163,7 +161,7 @@ class BuildService {
|
|
|
163
161
|
else {
|
|
164
162
|
this.logger.info('Unknown file type.', { fileStat });
|
|
165
163
|
if (!this.options.quiet) {
|
|
166
|
-
|
|
164
|
+
this.logger.info(`Can't read file "${entry.resolvedPath}". Ignoring.`);
|
|
167
165
|
}
|
|
168
166
|
}
|
|
169
167
|
});
|
|
@@ -222,5 +220,3 @@ class BuildService {
|
|
|
222
220
|
});
|
|
223
221
|
}
|
|
224
222
|
}
|
|
225
|
-
exports.BuildService = BuildService;
|
|
226
|
-
//# sourceMappingURL=BuildService.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,15 +7,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const progress = require("progress");
|
|
19
|
-
class ExtractService {
|
|
10
|
+
import fs from 'fs-extra';
|
|
11
|
+
import JSZip from 'jszip';
|
|
12
|
+
import logdown from 'logdown';
|
|
13
|
+
import os from 'os';
|
|
14
|
+
import path from 'path';
|
|
15
|
+
import progress from 'progress';
|
|
16
|
+
export class ExtractService {
|
|
20
17
|
constructor(options) {
|
|
21
18
|
this.options = options;
|
|
22
19
|
this.logger = logdown('jszip-cli/ExtractService', {
|
|
@@ -96,5 +93,3 @@ class ExtractService {
|
|
|
96
93
|
});
|
|
97
94
|
}
|
|
98
95
|
}
|
|
99
|
-
exports.ExtractService = ExtractService;
|
|
100
|
-
//# sourceMappingURL=ExtractService.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { TerminalOptions } from './interfaces';
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import type { TerminalOptions } from './interfaces.js';
|
|
3
3
|
export declare class FileService {
|
|
4
4
|
private readonly logger;
|
|
5
5
|
private readonly options;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,12 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const path = require("path");
|
|
16
|
-
class FileService {
|
|
10
|
+
import fs from 'fs-extra';
|
|
11
|
+
import logdown from 'logdown';
|
|
12
|
+
import path from 'path';
|
|
13
|
+
export class FileService {
|
|
17
14
|
constructor(options) {
|
|
18
15
|
this.options = options;
|
|
19
16
|
this.logger = logdown('jszip-cli/FileService', {
|
|
@@ -88,5 +85,3 @@ class FileService {
|
|
|
88
85
|
});
|
|
89
86
|
}
|
|
90
87
|
}
|
|
91
|
-
exports.FileService = FileService;
|
|
92
|
-
//# sourceMappingURL=FileService.js.map
|
|
@@ -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;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,12 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const BuildService_1 = require("./BuildService");
|
|
16
|
-
const ExtractService_1 = require("./ExtractService");
|
|
10
|
+
import { cosmiconfigSync } from 'cosmiconfig';
|
|
11
|
+
import logdown from 'logdown';
|
|
12
|
+
import { BuildService } from './BuildService.js';
|
|
13
|
+
import { ExtractService } from './ExtractService.js';
|
|
17
14
|
const defaultOptions = {
|
|
18
15
|
compressionLevel: 5,
|
|
19
16
|
configFile: true,
|
|
@@ -24,21 +21,21 @@ const defaultOptions = {
|
|
|
24
21
|
quiet: false,
|
|
25
22
|
verbose: false,
|
|
26
23
|
};
|
|
27
|
-
class JSZipCLI {
|
|
24
|
+
export class JSZipCLI {
|
|
28
25
|
constructor(options) {
|
|
29
26
|
this.terminalOptions = options;
|
|
30
27
|
this.logger = logdown('jszip-cli/index', {
|
|
31
28
|
logger: console,
|
|
32
29
|
markdown: false,
|
|
33
30
|
});
|
|
34
|
-
this.configExplorer =
|
|
31
|
+
this.configExplorer = cosmiconfigSync('jszip');
|
|
35
32
|
this.options = Object.assign(Object.assign({}, defaultOptions), this.terminalOptions);
|
|
36
33
|
this.logger.state.isEnabled = this.options.verbose;
|
|
37
34
|
this.logger.info('Merged options', this.options);
|
|
38
35
|
this.checkConfigFile();
|
|
39
36
|
this.logger.info('Loaded options', this.options);
|
|
40
|
-
this.buildService = new
|
|
41
|
-
this.extractService = new
|
|
37
|
+
this.buildService = new BuildService(this.options);
|
|
38
|
+
this.extractService = new ExtractService(this.options);
|
|
42
39
|
}
|
|
43
40
|
/**
|
|
44
41
|
* Add files and directories to the ZIP file.
|
|
@@ -133,5 +130,3 @@ class JSZipCLI {
|
|
|
133
130
|
this.logger.state.isEnabled = this.options.verbose;
|
|
134
131
|
}
|
|
135
132
|
}
|
|
136
|
-
exports.JSZipCLI = JSZipCLI;
|
|
137
|
-
//# sourceMappingURL=JSZipCLI.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -9,17 +8,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
9
|
});
|
|
11
10
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
11
|
+
import { program as commander } from 'commander';
|
|
12
|
+
import fs from 'fs-extra';
|
|
13
|
+
import path from 'path';
|
|
14
|
+
import { fileURLToPath } from 'url';
|
|
15
|
+
import { JSZipCLI } from './JSZipCLI.js';
|
|
16
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
17
|
+
const __dirname = path.dirname(__filename);
|
|
18
|
+
const defaultPackageJsonPath = path.join(__dirname, '../../package.json');
|
|
18
19
|
const packageJsonPath = fs.existsSync(defaultPackageJsonPath)
|
|
19
20
|
? defaultPackageJsonPath
|
|
20
21
|
: path.join(__dirname, '../package.json');
|
|
21
22
|
const { description, name, version } = fs.readJSONSync(packageJsonPath);
|
|
22
|
-
|
|
23
|
+
commander
|
|
23
24
|
.name(name.replace(/^@[^/]+\//, ''))
|
|
24
25
|
.description(description)
|
|
25
26
|
.option('--noconfig', "don't look for a configuration file")
|
|
@@ -36,7 +37,7 @@ commander_1.program
|
|
|
36
37
|
console.error(`\n error: invalid command \`${args[0]}'\n`);
|
|
37
38
|
process.exit(1);
|
|
38
39
|
});
|
|
39
|
-
|
|
40
|
+
commander
|
|
40
41
|
.command('add')
|
|
41
42
|
.alias('a')
|
|
42
43
|
.description('add files and directories to a new ZIP archive')
|
|
@@ -51,9 +52,9 @@ commander_1.program
|
|
|
51
52
|
.option('-V, --verbose', 'enable verbose logging', false)
|
|
52
53
|
.arguments('[entries...]')
|
|
53
54
|
.action((entries) => __awaiter(void 0, void 0, void 0, function* () {
|
|
54
|
-
const options =
|
|
55
|
+
const options = commander.opts();
|
|
55
56
|
try {
|
|
56
|
-
const jszip = new
|
|
57
|
+
const jszip = new JSZipCLI(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (options.level && { compressionLevel: Number(options.level) })), ((options.config && { configFile: options.config }) || (options.noconfig && { configFile: false }))), (options.dereference && { dereferenceLinks: options.dereference })), (options.force && { force: options.force })), (options.ignore && { ignoreEntries: [options.ignore] })), (options.output && { outputEntry: options.output })), (options.quiet && { quiet: options.quiet })), (options.verbose && { verbose: options.verbose })));
|
|
57
58
|
jszip.add(entries);
|
|
58
59
|
const { outputFile, compressedFilesCount } = yield jszip.save();
|
|
59
60
|
if (options.output && !options.quiet) {
|
|
@@ -65,7 +66,7 @@ commander_1.program
|
|
|
65
66
|
process.exit(1);
|
|
66
67
|
}
|
|
67
68
|
}));
|
|
68
|
-
|
|
69
|
+
commander
|
|
69
70
|
.command('extract')
|
|
70
71
|
.alias('e')
|
|
71
72
|
.description('extract files and directories from ZIP archive(s)')
|
|
@@ -78,9 +79,9 @@ commander_1.program
|
|
|
78
79
|
.option('-q, --quiet', "don't log anything excluding errors", false)
|
|
79
80
|
.arguments('<archives...>')
|
|
80
81
|
.action((archives) => __awaiter(void 0, void 0, void 0, function* () {
|
|
81
|
-
const options =
|
|
82
|
+
const options = commander.opts();
|
|
82
83
|
try {
|
|
83
|
-
const { outputDir, extractedFilesCount } = yield new
|
|
84
|
+
const { outputDir, extractedFilesCount } = yield new JSZipCLI(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((options.config && { configFile: options.config }) || (options.noconfig && { configFile: false }))), (options.force && { force: options.force })), (options.ignore && { ignoreEntries: [options.ignore] })), (options.output && { outputEntry: options.output })), (options.quiet && { quiet: options.quiet })), (options.verbose && { verbose: options.verbose }))).extract(archives);
|
|
84
85
|
if (options.output && !options.quiet) {
|
|
85
86
|
console.info(`Done extracting ${extractedFilesCount} files to "${outputDir}".`);
|
|
86
87
|
}
|
|
@@ -90,7 +91,7 @@ commander_1.program
|
|
|
90
91
|
process.exit(1);
|
|
91
92
|
}
|
|
92
93
|
}));
|
|
93
|
-
|
|
94
|
+
commander
|
|
94
95
|
.command('fileMode', { hidden: true, isDefault: true })
|
|
95
96
|
.option('--noconfig', "don't look for a configuration file", false)
|
|
96
97
|
.option('-c, --config <path>', 'use a configuration file (default: .jsziprc.json)')
|
|
@@ -100,12 +101,12 @@ commander_1.program
|
|
|
100
101
|
.option('-V, --verbose', 'enable verbose logging', false)
|
|
101
102
|
.option('-q, --quiet', "don't log anything excluding errors", false)
|
|
102
103
|
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
103
|
-
const options =
|
|
104
|
+
const options = commander.opts();
|
|
104
105
|
try {
|
|
105
106
|
if (options.noconfig) {
|
|
106
|
-
|
|
107
|
+
commander.outputHelp();
|
|
107
108
|
}
|
|
108
|
-
yield new
|
|
109
|
+
yield new JSZipCLI(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (options.config && { configFile: options.config })), (options.force && { force: options.force })), (options.ignore && { ignoreEntries: [options.ignore] })), (options.output && { outputEntry: options.output })), (options.quiet && { quiet: options.quiet })), (options.verbose && { verbose: options.verbose }))).fileMode();
|
|
109
110
|
}
|
|
110
111
|
catch (error) {
|
|
111
112
|
if (error.message.includes('ENOENT')) {
|
|
@@ -117,5 +118,4 @@ commander_1.program
|
|
|
117
118
|
process.exit(1);
|
|
118
119
|
}
|
|
119
120
|
}));
|
|
120
|
-
|
|
121
|
-
//# sourceMappingURL=cli.js.map
|
|
121
|
+
commander.parse(process.argv);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TerminalOptions } from './interfaces.js';
|
|
2
|
+
export declare class BuildService {
|
|
3
|
+
compressedFilesCount: number;
|
|
4
|
+
outputFile: string | null;
|
|
5
|
+
private entries;
|
|
6
|
+
private readonly fileService;
|
|
7
|
+
private readonly ignoreEntries;
|
|
8
|
+
private readonly jszip;
|
|
9
|
+
private readonly logger;
|
|
10
|
+
private readonly options;
|
|
11
|
+
private readonly progressBar;
|
|
12
|
+
constructor(options: Required<TerminalOptions>);
|
|
13
|
+
add(rawEntries: string[]): BuildService;
|
|
14
|
+
save(): Promise<BuildService>;
|
|
15
|
+
/**
|
|
16
|
+
* Note: glob patterns should always use / as a path separator, even on Windows systems,
|
|
17
|
+
* as \ is used to escape glob characters.
|
|
18
|
+
* https://github.com/isaacs/node-glob
|
|
19
|
+
*/
|
|
20
|
+
private normalizePaths;
|
|
21
|
+
private addFile;
|
|
22
|
+
private addLink;
|
|
23
|
+
private checkEntry;
|
|
24
|
+
private checkOutput;
|
|
25
|
+
private getBuffer;
|
|
26
|
+
private walkDir;
|
|
27
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import * as fs from 'fs-extra';
|
|
2
|
+
import JSZip from 'jszip';
|
|
3
|
+
import logdown from 'logdown';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import progress from 'progress';
|
|
6
|
+
import { FileService } from './FileService.js';
|
|
7
|
+
import { globSync } from 'glob';
|
|
8
|
+
export class BuildService {
|
|
9
|
+
constructor(options) {
|
|
10
|
+
this.fileService = new FileService(options);
|
|
11
|
+
this.jszip = new JSZip();
|
|
12
|
+
this.options = options;
|
|
13
|
+
this.logger = logdown('jszip-cli/BuildService', {
|
|
14
|
+
logger: console,
|
|
15
|
+
markdown: false,
|
|
16
|
+
});
|
|
17
|
+
this.logger.state = { isEnabled: options.verbose };
|
|
18
|
+
this.entries = [];
|
|
19
|
+
this.ignoreEntries = this.options.ignoreEntries.map(entry => entry instanceof RegExp ? entry : new RegExp(entry.replace(/\*/g, '.*')));
|
|
20
|
+
this.outputFile = this.options.outputEntry ? path.resolve(this.options.outputEntry) : null;
|
|
21
|
+
this.progressBar = new progress('Compressing [:bar] :percent :elapseds', {
|
|
22
|
+
complete: '=',
|
|
23
|
+
incomplete: ' ',
|
|
24
|
+
total: 100,
|
|
25
|
+
width: 20,
|
|
26
|
+
});
|
|
27
|
+
this.compressedFilesCount = 0;
|
|
28
|
+
}
|
|
29
|
+
add(rawEntries) {
|
|
30
|
+
this.logger.info(`Adding ${rawEntries.length} entr${rawEntries.length === 1 ? 'y' : 'ies'} to ZIP file.`);
|
|
31
|
+
const normalizedEntries = this.normalizePaths(rawEntries);
|
|
32
|
+
this.entries = globSync(normalizedEntries).map(rawEntry => {
|
|
33
|
+
const resolvedPath = path.resolve(rawEntry);
|
|
34
|
+
const baseName = path.basename(rawEntry);
|
|
35
|
+
return {
|
|
36
|
+
resolvedPath,
|
|
37
|
+
zipPath: baseName,
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
async save() {
|
|
43
|
+
await this.checkOutput();
|
|
44
|
+
await Promise.all(this.entries.map(entry => this.checkEntry(entry)));
|
|
45
|
+
const data = await this.getBuffer();
|
|
46
|
+
if (this.outputFile) {
|
|
47
|
+
if (!this.outputFile.match(/\.\w+$/)) {
|
|
48
|
+
this.outputFile = path.join(this.outputFile, 'data.zip');
|
|
49
|
+
}
|
|
50
|
+
this.logger.info(`Saving finished zip file to "${this.outputFile}" ...`);
|
|
51
|
+
await this.fileService.writeFile(data, this.outputFile);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
process.stdout.write(data);
|
|
55
|
+
}
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Note: glob patterns should always use / as a path separator, even on Windows systems,
|
|
60
|
+
* as \ is used to escape glob characters.
|
|
61
|
+
* https://github.com/isaacs/node-glob
|
|
62
|
+
*/
|
|
63
|
+
normalizePaths(rawEntries) {
|
|
64
|
+
return rawEntries.map(entry => entry.replace(/\\/g, '/'));
|
|
65
|
+
}
|
|
66
|
+
async addFile(entry, isLink = false) {
|
|
67
|
+
const { resolvedPath, zipPath } = entry;
|
|
68
|
+
let fileStat;
|
|
69
|
+
let fileData;
|
|
70
|
+
try {
|
|
71
|
+
fileData = isLink ? await fs.readlink(resolvedPath) : await fs.readFile(resolvedPath);
|
|
72
|
+
fileStat = await fs.lstat(resolvedPath);
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
if (!this.options.quiet) {
|
|
76
|
+
this.logger.info(`Can't read file "${entry.resolvedPath}". Ignoring.`);
|
|
77
|
+
}
|
|
78
|
+
this.logger.info(error);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
this.logger.info(`Adding file "${resolvedPath}" to ZIP file ...`);
|
|
82
|
+
this.jszip.file(zipPath, fileData, {
|
|
83
|
+
createFolders: true,
|
|
84
|
+
date: fileStat.mtime,
|
|
85
|
+
// See https://github.com/Stuk/jszip/issues/550
|
|
86
|
+
// dosPermissions: fileStat.mode,
|
|
87
|
+
unixPermissions: fileStat.mode,
|
|
88
|
+
});
|
|
89
|
+
this.compressedFilesCount++;
|
|
90
|
+
}
|
|
91
|
+
async addLink(entry) {
|
|
92
|
+
const { resolvedPath, zipPath } = entry;
|
|
93
|
+
if (this.options.dereferenceLinks) {
|
|
94
|
+
let realPath;
|
|
95
|
+
try {
|
|
96
|
+
realPath = await fs.realpath(resolvedPath);
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
if (!this.options.quiet) {
|
|
100
|
+
this.logger.info(`Can't read link "${entry.resolvedPath}". Ignoring.`);
|
|
101
|
+
}
|
|
102
|
+
this.logger.info(error);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
this.logger.info(`Found real path "${realPath} for symbolic link".`);
|
|
106
|
+
await this.checkEntry({
|
|
107
|
+
resolvedPath: realPath,
|
|
108
|
+
zipPath,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
await this.addFile(entry, true);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
async checkEntry(entry) {
|
|
116
|
+
let fileStat;
|
|
117
|
+
try {
|
|
118
|
+
fileStat = await fs.lstat(entry.resolvedPath);
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
if (!this.options.quiet) {
|
|
122
|
+
this.logger.info(`Can't read file "${entry.resolvedPath}". Ignoring.`);
|
|
123
|
+
}
|
|
124
|
+
this.logger.info(error);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const ignoreEntries = this.ignoreEntries.filter(ignoreEntry => Boolean(entry.resolvedPath.match(ignoreEntry)));
|
|
128
|
+
if (ignoreEntries.length) {
|
|
129
|
+
this.logger.info(`Found ${entry.resolvedPath}. Not adding since it's on the ignore list:`, ignoreEntries.map(entry => String(entry)));
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (fileStat.isDirectory()) {
|
|
133
|
+
this.logger.info(`Found directory "${entry.resolvedPath}".`);
|
|
134
|
+
await this.walkDir(entry);
|
|
135
|
+
}
|
|
136
|
+
else if (fileStat.isFile()) {
|
|
137
|
+
this.logger.info(`Found file "${entry.resolvedPath}".`);
|
|
138
|
+
this.logger.info(`Found file "${entry.resolvedPath}".`);
|
|
139
|
+
await this.addFile(entry);
|
|
140
|
+
}
|
|
141
|
+
else if (fileStat.isSymbolicLink()) {
|
|
142
|
+
this.logger.info(`Found symbolic link "${entry.resolvedPath}".`);
|
|
143
|
+
await this.addLink(entry);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
this.logger.info('Unknown file type.', { fileStat });
|
|
147
|
+
if (!this.options.quiet) {
|
|
148
|
+
this.logger.info(`Can't read file "${entry.resolvedPath}". Ignoring.`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
async checkOutput() {
|
|
153
|
+
if (this.outputFile) {
|
|
154
|
+
if (this.outputFile.match(/\.\w+$/)) {
|
|
155
|
+
const dirExists = await this.fileService.dirExists(path.dirname(this.outputFile));
|
|
156
|
+
if (!dirExists) {
|
|
157
|
+
throw new Error(`Directory "${path.dirname(this.outputFile)}" doesn't exist or is not writable.`);
|
|
158
|
+
}
|
|
159
|
+
const fileIsWritable = await this.fileService.fileIsWritable(this.outputFile);
|
|
160
|
+
if (!fileIsWritable) {
|
|
161
|
+
throw new Error(`File "${this.outputFile}" already exists.`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
const dirExists = await this.fileService.dirExists(this.outputFile);
|
|
166
|
+
if (!dirExists) {
|
|
167
|
+
throw new Error(`Directory "${this.outputFile}" doesn't exist or is not writable.`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
getBuffer() {
|
|
173
|
+
const compressionType = this.options.compressionLevel === 0 ? 'STORE' : 'DEFLATE';
|
|
174
|
+
let lastPercent = 0;
|
|
175
|
+
return this.jszip.generateAsync({
|
|
176
|
+
compression: compressionType,
|
|
177
|
+
compressionOptions: {
|
|
178
|
+
level: this.options.compressionLevel,
|
|
179
|
+
},
|
|
180
|
+
type: 'nodebuffer',
|
|
181
|
+
}, ({ percent }) => {
|
|
182
|
+
const diff = Math.floor(percent) - Math.floor(lastPercent);
|
|
183
|
+
if (diff && !this.options.quiet) {
|
|
184
|
+
this.progressBar.tick(diff);
|
|
185
|
+
lastPercent = Math.floor(percent);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
async walkDir(entry) {
|
|
190
|
+
this.logger.info(`Walking directory ${entry.resolvedPath} ...`);
|
|
191
|
+
const dirEntries = await fs.readdir(entry.resolvedPath);
|
|
192
|
+
for (const dirEntry of dirEntries) {
|
|
193
|
+
const newZipPath = entry.zipPath === '.' ? dirEntry : `${entry.zipPath}/${dirEntry}`;
|
|
194
|
+
const newResolvedPath = path.join(entry.resolvedPath, dirEntry);
|
|
195
|
+
await this.checkEntry({
|
|
196
|
+
resolvedPath: newResolvedPath,
|
|
197
|
+
zipPath: newZipPath,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TerminalOptions } from './interfaces.js';
|
|
2
|
+
export declare class ExtractService {
|
|
3
|
+
extractedFilesCount: number;
|
|
4
|
+
outputDir: string | null;
|
|
5
|
+
private readonly logger;
|
|
6
|
+
private readonly options;
|
|
7
|
+
private readonly progressBar;
|
|
8
|
+
constructor(options: Required<TerminalOptions>);
|
|
9
|
+
extract(rawEntries: string[]): Promise<ExtractService>;
|
|
10
|
+
private printStream;
|
|
11
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import JSZip from 'jszip';
|
|
3
|
+
import logdown from 'logdown';
|
|
4
|
+
import os from 'os';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import progress from 'progress';
|
|
7
|
+
export class ExtractService {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
this.options = options;
|
|
10
|
+
this.logger = logdown('jszip-cli/ExtractService', {
|
|
11
|
+
logger: console,
|
|
12
|
+
markdown: false,
|
|
13
|
+
});
|
|
14
|
+
this.logger.state.isEnabled = this.options.verbose;
|
|
15
|
+
this.outputDir = this.options.outputEntry ? path.resolve(this.options.outputEntry) : null;
|
|
16
|
+
this.progressBar = new progress('Extracting [:bar] :percent :elapseds', {
|
|
17
|
+
complete: '=',
|
|
18
|
+
incomplete: ' ',
|
|
19
|
+
total: 100,
|
|
20
|
+
width: 20,
|
|
21
|
+
});
|
|
22
|
+
this.extractedFilesCount = 0;
|
|
23
|
+
}
|
|
24
|
+
async extract(rawEntries) {
|
|
25
|
+
const isWin32 = os.platform() === 'win32';
|
|
26
|
+
for (const entry of rawEntries) {
|
|
27
|
+
const jszip = new JSZip();
|
|
28
|
+
if (this.outputDir) {
|
|
29
|
+
await fs.ensureDir(this.outputDir);
|
|
30
|
+
}
|
|
31
|
+
const resolvedPath = path.resolve(entry);
|
|
32
|
+
const data = await fs.readFile(resolvedPath);
|
|
33
|
+
const entries = [];
|
|
34
|
+
await jszip.loadAsync(data, { createFolders: true });
|
|
35
|
+
if (!this.outputDir) {
|
|
36
|
+
await this.printStream(jszip.generateNodeStream());
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
jszip.forEach((filePath, entry) => {
|
|
40
|
+
if (filePath.includes('..')) {
|
|
41
|
+
this.logger.info(`Skipping bad path "${filePath}"`);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
entries.push([filePath, entry]);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
let lastPercent = 0;
|
|
48
|
+
await Promise.all(entries.map(async ([filePath, entry], index) => {
|
|
49
|
+
const resolvedFilePath = path.join(this.outputDir, filePath);
|
|
50
|
+
if (entry.dir) {
|
|
51
|
+
await fs.ensureDir(resolvedFilePath);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
const data = await entry.async('nodebuffer');
|
|
55
|
+
await fs.writeFile(resolvedFilePath, data, {
|
|
56
|
+
encoding: 'utf-8',
|
|
57
|
+
});
|
|
58
|
+
this.extractedFilesCount++;
|
|
59
|
+
const diff = Math.floor(index / entries.length) - Math.floor(lastPercent);
|
|
60
|
+
if (diff && !this.options.quiet) {
|
|
61
|
+
this.progressBar.tick(diff);
|
|
62
|
+
lastPercent = Math.floor(index / entries.length);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (isWin32) {
|
|
66
|
+
if (entry.dosPermissions) {
|
|
67
|
+
await fs.chmod(resolvedFilePath, entry.dosPermissions);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else if (entry.unixPermissions) {
|
|
71
|
+
await fs.chmod(resolvedFilePath, entry.unixPermissions);
|
|
72
|
+
}
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
return this;
|
|
76
|
+
}
|
|
77
|
+
printStream(fileStream) {
|
|
78
|
+
return new Promise((resolve, reject) => {
|
|
79
|
+
const stream = fileStream.pipe(process.stdout);
|
|
80
|
+
stream.on('finish', resolve);
|
|
81
|
+
stream.on('error', reject);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import type { TerminalOptions } from './interfaces.js';
|
|
3
|
+
export declare class FileService {
|
|
4
|
+
private readonly logger;
|
|
5
|
+
private readonly options;
|
|
6
|
+
constructor(options: Required<TerminalOptions>);
|
|
7
|
+
dirExists(dirPath: string): Promise<boolean>;
|
|
8
|
+
fileIsReadable(filePath: string): Promise<boolean>;
|
|
9
|
+
fileIsWritable(filePath: string): Promise<boolean>;
|
|
10
|
+
writeFile(data: Buffer, filePath: string): Promise<FileService>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import logdown from 'logdown';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
export class FileService {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
this.options = options;
|
|
7
|
+
this.logger = logdown('jszip-cli/FileService', {
|
|
8
|
+
logger: console,
|
|
9
|
+
markdown: false,
|
|
10
|
+
});
|
|
11
|
+
this.logger.state.isEnabled = this.options.verbose;
|
|
12
|
+
}
|
|
13
|
+
async dirExists(dirPath) {
|
|
14
|
+
try {
|
|
15
|
+
await fs.access(dirPath, fs.constants.F_OK);
|
|
16
|
+
try {
|
|
17
|
+
await fs.access(dirPath, fs.constants.W_OK);
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
this.logger.info(`Directory "${dirPath}" exists but is not writable.`);
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
this.logger.info(`Directory "${dirPath}" doesn't exist.`, this.options.force ? 'Creating.' : 'Not creating.');
|
|
27
|
+
if (this.options.force) {
|
|
28
|
+
await fs.ensureDir(dirPath);
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async fileIsReadable(filePath) {
|
|
35
|
+
const dirExists = await this.dirExists(path.dirname(filePath));
|
|
36
|
+
if (dirExists) {
|
|
37
|
+
try {
|
|
38
|
+
await fs.access(filePath, fs.constants.F_OK | fs.constants.R_OK);
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
async fileIsWritable(filePath) {
|
|
48
|
+
const dirName = path.dirname(filePath);
|
|
49
|
+
const dirExists = await this.dirExists(dirName);
|
|
50
|
+
if (dirExists) {
|
|
51
|
+
try {
|
|
52
|
+
await fs.access(filePath, fs.constants.F_OK | fs.constants.R_OK);
|
|
53
|
+
this.logger.info(`File "${filePath}" already exists.`, this.options.force ? 'Forcing overwrite.' : 'Not overwriting.');
|
|
54
|
+
return this.options.force;
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
async writeFile(data, filePath) {
|
|
63
|
+
const fileIsWritable = await this.fileIsWritable(filePath);
|
|
64
|
+
if (fileIsWritable) {
|
|
65
|
+
await fs.writeFile(filePath, data);
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
68
|
+
throw new Error(`File "${this.options.outputEntry}" already exists.`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BuildService } from './BuildService.js';
|
|
2
|
+
import { ExtractService } from './ExtractService.js';
|
|
3
|
+
import type { TerminalOptions } from './interfaces.js';
|
|
4
|
+
export declare class JSZipCLI {
|
|
5
|
+
private readonly buildService;
|
|
6
|
+
private readonly configExplorer;
|
|
7
|
+
private readonly configFile?;
|
|
8
|
+
private readonly extractService;
|
|
9
|
+
private readonly logger;
|
|
10
|
+
private options;
|
|
11
|
+
private readonly terminalOptions?;
|
|
12
|
+
constructor(options?: TerminalOptions);
|
|
13
|
+
/**
|
|
14
|
+
* Add files and directories to the ZIP file.
|
|
15
|
+
* @param rawEntries The entries (files, directories) to add.
|
|
16
|
+
* If not specified, entries from configuration file are used.
|
|
17
|
+
*/
|
|
18
|
+
add(rawEntries?: string[]): BuildService;
|
|
19
|
+
/**
|
|
20
|
+
* Add files and directories to the ZIP file.
|
|
21
|
+
* @param rawEntries The entries (files, directories) to extract.
|
|
22
|
+
* If not specified, entries from configuration file are used.
|
|
23
|
+
*/
|
|
24
|
+
extract(rawEntries?: string[]): Promise<ExtractService>;
|
|
25
|
+
/**
|
|
26
|
+
* Run in file mode - reads entries and settings from configuration file.
|
|
27
|
+
* Options from the constructor still take precedence.
|
|
28
|
+
*/
|
|
29
|
+
fileMode(): Promise<JSZipCLI>;
|
|
30
|
+
save(): Promise<BuildService>;
|
|
31
|
+
private checkConfigFile;
|
|
32
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { cosmiconfigSync } from 'cosmiconfig';
|
|
2
|
+
import logdown from 'logdown';
|
|
3
|
+
import { BuildService } from './BuildService.js';
|
|
4
|
+
import { ExtractService } from './ExtractService.js';
|
|
5
|
+
const defaultOptions = {
|
|
6
|
+
compressionLevel: 5,
|
|
7
|
+
configFile: true,
|
|
8
|
+
dereferenceLinks: false,
|
|
9
|
+
force: false,
|
|
10
|
+
ignoreEntries: [],
|
|
11
|
+
outputEntry: null,
|
|
12
|
+
quiet: false,
|
|
13
|
+
verbose: false,
|
|
14
|
+
};
|
|
15
|
+
export class JSZipCLI {
|
|
16
|
+
constructor(options) {
|
|
17
|
+
this.terminalOptions = options;
|
|
18
|
+
this.logger = logdown('jszip-cli/index', {
|
|
19
|
+
logger: console,
|
|
20
|
+
markdown: false,
|
|
21
|
+
});
|
|
22
|
+
this.configExplorer = cosmiconfigSync('jszip');
|
|
23
|
+
this.options = Object.assign(Object.assign({}, defaultOptions), this.terminalOptions);
|
|
24
|
+
this.logger.state.isEnabled = this.options.verbose;
|
|
25
|
+
this.logger.info('Merged options', this.options);
|
|
26
|
+
this.checkConfigFile();
|
|
27
|
+
this.logger.info('Loaded options', this.options);
|
|
28
|
+
this.buildService = new BuildService(this.options);
|
|
29
|
+
this.extractService = new ExtractService(this.options);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Add files and directories to the ZIP file.
|
|
33
|
+
* @param rawEntries The entries (files, directories) to add.
|
|
34
|
+
* If not specified, entries from configuration file are used.
|
|
35
|
+
*/
|
|
36
|
+
add(rawEntries) {
|
|
37
|
+
if (!rawEntries || !rawEntries.length) {
|
|
38
|
+
if (this.options.entries) {
|
|
39
|
+
rawEntries = this.options.entries;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
throw new Error('No entries to add.');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return this.buildService.add(rawEntries);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Add files and directories to the ZIP file.
|
|
49
|
+
* @param rawEntries The entries (files, directories) to extract.
|
|
50
|
+
* If not specified, entries from configuration file are used.
|
|
51
|
+
*/
|
|
52
|
+
extract(rawEntries) {
|
|
53
|
+
if (!rawEntries || !rawEntries.length) {
|
|
54
|
+
if (this.options.entries) {
|
|
55
|
+
rawEntries = this.options.entries;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
throw new Error('No entries to extract.');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return this.extractService.extract(rawEntries);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Run in file mode - reads entries and settings from configuration file.
|
|
65
|
+
* Options from the constructor still take precedence.
|
|
66
|
+
*/
|
|
67
|
+
async fileMode() {
|
|
68
|
+
if (!this.options.mode && !this.configFile) {
|
|
69
|
+
throw new Error('No configuration file and no mode specified.');
|
|
70
|
+
}
|
|
71
|
+
if (this.options.mode === 'add') {
|
|
72
|
+
const { outputFile, compressedFilesCount } = await this.add().save();
|
|
73
|
+
if (this.options.outputEntry && !this.options.quiet) {
|
|
74
|
+
console.info(`Done compressing ${compressedFilesCount} files to "${outputFile}".`);
|
|
75
|
+
}
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
else if (this.options.mode === 'extract') {
|
|
79
|
+
const { outputDir, extractedFilesCount } = await this.extract();
|
|
80
|
+
if (this.options.outputEntry && !this.options.quiet) {
|
|
81
|
+
console.info(`Done extracting ${extractedFilesCount} files to "${outputDir}".`);
|
|
82
|
+
}
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
throw new Error('No or invalid mode in configuration file defined.');
|
|
86
|
+
}
|
|
87
|
+
save() {
|
|
88
|
+
return this.buildService.save();
|
|
89
|
+
}
|
|
90
|
+
checkConfigFile() {
|
|
91
|
+
if (!this.options.configFile) {
|
|
92
|
+
this.logger.info('Not using any configuration file.');
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
let configResult = null;
|
|
96
|
+
if (typeof this.options.configFile === 'string') {
|
|
97
|
+
try {
|
|
98
|
+
configResult = this.configExplorer.load(this.options.configFile);
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
throw new Error(`Can't read configuration file: ${error.message}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else if (this.options.configFile === true) {
|
|
105
|
+
try {
|
|
106
|
+
configResult = this.configExplorer.search();
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
this.logger.error(error);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (!configResult || configResult.isEmpty) {
|
|
113
|
+
this.logger.info('Not using any configuration file.');
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const configFileData = configResult.config;
|
|
117
|
+
this.logger.info(`Using configuration file ${configResult.filepath}`);
|
|
118
|
+
this.options = Object.assign(Object.assign(Object.assign({}, defaultOptions), configFileData), this.terminalOptions);
|
|
119
|
+
this.logger.state.isEnabled = this.options.verbose;
|
|
120
|
+
}
|
|
121
|
+
}
|
package/dist/esm/cli.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { program as commander } from 'commander';
|
|
3
|
+
import fs from 'fs-extra';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
import { JSZipCLI } from './JSZipCLI.js';
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = path.dirname(__filename);
|
|
9
|
+
const defaultPackageJsonPath = path.join(__dirname, '../../package.json');
|
|
10
|
+
const packageJsonPath = fs.existsSync(defaultPackageJsonPath)
|
|
11
|
+
? defaultPackageJsonPath
|
|
12
|
+
: path.join(__dirname, '../package.json');
|
|
13
|
+
const { description, name, version } = fs.readJSONSync(packageJsonPath);
|
|
14
|
+
commander
|
|
15
|
+
.name(name.replace(/^@[^/]+\//, ''))
|
|
16
|
+
.description(description)
|
|
17
|
+
.option('--noconfig', "don't look for a configuration file")
|
|
18
|
+
.option('-c, --config <path>', 'use a configuration file (default: .jsziprc.json)')
|
|
19
|
+
.option('-d, --dereference', 'dereference (follow) links', false)
|
|
20
|
+
.option('-f, --force', 'force overwriting files and directories when extracting', false)
|
|
21
|
+
.option('-i, --ignore <entry>', 'ignore a file or directory')
|
|
22
|
+
.option('-l, --level <number>', 'set the compression level', '5')
|
|
23
|
+
.option('-o, --output <dir>', 'set the output file or directory (default: stdout)')
|
|
24
|
+
.option('-q, --quiet', "don't log anything", false)
|
|
25
|
+
.option('-V, --verbose', 'enable verbose logging', false)
|
|
26
|
+
.version(version, '-v, --version')
|
|
27
|
+
.on('command:*', args => {
|
|
28
|
+
console.error(`\n error: invalid command \`${args[0]}'\n`);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
});
|
|
31
|
+
commander
|
|
32
|
+
.command('add')
|
|
33
|
+
.alias('a')
|
|
34
|
+
.description('add files and directories to a new ZIP archive')
|
|
35
|
+
.option('--noconfig', "don't look for a configuration file")
|
|
36
|
+
.option('-c, --config <path>', 'use a configuration file')
|
|
37
|
+
.option('-d, --dereference', 'dereference (follow) symlinks', false)
|
|
38
|
+
.option('-f, --force', 'force overwriting files and directories when extracting', false)
|
|
39
|
+
.option('-i, --ignore <entry>', 'ignore a file or directory')
|
|
40
|
+
.option('-l, --level <number>', 'set the compression level', '5')
|
|
41
|
+
.option('-o, --output <dir>', 'set the output file or directory (default: stdout)')
|
|
42
|
+
.option('-q, --quiet', "don't log anything excluding errors", false)
|
|
43
|
+
.option('-V, --verbose', 'enable verbose logging', false)
|
|
44
|
+
.arguments('[entries...]')
|
|
45
|
+
.action(async (entries) => {
|
|
46
|
+
const options = commander.opts();
|
|
47
|
+
try {
|
|
48
|
+
const jszip = new JSZipCLI(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (options.level && { compressionLevel: Number(options.level) })), ((options.config && { configFile: options.config }) || (options.noconfig && { configFile: false }))), (options.dereference && { dereferenceLinks: options.dereference })), (options.force && { force: options.force })), (options.ignore && { ignoreEntries: [options.ignore] })), (options.output && { outputEntry: options.output })), (options.quiet && { quiet: options.quiet })), (options.verbose && { verbose: options.verbose })));
|
|
49
|
+
jszip.add(entries);
|
|
50
|
+
const { outputFile, compressedFilesCount } = await jszip.save();
|
|
51
|
+
if (options.output && !options.quiet) {
|
|
52
|
+
console.info(`Done compressing ${compressedFilesCount} files to "${outputFile}".`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
console.error('Error:', error.message);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
commander
|
|
61
|
+
.command('extract')
|
|
62
|
+
.alias('e')
|
|
63
|
+
.description('extract files and directories from ZIP archive(s)')
|
|
64
|
+
.option('--noconfig', "don't look for a configuration file", false)
|
|
65
|
+
.option('-c, --config <path>', 'use a configuration file (default: .jsziprc.json)')
|
|
66
|
+
.option('-o, --output <dir>', 'set the output file or directory (default: stdout)')
|
|
67
|
+
.option('-i, --ignore <entry>', 'ignore a file or directory')
|
|
68
|
+
.option('-f, --force', 'force overwriting files and directories', false)
|
|
69
|
+
.option('-V, --verbose', 'enable verbose logging', false)
|
|
70
|
+
.option('-q, --quiet', "don't log anything excluding errors", false)
|
|
71
|
+
.arguments('<archives...>')
|
|
72
|
+
.action(async (archives) => {
|
|
73
|
+
const options = commander.opts();
|
|
74
|
+
try {
|
|
75
|
+
const { outputDir, extractedFilesCount } = await new JSZipCLI(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((options.config && { configFile: options.config }) || (options.noconfig && { configFile: false }))), (options.force && { force: options.force })), (options.ignore && { ignoreEntries: [options.ignore] })), (options.output && { outputEntry: options.output })), (options.quiet && { quiet: options.quiet })), (options.verbose && { verbose: options.verbose }))).extract(archives);
|
|
76
|
+
if (options.output && !options.quiet) {
|
|
77
|
+
console.info(`Done extracting ${extractedFilesCount} files to "${outputDir}".`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
console.error('Error:', error.message);
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
commander
|
|
86
|
+
.command('fileMode', { hidden: true, isDefault: true })
|
|
87
|
+
.option('--noconfig', "don't look for a configuration file", false)
|
|
88
|
+
.option('-c, --config <path>', 'use a configuration file (default: .jsziprc.json)')
|
|
89
|
+
.option('-o, --output <dir>', 'set the output file or directory (default: stdout)')
|
|
90
|
+
.option('-i, --ignore <entry>', 'ignore a file or directory')
|
|
91
|
+
.option('-f, --force', 'force overwriting files and directories', false)
|
|
92
|
+
.option('-V, --verbose', 'enable verbose logging', false)
|
|
93
|
+
.option('-q, --quiet', "don't log anything excluding errors", false)
|
|
94
|
+
.action(async () => {
|
|
95
|
+
const options = commander.opts();
|
|
96
|
+
try {
|
|
97
|
+
if (options.noconfig) {
|
|
98
|
+
commander.outputHelp();
|
|
99
|
+
}
|
|
100
|
+
await new JSZipCLI(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (options.config && { configFile: options.config })), (options.force && { force: options.force })), (options.ignore && { ignoreEntries: [options.ignore] })), (options.output && { outputEntry: options.output })), (options.quiet && { quiet: options.quiet })), (options.verbose && { verbose: options.verbose }))).fileMode();
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
if (error.message.includes('ENOENT')) {
|
|
104
|
+
console.error('Error:', `Configuration file "${options.config}" not found and no mode specified.`);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
console.error('Error:', error.message);
|
|
108
|
+
}
|
|
109
|
+
process.exit(1);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
commander.parse(process.argv);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface TerminalOptions {
|
|
2
|
+
/** The compression level to use (0 = save only, 9 = best compression) (default: 5). */
|
|
3
|
+
compressionLevel?: number;
|
|
4
|
+
/** Use a configuration file (default: .jsziprc.json). */
|
|
5
|
+
configFile?: string | boolean;
|
|
6
|
+
/** Whether to dereference (follow) symlinks (default: false). */
|
|
7
|
+
dereferenceLinks?: boolean;
|
|
8
|
+
/** Force overwriting files and directories when extracting (default: false). */
|
|
9
|
+
force?: boolean;
|
|
10
|
+
/** Ignore entries (e.g. `*.js.map`). */
|
|
11
|
+
ignoreEntries?: Array<string | RegExp>;
|
|
12
|
+
/** Set the output directory (default: stdout). */
|
|
13
|
+
outputEntry?: string | null;
|
|
14
|
+
/** Don't log anything excluding errors (default: false). */
|
|
15
|
+
quiet?: boolean;
|
|
16
|
+
/** Enable verbose logging (default: false). */
|
|
17
|
+
verbose?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface ConfigFileOptions extends TerminalOptions {
|
|
20
|
+
/** Which files or directories to add. */
|
|
21
|
+
entries: string[];
|
|
22
|
+
/** Add or extract files. */
|
|
23
|
+
mode: 'add' | 'extract';
|
|
24
|
+
}
|
|
25
|
+
export interface Entry {
|
|
26
|
+
resolvedPath: string;
|
|
27
|
+
zipPath: string;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Florian Imdahl <git@ffflorian.de>",
|
|
3
|
-
"bin":
|
|
4
|
-
"jszip-cli": "dist/cli.js"
|
|
5
|
-
},
|
|
3
|
+
"bin": "dist/cli.js",
|
|
6
4
|
"dependencies": {
|
|
7
5
|
"commander": "11.1.0",
|
|
8
6
|
"cosmiconfig": "8.3.6",
|
|
@@ -18,8 +16,9 @@
|
|
|
18
16
|
"@types/progress": "2.0.7",
|
|
19
17
|
"cross-env": "7.0.3",
|
|
20
18
|
"rimraf": "5.0.5",
|
|
21
|
-
"
|
|
22
|
-
"typescript": "5.2.2"
|
|
19
|
+
"ts-node": "10.9.1",
|
|
20
|
+
"typescript": "5.2.2",
|
|
21
|
+
"vitest": "0.34.6"
|
|
23
22
|
},
|
|
24
23
|
"engines": {
|
|
25
24
|
"node": ">= 10.9"
|
|
@@ -34,16 +33,21 @@
|
|
|
34
33
|
"zip"
|
|
35
34
|
],
|
|
36
35
|
"license": "GPL-3.0",
|
|
37
|
-
"main": "dist/index.js",
|
|
36
|
+
"main": "dist/cjs/index.js",
|
|
37
|
+
"module": "dist/esm/index.js",
|
|
38
38
|
"name": "@ffflorian/jszip-cli",
|
|
39
39
|
"repository": "https://github.com/ffflorian/node-packages/tree/main/packages/jszip-cli",
|
|
40
40
|
"scripts": {
|
|
41
|
-
"build": "
|
|
41
|
+
"build": "yarn build:cjs && yarn build:esm && yarn generate:packagejson",
|
|
42
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
43
|
+
"build:esm": "tsc -p tsconfig.json",
|
|
42
44
|
"clean": "rimraf dist",
|
|
43
45
|
"dist": "yarn clean && yarn build",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
+
"generate:packagejson": "../../bin/generate-hybrid-package-json.sh",
|
|
47
|
+
"start": "cross-env NODE_DEBUG=\"jszip-cli/*\" node --loader ts-node/esm src/cli.ts",
|
|
48
|
+
"test": "vitest run"
|
|
46
49
|
},
|
|
47
|
-
"
|
|
48
|
-
"
|
|
50
|
+
"type": "module",
|
|
51
|
+
"version": "3.5.3",
|
|
52
|
+
"gitHead": "08a3d819af6c24e44e0bc84380bb4fe9da3f7bbc"
|
|
49
53
|
}
|
package/dist/BuildService.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BuildService.js","sourceRoot":"","sources":["../src/BuildService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAA+B;AAC/B,+BAA+B;AAC/B,mCAAmC;AACnC,6BAA6B;AAC7B,qCAAqC;AACrC,+CAA0C;AAE1C,+BAA8B;AAE9B,MAAa,YAAY;IAWvB,YAAY,OAAkC;QAC5C,IAAI,CAAC,WAAW,GAAG,IAAI,yBAAW,CAAC,OAAO,CAAC,CAAC;QAC5C,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,wBAAwB,EAAE;YAC9C,MAAM,EAAE,OAAO;YACf,QAAQ,EAAE,KAAK;SAChB,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,KAAK,G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CAAC,CAAC;qBACzD;gBACH,CAAC,CAAA,CAAC,CACH,CAAC;aACH;YACD,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;IAEO,WAAW,CAAC,UAAiC;QACnD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC/C,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC7B,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA7FD,wCA6FC"}
|
package/dist/FileService.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileService.js","sourceRoot":"","sources":["../src/FileService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAA+B;AAC/B,mCAAmC;AACnC,6BAA6B;AAG7B,MAAa,WAAW;IAGtB,YAAY,OAAkC;QAC5C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,uBAAuB,EAAE;YAC7C,MAAM,EAAE,OAAO;YACf,QAAQ,EAAE,KAAK;SAChB,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;IACrD,CAAC;IAEY,SAAS,CAAC,OAAe;;YACpC,IAAI;gBACF,MAAM,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;gBAC5C,IAAI;oBACF,MAAM,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;oBAC5C,OAAO,IAAI,CAAC;iBACb;gBAAC,OAAO,KAAK,EAAE;oBACd,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C,CAAC,OAAO,CAAC,OAAO,IAAI,EAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAC,CAAC,EAClD,CAAC,QAAQ,EAAE,CAAC;KACf;IAAC,OAAO,KAAK,EAAE;QACd,IAAK,KAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YAC/C,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,uBAAuB,OAAO,CAAC,MAAM,oCAAoC,CAAC,CAAC;SACpG;aAAM;YACL,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAG,KAAe,CAAC,OAAO,CAAC,CAAC;SACnD;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC,CAAA,CAAC,CAAC;AAEL,mBAAS,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
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);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,+CAA6B"}
|
package/dist/interfaces.js
DELETED
package/dist/interfaces.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
File without changes
|