npm-pkgbuild 22.1.9 → 22.1.11
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/README.md +2 -2
- package/package.json +1 -1
- package/src/publish.mjs +5 -3
- package/src/util.mjs +10 -7
package/README.md
CHANGED
|
@@ -350,7 +350,7 @@ Source of package content.
|
|
|
350
350
|
* `dir` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
351
351
|
* `destination` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
352
352
|
* `defaultProperties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
|
|
353
|
-
* `permissions` **[Map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map)<[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
353
|
+
* `permissions` **([Map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map)<[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)> | [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** 
|
|
354
354
|
|
|
355
355
|
### propertiesFor
|
|
356
356
|
|
|
@@ -676,7 +676,7 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
|
|
|
676
676
|
|
|
677
677
|
### Parameters
|
|
678
678
|
|
|
679
|
-
* `locations` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
|
|
679
|
+
* `locations` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** 
|
|
680
680
|
* `properties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** 
|
|
681
681
|
|
|
682
682
|
* `properties.PKGBUILD_PUBLISH` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** 
|
package/package.json
CHANGED
package/src/publish.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { basename } from "node:path";
|
|
2
2
|
import { createReadStream } from "node:fs";
|
|
3
3
|
import { mkdir, copyFile } from "node:fs/promises";
|
|
4
|
+
import { asArray } from "pacc";
|
|
4
5
|
import { decodePassword } from "./util.mjs";
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -22,8 +23,8 @@ import { decodePassword } from "./util.mjs";
|
|
|
22
23
|
* @param {string} [properties.username]
|
|
23
24
|
* @return {PublishingDetail[]}
|
|
24
25
|
*/
|
|
25
|
-
export function createPublishingDetails(locations
|
|
26
|
-
locations =
|
|
26
|
+
export function createPublishingDetails(locations, properties) {
|
|
27
|
+
locations = asArray(locations);
|
|
27
28
|
|
|
28
29
|
let publishPropertyFound = false;
|
|
29
30
|
|
|
@@ -150,7 +151,8 @@ export async function publish(
|
|
|
150
151
|
|
|
151
152
|
if (!response.ok) {
|
|
152
153
|
throw new Error(
|
|
153
|
-
`Unable to publish to ${url}: ${response.statusText}(${response.status})`,
|
|
154
|
+
`Unable to publish to ${url}: ${response.statusText}(${response.status})`,
|
|
155
|
+
{ cause: response }
|
|
154
156
|
);
|
|
155
157
|
}
|
|
156
158
|
}
|
package/src/util.mjs
CHANGED
|
@@ -162,7 +162,7 @@ export function fieldProvider(properties, attributes) {
|
|
|
162
162
|
if (attribute.mandatory) {
|
|
163
163
|
console.error(`Missing value for mandatory attribute ${name}`);
|
|
164
164
|
}
|
|
165
|
-
if (attribute.
|
|
165
|
+
if (attribute.skipEmpty) {
|
|
166
166
|
continue;
|
|
167
167
|
}
|
|
168
168
|
} else {
|
|
@@ -171,7 +171,7 @@ export function fieldProvider(properties, attributes) {
|
|
|
171
171
|
} else {
|
|
172
172
|
if (attribute.mapping) {
|
|
173
173
|
const mappedValue = attribute.mapping[value];
|
|
174
|
-
if (mappedValue) {
|
|
174
|
+
if (mappedValue !== undefined) {
|
|
175
175
|
value = mappedValue;
|
|
176
176
|
}
|
|
177
177
|
}
|
|
@@ -222,17 +222,20 @@ export async function* copyEntries(
|
|
|
222
222
|
entry.destination = name;
|
|
223
223
|
const destination = join(destinationDirectory, name);
|
|
224
224
|
|
|
225
|
+
let options;
|
|
226
|
+
const mode = await entry.mode;
|
|
227
|
+
if (mode) {
|
|
228
|
+
options = { mode };
|
|
229
|
+
}
|
|
230
|
+
|
|
225
231
|
if (entry.isCollection) {
|
|
226
|
-
await mkdir(destination, { recursive: true,
|
|
232
|
+
await mkdir(destination, { recursive: true, ...options });
|
|
227
233
|
} else {
|
|
228
234
|
await mkdir(dirname(destination), { recursive: true });
|
|
229
235
|
|
|
230
236
|
await pipeline(
|
|
231
237
|
Readable.fromWeb(await entry.stream),
|
|
232
|
-
createWriteStream(
|
|
233
|
-
destination,
|
|
234
|
-
entry.mode ? { mode: await entry.mode } : undefined
|
|
235
|
-
)
|
|
238
|
+
createWriteStream(destination, options)
|
|
236
239
|
);
|
|
237
240
|
}
|
|
238
241
|
|