npm-pkgbuild 11.0.4 → 11.1.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": "11.0.4",
3
+ "version": "11.1.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -11,6 +11,7 @@ import { DEBIAN } from "./output/debian.mjs";
11
11
  import { ARCH } from "./output/arch.mjs";
12
12
  import { RPM } from "./output/rpm.mjs";
13
13
  import { OCI } from "./output/oci.mjs";
14
+ import { DOCKER } from "./output/docker.mjs";
14
15
 
15
16
  /**
16
17
  * All content providers
@@ -24,7 +25,7 @@ export const allInputs = [
24
25
  /**
25
26
  * All output formats
26
27
  */
27
- export const allOutputs = [DEBIAN, ARCH, RPM, OCI];
28
+ export const allOutputs = [DEBIAN, ARCH, RPM, OCI, DOCKER];
28
29
 
29
30
  /**
30
31
  * Node architecture name to os native arch name mapping
@@ -132,6 +133,8 @@ export async function* extractFromPackage(options = {}, env = {}) {
132
133
  fullfilled = false;
133
134
  break;
134
135
  }
136
+
137
+ priority += 1;
135
138
  }
136
139
  }
137
140
 
@@ -139,7 +142,7 @@ export async function* extractFromPackage(options = {}, env = {}) {
139
142
  if (env[requires.environment.has] === undefined) {
140
143
  fullfilled = false;
141
144
  }
142
- priority++;
145
+ priority += 10;
143
146
  }
144
147
 
145
148
  if (fullfilled) {
@@ -0,0 +1,55 @@
1
+ import { join } from "node:path";
2
+ import { execa } from "execa";
3
+ import { EmptyContentEntry, ReadableStreamContentEntry } from "content-entry";
4
+ import {
5
+ keyValueTransformer,
6
+ } from "key-value-transformer";
7
+ import { Packager } from "./packager.mjs";
8
+
9
+ const DOCKERFILE = "Dockerfile";
10
+
11
+ export class DOCKER extends Packager {
12
+ static get name() {
13
+ return "docker";
14
+ }
15
+
16
+ async execute(
17
+ sources,
18
+ transformer,
19
+ dependencies,
20
+ options,
21
+ expander = v => v
22
+ ) {
23
+ const { properties, staging, destination } = await this.prepareExecute(
24
+ options
25
+ );
26
+
27
+ const fp = fieldProvider(properties, fields);
28
+
29
+ transformer.push({
30
+ name: DOCKERFILE,
31
+ match: entry => entry.name === DOCKERFILE,
32
+ transform: async entry =>
33
+ new ReadableStreamContentEntry(
34
+ "../" + entry.name,
35
+ keyValueTransformer(await entry.readStream, fp)
36
+ ),
37
+ createEntryWhenMissing: () => new EmptyContentEntry(DOCKERFILE)
38
+ });
39
+
40
+ if (!options.dry) {
41
+ const docker = await execa("docker", ["build", "-e"], {
42
+ cwd: staging
43
+ });
44
+
45
+ if (options.verbose) {
46
+ console.log(docker.stdout);
47
+ }
48
+ }
49
+
50
+ return join(destination, this.packageFileName);
51
+ }
52
+ }
53
+
54
+ const fields = {
55
+ };