npm-pkgbuild 8.2.1 → 8.2.2

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": "8.2.1",
3
+ "version": "8.2.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -18,7 +18,8 @@ import {
18
18
  copyEntries,
19
19
  fieldProvider,
20
20
  quote,
21
- utf8StreamOptions
21
+ utf8StreamOptions,
22
+ packageNameMapping
22
23
  } from "../util.mjs";
23
24
 
24
25
  /**
@@ -200,9 +201,6 @@ const fields = {
200
201
  options: { type: "string[]" }
201
202
  };
202
203
 
203
- const mapping = {
204
- node: "nodejs"
205
- };
206
204
 
207
205
  function normalizeExpression(e) {
208
206
  e = e.replace(/\-([\w\d]+)$/, "");
@@ -216,6 +214,6 @@ function normalizeExpression(e) {
216
214
  function makeDepends(dependencies) {
217
215
  return Object.entries(dependencies).map(
218
216
  ([name, version]) =>
219
- `${mapping[name] ? mapping[name] : name}${normalizeExpression(version)}`
217
+ `${packageNameMapping[name] ? packageNameMapping[name] : name}${normalizeExpression(version)}`
220
218
  );
221
219
  }
@@ -17,7 +17,8 @@ import {
17
17
  copyEntries,
18
18
  fieldProvider,
19
19
  extractFunctions,
20
- utf8StreamOptions
20
+ utf8StreamOptions,
21
+ packageNameMapping
21
22
  } from "../util.mjs";
22
23
 
23
24
  /**
@@ -93,7 +94,7 @@ export class DEBIAN extends Packager {
93
94
  );
94
95
 
95
96
  properties.Depends = Object.entries(dependencies).map(
96
- ([n, e]) => `${n} (${e})`
97
+ ([name, e]) => `${packageNameMapping[name] ? packageNameMapping[name] : name} (${e})`
97
98
  );
98
99
 
99
100
  const fp = fieldProvider(properties, fields);
@@ -14,7 +14,8 @@ import {
14
14
  copyEntries,
15
15
  fieldProvider,
16
16
  utf8StreamOptions,
17
- extractFunctions
17
+ extractFunctions,
18
+ packageNameMapping
18
19
  } from "../util.mjs";
19
20
 
20
21
  /**
@@ -76,7 +77,9 @@ export class RPM extends Packager {
76
77
 
77
78
  properties.Requires = Object.entries(dependencies).map(
78
79
  ([name, e]) =>
79
- `${name} ${e.replace(/([<=>])\d/, (match, p1) => `${p1} `)}`
80
+ `${
81
+ packageNameMapping[name] ? packageNameMapping[name] : name
82
+ } ${e.replace(/([<=>])\d/, (match, p1) => `${p1} `)}`
80
83
  );
81
84
 
82
85
  const specFileName = `${properties.name}.spec`;
@@ -169,7 +172,6 @@ export class RPM extends Packager {
169
172
  }
170
173
  }
171
174
 
172
-
173
175
  const pkglist = { type: "string[]" };
174
176
  /**
175
177
  * @see https://rpm-packaging-guide.github.io
@@ -195,4 +197,3 @@ const fields = {
195
197
  Obsoletes: pkglist,
196
198
  Conflicts: pkglist
197
199
  };
198
-
package/src/util.mjs CHANGED
@@ -5,6 +5,13 @@ import { createWriteStream } from "fs";
5
5
 
6
6
  export const utf8StreamOptions = { encoding: "utf8" };
7
7
 
8
+ /**
9
+ * what is the node name in the package eco-system
10
+ */
11
+ export const packageNameMapping = {
12
+ node: "nodejs"
13
+ };
14
+
8
15
  /**
9
16
  * Decode a password
10
17
  * @param {string} password