npm-pkgbuild 22.2.0 → 22.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-pkgbuild",
3
- "version": "22.2.0",
3
+ "version": "22.2.1",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": false
@@ -61,7 +61,7 @@
61
61
  "key-value-transformer": "^3.3.2",
62
62
  "npm-package-walker": "^8.0.11",
63
63
  "npm-packlist": "^11.3.0",
64
- "pacc": "^11.12.6",
64
+ "pacc": "^11.13.0",
65
65
  "package-directory": "^8.2.0",
66
66
  "pacote": "^22.0.0",
67
67
  "picomatch": "^4.0.7",
@@ -20,7 +20,8 @@ import {
20
20
  pkgbuild_version_attribute,
21
21
  pkgbuild_description_attribute,
22
22
  pkgbuild_name_attribute,
23
- dependency_attribute_collection_writable
23
+ dependency_attribute_collection_writable,
24
+ arch_attribute_writable
24
25
  } from "../types.mjs";
25
26
  import {
26
27
  copyEntries,
@@ -124,6 +125,7 @@ export class ALPM extends Packager {
124
125
  },
125
126
  license: {
126
127
  ...string_collection_attribute_writable,
128
+ separator: undefined,
127
129
  name: "license",
128
130
  skipEmpty: true
129
131
  },
@@ -177,10 +179,8 @@ export class ALPM extends Packager {
177
179
  skipEmpty: true
178
180
  },
179
181
  arch: {
180
- ...string_collection_attribute_writable,
181
- name: "arch",
182
- default: ["any"],
183
- mandatory: true
182
+ ...arch_attribute_writable,
183
+ default: ["any"]
184
184
  },
185
185
  backup: {
186
186
  ...string_collection_attribute_writable,
@@ -21,7 +21,7 @@ import {
21
21
  pkgbuild_description_attribute,
22
22
  pkgbuild_name_attribute,
23
23
  dependency_attribute_collection_writable,
24
- architectureType
24
+ arch_attribute_writable
25
25
  } from "../types.mjs";
26
26
 
27
27
  const debian_dependency_attribute_collection_writable = {
@@ -70,13 +70,10 @@ export class DEBIAN extends Packager {
70
70
  mandatory: true
71
71
  },
72
72
  arch: {
73
- ...string_attribute_writable,
74
- name: "arch",
73
+ ...arch_attribute_writable,
75
74
  externalName: "Architecture",
76
75
  default: "all",
77
- mandatory: true,
78
- type: architectureType,
79
- mapping: { aarch64: "arm64" }
76
+ mapping: { aarch64: "arm64", any: "all" }
80
77
  },
81
78
  groups: {
82
79
  ...string_attribute_writable,
@@ -19,7 +19,8 @@ import { Packager } from "./packager.mjs";
19
19
  import {
20
20
  pkgbuild_version_attribute,
21
21
  pkgbuild_description_attribute,
22
- pkgbuild_name_attribute
22
+ pkgbuild_name_attribute,
23
+ arch_attribute_writable
23
24
  } from "../types.mjs";
24
25
  import {
25
26
  copyEntries,
@@ -79,17 +80,23 @@ export class RPM extends Packager {
79
80
  },
80
81
  source: { ...string_attribute, externalName: "Source0", name: "source" },
81
82
  groups: { ...string_attribute, externalName: "Group", name: "groups" },
82
- maintainer: { ...string_attribute, name: "maintainer", externalName: "Packager" },
83
+ maintainer: {
84
+ ...string_attribute,
85
+ name: "maintainer",
86
+ externalName: "Packager"
87
+ },
83
88
  vendor: { ...string_attribute, externalName: "Vendor", name: "vendor" },
84
89
  arch: {
85
- ...string_attribute,
90
+ ...arch_attribute_writable,
86
91
  externalName: "BuildArch",
87
- name: "arch",
88
92
  default: "noarch",
89
- mandatory: true
93
+ mapping: { any: "noarch" }
90
94
  },
91
95
  URL: { ...url_attribute, name: "URL", alias: "homepage" },
92
- Requires: { ...string_collection_attribute_writable, name: "Requires" },
96
+ dependencies: {
97
+ ...string_collection_attribute_writable,
98
+ externalName: "Requires"
99
+ },
93
100
  Obsoletes: { ...string_collection_attribute_writable, name: "Obsoletes" },
94
101
  Conflicts: { ...string_collection_attribute_writable, name: "Conflicts" }
95
102
  };
@@ -152,7 +159,7 @@ export class RPM extends Packager {
152
159
  const { properties, tmpdir, staging, destination } =
153
160
  await this.prepare(options);
154
161
 
155
- properties.Requires = this.makeDepends(properties.dependencies);
162
+ properties.dependencies = this.makeDepends(properties.dependencies);
156
163
 
157
164
  if (properties.Packager?.length > 1) {
158
165
  // TODO how to write several Packages ?
package/src/types.mjs CHANGED
@@ -1,20 +1,16 @@
1
1
  import {
2
2
  types,
3
+ primitive_type,
3
4
  string_collection_attribute_writable,
4
5
  name_attribute,
5
6
  description_attribute,
6
- version_attribute_writable
7
+ version_attribute_writable,
8
+ string_attribute_writable
7
9
  } from "pacc";
8
10
 
9
- export const pkgbuild_name_attribute = {
10
- ...name_attribute,
11
- mandatory: true,
12
- pattern: /^[a-z_][a-z0-9_\-]*$/i
13
- };
14
-
15
11
  export const dependency_type = {
12
+ ...primitive_type,
16
13
  name: "dependency",
17
- primitive: false,
18
14
  toExternal: (value, attribute) => {
19
15
  switch (typeof value) {
20
16
  case "string":
@@ -36,9 +32,9 @@ export const dependency_type = {
36
32
  }
37
33
  };
38
34
 
39
- export const architectureType = {
35
+ export const architecture_type = {
36
+ ...primitive_type,
40
37
  name: "architecture",
41
- primitive: true,
42
38
 
43
39
  toInternal: (value, attribute) => {
44
40
  // console.log("architectureType toInternal", value);
@@ -47,10 +43,24 @@ export const architectureType = {
47
43
 
48
44
  toExternal: (value, attribute) => {
49
45
  // console.log("architectureType toExternal", value);
50
- return attribute.mapping[value] ?? value;
46
+ return attribute.mapping?.[value] ?? value;
51
47
  }
52
48
  };
53
49
 
50
+ export const arch_attribute_writable = {
51
+ ...string_attribute_writable,
52
+ name: "arch",
53
+ default: "all",
54
+ mandatory: true,
55
+ type: architecture_type
56
+ };
57
+
58
+ export const pkgbuild_name_attribute = {
59
+ ...name_attribute,
60
+ mandatory: true,
61
+ pattern: /^[a-z_][a-z0-9_\-]*$/i
62
+ };
63
+
54
64
  export const dependency_attribute_collection_writable = {
55
65
  ...string_collection_attribute_writable,
56
66
  type: dependency_type,
package/src/util.mjs CHANGED
@@ -145,15 +145,11 @@ export function quote(v, qc = "'") {
145
145
  * @returns {Function}
146
146
  */
147
147
  export function fieldProvider(properties, attributes) {
148
- function av(attribute, value) {
149
- return attribute.collection ? asArray(value) : value;
150
- }
151
-
152
- return function* controlProperties(k, v, presentKeys) {
148
+ return function* controlProperties(key, value, presentKeys) {
153
149
  let filter;
154
150
 
155
- if (k) {
156
- filter = attribute => attribute.name === k;
151
+ if (key) {
152
+ filter = attribute => attribute.name === key;
157
153
  }
158
154
 
159
155
  for (const [name, value] of iterateToExternal(