npm-pkgbuild 22.1.10 → 22.1.12

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 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)>**&#x20;
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))**&#x20;
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)>** (optional, default `[]`)
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)>**&#x20;
680
680
  * `properties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?**&#x20;
681
681
 
682
682
  * `properties.PKGBUILD_PUBLISH` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?**&#x20;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-pkgbuild",
3
- "version": "22.1.10",
3
+ "version": "22.1.12",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": false
@@ -5,7 +5,8 @@ import {
5
5
  integer_attribute_writable,
6
6
  yesno_attribute_writable,
7
7
  string_attribute_writable,
8
- string_collection_attribute_writable
8
+ string_collection_attribute_writable,
9
+ toExternal
9
10
  } from "pacc";
10
11
  import { ContentEntry, IteratorContentEntry } from "content-entry";
11
12
  import {
@@ -18,7 +19,8 @@ import {
18
19
  pkgbuild_version_attribute,
19
20
  pkgbuild_description_attribute,
20
21
  pkgbuild_name_attribute,
21
- dependency_attribute_collection_writable
22
+ dependency_attribute_collection_writable,
23
+ architectureType
22
24
  } from "./packager.mjs";
23
25
  import { copyEntries, fieldProvider, aggregate } from "../util.mjs";
24
26
 
@@ -73,6 +75,7 @@ export class DEBIAN extends Packager {
73
75
  alias: "arch",
74
76
  default: "all",
75
77
  mandatory: true,
78
+ type: architectureType,
76
79
  mapping: { aarch64: "arm64" }
77
80
  },
78
81
  Homepage: {
@@ -153,7 +156,7 @@ export class DEBIAN extends Packager {
153
156
  const p = this.properties;
154
157
 
155
158
  // TODO utility to provide final values
156
- const arch = this.attributes.Architecture.mapping[p.arch] || p.arch;
159
+ const arch = toExternal(p.arch, this.attributes.Architecture);
157
160
 
158
161
  // @ts-ignore
159
162
  return `${p.name}_${p.version}_${arch}${this.constructor.fileNameExtension}`;
@@ -301,6 +301,21 @@ export const dependency_type = {
301
301
  }
302
302
  };
303
303
 
304
+ export const architectureType = {
305
+ name: "dependency",
306
+ primitive: true,
307
+
308
+ toInternal: (value, attribute) => {
309
+ // console.log("architectureType toInternal", value);
310
+ return value;
311
+ },
312
+
313
+ toExternal: (value, attribute) => {
314
+ // console.log("architectureType toExternal", value);
315
+ return attribute.mapping[value] ?? value;
316
+ }
317
+ };
318
+
304
319
  export const dependency_attribute_collection_writable = {
305
320
  ...string_collection_attribute_writable,
306
321
  type: dependency_type,
package/src/util.mjs CHANGED
@@ -182,7 +182,7 @@ export function fieldProvider(properties, attributes) {
182
182
  }
183
183
  } else {
184
184
  const attribute = attributes[k];
185
- yield [k, av(attribute, toExternal(properties[k] || v, attribute))];
185
+ yield [k, av(attribute, toExternal(properties[k] ?? v, attribute))];
186
186
  }
187
187
  };
188
188
  }
@@ -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, mode: await entry.mode });
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