ppcos 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/utils/manifest.js +2 -1
- package/lib/utils/skills-fetcher.js +11 -7
- package/package.json +1 -1
package/lib/utils/manifest.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { pipeline } from 'stream/promises';
|
|
1
|
+
import { existsSync, mkdirSync } from 'fs';
|
|
3
2
|
import { Extract } from 'unzipper';
|
|
4
3
|
import { Readable } from 'stream';
|
|
5
4
|
import { downloadSkills } from './api-client.js';
|
|
@@ -28,11 +27,16 @@ export async function fetchSkills(targetDir) {
|
|
|
28
27
|
// Convert web stream to Node stream
|
|
29
28
|
const nodeStream = Readable.fromWeb(stream);
|
|
30
29
|
|
|
31
|
-
// Extract zip
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
// Extract zip — use .pipe() with close event instead of pipeline.
|
|
31
|
+
// unzipper's Extract doesn't properly signal completion through pipeline,
|
|
32
|
+
// causing rmSync to delete the temp dir while files are still being written.
|
|
33
|
+
await new Promise((resolve, reject) => {
|
|
34
|
+
nodeStream
|
|
35
|
+
.pipe(Extract({ path: targetDir }))
|
|
36
|
+
.on('close', resolve)
|
|
37
|
+
.on('error', reject);
|
|
38
|
+
nodeStream.on('error', reject);
|
|
39
|
+
});
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
/**
|