@ffflorian/jszip-cli 3.6.4 → 3.7.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.
- package/dist/BuildService.d.ts +1 -1
- package/dist/BuildService.js +131 -182
- package/dist/ExtractService.d.ts +1 -1
- package/dist/ExtractService.js +58 -76
- package/dist/FileService.d.ts +1 -2
- package/dist/FileService.js +50 -74
- package/dist/JSZipCLI.d.ts +3 -3
- package/dist/JSZipCLI.js +28 -46
- package/dist/cli.js +51 -42
- 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,62 +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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.BuildService = void 0;
|
|
39
|
-
const fs = __importStar(require("fs-extra"));
|
|
40
|
-
const jszip_1 = __importDefault(require("jszip"));
|
|
41
|
-
const logdown_1 = __importDefault(require("logdown"));
|
|
42
|
-
const path_1 = __importDefault(require("path"));
|
|
43
|
-
const progress_1 = __importDefault(require("progress"));
|
|
44
|
-
const FileService_1 = require("./FileService");
|
|
45
|
-
const glob_1 = require("glob");
|
|
46
|
-
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 {
|
|
47
9
|
constructor(options) {
|
|
48
|
-
this.fileService = new
|
|
49
|
-
this.jszip = new
|
|
10
|
+
this.fileService = new FileService(options);
|
|
11
|
+
this.jszip = new JSZip();
|
|
50
12
|
this.options = options;
|
|
51
|
-
this.logger = (
|
|
13
|
+
this.logger = logdown('jszip-cli/BuildService', {
|
|
52
14
|
logger: console,
|
|
53
15
|
markdown: false,
|
|
54
16
|
});
|
|
55
17
|
this.logger.state = { isEnabled: options.verbose };
|
|
56
18
|
this.entries = [];
|
|
57
19
|
this.ignoreEntries = this.options.ignoreEntries.map(entry => entry instanceof RegExp ? entry : new RegExp(entry.replace(/\*/g, '.*')));
|
|
58
|
-
this.outputFile = this.options.outputEntry ?
|
|
59
|
-
this.progressBar = new
|
|
20
|
+
this.outputFile = this.options.outputEntry ? path.resolve(this.options.outputEntry) : null;
|
|
21
|
+
this.progressBar = new progress('Compressing [:bar] :percent :elapseds', {
|
|
60
22
|
complete: '=',
|
|
61
23
|
incomplete: ' ',
|
|
62
24
|
total: 100,
|
|
@@ -67,9 +29,9 @@ class BuildService {
|
|
|
67
29
|
add(rawEntries) {
|
|
68
30
|
this.logger.info(`Adding ${rawEntries.length} entr${rawEntries.length === 1 ? 'y' : 'ies'} to ZIP file.`);
|
|
69
31
|
const normalizedEntries = this.normalizePaths(rawEntries);
|
|
70
|
-
this.entries =
|
|
71
|
-
const resolvedPath =
|
|
72
|
-
const baseName =
|
|
32
|
+
this.entries = globSync(normalizedEntries).map(rawEntry => {
|
|
33
|
+
const resolvedPath = path.resolve(rawEntry);
|
|
34
|
+
const baseName = path.basename(rawEntry);
|
|
73
35
|
return {
|
|
74
36
|
resolvedPath,
|
|
75
37
|
zipPath: baseName,
|
|
@@ -77,23 +39,21 @@ class BuildService {
|
|
|
77
39
|
});
|
|
78
40
|
return this;
|
|
79
41
|
}
|
|
80
|
-
save() {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (this.outputFile) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return this;
|
|
96
|
-
});
|
|
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;
|
|
97
57
|
}
|
|
98
58
|
/**
|
|
99
59
|
* Note: glob patterns should always use / as a path separator, even on Windows systems,
|
|
@@ -103,119 +63,111 @@ class BuildService {
|
|
|
103
63
|
normalizePaths(rawEntries) {
|
|
104
64
|
return rawEntries.map(entry => entry.replace(/\\/g, '/'));
|
|
105
65
|
}
|
|
106
|
-
addFile(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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;
|
|
111
95
|
try {
|
|
112
|
-
|
|
113
|
-
fileStat = yield fs.lstat(resolvedPath);
|
|
96
|
+
realPath = await fs.realpath(resolvedPath);
|
|
114
97
|
}
|
|
115
98
|
catch (error) {
|
|
116
99
|
if (!this.options.quiet) {
|
|
117
|
-
this.logger.info(`Can't read
|
|
100
|
+
this.logger.info(`Can't read link "${entry.resolvedPath}". Ignoring.`);
|
|
118
101
|
}
|
|
119
102
|
this.logger.info(error);
|
|
120
103
|
return;
|
|
121
104
|
}
|
|
122
|
-
this.logger.info(`
|
|
123
|
-
this.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
// See https://github.com/Stuk/jszip/issues/550
|
|
127
|
-
// dosPermissions: fileStat.mode,
|
|
128
|
-
unixPermissions: fileStat.mode,
|
|
105
|
+
this.logger.info(`Found real path "${realPath} for symbolic link".`);
|
|
106
|
+
await this.checkEntry({
|
|
107
|
+
resolvedPath: realPath,
|
|
108
|
+
zipPath,
|
|
129
109
|
});
|
|
130
|
-
|
|
131
|
-
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
await this.addFile(entry, true);
|
|
113
|
+
}
|
|
132
114
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
|
|
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
|
+
}
|
|
158
151
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
catch (error) {
|
|
166
|
-
if (!this.options.quiet) {
|
|
167
|
-
this.logger.info(`Can't read file "${entry.resolvedPath}". Ignoring.`);
|
|
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.`);
|
|
168
158
|
}
|
|
169
|
-
this.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
const ignoreEntries = this.ignoreEntries.filter(ignoreEntry => Boolean(entry.resolvedPath.match(ignoreEntry)));
|
|
173
|
-
if (ignoreEntries.length) {
|
|
174
|
-
this.logger.info(`Found ${entry.resolvedPath}. Not adding since it's on the ignore list:`, ignoreEntries.map(entry => String(entry)));
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
if (fileStat.isDirectory()) {
|
|
178
|
-
this.logger.info(`Found directory "${entry.resolvedPath}".`);
|
|
179
|
-
yield this.walkDir(entry);
|
|
180
|
-
}
|
|
181
|
-
else if (fileStat.isFile()) {
|
|
182
|
-
this.logger.info(`Found file "${entry.resolvedPath}".`);
|
|
183
|
-
this.logger.info(`Found file "${entry.resolvedPath}".`);
|
|
184
|
-
yield this.addFile(entry);
|
|
185
|
-
}
|
|
186
|
-
else if (fileStat.isSymbolicLink()) {
|
|
187
|
-
this.logger.info(`Found symbolic link "${entry.resolvedPath}".`);
|
|
188
|
-
yield this.addLink(entry);
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
this.logger.info('Unknown file type.', { fileStat });
|
|
192
|
-
if (!this.options.quiet) {
|
|
193
|
-
this.logger.info(`Can't read file "${entry.resolvedPath}". Ignoring.`);
|
|
159
|
+
const fileIsWritable = await this.fileService.fileIsWritable(this.outputFile);
|
|
160
|
+
if (!fileIsWritable) {
|
|
161
|
+
throw new Error(`File "${this.outputFile}" already exists.`);
|
|
194
162
|
}
|
|
195
163
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
if (this.outputFile) {
|
|
201
|
-
if (this.outputFile.match(/\.\w+$/)) {
|
|
202
|
-
const dirExists = yield this.fileService.dirExists(path_1.default.dirname(this.outputFile));
|
|
203
|
-
if (!dirExists) {
|
|
204
|
-
throw new Error(`Directory "${path_1.default.dirname(this.outputFile)}" doesn't exist or is not writable.`);
|
|
205
|
-
}
|
|
206
|
-
const fileIsWritable = yield this.fileService.fileIsWritable(this.outputFile);
|
|
207
|
-
if (!fileIsWritable) {
|
|
208
|
-
throw new Error(`File "${this.outputFile}" already exists.`);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
const dirExists = yield this.fileService.dirExists(this.outputFile);
|
|
213
|
-
if (!dirExists) {
|
|
214
|
-
throw new Error(`Directory "${this.outputFile}" doesn't exist or is not writable.`);
|
|
215
|
-
}
|
|
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.`);
|
|
216
168
|
}
|
|
217
169
|
}
|
|
218
|
-
}
|
|
170
|
+
}
|
|
219
171
|
}
|
|
220
172
|
getBuffer() {
|
|
221
173
|
const compressionType = this.options.compressionLevel === 0 ? 'STORE' : 'DEFLATE';
|
|
@@ -234,19 +186,16 @@ class BuildService {
|
|
|
234
186
|
}
|
|
235
187
|
});
|
|
236
188
|
}
|
|
237
|
-
walkDir(entry) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
});
|
|
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
|
+
}
|
|
250
200
|
}
|
|
251
201
|
}
|
|
252
|
-
exports.BuildService = BuildService;
|
package/dist/ExtractService.d.ts
CHANGED
package/dist/ExtractService.js
CHANGED
|
@@ -1,34 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.ExtractService = void 0;
|
|
16
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
17
|
-
const jszip_1 = __importDefault(require("jszip"));
|
|
18
|
-
const logdown_1 = __importDefault(require("logdown"));
|
|
19
|
-
const os_1 = __importDefault(require("os"));
|
|
20
|
-
const path_1 = __importDefault(require("path"));
|
|
21
|
-
const progress_1 = __importDefault(require("progress"));
|
|
22
|
-
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 {
|
|
23
8
|
constructor(options) {
|
|
24
9
|
this.options = options;
|
|
25
|
-
this.logger = (
|
|
10
|
+
this.logger = logdown('jszip-cli/ExtractService', {
|
|
26
11
|
logger: console,
|
|
27
12
|
markdown: false,
|
|
28
13
|
});
|
|
29
14
|
this.logger.state.isEnabled = this.options.verbose;
|
|
30
|
-
this.outputDir = this.options.outputEntry ?
|
|
31
|
-
this.progressBar = new
|
|
15
|
+
this.outputDir = this.options.outputEntry ? path.resolve(this.options.outputEntry) : null;
|
|
16
|
+
this.progressBar = new progress('Extracting [:bar] :percent :elapseds', {
|
|
32
17
|
complete: '=',
|
|
33
18
|
incomplete: ' ',
|
|
34
19
|
total: 100,
|
|
@@ -36,60 +21,58 @@ class ExtractService {
|
|
|
36
21
|
});
|
|
37
22
|
this.extractedFilesCount = 0;
|
|
38
23
|
}
|
|
39
|
-
extract(rawEntries) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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}"`);
|
|
46
42
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const entries = [];
|
|
50
|
-
yield jszip.loadAsync(data, { createFolders: true });
|
|
51
|
-
if (!this.outputDir) {
|
|
52
|
-
yield this.printStream(jszip.generateNodeStream());
|
|
53
|
-
return this;
|
|
43
|
+
else {
|
|
44
|
+
entries.push([filePath, entry]);
|
|
54
45
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
encoding: 'utf-8',
|
|
73
|
-
});
|
|
74
|
-
this.extractedFilesCount++;
|
|
75
|
-
const diff = Math.floor(index / entries.length) - Math.floor(lastPercent);
|
|
76
|
-
if (diff && !this.options.quiet) {
|
|
77
|
-
this.progressBar.tick(diff);
|
|
78
|
-
lastPercent = Math.floor(index / entries.length);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
if (isWin32) {
|
|
82
|
-
if (entry.dosPermissions) {
|
|
83
|
-
yield fs_extra_1.default.chmod(resolvedFilePath, entry.dosPermissions);
|
|
84
|
-
}
|
|
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);
|
|
85
63
|
}
|
|
86
|
-
|
|
87
|
-
|
|
64
|
+
}
|
|
65
|
+
if (isWin32) {
|
|
66
|
+
if (entry.dosPermissions) {
|
|
67
|
+
await fs.chmod(resolvedFilePath, entry.dosPermissions);
|
|
88
68
|
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
69
|
+
}
|
|
70
|
+
else if (entry.unixPermissions) {
|
|
71
|
+
await fs.chmod(resolvedFilePath, entry.unixPermissions);
|
|
72
|
+
}
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
return this;
|
|
93
76
|
}
|
|
94
77
|
printStream(fileStream) {
|
|
95
78
|
return new Promise((resolve, reject) => {
|
|
@@ -99,4 +82,3 @@ class ExtractService {
|
|
|
99
82
|
});
|
|
100
83
|
}
|
|
101
84
|
}
|
|
102
|
-
exports.ExtractService = ExtractService;
|
package/dist/FileService.d.ts
CHANGED
package/dist/FileService.js
CHANGED
|
@@ -1,94 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.FileService = void 0;
|
|
16
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
17
|
-
const logdown_1 = __importDefault(require("logdown"));
|
|
18
|
-
const path_1 = __importDefault(require("path"));
|
|
19
|
-
class FileService {
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import logdown from 'logdown';
|
|
4
|
+
export class FileService {
|
|
20
5
|
constructor(options) {
|
|
21
6
|
this.options = options;
|
|
22
|
-
this.logger = (
|
|
7
|
+
this.logger = logdown('jszip-cli/FileService', {
|
|
23
8
|
logger: console,
|
|
24
9
|
markdown: false,
|
|
25
10
|
});
|
|
26
11
|
this.logger.state.isEnabled = this.options.verbose;
|
|
27
12
|
}
|
|
28
|
-
dirExists(dirPath) {
|
|
29
|
-
|
|
13
|
+
async dirExists(dirPath) {
|
|
14
|
+
try {
|
|
15
|
+
await fs.access(dirPath, fs.constants.F_OK);
|
|
30
16
|
try {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
yield fs_extra_1.default.access(dirPath, fs_extra_1.default.constants.W_OK);
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
this.logger.info(`Directory "${dirPath}" exists but is not writable.`);
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
17
|
+
await fs.access(dirPath, fs.constants.W_OK);
|
|
18
|
+
return true;
|
|
40
19
|
}
|
|
41
20
|
catch (error) {
|
|
42
|
-
this.logger.info(`Directory "${dirPath}"
|
|
43
|
-
if (this.options.force) {
|
|
44
|
-
yield fs_extra_1.default.ensureDir(dirPath);
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
21
|
+
this.logger.info(`Directory "${dirPath}" exists but is not writable.`);
|
|
47
22
|
return false;
|
|
48
23
|
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
try {
|
|
56
|
-
yield fs_extra_1.default.access(filePath, fs_extra_1.default.constants.F_OK | fs_extra_1.default.constants.R_OK);
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
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;
|
|
62
30
|
}
|
|
63
31
|
return false;
|
|
64
|
-
}
|
|
32
|
+
}
|
|
65
33
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
yield fs_extra_1.default.access(filePath, fs_extra_1.default.constants.F_OK | fs_extra_1.default.constants.R_OK);
|
|
73
|
-
this.logger.info(`File "${filePath}" already exists.`, this.options.force ? 'Forcing overwrite.' : 'Not overwriting.');
|
|
74
|
-
return this.options.force;
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
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;
|
|
79
40
|
}
|
|
80
|
-
|
|
81
|
-
|
|
41
|
+
catch (error) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
82
46
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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;
|
|
89
55
|
}
|
|
90
|
-
|
|
91
|
-
|
|
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.`);
|
|
92
69
|
}
|
|
93
70
|
}
|
|
94
|
-
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,22 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.JSZipCLI = void 0;
|
|
16
|
-
const cosmiconfig_1 = require("cosmiconfig");
|
|
17
|
-
const logdown_1 = __importDefault(require("logdown"));
|
|
18
|
-
const BuildService_1 = require("./BuildService");
|
|
19
|
-
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';
|
|
20
5
|
const defaultOptions = {
|
|
21
6
|
compressionLevel: 5,
|
|
22
7
|
configFile: true,
|
|
@@ -27,21 +12,21 @@ const defaultOptions = {
|
|
|
27
12
|
quiet: false,
|
|
28
13
|
verbose: false,
|
|
29
14
|
};
|
|
30
|
-
class JSZipCLI {
|
|
15
|
+
export class JSZipCLI {
|
|
31
16
|
constructor(options) {
|
|
32
17
|
this.terminalOptions = options;
|
|
33
|
-
this.logger = (
|
|
18
|
+
this.logger = logdown('jszip-cli/index', {
|
|
34
19
|
logger: console,
|
|
35
20
|
markdown: false,
|
|
36
21
|
});
|
|
37
|
-
this.configExplorer =
|
|
38
|
-
this.options =
|
|
22
|
+
this.configExplorer = cosmiconfigSync('jszip');
|
|
23
|
+
this.options = { ...defaultOptions, ...this.terminalOptions };
|
|
39
24
|
this.logger.state.isEnabled = this.options.verbose;
|
|
40
25
|
this.logger.info('Merged options', this.options);
|
|
41
26
|
this.checkConfigFile();
|
|
42
27
|
this.logger.info('Loaded options', this.options);
|
|
43
|
-
this.buildService = new
|
|
44
|
-
this.extractService = new
|
|
28
|
+
this.buildService = new BuildService(this.options);
|
|
29
|
+
this.extractService = new ExtractService(this.options);
|
|
45
30
|
}
|
|
46
31
|
/**
|
|
47
32
|
* Add files and directories to the ZIP file.
|
|
@@ -79,27 +64,25 @@ class JSZipCLI {
|
|
|
79
64
|
* Run in file mode - reads entries and settings from configuration file.
|
|
80
65
|
* Options from the constructor still take precedence.
|
|
81
66
|
*/
|
|
82
|
-
fileMode() {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
console.info(`Done compressing ${compressedFilesCount} files to "${outputFile}".`);
|
|
91
|
-
}
|
|
92
|
-
return this;
|
|
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}".`);
|
|
93
75
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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}".`);
|
|
100
82
|
}
|
|
101
|
-
|
|
102
|
-
}
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
throw new Error('No or invalid mode in configuration file defined.');
|
|
103
86
|
}
|
|
104
87
|
save() {
|
|
105
88
|
return this.buildService.save();
|
|
@@ -132,8 +115,7 @@ class JSZipCLI {
|
|
|
132
115
|
}
|
|
133
116
|
const configFileData = configResult.config;
|
|
134
117
|
this.logger.info(`Using configuration file ${configResult.filepath}`);
|
|
135
|
-
this.options =
|
|
118
|
+
this.options = { ...defaultOptions, ...configFileData, ...this.terminalOptions };
|
|
136
119
|
this.logger.state.isEnabled = this.options.verbose;
|
|
137
120
|
}
|
|
138
121
|
}
|
|
139
|
-
exports.JSZipCLI = JSZipCLI;
|
package/dist/cli.js
CHANGED
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
-
};
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
const commander_1 = require("commander");
|
|
17
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
18
|
-
const path_1 = __importDefault(require("path"));
|
|
19
|
-
const JSZipCLI_1 = require("./JSZipCLI");
|
|
20
|
-
const defaultPackageJsonPath = path_1.default.join(__dirname, '../../package.json');
|
|
21
|
-
const packageJsonPath = fs_extra_1.default.existsSync(defaultPackageJsonPath)
|
|
22
|
-
? defaultPackageJsonPath
|
|
23
|
-
: path_1.default.join(__dirname, '../package.json');
|
|
24
|
-
const { description, name, version } = fs_extra_1.default.readJSONSync(packageJsonPath);
|
|
25
|
-
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
|
|
26
12
|
.name(name.replace(/^@[^/]+\//, ''))
|
|
27
13
|
.description(description)
|
|
28
14
|
.option('--noconfig', "don't look for a configuration file")
|
|
@@ -39,7 +25,7 @@ commander_1.program
|
|
|
39
25
|
console.error(`\n error: invalid command \`${args[0]}'\n`);
|
|
40
26
|
process.exit(1);
|
|
41
27
|
});
|
|
42
|
-
|
|
28
|
+
commander
|
|
43
29
|
.command('add')
|
|
44
30
|
.alias('a')
|
|
45
31
|
.description('add files and directories to a new ZIP archive')
|
|
@@ -53,12 +39,21 @@ commander_1.program
|
|
|
53
39
|
.option('-q, --quiet', "don't log anything excluding errors", false)
|
|
54
40
|
.option('-V, --verbose', 'enable verbose logging', false)
|
|
55
41
|
.arguments('[entries...]')
|
|
56
|
-
.action((entries) =>
|
|
57
|
-
const options =
|
|
42
|
+
.action(async (entries) => {
|
|
43
|
+
const options = commander.opts();
|
|
58
44
|
try {
|
|
59
|
-
const jszip = new
|
|
45
|
+
const jszip = new JSZipCLI({
|
|
46
|
+
...(options.level && { compressionLevel: Number(options.level) }),
|
|
47
|
+
...((options.config && { configFile: options.config }) || (options.noconfig && { configFile: false })),
|
|
48
|
+
...(options.dereference && { dereferenceLinks: options.dereference }),
|
|
49
|
+
...(options.force && { force: options.force }),
|
|
50
|
+
...(options.ignore && { ignoreEntries: [options.ignore] }),
|
|
51
|
+
...(options.output && { outputEntry: options.output }),
|
|
52
|
+
...(options.quiet && { quiet: options.quiet }),
|
|
53
|
+
...(options.verbose && { verbose: options.verbose }),
|
|
54
|
+
});
|
|
60
55
|
jszip.add(entries);
|
|
61
|
-
const { outputFile, compressedFilesCount } =
|
|
56
|
+
const { outputFile, compressedFilesCount } = await jszip.save();
|
|
62
57
|
if (options.output && !options.quiet) {
|
|
63
58
|
console.info(`Done compressing ${compressedFilesCount} files to "${outputFile}".`);
|
|
64
59
|
}
|
|
@@ -67,8 +62,8 @@ commander_1.program
|
|
|
67
62
|
console.error('Error:', error.message);
|
|
68
63
|
process.exit(1);
|
|
69
64
|
}
|
|
70
|
-
})
|
|
71
|
-
|
|
65
|
+
});
|
|
66
|
+
commander
|
|
72
67
|
.command('extract')
|
|
73
68
|
.alias('e')
|
|
74
69
|
.description('extract files and directories from ZIP archive(s)')
|
|
@@ -80,10 +75,17 @@ commander_1.program
|
|
|
80
75
|
.option('-V, --verbose', 'enable verbose logging', false)
|
|
81
76
|
.option('-q, --quiet', "don't log anything excluding errors", false)
|
|
82
77
|
.arguments('<archives...>')
|
|
83
|
-
.action((archives) =>
|
|
84
|
-
const options =
|
|
78
|
+
.action(async (archives) => {
|
|
79
|
+
const options = commander.opts();
|
|
85
80
|
try {
|
|
86
|
-
const { outputDir, extractedFilesCount } =
|
|
81
|
+
const { outputDir, extractedFilesCount } = await new JSZipCLI({
|
|
82
|
+
...((options.config && { configFile: options.config }) || (options.noconfig && { configFile: false })),
|
|
83
|
+
...(options.force && { force: options.force }),
|
|
84
|
+
...(options.ignore && { ignoreEntries: [options.ignore] }),
|
|
85
|
+
...(options.output && { outputEntry: options.output }),
|
|
86
|
+
...(options.quiet && { quiet: options.quiet }),
|
|
87
|
+
...(options.verbose && { verbose: options.verbose }),
|
|
88
|
+
}).extract(archives);
|
|
87
89
|
if (options.output && !options.quiet) {
|
|
88
90
|
console.info(`Done extracting ${extractedFilesCount} files to "${outputDir}".`);
|
|
89
91
|
}
|
|
@@ -92,8 +94,8 @@ commander_1.program
|
|
|
92
94
|
console.error('Error:', error.message);
|
|
93
95
|
process.exit(1);
|
|
94
96
|
}
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
+
});
|
|
98
|
+
commander
|
|
97
99
|
.command('fileMode', { hidden: true, isDefault: true })
|
|
98
100
|
.option('--noconfig', "don't look for a configuration file", false)
|
|
99
101
|
.option('-c, --config <path>', 'use a configuration file (default: .jsziprc.json)')
|
|
@@ -102,13 +104,20 @@ commander_1.program
|
|
|
102
104
|
.option('-f, --force', 'force overwriting files and directories', false)
|
|
103
105
|
.option('-V, --verbose', 'enable verbose logging', false)
|
|
104
106
|
.option('-q, --quiet', "don't log anything excluding errors", false)
|
|
105
|
-
.action(() =>
|
|
106
|
-
const options =
|
|
107
|
+
.action(async () => {
|
|
108
|
+
const options = commander.opts();
|
|
107
109
|
try {
|
|
108
110
|
if (options.noconfig) {
|
|
109
|
-
|
|
111
|
+
commander.outputHelp();
|
|
110
112
|
}
|
|
111
|
-
|
|
113
|
+
await new JSZipCLI({
|
|
114
|
+
...(options.config && { configFile: options.config }),
|
|
115
|
+
...(options.force && { force: options.force }),
|
|
116
|
+
...(options.ignore && { ignoreEntries: [options.ignore] }),
|
|
117
|
+
...(options.output && { outputEntry: options.output }),
|
|
118
|
+
...(options.quiet && { quiet: options.quiet }),
|
|
119
|
+
...(options.verbose && { verbose: options.verbose }),
|
|
120
|
+
}).fileMode();
|
|
112
121
|
}
|
|
113
122
|
catch (error) {
|
|
114
123
|
if (error.message.includes('ENOENT')) {
|
|
@@ -119,5 +128,5 @@ commander_1.program
|
|
|
119
128
|
}
|
|
120
129
|
process.exit(1);
|
|
121
130
|
}
|
|
122
|
-
})
|
|
123
|
-
|
|
131
|
+
});
|
|
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.0",
|
|
47
|
+
"gitHead": "f1a74d8ec9721d5b52a00e41b2ec73278e048290"
|
|
48
48
|
}
|