npm-pkgbuild 18.2.5 → 18.2.6
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/package.json +1 -1
- package/src/util.mjs +31 -29
package/package.json
CHANGED
package/src/util.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { join, dirname } from "node:path";
|
|
2
2
|
import { mkdir } from "node:fs/promises";
|
|
3
3
|
import { pipeline } from "node:stream/promises";
|
|
4
|
-
import { Readable} from "node:stream";
|
|
4
|
+
import { Readable } from "node:stream";
|
|
5
5
|
|
|
6
6
|
import { createWriteStream } from "node:fs";
|
|
7
7
|
import { ContentEntry } from "content-entry";
|
|
@@ -209,35 +209,37 @@ export async function* copyEntries(
|
|
|
209
209
|
expander = v => v
|
|
210
210
|
) {
|
|
211
211
|
for await (const entry of source) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
212
|
+
if (entry) {
|
|
213
|
+
// @ts-ignore
|
|
214
|
+
const d = entry.destination;
|
|
215
|
+
|
|
216
|
+
const name = expander(
|
|
217
|
+
d === undefined
|
|
218
|
+
? entry.name
|
|
219
|
+
: d.isCollection || d.endsWith("/")
|
|
220
|
+
? join(d, entry.name)
|
|
221
|
+
: d
|
|
222
|
+
).replace(/^\//, "");
|
|
223
|
+
|
|
224
|
+
// @ts-ignore
|
|
225
|
+
entry.destination = name;
|
|
226
|
+
const destination = join(destinationDirectory, name);
|
|
227
|
+
|
|
228
|
+
if (entry.isCollection) {
|
|
229
|
+
await mkdir(destination, { recursive: true, mode: await entry.mode });
|
|
230
|
+
} else {
|
|
231
|
+
await mkdir(dirname(destination), { recursive: true });
|
|
232
|
+
|
|
233
|
+
await pipeline(
|
|
234
|
+
Readable.fromWeb(await entry.stream),
|
|
235
|
+
createWriteStream(
|
|
236
|
+
destination,
|
|
237
|
+
entry.mode ? { mode: await entry.mode } : undefined
|
|
238
|
+
)
|
|
239
|
+
);
|
|
240
|
+
}
|
|
226
241
|
|
|
227
|
-
|
|
228
|
-
await mkdir(destination, { recursive: true, mode: await entry.mode });
|
|
229
|
-
} else {
|
|
230
|
-
await mkdir(dirname(destination), { recursive: true });
|
|
231
|
-
|
|
232
|
-
await pipeline(
|
|
233
|
-
Readable.fromWeb(await entry.stream),
|
|
234
|
-
createWriteStream(
|
|
235
|
-
destination,
|
|
236
|
-
entry.mode ? { mode: await entry.mode } : undefined
|
|
237
|
-
)
|
|
238
|
-
);
|
|
242
|
+
yield entry;
|
|
239
243
|
}
|
|
240
|
-
|
|
241
|
-
yield entry;
|
|
242
244
|
}
|
|
243
245
|
}
|