pmcf 1.55.0 → 1.56.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/bin/pmcf-package CHANGED
@@ -4,11 +4,7 @@ import { join } from "node:path";
4
4
  import { readFile, mkdtemp } from "node:fs/promises";
5
5
  import { tmpdir } from "node:os";
6
6
  import { packageDirectory } from "pkg-dir";
7
- import {
8
- FileContentProvider,
9
- createPublishingDetails,
10
- ARCH
11
- } from "npm-pkgbuild";
7
+ import { FileContentProvider, createPublishingDetails } from "npm-pkgbuild";
12
8
  import { prepare } from "../src/cmd.mjs";
13
9
 
14
10
  const { root, args, options } = await prepare();
@@ -25,28 +21,37 @@ const publishingDetails = createPublishingDetails(options.publish, process.env);
25
21
  for (const name of args) {
26
22
  const object = await root.load(name);
27
23
  const stagingDir = join(options.output, object.fullName);
28
- const { properties } = await object.preparePackage(stagingDir);
29
-
30
- properties.version = pkg.version;
31
- properties.license = pkg.license;
32
-
33
- if (properties.verbose) {
34
- console.log(properties);
35
- }
36
-
37
- const output = new ARCH(properties);
38
- const sources = [
39
- new FileContentProvider(stagingDir + "/")[Symbol.asyncIterator]()
40
- ];
41
- const artifact = await output.create(sources, [], publishingDetails, options);
42
-
43
- if (properties.verbose) {
44
- console.log(artifact);
24
+ const { properties, outputs } = await object.preparePackage(stagingDir);
25
+
26
+ for (const outputFactory of outputs) {
27
+ properties.version = pkg.version;
28
+ properties.license = pkg.license;
29
+
30
+ if (properties.verbose) {
31
+ console.log(properties);
32
+ }
33
+
34
+ const sources = [
35
+ new FileContentProvider(stagingDir + "/")[Symbol.asyncIterator]()
36
+ ];
37
+
38
+ const output = new outputFactory(properties);
39
+
40
+ const artifact = await output.create(
41
+ sources,
42
+ [],
43
+ publishingDetails,
44
+ options
45
+ );
46
+
47
+ if (properties.verbose) {
48
+ console.log(artifact);
49
+ }
50
+
51
+ await Promise.all(
52
+ publishingDetails.map(publishDetail =>
53
+ output.publish(artifact, publishDetail)
54
+ )
55
+ );
45
56
  }
46
-
47
- await Promise.all(
48
- publishingDetails.map(publishDetail =>
49
- output.publish(artifact, publishDetail)
50
- )
51
- );
52
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "1.55.0",
3
+ "version": "1.56.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,7 +38,7 @@
38
38
  "lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule --target es2024 --lib esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
39
39
  },
40
40
  "dependencies": {
41
- "npm-pkgbuild": "^17.1.0",
41
+ "npm-pkgbuild": "^17.1.1",
42
42
  "pacc": "^3.3.0",
43
43
  "pkg-dir": "^8.0.0"
44
44
  },
package/src/base.mjs CHANGED
@@ -288,8 +288,13 @@ export class Base {
288
288
  return `${this.constructor.typeDefinition.name}-${this.name}`;
289
289
  }
290
290
 
291
+ get outputs() {
292
+ return new Set();
293
+ }
294
+
291
295
  async preparePackage(stagingDir) {
292
296
  return {
297
+ outputs: this.outputs,
293
298
  properties: {
294
299
  name: this.packageName,
295
300
  description: `${this.constructor.typeDefinition.name} definitions for ${this.fullName}`,
package/src/dns.mjs CHANGED
@@ -104,14 +104,14 @@ export class DNSService extends Base {
104
104
  }
105
105
 
106
106
  async preparePackage(stagingDir) {
107
- const { properties } = await super.preparePackage(stagingDir);
107
+ const result = await super.preparePackage(stagingDir);
108
108
 
109
109
  await generateNamedDefs(this, stagingDir);
110
110
 
111
- properties.dependencies = ["mf-named"];
112
- properties.replaces = ["mf-named-zones"];
111
+ result.properties.dependencies = ["mf-named"];
112
+ result.properties.replaces = ["mf-named-zones"];
113
113
 
114
- return { properties };
114
+ return result;
115
115
  }
116
116
  }
117
117
 
package/src/host.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { readFile } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
+ import { allOutputs } from "npm-pkgbuild";
3
4
  import { Base } from "./base.mjs";
4
5
  import { networkProperties } from "./network-support.mjs";
5
6
  import {
@@ -335,8 +336,13 @@ export class Host extends Base {
335
336
  return readFile(join(this.directory, `ssh_host_${type}_key.pub`), "utf8");
336
337
  }
337
338
 
339
+ get outputs()
340
+ {
341
+ return new Set(allOutputs.filter(o=>o.name === this.packaging));
342
+ }
343
+
338
344
  async preparePackage(stagingDir) {
339
- const { properties } = await super.preparePackage(stagingDir);
345
+ const result = await super.preparePackage(stagingDir);
340
346
  await generateNetworkDefs(this, stagingDir);
341
347
  await generateMachineInfo(this, stagingDir);
342
348
  await copySshKeys(this, stagingDir);
@@ -345,12 +351,12 @@ export class Host extends Base {
345
351
  join(stagingDir, "root", ".ssh")
346
352
  );
347
353
 
348
- properties.dependencies = [this.location.packageName, ...this.depends];
349
- properties.provides = [...this.provides];
350
- properties.replaces = [`mf-${this.hostName}`, ...this.replaces];
351
- properties.backup = "root/.ssh/known_hosts";
354
+ result.properties.dependencies = [this.location.packageName, ...this.depends];
355
+ result.properties.provides = [...this.provides];
356
+ result.properties.replaces = [`mf-${this.hostName}`, ...this.replaces];
357
+ result.properties.backup = "root/.ssh/known_hosts";
352
358
 
353
- return { properties };
359
+ return result;
354
360
  }
355
361
  }
356
362
 
package/src/location.mjs CHANGED
@@ -46,7 +46,7 @@ export class Location extends Owner {
46
46
  }
47
47
 
48
48
  async preparePackage(stagingDir) {
49
- const { properties } = await super.preparePackage(stagingDir);
49
+ const result = await super.preparePackage(stagingDir);
50
50
 
51
51
  await writeLines(
52
52
  join(stagingDir, "etc/systemd/resolved.conf.d"),
@@ -83,25 +83,26 @@ export class Location extends Owner {
83
83
  join(locationDir, "location.json")
84
84
  );
85
85
 
86
- properties.provides = [
86
+ result.properties.provides = [
87
87
  "location",
88
88
  "mf-location",
89
89
  `mf-location-${this.name}`
90
90
  ];
91
- properties.replaces = [`mf-location-${this.name}`];
91
+ result.properties.replaces = [`mf-location-${this.name}`];
92
92
 
93
+ /*
93
94
  const install = "location.install";
94
95
 
95
- console.log(
96
- new URL(install, import.meta.url));
96
+ console.log(new URL(install, import.meta.url));
97
97
 
98
98
  await copyFile(
99
99
  new URL(install, import.meta.url),
100
100
  join(stagingDir, install)
101
101
  );
102
102
 
103
- properties.install = install;
104
-
105
- return { properties };
103
+ result.properties.install = install;
104
+ */
105
+
106
+ return result;
106
107
  }
107
108
  }
package/src/owner.mjs CHANGED
@@ -278,6 +278,15 @@ export class Owner extends Base {
278
278
  }
279
279
  }
280
280
 
281
+ get outputs() {
282
+ let all = new Set();
283
+ for (const host of this.hosts()) {
284
+ all = all.union(host.outputs);
285
+ }
286
+
287
+ return all;
288
+ }
289
+
281
290
  *networkAddresses() {
282
291
  for (const host of this.hosts()) {
283
292
  yield* host.networkAddresses();
package/types/base.d.mts CHANGED
@@ -60,7 +60,9 @@ export class Base {
60
60
  get directory(): any;
61
61
  get fullName(): any;
62
62
  get packageName(): string;
63
+ get outputs(): Set<any>;
63
64
  preparePackage(stagingDir: any): Promise<{
65
+ outputs: Set<any>;
64
66
  properties: {
65
67
  name: string;
66
68
  description: string;
package/types/host.d.mts CHANGED
@@ -189,6 +189,7 @@ export class Host extends Base {
189
189
  get rawAddresses(): any[];
190
190
  get cidrAddresses(): any[];
191
191
  publicKey(type?: string): Promise<string>;
192
+ get outputs(): Set<typeof import("npm-pkgbuild").OCI | typeof import("npm-pkgbuild").DOCKER>;
192
193
  #private;
193
194
  }
194
195
  export class NetworkInterface extends Base {