npm-pkgbuild 15.6.11 → 16.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/LICENSE CHANGED
@@ -1,23 +1,12 @@
1
- Copyright (c) 2018-2024 by arlac77
2
- All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without
5
- modification, are permitted provided that the following conditions are met:
6
-
7
- * Redistributions of source code must retain the above copyright notice, this
8
- list of conditions and the following disclaimer.
9
-
10
- * Redistributions in binary form must reproduce the above copyright notice,
11
- this list of conditions and the following disclaimer in the documentation
12
- and/or other materials provided with the distribution.
13
-
14
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
18
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1
+ Copyright (C) 2018-2025 by arlac77
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any
4
+ purpose with or without fee is hereby granted.
5
+
6
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
7
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
8
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
9
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
10
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
11
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
12
+ PERFORMANCE OF THIS SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [![npm](https://img.shields.io/npm/v/npm-pkgbuild.svg)](https://www.npmjs.com/package/npm-pkgbuild)
2
- [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
2
+ [![License](https://img.shields.io/badge/License-0BSD-blue.svg)](https://spdx.org/licenses/0BSD.html)
3
3
  [![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript\&label\&labelColor=blue\&color=555555)](https://typescriptlang.org)
4
4
  [![bundlejs](https://deno.bundlejs.com/?q=npm-pkgbuild\&badge=detailed)](https://bundlejs.com/?q=npm-pkgbuild)
5
5
  [![downloads](http://img.shields.io/npm/dm/npm-pkgbuild.svg?style=flat-square)](https://npmjs.org/package/npm-pkgbuild)
@@ -90,202 +90,188 @@ See [mf-hosting](https://www.npmjs.com/package/mf-hosting) or [mf-hosting-fronte
90
90
 
91
91
  ### Table of Contents
92
92
 
93
- * [ContentProvider](#contentprovider)
93
+ * [allInputs](#allinputs)
94
+ * [allOutputs](#alloutputs)
95
+ * [npmArchMapping](#npmarchmapping)
96
+ * [content2Sources](#content2sources)
94
97
  * [Parameters](#parameters)
98
+ * [PackageDefinition](#packagedefinition)
95
99
  * [Properties](#properties)
96
- * [destinationPrefix](#destinationprefix)
97
- * [asyncIterator](#asynciterator)
98
- * [FileContentProvider](#filecontentprovider)
100
+ * [extractFromPackage](#extractfrompackage)
99
101
  * [Parameters](#parameters-1)
100
- * [name](#name)
101
- * [utf8StreamOptions](#utf8streamoptions)
102
- * [Properties](#properties-1)
103
- * [decodePassword](#decodepassword)
102
+ * [BUILDAH](#buildah)
103
+ * [ContentProvider](#contentprovider)
104
104
  * [Parameters](#parameters-2)
105
- * [FunctionDecl](#functiondecl)
106
- * [Properties](#properties-2)
107
- * [extractFunctions](#extractfunctions)
105
+ * [Properties](#properties-1)
106
+ * [asyncIterator](#asynciterator)
107
+ * [FileContentProvider](#filecontentprovider)
108
108
  * [Parameters](#parameters-3)
109
- * [fieldProvider](#fieldprovider)
109
+ * [name](#name)
110
+ * [NodeModulesContentProvider](#nodemodulescontentprovider)
110
111
  * [Parameters](#parameters-4)
111
- * [Expander](#expander)
112
- * [Parameters](#parameters-5)
113
- * [copyEntries](#copyentries)
114
- * [Parameters](#parameters-6)
115
- * [NFTContentProvider](#nftcontentprovider)
116
- * [Parameters](#parameters-7)
112
+ * [Properties](#properties-2)
117
113
  * [name](#name-1)
118
- * [NodeModulesContentProvider](#nodemodulescontentprovider)
119
- * [Parameters](#parameters-8)
114
+ * [NPMPackContentProvider](#npmpackcontentprovider)
115
+ * [Parameters](#parameters-5)
120
116
  * [Properties](#properties-3)
121
117
  * [name](#name-2)
122
- * [NPMPackContentProvider](#npmpackcontentprovider)
123
- * [Parameters](#parameters-9)
124
- * [Properties](#properties-4)
118
+ * [NFTContentProvider](#nftcontentprovider)
119
+ * [Parameters](#parameters-6)
125
120
  * [name](#name-3)
126
- * [pkgKeyValuePairOptions](#pkgkeyvaluepairoptions)
127
- * [fields](#fields)
128
- * [fields](#fields-1)
129
- * [fields](#fields-2)
130
- * [fields](#fields-3)
131
- * [BUILDAH](#buildah)
132
121
  * [hookMapping](#hookmapping)
133
122
  * [hookMapping](#hookmapping-1)
134
123
  * [DEBIAN](#debian)
135
124
  * [prepare](#prepare)
136
- * [Parameters](#parameters-10)
137
- * [DOCKER](#docker)
125
+ * [Parameters](#parameters-7)
126
+ * [fields](#fields)
127
+ * [fields](#fields-1)
128
+ * [fields](#fields-2)
129
+ * [fields](#fields-3)
130
+ * [quoteFile](#quotefile)
131
+ * [Parameters](#parameters-8)
132
+ * [RPM](#rpm)
138
133
  * [prepare](#prepare-1)
139
- * [Parameters](#parameters-11)
134
+ * [Parameters](#parameters-9)
135
+ * [pkgKeyValuePairOptions](#pkgkeyvaluepairoptions)
140
136
  * [OCI](#oci)
137
+ * [DOCKER](#docker)
138
+ * [prepare](#prepare-2)
139
+ * [Parameters](#parameters-10)
141
140
  * [Packager](#packager)
142
- * [Parameters](#parameters-12)
141
+ * [Parameters](#parameters-11)
143
142
  * [packageName](#packagename)
144
- * [Parameters](#parameters-13)
143
+ * [Parameters](#parameters-12)
145
144
  * [tmpdir](#tmpdir)
146
- * [prepare](#prepare-2)
147
- * [Parameters](#parameters-14)
145
+ * [prepare](#prepare-3)
146
+ * [Parameters](#parameters-13)
148
147
  * [create](#create)
149
- * [Parameters](#parameters-15)
148
+ * [Parameters](#parameters-14)
150
149
  * [workspaceLayout](#workspacelayout)
151
- * [prepare](#prepare-3)
152
- * [Parameters](#parameters-16)
150
+ * [prepare](#prepare-4)
151
+ * [Parameters](#parameters-15)
153
152
  * [Packager](#packager-1)
154
- * [Parameters](#parameters-17)
153
+ * [Parameters](#parameters-16)
155
154
  * [packageName](#packagename-1)
156
- * [Parameters](#parameters-18)
155
+ * [Parameters](#parameters-17)
157
156
  * [tmpdir](#tmpdir-1)
158
- * [prepare](#prepare-4)
159
- * [Parameters](#parameters-19)
157
+ * [prepare](#prepare-5)
158
+ * [Parameters](#parameters-18)
160
159
  * [create](#create-1)
161
- * [Parameters](#parameters-20)
160
+ * [Parameters](#parameters-19)
162
161
  * [workspaceLayout](#workspacelayout-1)
163
- * [prepare](#prepare-5)
164
- * [Parameters](#parameters-21)
162
+ * [prepare](#prepare-6)
163
+ * [Parameters](#parameters-20)
165
164
  * [Field](#field)
166
- * [Properties](#properties-5)
165
+ * [Properties](#properties-4)
166
+ * [copyNodeModules](#copynodemodules)
167
+ * [Parameters](#parameters-21)
167
168
  * [PublishingDetail](#publishingdetail)
168
- * [Properties](#properties-6)
169
+ * [Properties](#properties-5)
169
170
  * [createPublishingDetails](#createpublishingdetails)
170
171
  * [Parameters](#parameters-22)
171
172
  * [publish](#publish)
172
173
  * [Parameters](#parameters-23)
173
- * [quoteFile](#quotefile)
174
+ * [utf8StreamOptions](#utf8streamoptions)
175
+ * [Properties](#properties-6)
176
+ * [decodePassword](#decodepassword)
174
177
  * [Parameters](#parameters-24)
175
- * [RPM](#rpm)
176
- * [prepare](#prepare-6)
177
- * [Parameters](#parameters-25)
178
-
179
- ## ContentProvider
180
-
181
- Source of package content.
182
-
183
- ### Parameters
184
-
185
- * `definitions`  
186
- * `entryProperties`  
187
-
188
- ### Properties
189
-
190
- * `dir` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
191
- * `transformer` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<Transformer>**&#x20;
178
+ * [FunctionDecl](#functiondecl)
179
+ * [Properties](#properties-7)
180
+ * [extractFunctions](#extractfunctions)
181
+ * [Parameters](#parameters-25)
182
+ * [fieldProvider](#fieldprovider)
183
+ * [Parameters](#parameters-26)
184
+ * [Expander](#expander)
185
+ * [Parameters](#parameters-27)
186
+ * [copyEntries](#copyentries)
187
+ * [Parameters](#parameters-28)
192
188
 
193
- ### destinationPrefix
189
+ ## allInputs
194
190
 
195
- Returns **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))**&#x20;
191
+ All content providers (input)
196
192
 
197
- ### asyncIterator
193
+ ## allOutputs
198
194
 
199
- List all entries.
195
+ All output formats
200
196
 
201
- Returns **AsyncIterable\<ContentEntry>** all entries
197
+ ## npmArchMapping
202
198
 
203
- ## FileContentProvider
199
+ Node architecture name to os native arch name mapping
200
+ {@see <https://nodejs.org/dist/latest-v18.x/docs/api/process.html#processargv}>
204
201
 
205
- **Extends ContentProvider**
202
+ ## content2Sources
206
203
 
207
- Content provided form the file system.
204
+ Delivers ContentProviders from pkgbuild.content definition.
208
205
 
209
206
  ### Parameters
210
207
 
211
- * `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;
212
-
213
- * `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;
214
- * `definitions.base` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** base directory where to find the files
215
- * `entryProperties` &#x20;
216
-
217
- ### name
208
+ * `content` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** from pkgbuild.content
209
+ * `dir` &#x20;
218
210
 
219
- Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the content provider
211
+ Returns **Iterable<[ContentProvider](#contentprovider)>**&#x20;
220
212
 
221
- ## utf8StreamOptions
213
+ ## PackageDefinition
222
214
 
223
215
  Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
224
216
 
225
217
  ### Properties
226
218
 
227
- * `encoding` **BufferEncoding**&#x20;
228
-
229
- ## decodePassword
230
-
231
- Decode a password
232
-
233
- ### Parameters
234
-
235
- * `password` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
236
-
237
- Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** plaintext password
219
+ * `properties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** values describing the package attributes
238
220
 
239
- ## FunctionDecl
221
+ * `properties.dependencies` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
222
+ * `sources` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[ContentProvider](#contentprovider)>** content providers
223
+ * `output` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** package type
224
+ * `variant` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** identifier of the variant
240
225
 
241
- Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
226
+ * `variant.name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the variant
227
+ * `variant.arch` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the architecture
242
228
 
243
- ### Properties
244
-
245
- * `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
246
- * `body` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
229
+ ## extractFromPackage
247
230
 
248
- ## extractFunctions
231
+ Extract package definition from package.json.
249
232
 
250
- Extract shell functions from a given text.
233
+ * for each architecture deliver a new result
234
+ * if no architecture is given one result set is provided nethertheless
235
+ * architectures are taken from cpu (node arch ids) and from pkgbuild.arch (raw arch ids)
236
+ * architecture given in a variant definition are used to restrict the set of avaliable architectures
251
237
 
252
238
  ### Parameters
253
239
 
254
- * `source` **AsyncIterable<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**&#x20;
240
+ * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `{}`)
255
241
 
256
- Returns **AsyncIterable<[FunctionDecl](#functiondecl)>**&#x20;
242
+ * `options.dir` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** where to look for package.json
243
+ * `options.verbose` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** log
244
+ * `env` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** as delared in process.env (optional, default `{}`)
257
245
 
258
- ## fieldProvider
246
+ Returns **AsyncIterable<[PackageDefinition](#packagedefinition)>**&#x20;
259
247
 
260
- ### Parameters
248
+ ## BUILDAH
261
249
 
262
- * `properties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
263
- * `fields` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
250
+ **Extends DOCKER**
264
251
 
265
- Returns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**&#x20;
252
+ Use buildah @see <https://buildah.io>
266
253
 
267
- ## Expander
254
+ ## ContentProvider
268
255
 
269
- Type: [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)
256
+ Source of package content.
270
257
 
271
258
  ### Parameters
272
259
 
273
- * `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
260
+ * `definitions` &#x20;
261
+ * `entryProperties` &#x20;
274
262
 
275
- Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
263
+ ### Properties
276
264
 
277
- ## copyEntries
265
+ * `dir` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
266
+ * `transformer` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<Transformer>**&#x20;
278
267
 
279
- Copy content from source into destinationDirectory.
280
- Destination paths a generated without leading '/' (as for entry names too).
268
+ ### asyncIterator
281
269
 
282
- ### Parameters
270
+ List all entries.
283
271
 
284
- * `source` **AsyncIterable\<ContentEntry>**&#x20;
285
- * `destinationDirectory` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
286
- * `expander` **[Expander](#expander)** (optional, default `v=>v`)
272
+ Returns **AsyncIterable\<ContentEntry>** all entries
287
273
 
288
- ## NFTContentProvider
274
+ ## FileContentProvider
289
275
 
290
276
  **Extends ContentProvider**
291
277
 
@@ -318,7 +304,6 @@ Requires .npmrc or NPM\_TOKEN environment
318
304
  ### Properties
319
305
 
320
306
  * `withoutDevelpmentDependencies` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**&#x20;
321
- * `destinationPrefix` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** base name out output
322
307
 
323
308
  ### name
324
309
 
@@ -343,33 +328,23 @@ Content from npm pack.
343
328
 
344
329
  Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the content provider
345
330
 
346
- ## pkgKeyValuePairOptions
347
-
348
- Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
349
-
350
- ## fields
351
-
352
- well known package properties
353
- <https://www.archlinux.org/pacman/PKGBUILD.5.html>
354
-
355
- ## fields
356
-
357
- * **See**: <https://www.debian.org/doc/debian-policy/ch-controlfields.html>
358
- * **See**: <https://linux.die.net/man/5/deb-control>
331
+ ## NFTContentProvider
359
332
 
360
- ## fields
333
+ **Extends ContentProvider**
361
334
 
362
- * **See**: <https://docs.docker.com/engine/reference/builder/>
335
+ Content provided form the file system.
363
336
 
364
- ## fields
337
+ ### Parameters
365
338
 
366
- * **See**: <https://rpm-packaging-guide.github.io>
339
+ * `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;
367
340
 
368
- ## BUILDAH
341
+ * `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;
342
+ * `definitions.base` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** base directory where to find the files
343
+ * `entryProperties` &#x20;
369
344
 
370
- **Extends DOCKER**
345
+ ### name
371
346
 
372
- Use buildah @see <https://buildah.io>
347
+ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the content provider
373
348
 
374
349
  ## hookMapping
375
350
 
@@ -396,15 +371,39 @@ Create .deb packages
396
371
 
397
372
  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;
398
373
 
399
- ## DOCKER
374
+ ## fields
375
+
376
+ * **See**: <https://www.debian.org/doc/debian-policy/ch-controlfields.html>
377
+ * **See**: <https://linux.die.net/man/5/deb-control>
378
+
379
+ ## fields
380
+
381
+ * **See**: <https://rpm-packaging-guide.github.io>
382
+
383
+ ## fields
384
+
385
+ well known package properties
386
+ <https://www.archlinux.org/pacman/PKGBUILD.5.html>
387
+
388
+ ## fields
389
+
390
+ * **See**: <https://docs.docker.com/engine/reference/builder/>
391
+
392
+ ## quoteFile
393
+
394
+ ### Parameters
395
+
396
+ * `name` &#x20;
397
+
398
+ ## RPM
400
399
 
401
400
  **Extends Packager**
402
401
 
403
- docker image build
402
+ produce rpm packages
404
403
 
405
404
  ### prepare
406
405
 
407
- Check for docker presence.
406
+ Check for rpmbuild presence.
408
407
 
409
408
  #### Parameters
410
409
 
@@ -413,7 +412,11 @@ Check for docker presence.
413
412
 
414
413
  * `variant.arch` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
415
414
 
416
- 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
415
+ 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
416
+
417
+ ## pkgKeyValuePairOptions
418
+
419
+ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
417
420
 
418
421
  ## OCI
419
422
 
@@ -421,6 +424,25 @@ Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
421
424
 
422
425
  Low level OCI compatible packager
423
426
 
427
+ ## DOCKER
428
+
429
+ **Extends Packager**
430
+
431
+ docker image build
432
+
433
+ ### prepare
434
+
435
+ Check for docker presence.
436
+
437
+ #### Parameters
438
+
439
+ * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
440
+ * `variant` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
441
+
442
+ * `variant.arch` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
443
+
444
+ 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
445
+
424
446
  ## Packager
425
447
 
426
448
  ### Parameters
@@ -462,10 +484,9 @@ Execute package generation.
462
484
 
463
485
  * `sources` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
464
486
  * `transformer` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>**&#x20;
465
- * `dependencies` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
466
487
  * `publishingDetails` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[PublishingDetail](#publishingdetail)>**&#x20;
467
488
  * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
468
- * `expander` **function ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)): [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
489
+ * `expander` **function ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)): [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?**&#x20;
469
490
 
470
491
  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** identifier of the resulting package
471
492
 
@@ -525,10 +546,9 @@ Execute package generation.
525
546
 
526
547
  * `sources` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
527
548
  * `transformer` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>**&#x20;
528
- * `dependencies` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
529
549
  * `publishingDetails` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[PublishingDetail](#publishingdetail)>**&#x20;
530
550
  * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
531
- * `expander` **function ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)): [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
551
+ * `expander` **function ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)): [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?**&#x20;
532
552
 
533
553
  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** identifier of the resulting package
534
554
 
@@ -556,6 +576,14 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
556
576
  * `default` **any**&#x20;
557
577
  * `mandatory` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**&#x20;
558
578
 
579
+ ## copyNodeModules
580
+
581
+ ### Parameters
582
+
583
+ * `source` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
584
+ * `dest` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
585
+ * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `defaultOptions`)
586
+
559
587
  ## PublishingDetail
560
588
 
561
589
  Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
@@ -592,30 +620,72 @@ Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Gl
592
620
  * `properties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?**&#x20;
593
621
  * `logger` **function (any): void** (optional, default `console.log`)
594
622
 
595
- ## quoteFile
623
+ ## utf8StreamOptions
624
+
625
+ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
626
+
627
+ ### Properties
628
+
629
+ * `encoding` **BufferEncoding**&#x20;
630
+
631
+ ## decodePassword
632
+
633
+ Decode a password
596
634
 
597
635
  ### Parameters
598
636
 
599
- * `name` &#x20;
637
+ * `password` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
600
638
 
601
- ## RPM
639
+ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** plaintext password
602
640
 
603
- **Extends Packager**
641
+ ## FunctionDecl
604
642
 
605
- produce rpm packages
643
+ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
606
644
 
607
- ### prepare
645
+ ### Properties
608
646
 
609
- Check for rpmbuild presence.
647
+ * `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
648
+ * `body` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
610
649
 
611
- #### Parameters
650
+ ## extractFunctions
612
651
 
613
- * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
614
- * `variant` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
652
+ Extract shell functions from a given text.
615
653
 
616
- * `variant.arch` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
654
+ ### Parameters
617
655
 
618
- 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
656
+ * `source` **AsyncIterable<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**&#x20;
657
+
658
+ Returns **AsyncIterable<[FunctionDecl](#functiondecl)>**&#x20;
659
+
660
+ ## fieldProvider
661
+
662
+ ### Parameters
663
+
664
+ * `properties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
665
+ * `fields` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
666
+
667
+ Returns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**&#x20;
668
+
669
+ ## Expander
670
+
671
+ Type: [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)
672
+
673
+ ### Parameters
674
+
675
+ * `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
676
+
677
+ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
678
+
679
+ ## copyEntries
680
+
681
+ Copy content from source into destinationDirectory.
682
+ Destination paths a generated without leading '/' (as for entry names too).
683
+
684
+ ### Parameters
685
+
686
+ * `source` **AsyncIterable\<ContentEntry>**&#x20;
687
+ * `destinationDirectory` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
688
+ * `expander` **[Expander](#expander)** (optional, default `v=>v`)
619
689
 
620
690
  # install
621
691
 
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "npm-pkgbuild",
3
- "version": "15.6.11",
3
+ "version": "16.1.1",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
- "provenance": true
6
+ "provenance": false
7
7
  },
8
8
  "types": "./types/module.d.mts",
9
9
  "exports": {
10
10
  ".": {
11
- "default": "./src/module.mjs",
12
- "types": "./types/module.d.mts"
11
+ "types": "./types/module.d.mts",
12
+ "default": "./src/module.mjs"
13
13
  }
14
14
  },
15
15
  "description": "create ArchLinux, RPM and Debian packages from npm packages",
@@ -34,34 +34,34 @@
34
34
  "email": "markus.felten@gmx.de"
35
35
  }
36
36
  ],
37
- "license": "BSD-2-Clause",
37
+ "license": "0BSD",
38
38
  "bin": {
39
39
  "npm-pkgbuild": "src/npm-pkgbuild-cli.mjs"
40
40
  },
41
41
  "scripts": {
42
42
  "prepare": "node --run prepare:typescript",
43
- "prepare:typescript": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types --resolveJsonModule --target es2024 --lib es2024 -m esnext --module nodenext --moduleResolution nodenext --rootDir src ./src**/*.mjs",
43
+ "prepare:typescript": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types --resolveJsonModule --target es2024 --lib esnext -m esnext --module nodenext --moduleResolution nodenext --rootDir src ./src**/*.mjs",
44
44
  "test": "node --run test:ava",
45
45
  "test:ava": "ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs",
46
46
  "cover": "c8 -x 'tests/**/*' --temp-directory build/tmp ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs && c8 report -r lcov -o build/coverage --temp-directory build/tmp",
47
- "docs": "documentation readme --section=API ./src/**/*.mjs",
47
+ "docs": "documentation readme --section=API ./src**/*.mjs",
48
48
  "lint": "node --run lint:docs && node --run lint:typescript",
49
- "lint:docs": "documentation lint ./src/**/*.mjs",
50
- "lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule --target es2024 --lib es2024 -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs",
49
+ "lint:docs": "documentation lint ./src**/*.mjs",
50
+ "lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule --target es2024 --lib esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs",
51
51
  "tsc:types": "tsc -d --allowJs --declarationDir dist --emitDeclarationOnly ./src/extract-from-package.mjs"
52
52
  },
53
53
  "dependencies": {
54
- "@npmcli/arborist": "^8.0.0",
55
- "@vercel/nft": "^0.27.9",
54
+ "@npmcli/arborist": "^9.0.0",
55
+ "@vercel/nft": "^0.29.1",
56
56
  "aggregate-async-iterator": "^1.2.1",
57
- "commander": "^12.1.0",
57
+ "commander": "^13.1.0",
58
58
  "compare-versions": "^6.1.1",
59
59
  "content-entry": "^11.1.3",
60
60
  "content-entry-filesystem": "^6.0.0",
61
61
  "content-entry-transform": "^1.4.29",
62
62
  "execa": "^9.5.2",
63
63
  "expression-expander": "^7.2.5",
64
- "globby": "^14.0.2",
64
+ "globby": "^14.1.0",
65
65
  "ini": "^5.0.0",
66
66
  "iterable-string-interceptor": "^3.0.0",
67
67
  "key-value-transformer": "^3.2.3",
@@ -70,20 +70,20 @@
70
70
  "pacote": "^21.0.0",
71
71
  "pkg-dir": "^8.0.0",
72
72
  "tar-stream": "^3.1.7",
73
- "uti": "^8.7.0"
73
+ "uti": "^8.7.1"
74
74
  },
75
75
  "devDependencies": {
76
- "@types/node": "^22.10.2",
76
+ "@types/node": "^22.13.8",
77
77
  "ava": "^6.2.0",
78
78
  "c8": "^10.1.3",
79
79
  "documentation": "^14.0.3",
80
- "semantic-release": "^24.2.0",
80
+ "semantic-release": "^24.2.3",
81
81
  "stream-buffers": "^3.0.3",
82
- "typescript": "^5.7.2"
82
+ "typescript": "^5.8.2"
83
83
  },
84
84
  "engines": {
85
- "node": ">=20.18.0",
86
- "bun": ">=1.1"
85
+ "node": ">=22.13.0",
86
+ "bun": ">=1.1.43"
87
87
  },
88
88
  "repository": {
89
89
  "type": "git",
@@ -3,14 +3,13 @@ import { ContentEntry } from "content-entry";
3
3
  /**
4
4
  * Source of package content.
5
5
  * @property {string} dir
6
- * @property {Transformer[]} transformer
6
+ * @property {Transformer[]} transformer
7
7
  */
8
8
  export class ContentProvider {
9
-
10
9
  transformers = [];
11
10
  entryProperties;
12
11
  dir;
13
-
12
+
14
13
  constructor(definitions, entryProperties) {
15
14
  if (entryProperties) {
16
15
  this.entryProperties = entryProperties;
@@ -27,18 +26,9 @@ export class ContentProvider {
27
26
  }
28
27
  }
29
28
 
30
- /**
31
- * @return {string|undefined}
32
- */
33
- get destinationPrefix()
34
- {
35
- return undefined;
36
- }
37
-
38
29
  /**
39
30
  * List all entries.
40
31
  * @return {AsyncIterable<ContentEntry>} all entries
41
32
  */
42
- async *[Symbol.asyncIterator]() {
43
- }
33
+ async *[Symbol.asyncIterator]() {}
44
34
  }
@@ -4,7 +4,7 @@ import { FileSystemEntry } from "content-entry-filesystem";
4
4
  import { asArray } from "../util.mjs";
5
5
  import { ContentProvider } from "./content-provider.mjs";
6
6
 
7
- const DEFAULT_PATTERN = ["**/*"];
7
+ const DEFAULT_PATTERN = ["**/*", "!.*"];
8
8
 
9
9
  /**
10
10
  * Content provided form the file system.
@@ -14,7 +14,6 @@ import { shrinkNPM } from "../npm-shrink.mjs";
14
14
  * Content from node_modules.
15
15
  * Requires .npmrc or NPM_TOKEN environment
16
16
  * @property {boolean} withoutDevelpmentDependencies
17
- * @property {string} destinationPrefix base name out output
18
17
  */
19
18
  export class NodeModulesContentProvider extends ContentProvider {
20
19
  /**
@@ -29,9 +28,11 @@ export class NodeModulesContentProvider extends ContentProvider {
29
28
  }
30
29
 
31
30
  withoutDevelpmentDependencies = true;
32
- destinationPrefix = "node_modules";
33
31
 
34
32
  constructor(definitions, entryProperties) {
33
+ if (entryProperties?.destination && !entryProperties.destination.endsWith("/")) {
34
+ entryProperties.destination += "/";
35
+ }
35
36
  super(definitions, entryProperties);
36
37
  Object.assign(this, definitions);
37
38
  }
@@ -26,6 +26,9 @@ export class NPMPackContentProvider extends ContentProvider {
26
26
  }
27
27
 
28
28
  constructor(definitions, entryProperties) {
29
+ if (entryProperties?.destination && !entryProperties.destination.endsWith("/")) {
30
+ entryProperties.destination += "/";
31
+ }
29
32
  super(definitions, entryProperties);
30
33
  Object.assign(this, definitions);
31
34
  }
@@ -109,8 +109,8 @@ function* content2Sources(content, dir) {
109
109
  /**
110
110
  * @typedef {Object} PackageDefinition
111
111
  * @property {Object} properties values describing the package attributes
112
+ * @property {Object} properties.dependencies
112
113
  * @property {ContentProvider[]} sources content providers
113
- * @property {Object} dependencies
114
114
  * @property {Object} output package type
115
115
  * @property {Object} variant identifier of the variant
116
116
  * @property {string} variant.name name of the variant
@@ -261,7 +261,7 @@ export async function* extractFromPackage(options = {}, env = {}) {
261
261
 
262
262
  if (packageContent.contributors) {
263
263
  properties.maintainer = packageContent.contributors.map(
264
- c => c.name + (c.email ? ` <${c.email}>` : '')
264
+ c => c.name + (c.email ? ` <${c.email}>` : "")
265
265
  );
266
266
  }
267
267
 
@@ -360,7 +360,7 @@ export async function* extractFromPackage(options = {}, env = {}) {
360
360
  properties
361
361
  };
362
362
 
363
- function* forEachOutput(result) {
363
+ function* forEachOutput(result) {
364
364
  if (Object.entries(result.output).length === 0) {
365
365
  result.context = createContext({ properties: result.properties });
366
366
  result.sources = [];
@@ -384,7 +384,11 @@ export async function* extractFromPackage(options = {}, env = {}) {
384
384
  const properties = {
385
385
  type: name,
386
386
  ...result.properties,
387
- ...output.properties
387
+ ...output.properties,
388
+ dependencies: mergeDependencies(
389
+ result.dependencies,
390
+ output.dependencies
391
+ )
388
392
  };
389
393
 
390
394
  const context = createContext({ properties });
@@ -399,11 +403,7 @@ export async function* extractFromPackage(options = {}, env = {}) {
399
403
  variant: { ...result.variant, output: name },
400
404
  output: { [name]: output },
401
405
  sources,
402
- dependencies: mergeDependencies(
403
- result.dependencies,
404
- output.dependencies
405
- ),
406
- properties : context.expand(properties)
406
+ properties: context.expand(properties)
407
407
  };
408
408
  }
409
409
  }
@@ -56,7 +56,6 @@ program
56
56
  sources,
57
57
  output,
58
58
  variant,
59
- dependencies,
60
59
  context
61
60
  } of extractFromPackage(options, process.env)) {
62
61
  for (const inputFactory of allInputs.filter(
@@ -139,14 +138,13 @@ program
139
138
  console.log("sources:");
140
139
  console.log(" " + sources.join("\n "));
141
140
  console.log("dependencies:");
142
- console.log(kv(dependencies, " "));
141
+ console.log(kv(properties.dependencies, " "));
143
142
  console.log("publish:", publishingDetails.map(pd=>pd.url));
144
143
  }
145
144
 
146
145
  const artifact = await o.create(
147
146
  sources.map(c => c[Symbol.asyncIterator]()),
148
147
  transformer,
149
- dependencies,
150
148
  publishingDetails,
151
149
  options,
152
150
  context.expand
@@ -116,7 +116,7 @@ export class ARCH extends Packager {
116
116
  return `${p.name}-${p.version}-${p.release}-${p.arch}${this.fileNameExtension}`;
117
117
  }
118
118
 
119
- makeDepends(dependencies) {
119
+ makeDepends(dependencies={}) {
120
120
  return Object.entries(dependencies)
121
121
  .filter(filterOutUnwantedDependencies())
122
122
  .map(
@@ -128,7 +128,6 @@ export class ARCH extends Packager {
128
128
  async create(
129
129
  sources,
130
130
  transformer,
131
- dependencies,
132
131
  publishingDetails,
133
132
  options,
134
133
  expander
@@ -146,7 +145,8 @@ export class ARCH extends Packager {
146
145
  async function* trailingLines() {
147
146
  yield `
148
147
  package() {
149
- depends=(${self.makeDepends(dependencies)
148
+ depends=(${self
149
+ .makeDepends(properties.dependencies)
150
150
  .map(v => quote(v))
151
151
  .join(" ")})
152
152
 
@@ -200,6 +200,10 @@ package() {
200
200
 
201
201
  if (options.verbose) {
202
202
  console.log(await readFile(join(staging, PKGBUILD), utf8StreamOptions));
203
+ console.log("***", staging, "***");
204
+ const ls = await execa("ls", ["-lR"], { cwd: staging });
205
+ console.log(ls.stdout);
206
+ console.log("*** end ***");
203
207
  }
204
208
 
205
209
  if (!options.dry) {
@@ -238,7 +242,12 @@ const fields = {
238
242
  Maintainer: { alias: "maintainer", type: "string[]", prefix: "# " },
239
243
  packager: { alias: "maintainer", type: "string[]" },
240
244
  pkgname: { alias: "name", type: "string[]", mandatory: true },
241
- pkgver: { alias: "version", type: "string", mandatory: true },
245
+ pkgver: {
246
+ alias: "version",
247
+ type: "string",
248
+ mandatory: true,
249
+ set: v => v.replace("-semantic-release", "")
250
+ },
242
251
  pkgrel: { alias: "release", type: "integer", default: 1, mandatory: true },
243
252
  epoch: { type: "integer", default: 0 },
244
253
  pkgdesc: { alias: "description", type: "string", mandatory: true },
@@ -102,7 +102,6 @@ export class DEBIAN extends Packager {
102
102
  async create(
103
103
  sources,
104
104
  transformer,
105
- dependencies,
106
105
  publishingDetails,
107
106
  options,
108
107
  expander
@@ -117,8 +116,8 @@ export class DEBIAN extends Packager {
117
116
  )
118
117
  );
119
118
 
120
- if (Object.keys(dependencies).length > 0) {
121
- properties.Depends = Object.entries(dependencies)
119
+ if (properties.dependencies && Object.keys(properties.dependencies).length > 0) {
120
+ properties.Depends = Object.entries(properties.dependencies)
122
121
  .filter(filterOutUnwantedDependencies())
123
122
  .map(([name, e]) => `${this.packageName(name)} (${e})`);
124
123
  }
@@ -72,7 +72,6 @@ export class DOCKER extends Packager {
72
72
  async create(
73
73
  sources,
74
74
  transformer,
75
- dependencies,
76
75
  options,
77
76
  publishingDetails,
78
77
  expander
@@ -87,7 +86,7 @@ export class DOCKER extends Packager {
87
86
  for (const [k, v] of Object.entries({
88
87
  ...properties.from,
89
88
  ...Object.fromEntries(
90
- Object.entries(dependencies)
89
+ Object.entries(properties.dependencies)
91
90
  .filter(filterOutUnwantedDependencies())
92
91
  .filter(([k, v]) => dependenciesToFrom[k])
93
92
  .map(([k, v]) => [dependenciesToFrom[k], v.replace(/[>=]*/, "")])
@@ -79,7 +79,6 @@ export class OCI extends Packager {
79
79
  async create(
80
80
  sources,
81
81
  transformer,
82
- dependencies,
83
82
  publishingDetails,
84
83
  options,
85
84
  expander = v => v
@@ -157,16 +157,14 @@ export class Packager {
157
157
  * Execute package generation.
158
158
  * @param {Object} sources
159
159
  * @param {Object[]} transformer
160
- * @param {Object} dependencies
161
160
  * @param {PublishingDetail[]} publishingDetails
162
161
  * @param {Object} options
163
- * @param {function(string):string} expander
162
+ * @param {function(string):string?} expander
164
163
  * @return {Promise<string>} identifier of the resulting package
165
164
  */
166
165
  async create(
167
166
  sources,
168
167
  transformer,
169
- dependencies,
170
168
  publishingDetails,
171
169
  options,
172
170
  expander
@@ -94,7 +94,7 @@ export class RPM extends Packager {
94
94
  return false;
95
95
  }
96
96
 
97
- requiresFromDependencies(dependencies) {
97
+ requiresFromDependencies(dependencies={}) {
98
98
  return Object.entries(dependencies)
99
99
  .filter(filterOutUnwantedDependencies())
100
100
  .map(
@@ -112,7 +112,6 @@ export class RPM extends Packager {
112
112
  async create(
113
113
  sources,
114
114
  transformer,
115
- dependencies,
116
115
  publishingDetails,
117
116
  options,
118
117
  expander
@@ -121,7 +120,7 @@ export class RPM extends Packager {
121
120
  options
122
121
  );
123
122
 
124
- properties.Requires = this.requiresFromDependencies(dependencies);
123
+ properties.Requires = this.requiresFromDependencies(properties.dependencies);
125
124
 
126
125
  if (properties.Packager?.length > 1) {
127
126
  // TODO how to write several Packages ?
package/src/util.mjs CHANGED
@@ -5,10 +5,9 @@ import { createWriteStream } from "node:fs";
5
5
  import { ContentEntry } from "content-entry";
6
6
 
7
7
  /**
8
- * @type {Object}
9
- * @property {BufferEncoding} encoding
8
+ * @type {BufferEncoding}
10
9
  */
11
- export const utf8StreamOptions = { encoding: "utf8" };
10
+ export const utf8StreamOptions = "utf8";
12
11
 
13
12
  export function filterOutUnwantedDependencies() {
14
13
  return ([name, version]) => version !== "-";
@@ -200,9 +199,7 @@ export async function* copyEntries(
200
199
 
201
200
  // @ts-ignore
202
201
  entry.destination = name;
203
- const destination = entry.destinationPrefix
204
- ? join(destinationDirectory, entry.destinationPrefix, name)
205
- : join(destinationDirectory, name);
202
+ const destination = join(destinationDirectory, name);
206
203
  await mkdir(dirname(destination), { recursive: true });
207
204
 
208
205
  const options = { mode: entry.mode };
@@ -9,10 +9,6 @@ export class ContentProvider {
9
9
  entryProperties: any;
10
10
  dir: any;
11
11
  baseProperties: {};
12
- /**
13
- * @return {string|undefined}
14
- */
15
- get destinationPrefix(): string | undefined;
16
12
  /**
17
13
  * List all entries.
18
14
  * @return {AsyncIterable<ContentEntry>} all entries
@@ -2,12 +2,10 @@
2
2
  * Content from node_modules.
3
3
  * Requires .npmrc or NPM_TOKEN environment
4
4
  * @property {boolean} withoutDevelpmentDependencies
5
- * @property {string} destinationPrefix base name out output
6
5
  */
7
6
  export class NodeModulesContentProvider extends ContentProvider {
8
7
  static get description(): string;
9
8
  withoutDevelpmentDependencies: boolean;
10
- destinationPrefix: string;
11
9
  [Symbol.asyncIterator](): AsyncGenerator<any, void, unknown>;
12
10
  }
13
11
  import { ContentProvider } from "./content-provider.mjs";
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @typedef {Object} PackageDefinition
3
3
  * @property {Object} properties values describing the package attributes
4
+ * @property {Object} properties.dependencies
4
5
  * @property {ContentProvider[]} sources content providers
5
- * @property {Object} dependencies
6
6
  * @property {Object} output package type
7
7
  * @property {Object} variant identifier of the variant
8
8
  * @property {string} variant.name name of the variant
@@ -48,12 +48,13 @@ export type PackageDefinition = {
48
48
  /**
49
49
  * values describing the package attributes
50
50
  */
51
- properties: any;
51
+ properties: {
52
+ dependencies: any;
53
+ };
52
54
  /**
53
55
  * content providers
54
56
  */
55
57
  sources: ContentProvider[];
56
- dependencies: any;
57
58
  /**
58
59
  * package type
59
60
  */
@@ -25,6 +25,7 @@ export class ARCH extends Packager {
25
25
  alias: string;
26
26
  type: string;
27
27
  mandatory: boolean;
28
+ set: (v: any) => any;
28
29
  };
29
30
  pkgrel: {
30
31
  alias: string;
@@ -120,7 +121,7 @@ export class ARCH extends Packager {
120
121
  };
121
122
  static prepare(options?: {}, variant?: {}): Promise<boolean>;
122
123
  get packageFileName(): string;
123
- makeDepends(dependencies: any): string[];
124
- create(sources: any, transformer: any, dependencies: any, publishingDetails: any, options: any, expander: any): Promise<string>;
124
+ makeDepends(dependencies?: {}): string[];
125
+ create(sources: any, transformer: any, publishingDetails: any, options: any, expander: any): Promise<string>;
125
126
  }
126
127
  import { Packager } from "./packager.mjs";
@@ -105,7 +105,7 @@ export class DEBIAN extends Packager {
105
105
  }): Promise<boolean>;
106
106
  get packageFileName(): string;
107
107
  hookFiles(properties: any): AsyncGenerator<StringContentEntry, void, unknown>;
108
- create(sources: any, transformer: any, dependencies: any, publishingDetails: any, options: any, expander: any): Promise<string>;
108
+ create(sources: any, transformer: any, publishingDetails: any, options: any, expander: any): Promise<string>;
109
109
  }
110
110
  import { Packager } from "./packager.mjs";
111
111
  import { StringContentEntry } from "content-entry";
@@ -36,7 +36,7 @@ export class DOCKER extends Packager {
36
36
  static prepare(options: any, variant: {
37
37
  arch: string;
38
38
  }): Promise<boolean>;
39
- create(sources: any, transformer: any, dependencies: any, options: any, publishingDetails: any, expander: any): Promise<string>;
39
+ create(sources: any, transformer: any, options: any, publishingDetails: any, expander: any): Promise<string>;
40
40
  publish(artifact: any, publishingDetails: any, properties: any, logger?: (message?: any, ...optionalParams: any[]) => void): Promise<void>;
41
41
  }
42
42
  import { Packager } from "./packager.mjs";
@@ -6,6 +6,6 @@ export class OCI extends Packager {
6
6
  static get fileNameExtension(): string;
7
7
  static prepare(options: any, variant: any): Promise<boolean>;
8
8
  get packageFileName(): string;
9
- create(sources: any, transformer: any, dependencies: any, publishingDetails: any, options: any, expander?: (v: any) => any): Promise<string>;
9
+ create(sources: any, transformer: any, publishingDetails: any, options: any, expander?: (v: any) => any): Promise<string>;
10
10
  }
11
11
  import { Packager } from "./packager.mjs";
@@ -62,13 +62,12 @@ export class Packager {
62
62
  * Execute package generation.
63
63
  * @param {Object} sources
64
64
  * @param {Object[]} transformer
65
- * @param {Object} dependencies
66
65
  * @param {PublishingDetail[]} publishingDetails
67
66
  * @param {Object} options
68
- * @param {function(string):string} expander
67
+ * @param {function(string):string?} expander
69
68
  * @return {Promise<string>} identifier of the resulting package
70
69
  */
71
- create(sources: any, transformer: any[], dependencies: any, publishingDetails: PublishingDetail[], options: any, expander: (arg0: string) => string): Promise<string>;
70
+ create(sources: any, transformer: any[], publishingDetails: PublishingDetail[], options: any, expander: (arg0: string) => string | null): Promise<string>;
72
71
  publish(artifact: any, publishingDetails: any, properties: any, logger: any): Promise<void>;
73
72
  #private;
74
73
  }
@@ -84,8 +84,8 @@ export class RPM extends Packager {
84
84
  arch: string;
85
85
  }): Promise<boolean>;
86
86
  get packageFileName(): string;
87
- requiresFromDependencies(dependencies: any): string[];
88
- create(sources: any, transformer: any, dependencies: any, publishingDetails: any, options: any, expander: any): Promise<string>;
87
+ requiresFromDependencies(dependencies?: {}): string[];
88
+ create(sources: any, transformer: any, publishingDetails: any, options: any, expander: any): Promise<string>;
89
89
  }
90
90
  export type PublishingDetail = import("../publish.mjs").PublishingDetail;
91
91
  import { Packager } from "./packager.mjs";
package/types/util.d.mts CHANGED
@@ -40,10 +40,9 @@ export function fieldProvider(properties: any, fields: any): Function;
40
40
  */
41
41
  export function copyEntries(source: AsyncIterable<ContentEntry>, destinationDirectory: string, expander?: Expander): AsyncGenerator<ContentEntry, void, unknown>;
42
42
  /**
43
- * @type {Object}
44
- * @property {BufferEncoding} encoding
43
+ * @type {BufferEncoding}
45
44
  */
46
- export const utf8StreamOptions: any;
45
+ export const utf8StreamOptions: BufferEncoding;
47
46
  export type FunctionDecl = {
48
47
  name: string;
49
48
  body: string;