npm-pkgbuild 10.17.1 → 10.17.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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2018-2022 by arlac77
1
+ Copyright (c) 2018-2023 by arlac77
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-pkgbuild",
3
- "version": "10.17.1",
3
+ "version": "10.17.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -238,7 +238,7 @@ export async function* extractFromPackage(options = {}) {
238
238
 
239
239
  for (const a of arch) {
240
240
  if (!restrictArch.size || restrictArch.has(a)) {
241
- if (!options.available || npmArchMapping[process.arch] === a) {
241
+ if (!options.prepare || npmArchMapping[process.arch] === a) {
242
242
  numberOfArchs++;
243
243
  properties.arch = [a];
244
244
  yield {
@@ -72,7 +72,7 @@ program
72
72
  for (const outputFactory of allOutputs.filter(
73
73
  o => options[o.name] === true || output[o.name] !== undefined
74
74
  )) {
75
- if (options.available && !(await outputFactory.available)) {
75
+ if (options.available && !(await outputFactory.prepare)) {
76
76
  continute;
77
77
  }
78
78
 
@@ -54,7 +54,8 @@ function keyPrefix(key) {
54
54
 
55
55
  const PKGBUILD = "PKGBUILD";
56
56
 
57
- let ext = ".pkg.tar.xz";
57
+ let _ext = ".pkg.tar.xz";
58
+ let _prepared;
58
59
 
59
60
  export class ARCH extends Packager {
60
61
  static get name() {
@@ -66,14 +67,15 @@ export class ARCH extends Packager {
66
67
  }
67
68
 
68
69
  static get fileNameExtension() {
69
- return ext;
70
+ return _ext;
70
71
  }
71
72
 
72
73
  static get fields() {
73
74
  return fields;
74
75
  }
75
76
 
76
- static async available() {
77
+ static async prepare() {
78
+ if(_prepared === undefined) {
77
79
  try {
78
80
  await execa("makepkg", ["-V"]);
79
81
 
@@ -84,12 +86,14 @@ export class ARCH extends Packager {
84
86
  .substring(i)
85
87
  .split(/\n/)[0]
86
88
  .match(/='([^']+)'/);
87
- ext = m[1];
89
+ _ext = m[1];
88
90
  }
89
- return true;
90
- } catch {}
91
-
92
- return false;
91
+ _prepared = true;
92
+ } catch {
93
+ _prepared = false;
94
+ }
95
+ }
96
+ return _prepared;
93
97
  }
94
98
 
95
99
  get packageFileName() {
@@ -47,7 +47,7 @@ export class DEBIAN extends Packager {
47
47
  return fields;
48
48
  }
49
49
 
50
- static async available() {
50
+ static async prepare() {
51
51
  try {
52
52
  await execa("dpkg", ["--version"]);
53
53
  return true;
@@ -64,7 +64,7 @@ export class OCI extends Packager {
64
64
  return ".oci.tar.gz";
65
65
  }
66
66
 
67
- static available() {
67
+ static prepare() {
68
68
  return true;
69
69
  }
70
70
 
@@ -28,7 +28,7 @@ export class Packager {
28
28
  };
29
29
  }
30
30
 
31
- static available() {
31
+ static prepare() {
32
32
  return false;
33
33
  }
34
34
 
@@ -80,7 +80,7 @@ export class RPM extends Packager {
80
80
  * Check for rpmbuild presence.
81
81
  * @returns {boolean} true when rpmbuild is present
82
82
  */
83
- static async available() {
83
+ static async prepare() {
84
84
  try {
85
85
  await execa("rpmbuild", ["--version"]);
86
86
  return true;