npm-pkgbuild 19.0.8 → 19.1.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/README.md CHANGED
@@ -8,7 +8,6 @@
8
8
  [![Styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
9
9
  [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
10
10
  [![Known Vulnerabilities](https://snyk.io/test/github/arlac77/npm-pkgbuild/badge.svg)](https://snyk.io/test/github/arlac77/npm-pkgbuild)
11
- [![Coverage Status](https://coveralls.io/repos/arlac77/npm-pkgbuild/badge.svg)](https://coveralls.io/github/arlac77/npm-pkgbuild)
12
11
 
13
12
  ## npm-pkgbuild
14
13
 
@@ -99,47 +98,47 @@ See [mf-hosting](https://www.npmjs.com/package/mf-hosting) or [mf-hosting-fronte
99
98
  * [Properties](#properties)
100
99
  * [extractFromPackage](#extractfrompackage)
101
100
  * [Parameters](#parameters-1)
102
- * [NPMPackContentProvider](#npmpackcontentprovider)
101
+ * [BUILDAH](#buildah)
102
+ * [ContentProvider](#contentprovider)
103
103
  * [Parameters](#parameters-2)
104
104
  * [Properties](#properties-1)
105
+ * [asyncIterator](#asynciterator)
106
+ * [FileContentProvider](#filecontentprovider)
107
+ * [Parameters](#parameters-3)
108
+ * [asyncIterator](#asynciterator-1)
105
109
  * [name](#name)
106
110
  * [NodeModulesContentProvider](#nodemodulescontentprovider)
107
- * [Parameters](#parameters-3)
111
+ * [Parameters](#parameters-4)
108
112
  * [Properties](#properties-2)
109
- * [asyncIterator](#asynciterator)
113
+ * [asyncIterator](#asynciterator-2)
110
114
  * [name](#name-1)
111
- * [FileContentProvider](#filecontentprovider)
112
- * [Parameters](#parameters-4)
113
- * [asyncIterator](#asynciterator-1)
115
+ * [NPMPackContentProvider](#npmpackcontentprovider)
116
+ * [Parameters](#parameters-5)
117
+ * [Properties](#properties-3)
114
118
  * [name](#name-2)
115
119
  * [NFTContentProvider](#nftcontentprovider)
116
- * [Parameters](#parameters-5)
117
- * [asyncIterator](#asynciterator-2)
118
- * [name](#name-3)
119
- * [ContentProvider](#contentprovider)
120
120
  * [Parameters](#parameters-6)
121
- * [Properties](#properties-3)
122
121
  * [asyncIterator](#asynciterator-3)
122
+ * [name](#name-3)
123
123
  * [DEBIAN](#debian)
124
124
  * [hookMapping](#hookmapping)
125
125
  * [attributes](#attributes)
126
126
  * [prepare](#prepare)
127
127
  * [Parameters](#parameters-7)
128
- * [pkgKeyValuePairOptions](#pkgkeyvaluepairoptions)
129
- * [attributes](#attributes-1)
130
128
  * [quoteFile](#quotefile)
131
129
  * [Parameters](#parameters-8)
132
130
  * [RPM](#rpm)
133
131
  * [hookMapping](#hookmapping-1)
134
- * [attributes](#attributes-2)
132
+ * [attributes](#attributes-1)
135
133
  * [prepare](#prepare-1)
136
134
  * [Parameters](#parameters-9)
135
+ * [pkgKeyValuePairOptions](#pkgkeyvaluepairoptions)
136
+ * [attributes](#attributes-2)
137
137
  * [OCI](#oci)
138
138
  * [DOCKER](#docker)
139
139
  * [attributes](#attributes-3)
140
140
  * [prepare](#prepare-2)
141
141
  * [Parameters](#parameters-10)
142
- * [BUILDAH](#buildah)
143
142
  * [Packager](#packager)
144
143
  * [Parameters](#parameters-11)
145
144
  * [packageName](#packagename)
@@ -249,21 +248,51 @@ Extract package definition from package.json.
249
248
 
250
249
  Returns **AsyncIterable<[PackageDefinition](#packagedefinition)>**&#x20;
251
250
 
252
- ## NPMPackContentProvider
251
+ ## BUILDAH
253
252
 
254
- **Extends ContentProvider**
253
+ **Extends DOCKER**
255
254
 
256
- Content from npm pack.
255
+ Use buildah @see <https://buildah.io>
256
+
257
+ ## ContentProvider
258
+
259
+ Source of package content.
257
260
 
258
261
  ### Parameters
259
262
 
260
- * `definitions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
261
- * `entryProperties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** to be set for each entry
263
+ * `definitions` &#x20;
264
+ * `entryProperties` &#x20;
262
265
  * `directoryProperties` &#x20;
263
266
 
264
267
  ### Properties
265
268
 
266
269
  * `dir` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
270
+ * `transformer` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<Transformer>**&#x20;
271
+
272
+ ### asyncIterator
273
+
274
+ List all entries.
275
+
276
+ Returns **AsyncIterable<(ContentEntry | CollectionEntry)>** all entries
277
+
278
+ ## FileContentProvider
279
+
280
+ **Extends ContentProvider**
281
+
282
+ Content provided form the file system.
283
+
284
+ ### Parameters
285
+
286
+ * `definitions` **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))**&#x20;
287
+
288
+ * `definitions.pattern` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>)**&#x20;
289
+ * `definitions.base` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** base directory where to find the files
290
+ * `entryProperties` &#x20;
291
+ * `directoryProperties` &#x20;
292
+
293
+ ### asyncIterator
294
+
295
+ Returns **AsyncIterable<(ContentEntry | CollectionEntry)>** all entries
267
296
 
268
297
  ### name
269
298
 
@@ -296,24 +325,21 @@ Returns **AsyncIterable<(ContentEntry | CollectionEntry)>** all entries
296
325
 
297
326
  Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the content provider
298
327
 
299
- ## FileContentProvider
328
+ ## NPMPackContentProvider
300
329
 
301
330
  **Extends ContentProvider**
302
331
 
303
- Content provided form the file system.
332
+ Content from npm pack.
304
333
 
305
334
  ### Parameters
306
335
 
307
- * `definitions` **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))**&#x20;
308
-
309
- * `definitions.pattern` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>)**&#x20;
310
- * `definitions.base` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** base directory where to find the files
311
- * `entryProperties` &#x20;
336
+ * `definitions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
337
+ * `entryProperties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** to be set for each entry
312
338
  * `directoryProperties` &#x20;
313
339
 
314
- ### asyncIterator
340
+ ### Properties
315
341
 
316
- Returns **AsyncIterable<(ContentEntry | CollectionEntry)>** all entries
342
+ * `dir` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
317
343
 
318
344
  ### name
319
345
 
@@ -342,27 +368,6 @@ Returns **AsyncIterable\<ContentEntry>** all entries
342
368
 
343
369
  Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the content provider
344
370
 
345
- ## ContentProvider
346
-
347
- Source of package content.
348
-
349
- ### Parameters
350
-
351
- * `definitions` &#x20;
352
- * `entryProperties` &#x20;
353
- * `directoryProperties` &#x20;
354
-
355
- ### Properties
356
-
357
- * `dir` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
358
- * `transformer` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<Transformer>**&#x20;
359
-
360
- ### asyncIterator
361
-
362
- List all entries.
363
-
364
- Returns **AsyncIterable<(ContentEntry | CollectionEntry)>** all entries
365
-
366
371
  ## DEBIAN
367
372
 
368
373
  **Extends Packager**
@@ -389,15 +394,6 @@ Map install hook named from default (arch) to deb.
389
394
 
390
395
  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>**&#x20;
391
396
 
392
- ## pkgKeyValuePairOptions
393
-
394
- Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
395
-
396
- ## attributes
397
-
398
- well known package properties
399
- <https://www.archlinux.org/pacman/PKGBUILD.5.html>
400
-
401
397
  ## quoteFile
402
398
 
403
399
  ### Parameters
@@ -431,6 +427,15 @@ Check for rpmbuild presence.
431
427
 
432
428
  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>** true when rpmbuild executable is present
433
429
 
430
+ ## pkgKeyValuePairOptions
431
+
432
+ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
433
+
434
+ ## attributes
435
+
436
+ well known package properties
437
+ <https://www.archlinux.org/pacman/PKGBUILD.5.html>
438
+
434
439
  ## OCI
435
440
 
436
441
  **Extends Packager**
@@ -460,12 +465,6 @@ Check for docker presence.
460
465
 
461
466
  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>** true when docker executable is present
462
467
 
463
- ## BUILDAH
464
-
465
- **Extends DOCKER**
466
-
467
- Use buildah @see <https://buildah.io>
468
-
469
468
  ## Packager
470
469
 
471
470
  ### Parameters
@@ -495,6 +494,9 @@ Prepares artifact generation.
495
494
  #### Parameters
496
495
 
497
496
  * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
497
+
498
+ * `options.staging` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?**&#x20;
499
+ * `options.destination` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?**&#x20;
498
500
  * `publishingDetail` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?**&#x20;
499
501
 
500
502
  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{properties: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), destination: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), tmpdir: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), staging: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>**&#x20;
@@ -557,6 +559,9 @@ Prepares artifact generation.
557
559
  #### Parameters
558
560
 
559
561
  * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
562
+
563
+ * `options.staging` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?**&#x20;
564
+ * `options.destination` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?**&#x20;
560
565
  * `publishingDetail` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?**&#x20;
561
566
 
562
567
  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{properties: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), destination: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), tmpdir: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), staging: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>**&#x20;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-pkgbuild",
3
- "version": "19.0.8",
3
+ "version": "19.1.1",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": false
@@ -52,7 +52,7 @@
52
52
  "tsc:types": "tsc -d --allowJs --declarationDir dist --emitDeclarationOnly ./src/extract-from-package.mjs"
53
53
  },
54
54
  "dependencies": {
55
- "@npmcli/arborist": "^9.1.8",
55
+ "@npmcli/arborist": "^9.1.9",
56
56
  "@vercel/nft": "^1.1.0",
57
57
  "aggregate-async-iterator": "^1.2.3",
58
58
  "commander": "^14.0.2",
@@ -74,7 +74,7 @@
74
74
  "uti": "^8.10.3"
75
75
  },
76
76
  "devDependencies": {
77
- "@types/node": "^24.10.1",
77
+ "@types/node": "^25.0.0",
78
78
  "ava": "^6.4.1",
79
79
  "c8": "^10.1.3",
80
80
  "documentation": "^14.0.3",
@@ -28,6 +28,7 @@ allInputs.forEach(i => {
28
28
  program
29
29
  .option("--verbose", "be more verbose", false)
30
30
  .option("--dry", "do not execute, only print definitions", false)
31
+ .option("--staging <dir>","directory where to start packaging process")
31
32
  .option("-D --define <a=b>", "define property", (str, former = {}) =>
32
33
  Object.assign(former, Object.fromEntries([str.split(/=/)]))
33
34
  )
@@ -261,10 +261,6 @@ package() {
261
261
 
262
262
  if (options.verbose) {
263
263
  console.log(await readFile(join(staging, PKGBUILD), utf8StreamOptions));
264
- /*console.log("***", staging, "***");
265
- const ls = await execa("ls", ["-lR"], { cwd: staging });
266
- console.log(ls.stdout);
267
- console.log("*** end ***");*/
268
264
  }
269
265
 
270
266
  if (!options.dry) {
@@ -274,9 +270,14 @@ package() {
274
270
  PACKAGER = person(properties.contributors);
275
271
  }
276
272
 
273
+ const makePackageOptions = ["--noprogressbar", "-m", "-c", "-f", "-e"];
274
+ if (options.verbose) {
275
+ makePackageOptions.push("--log");
276
+ }
277
+
277
278
  const makepkg = await execa(
278
279
  "makepkg",
279
- ["--noprogressbar", "-c", "-f", "-e"],
280
+ makePackageOptions,
280
281
  {
281
282
  cwd: staging,
282
283
  env: { PKGDEST: destination, PACKAGER }
@@ -198,6 +198,8 @@ export class Packager {
198
198
  /**
199
199
  * Prepares artifact generation.
200
200
  * @param {Object} options
201
+ * @param {string} [options.staging]
202
+ * @param {string} [options.destination]
201
203
  * @param {Object} [publishingDetail]
202
204
  * @returns {Promise<{properties:Object, destination:string, tmpdir:string, staging:string}>}
203
205
  */
@@ -212,7 +214,7 @@ export class Packager {
212
214
  properties: this.properties,
213
215
  destination: options.destination || tmpdir,
214
216
  tmpdir,
215
- staging: tmpdir
217
+ staging: options.staging || tmpdir
216
218
  };
217
219
 
218
220
  // @ts-ignore
@@ -118,9 +118,6 @@ export class DOCKER extends Packager {
118
118
  arch: string;
119
119
  }): Promise<boolean>;
120
120
  create(sources: any, transformer: any, options: any, publishingDetails: any, expander: any): Promise<string>;
121
- publish(artifact: any, publishingDetails: any, logger?: {
122
- (...data: any[]): void;
123
- (message?: any, ...optionalParams: any[]): void;
124
- }): Promise<void>;
121
+ publish(artifact: any, publishingDetails: any, logger?: (...data: any[]) => void): Promise<void>;
125
122
  }
126
123
  import { Packager } from "./packager.mjs";
@@ -53,10 +53,15 @@ export class Packager {
53
53
  /**
54
54
  * Prepares artifact generation.
55
55
  * @param {Object} options
56
+ * @param {string} [options.staging]
57
+ * @param {string} [options.destination]
56
58
  * @param {Object} [publishingDetail]
57
59
  * @returns {Promise<{properties:Object, destination:string, tmpdir:string, staging:string}>}
58
60
  */
59
- prepare(options: any, publishingDetail?: any): Promise<{
61
+ prepare(options: {
62
+ staging?: string;
63
+ destination?: string;
64
+ }, publishingDetail?: any): Promise<{
60
65
  properties: any;
61
66
  destination: string;
62
67
  tmpdir: string;