npm-pkgbuild 10.15.25 → 10.16.0

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": "10.15.25",
3
+ "version": "10.16.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -45,7 +45,7 @@ export const npmArchMapping = {
45
45
  };
46
46
 
47
47
  /**
48
- * Deliver basic properties from the root package
48
+ * Deliver basic properties from the root package.
49
49
  * @param {Object} content of root package.json
50
50
  * @returns {Object} key value pairs extracted from package
51
51
  */
@@ -31,6 +31,7 @@ allInputs.forEach(i => program.option(`--${i.name}`, i.description));
31
31
 
32
32
  program
33
33
  .option("--verbose", "be more verbose", false)
34
+ .option("--dry", "do not execut only print definitions", false)
34
35
  .option("-D --define <a=b>", "define property", (str, former = {}) =>
35
36
  Object.assign(former, Object.fromEntries([str.split(/=/)]))
36
37
  )
@@ -112,10 +112,10 @@ package() {
112
112
  `;
113
113
  }
114
114
 
115
- if(properties.backup && properties.backup[0] === '/') {
116
- properties.backup = properties.backup.replace(/\//,'');
115
+ if (properties.backup && properties.backup[0] === "/") {
116
+ properties.backup = properties.backup.replace(/\//, "");
117
117
  }
118
-
118
+
119
119
  if (properties.hooks) {
120
120
  await pipeline(
121
121
  iterableStringInterceptor(
@@ -161,13 +161,15 @@ package() {
161
161
  );
162
162
  }
163
163
 
164
- const makepkg = await execa("makepkg", ["-f", "-e"], {
165
- cwd: staging,
166
- env: { PKGDEST: destination }
167
- });
164
+ if (!options.dry) {
165
+ const makepkg = await execa("makepkg", ["-f", "-e"], {
166
+ cwd: staging,
167
+ env: { PKGDEST: destination }
168
+ });
168
169
 
169
- if (options.verbose) {
170
- console.log(makepkg.stdout);
170
+ if (options.verbose) {
171
+ console.log(makepkg.stdout);
172
+ }
171
173
  }
172
174
 
173
175
  return join(destination, this.packageFileName);
@@ -212,7 +214,6 @@ const fields = {
212
214
  options: { type: "string[]" }
213
215
  };
214
216
 
215
-
216
217
  function normalizeExpression(e) {
217
218
  e = e.replace(/\-([\w\d]+)$/, "");
218
219
  if (e.match(/^\d+/)) {
@@ -225,6 +226,8 @@ function normalizeExpression(e) {
225
226
  function makeDepends(dependencies) {
226
227
  return Object.entries(dependencies).map(
227
228
  ([name, version]) =>
228
- `${packageNameMapping[name] ? packageNameMapping[name] : name}${normalizeExpression(version)}`
229
+ `${
230
+ packageNameMapping[name] ? packageNameMapping[name] : name
231
+ }${normalizeExpression(version)}`
229
232
  );
230
233
  }
@@ -133,10 +133,12 @@ export class DEBIAN extends Packager {
133
133
  );
134
134
  }
135
135
 
136
- const dpkg = await execa("dpkg", ["-b", staging, destination]);
136
+ if (!options.dry) {
137
+ const dpkg = await execa("dpkg", ["-b", staging, destination]);
137
138
 
138
- if (options.verbose) {
139
- console.log(dpkg.stdout);
139
+ if (options.verbose) {
140
+ console.log(dpkg.stdout);
141
+ }
140
142
  }
141
143
 
142
144
  return join(destination, this.packageFileName);
@@ -36,9 +36,12 @@ export function requiresFromDependencies(dependencies) {
36
36
  return Object.entries(dependencies).map(
37
37
  ([name, e]) =>
38
38
  `${packageNameMapping[name] ? packageNameMapping[name] : name}${e
39
- .replace(/^\s*(\w+)/, (match, p1) => ` = ${p1}`)
40
- .replace(/^\s*$/, "")
41
- .replace(/^\s*(<|<=|>|>=|=)\s*(\w+)/, (match, p1, p2) => ` ${p1} ${p2}`)}`
39
+ .replace(/^\s*(\w+)/, (match, p1) => ` = ${p1}`)
40
+ .replace(/^\s*$/, "")
41
+ .replace(
42
+ /^\s*(<|<=|>|>=|=)\s*(\w+)/,
43
+ (match, p1, p2) => ` ${p1} ${p2}`
44
+ )}`
42
45
  );
43
46
  }
44
47
 
@@ -163,27 +166,29 @@ export class RPM extends Packager {
163
166
  );
164
167
  }
165
168
 
166
- const rpmbuild = await execa("rpmbuild", [
167
- "--define",
168
- `_topdir ${tmpdir}`,
169
- "--buildroot",
170
- staging,
171
- "-vv",
172
- "-bb",
173
- join(staging, specFileName)
174
- ]);
169
+ const packageFile = join(destination, this.packageFileName);
175
170
 
176
- if (options.verbose) {
177
- console.log(rpmbuild.stdout);
178
- }
171
+ if (!options.dry) {
172
+ const rpmbuild = await execa("rpmbuild", [
173
+ "--define",
174
+ `_topdir ${tmpdir}`,
175
+ "--buildroot",
176
+ staging,
177
+ "-vv",
178
+ "-bb",
179
+ join(staging, specFileName)
180
+ ]);
179
181
 
180
- const packageFile = join(destination, this.packageFileName);
182
+ if (options.verbose) {
183
+ console.log(rpmbuild.stdout);
184
+ }
181
185
 
182
- await cp(
183
- join(tmpdir, "RPMS", properties.arch, this.packageFileName),
184
- packageFile,
185
- { preserveTimestamps: true }
186
- );
186
+ await cp(
187
+ join(tmpdir, "RPMS", properties.arch, this.packageFileName),
188
+ packageFile,
189
+ { preserveTimestamps: true }
190
+ );
191
+ }
187
192
  return packageFile;
188
193
  }
189
194
  }