npm-pkgbuild 18.2.5 → 18.2.7
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/npm-pkgbuild-cli.mjs +8 -7
- package/src/util.mjs +31 -29
package/package.json
CHANGED
package/src/npm-pkgbuild-cli.mjs
CHANGED
|
@@ -106,24 +106,25 @@ program
|
|
|
106
106
|
const transformer = [
|
|
107
107
|
{
|
|
108
108
|
name: "skip-architecutes",
|
|
109
|
-
match: (entry) => entry.name.endsWith(".node"),
|
|
109
|
+
match: (entry) => entry.name.endsWith(".node") && entry.filename,
|
|
110
110
|
async transform(entry) {
|
|
111
|
-
const proc = await execa("file", ["-b", entry.
|
|
111
|
+
const proc = await execa("file", ["-b", entry.filename], {
|
|
112
112
|
cwd: options.dir
|
|
113
113
|
});
|
|
114
|
-
|
|
114
|
+
let arch = proc.stdout.split(/\s*,\s*/)[1];
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
const archs = { "ARM aarch64" : "aarch64" };
|
|
117
|
+
arch = archs[arch] || arch;
|
|
117
118
|
|
|
118
|
-
if(arch
|
|
119
|
+
if(properties.arch.indexOf(arch) >= 0) {
|
|
119
120
|
return entry;
|
|
120
121
|
}
|
|
121
122
|
|
|
122
|
-
|
|
123
|
+
console.log('SKIP', entry.name, arch);
|
|
123
124
|
}
|
|
124
125
|
},
|
|
125
126
|
createExpressionTransformer(
|
|
126
|
-
entry => uc.fileNameConformsTo(entry.name, "public.text") && !uc.fileNameConformsTo(entry.name, "com.netscape.javascript-source"),
|
|
127
|
+
entry => entry.isBlob && uc.fileNameConformsTo(entry.name, "public.text") && !uc.fileNameConformsTo(entry.name, "com.netscape.javascript-source"),
|
|
127
128
|
properties
|
|
128
129
|
)
|
|
129
130
|
];
|
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
|
}
|