npm-pkgbuild 13.0.22 → 13.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 +11 -1
- package/package.json +2 -2
- package/src/extract-from-package.mjs +17 -2
- package/src/npm-pkgbuild-cli.mjs +1 -2
- package/src/output/docker.mjs +16 -0
- package/types/output/docker.d.mts +10 -0
package/README.md
CHANGED
|
@@ -134,6 +134,7 @@ See [mf-hosting](https://www.npmjs.com/package/mf-hosting) or [mf-hosting-fronte
|
|
|
134
134
|
* [DEBIAN](#debian)
|
|
135
135
|
* [prepare](#prepare)
|
|
136
136
|
* [Parameters](#parameters-10)
|
|
137
|
+
* [OCI](#oci)
|
|
137
138
|
* [Field](#field)
|
|
138
139
|
* [Properties](#properties-5)
|
|
139
140
|
* [Packager](#packager)
|
|
@@ -279,7 +280,8 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
|
|
|
279
280
|
|
|
280
281
|
**Extends ContentProvider**
|
|
281
282
|
|
|
282
|
-
Content from node\_modules
|
|
283
|
+
Content from node\_modules.
|
|
284
|
+
Requires .npmrc or NPM\_TOKEN environment
|
|
283
285
|
|
|
284
286
|
### Parameters
|
|
285
287
|
|
|
@@ -366,6 +368,12 @@ Create .deb packages
|
|
|
366
368
|
|
|
367
369
|
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)>** 
|
|
368
370
|
|
|
371
|
+
## OCI
|
|
372
|
+
|
|
373
|
+
**Extends Packager**
|
|
374
|
+
|
|
375
|
+
Low level OCI compatible packager
|
|
376
|
+
|
|
369
377
|
## Field
|
|
370
378
|
|
|
371
379
|
Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
@@ -379,6 +387,8 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
|
|
|
379
387
|
|
|
380
388
|
## Packager
|
|
381
389
|
|
|
390
|
+
Base Packager
|
|
391
|
+
|
|
382
392
|
### Parameters
|
|
383
393
|
|
|
384
394
|
* `properties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-pkgbuild",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.1.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"npm-pkgbuild": "src/npm-pkgbuild-cli.mjs"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
|
-
"prepare": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs
|
|
42
|
+
"prepare": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types -t esnext -m esnext --module nodenext --moduleResolution nodenext --rootDir src ./src**/*.mjs",
|
|
43
43
|
"test": "npm run test:ava",
|
|
44
44
|
"test:ava": "ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs",
|
|
45
45
|
"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",
|
|
@@ -350,14 +350,29 @@ export async function* extractFromPackage(options = {}, env = {}) {
|
|
|
350
350
|
arch
|
|
351
351
|
);*/
|
|
352
352
|
|
|
353
|
+
function* forEachOutput(result) {
|
|
354
|
+
if (Object.entries(result.output).length === 0) {
|
|
355
|
+
yield result;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
for (const [name, output] of Object.entries(result.output)) {
|
|
359
|
+
yield {
|
|
360
|
+
...result,
|
|
361
|
+
variant: { ...result.variant, output: name },
|
|
362
|
+
output: { [name]: output },
|
|
363
|
+
properties: { ...result.properties, ...output.properties }
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
353
368
|
if (arch.size === 0) {
|
|
354
|
-
yield result;
|
|
369
|
+
yield* forEachOutput(result);
|
|
355
370
|
} else {
|
|
356
371
|
for (const a of [...arch].sort()) {
|
|
357
372
|
if (variant.restrictArch.size === 0 || variant.restrictArch.has(a)) {
|
|
358
373
|
result.variant.arch = a;
|
|
359
374
|
result.properties.arch = [a];
|
|
360
|
-
yield result;
|
|
375
|
+
yield* forEachOutput(result);
|
|
361
376
|
}
|
|
362
377
|
}
|
|
363
378
|
}
|
package/src/npm-pkgbuild-cli.mjs
CHANGED
|
@@ -88,7 +88,7 @@ program
|
|
|
88
88
|
try {
|
|
89
89
|
Object.assign(
|
|
90
90
|
properties,
|
|
91
|
-
output[outputFactory.name],
|
|
91
|
+
output?.[outputFactory.name]?.properties,
|
|
92
92
|
{
|
|
93
93
|
type: outputFactory.name,
|
|
94
94
|
"user-agent": `npm-pkgbuild-${version}`
|
|
@@ -130,7 +130,6 @@ program
|
|
|
130
130
|
console.log(" " + sources.join("\n "));
|
|
131
131
|
console.log("dependencies:");
|
|
132
132
|
console.log(kv(dependencies, " "));
|
|
133
|
-
console.log(kv(output.properties));
|
|
134
133
|
}
|
|
135
134
|
|
|
136
135
|
const fileName = await o.execute(
|
package/src/output/docker.mjs
CHANGED
|
@@ -47,6 +47,22 @@ export class DOCKER extends Packager {
|
|
|
47
47
|
return fields;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Check for docker presence.
|
|
52
|
+
* @param {Object} options
|
|
53
|
+
* @param {Object} variant
|
|
54
|
+
* @param {string} variant.arch
|
|
55
|
+
* @returns {Promise<boolean>} true when docker executable is present
|
|
56
|
+
*/
|
|
57
|
+
static async prepare(options, variant) {
|
|
58
|
+
try {
|
|
59
|
+
await execa(this.constructor.name, ["--version"]);
|
|
60
|
+
return true;
|
|
61
|
+
} catch {}
|
|
62
|
+
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
|
|
50
66
|
async execute(
|
|
51
67
|
sources,
|
|
52
68
|
transformer,
|
|
@@ -23,6 +23,16 @@ export class DOCKER extends Packager {
|
|
|
23
23
|
mandatory: boolean;
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Check for docker presence.
|
|
28
|
+
* @param {Object} options
|
|
29
|
+
* @param {Object} variant
|
|
30
|
+
* @param {string} variant.arch
|
|
31
|
+
* @returns {Promise<boolean>} true when docker executable is present
|
|
32
|
+
*/
|
|
33
|
+
static prepare(options: any, variant: {
|
|
34
|
+
arch: string;
|
|
35
|
+
}): Promise<boolean>;
|
|
26
36
|
execute(sources: any, transformer: any, dependencies: any, options: any, expander?: (v: any) => any): Promise<string>;
|
|
27
37
|
}
|
|
28
38
|
import { Packager } from "./packager.mjs";
|