npm-pkgbuild 7.2.4 → 7.2.5

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": "7.2.4",
3
+ "version": "7.2.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -4,17 +4,38 @@
4
4
  * @param updates
5
5
  */
6
6
  export async function* keyValueTransformer(source, updates) {
7
- for await (let line of asLines(source)) {
7
+ let key, value;
8
+
9
+ function * eject() {
10
+ if (key !== undefined) {
11
+ const [k, v] = updates(key, value);
12
+ if (k !== undefined) {
13
+ yield`${k}: ${v}\n`;
14
+ }
15
+ key = value = undefined;
16
+ }
17
+ }
18
+
19
+ for await (const line of asLines(source)) {
8
20
  const m = line.match(/^(\w+):\s*(.*)/);
9
21
  if (m) {
10
- const [k, v] = updates(m[1], m[2]);
11
- if (k !== undefined) {
12
- yield `${k}: ${v}\n`;
22
+ yield *eject();
23
+ key = m[1];
24
+ value = m[2];
25
+ } else if (key !== undefined) {
26
+ const m = line.match(/^\s+(.*)/);
27
+ if (m) {
28
+ value += m[1];
29
+ } else {
30
+ yield * eject();
31
+ yield line + "\n";
13
32
  }
14
33
  } else {
15
34
  yield line + "\n";
16
35
  }
17
36
  }
37
+
38
+ yield *eject();
18
39
  }
19
40
 
20
41
  async function* asLines(source) {
@@ -53,12 +53,15 @@ program
53
53
  );
54
54
 
55
55
  const properties = Object.fromEntries(
56
- ["name", "version", "description", "homepage"].map(key => [
57
- key,
58
- pkg[key]
59
- ]).filter(([k,v]) => v !== undefined )
56
+ ["name", "version", "description", "homepage"]
57
+ .map(key => [key, pkg[key]])
58
+ .filter(([k, v]) => v !== undefined)
60
59
  );
61
60
 
61
+ if(pkg.contributors) {
62
+ properties.maintainer = pkg.contributors.map(c => `${c.name} <${c.email}>`)[0];
63
+ }
64
+
62
65
  const sources = [...options.content, ...options.meta]
63
66
  .filter(x => x)
64
67
  .map(source =>
@@ -96,7 +96,7 @@ const fields = {
96
96
  Description: { alias: "description", mandatory: true },
97
97
  Homepage: { alias: "homepage" },
98
98
  Source: { mandatory: true },
99
- Maintainer: { mandatory: true },
99
+ Maintainer: { alias: "maintainer", mandatory: true },
100
100
  Uploaders: { mandatory: false },
101
101
  Section: { recommended: true },
102
102
  Priority: { recommended: true },