@matterbridge/utils 3.6.2-dev-20260314-d28b48a → 3.6.2-dev-20260315-d23fd18
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/export.d.ts +0 -1
- package/dist/export.js +0 -1
- package/package.json +2 -2
- package/dist/createZip.d.ts +0 -1
- package/dist/createZip.js +0 -69
package/dist/export.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export * from './colorUtils.js';
|
|
|
2
2
|
export * from './commandLine.js';
|
|
3
3
|
export * from './copyDirectory.js';
|
|
4
4
|
export * from './createDirectory.js';
|
|
5
|
-
export * from './createZip.js';
|
|
6
5
|
export * from './deepCopy.js';
|
|
7
6
|
export * from './deepEqual.js';
|
|
8
7
|
export * from './error.js';
|
package/dist/export.js
CHANGED
|
@@ -2,7 +2,6 @@ export * from './colorUtils.js';
|
|
|
2
2
|
export * from './commandLine.js';
|
|
3
3
|
export * from './copyDirectory.js';
|
|
4
4
|
export * from './createDirectory.js';
|
|
5
|
-
export * from './createZip.js';
|
|
6
5
|
export * from './deepCopy.js';
|
|
7
6
|
export * from './deepEqual.js';
|
|
8
7
|
export * from './error.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matterbridge/utils",
|
|
3
|
-
"version": "3.6.2-dev-
|
|
3
|
+
"version": "3.6.2-dev-20260315-d23fd18",
|
|
4
4
|
"description": "Matterbridge utils library",
|
|
5
5
|
"author": "https://github.com/Luligu",
|
|
6
6
|
"homepage": "https://matterbridge.io/",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"CHANGELOG.md"
|
|
134
134
|
],
|
|
135
135
|
"dependencies": {
|
|
136
|
-
"@matterbridge/jest-utils": "3.6.2-dev-
|
|
136
|
+
"@matterbridge/jest-utils": "3.6.2-dev-20260315-d23fd18",
|
|
137
137
|
"node-ansi-logger": "3.2.0"
|
|
138
138
|
}
|
|
139
139
|
}
|
package/dist/createZip.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function createZip(outputPath: string, ...sourcePaths: string[]): Promise<number>;
|
package/dist/createZip.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { AnsiLogger } from 'node-ansi-logger';
|
|
2
|
-
export async function createZip(outputPath, ...sourcePaths) {
|
|
3
|
-
const log = new AnsiLogger({ logName: 'Archive', logTimestampFormat: 4, logLevel: "info" });
|
|
4
|
-
const { default: archiver } = await import('archiver');
|
|
5
|
-
const { glob } = await import('glob');
|
|
6
|
-
const { createWriteStream, statSync } = await import('node:fs');
|
|
7
|
-
const path = await import('node:path');
|
|
8
|
-
log.debug(`creating archive ${outputPath} from ${sourcePaths.join(', ')} ...`);
|
|
9
|
-
return new Promise((resolve, reject) => {
|
|
10
|
-
const output = createWriteStream(outputPath);
|
|
11
|
-
const archive = archiver('zip', {
|
|
12
|
-
zlib: { level: 9 },
|
|
13
|
-
});
|
|
14
|
-
output.on('close', () => {
|
|
15
|
-
log.debug(`archive ${outputPath} closed with ${archive.pointer()} total bytes`);
|
|
16
|
-
resolve(archive.pointer());
|
|
17
|
-
});
|
|
18
|
-
output.on('end', () => {
|
|
19
|
-
log.debug(`archive ${outputPath} data has been drained ${archive.pointer()} total bytes`);
|
|
20
|
-
});
|
|
21
|
-
archive.on('error', (error) => {
|
|
22
|
-
log.error(`archive error: ${error.message}`);
|
|
23
|
-
reject(error);
|
|
24
|
-
});
|
|
25
|
-
archive.on('warning', (error) => {
|
|
26
|
-
if (error.code === 'ENOENT') {
|
|
27
|
-
log.warn(`archive warning: ${error.message}`);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
log.error(`archive warning: ${error.message}`);
|
|
31
|
-
reject(error);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
archive.on('entry', (entry) => {
|
|
35
|
-
log.debug(`- archive entry: ${entry.name}`);
|
|
36
|
-
});
|
|
37
|
-
archive.pipe(output);
|
|
38
|
-
for (const sourcePath of sourcePaths) {
|
|
39
|
-
let stats;
|
|
40
|
-
try {
|
|
41
|
-
stats = statSync(sourcePath);
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
if (sourcePath.includes('*')) {
|
|
45
|
-
const files = glob.sync(sourcePath.replace(/\\/g, '/'));
|
|
46
|
-
log.debug(`adding files matching glob pattern: ${sourcePath}`);
|
|
47
|
-
for (const file of files) {
|
|
48
|
-
log.debug(`- glob file: ${file}`);
|
|
49
|
-
archive.file(file, { name: file });
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
log.error(`no files or directory found for pattern ${sourcePath}: ${error}`);
|
|
54
|
-
}
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
if (stats.isFile()) {
|
|
58
|
-
log.debug(`adding file: ${sourcePath}`);
|
|
59
|
-
archive.file(sourcePath, { name: path.basename(sourcePath) });
|
|
60
|
-
}
|
|
61
|
-
else if (stats.isDirectory()) {
|
|
62
|
-
log.debug(`adding directory: ${sourcePath}`);
|
|
63
|
-
archive.directory(sourcePath, path.basename(sourcePath));
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
log.debug(`finalizing archive ${outputPath}...`);
|
|
67
|
-
archive.finalize().catch(reject);
|
|
68
|
-
});
|
|
69
|
-
}
|