pmcf 1.59.7 → 1.59.8

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
@@ -5,7 +5,7 @@ import { readFile, mkdtemp } from "node:fs/promises";
5
5
  import { tmpdir } from "node:os";
6
6
  import { env } from "node:process";
7
7
  import { packageDirectory } from "pkg-dir";
8
- import { FileContentProvider, createPublishingDetails } from "npm-pkgbuild";
8
+ import { createPublishingDetails } from "npm-pkgbuild";
9
9
  import { prepare } from "../src/cmd.mjs";
10
10
  import { asArray } from "../src/utils.mjs";
11
11
 
@@ -26,7 +26,7 @@ for (const name of args) {
26
26
  const object = await root.load(name);
27
27
  const stagingDir = join(options.output, object.fullName);
28
28
 
29
- for await (const { properties, outputs } of object.preparePackages(
29
+ for await (const { sources, outputs, properties } of object.preparePackages(
30
30
  stagingDir
31
31
  )) {
32
32
  for (const outputFactory of outputs) {
@@ -40,10 +40,6 @@ for (const name of args) {
40
40
  console.log(properties);
41
41
  }
42
42
 
43
- const sources = [
44
- new FileContentProvider(stagingDir + "/")[Symbol.asyncIterator]()
45
- ];
46
-
47
43
  const output = new outputFactory(properties);
48
44
 
49
45
  const artifact = await output.create(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "1.59.7",
3
+ "version": "1.59.8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,12 +38,12 @@
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.2.3",
41
+ "npm-pkgbuild": "^17.2.4",
42
42
  "pacc": "^3.3.0",
43
43
  "pkg-dir": "^8.0.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@types/node": "^22.13.9",
46
+ "@types/node": "^22.13.10",
47
47
  "ava": "^6.2.0",
48
48
  "c8": "^10.1.3",
49
49
  "documentation": "^14.0.3",
package/src/base.mjs CHANGED
@@ -317,10 +317,6 @@ export class Base {
317
317
  : this.owner.fullName;
318
318
  }
319
319
 
320
- get packageName() {
321
- return `${this.constructor.typeDefinition.name}-${this.name}`;
322
- }
323
-
324
320
  #packaging = new Set();
325
321
 
326
322
  set packaging(value) {
@@ -348,9 +344,9 @@ export class Base {
348
344
  async *preparePackages(stagingDir) {
349
345
  yield {
350
346
  outputs: this.outputs,
347
+ sources: [],
351
348
  properties: {
352
- name: this.packageName,
353
- description: `${this.constructor.typeDefinition.name} definitions for ${this.fullName}`,
349
+ description: `${this.typeName} definitions for ${this.fullName}`,
354
350
  access: "private"
355
351
  }
356
352
  };
package/src/cluster.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import { join } from "node:path";
2
+ import { FileContentProvider } from "npm-pkgbuild";
2
3
  import { Owner } from "./owner.mjs";
3
4
  import { addType } from "./types.mjs";
4
5
  import { writeLines } from "./utils.mjs";
@@ -31,34 +32,27 @@ export class Cluster extends Owner {
31
32
  this.read(data, ClusterTypeDefinition);
32
33
  }
33
34
 
34
- set masters(value)
35
- {
35
+ set masters(value) {
36
36
  this.#masters.add(value);
37
37
  }
38
38
 
39
- get masters()
40
- {
39
+ get masters() {
41
40
  return this.#masters;
42
41
  }
43
42
 
44
- set backups(value)
45
- {
43
+ set backups(value) {
46
44
  this.#backups.add(value);
47
45
  }
48
46
 
49
- get backups()
50
- {
47
+ get backups() {
51
48
  return this.#backups;
52
49
  }
53
50
 
54
- get packageName() {
55
- return `${this.constructor.typeDefinition.name}-${this.owner.name}-${this.name}`;
56
- }
57
-
58
51
  async *preparePackages(stagingDir) {
59
52
  for await (const result of super.preparePackages(stagingDir)) {
60
53
  for (const ni of this.masters.union(this.backups)) {
61
-
54
+ const name = `${this.typeName}-${this.owner.name}-${this.name}-${ni.host.name}`;
55
+ const packageStagingDir = join(stagingDir, name);
62
56
  const cfg = [
63
57
  `vrrp_instance ${this.name} {`,
64
58
  ` state ${this.masters.has(ni) ? "MASTER" : "BACKUP"}`,
@@ -77,14 +71,20 @@ export class Cluster extends Owner {
77
71
  ];
78
72
 
79
73
  await writeLines(
80
- join(stagingDir, "etc/keepalived"),
74
+ join(packageStagingDir, "etc/keepalived"),
81
75
  "keepalived.conf",
82
76
  cfg
83
77
  );
84
78
 
85
- result.properties.name = `${this.constructor.typeDefinition.name}-${this.owner.name}-${this.name}-${ni.host.name}`;
79
+ result.properties.name = name;
86
80
  result.properties.dependencies = ["keepalived"];
87
81
 
82
+ result.sources.push(
83
+ new FileContentProvider(packageStagingDir + "/")[
84
+ Symbol.asyncIterator
85
+ ]()
86
+ );
87
+
88
88
  yield result;
89
89
  }
90
90
  }
package/src/dns.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { join } from "node:path";
2
2
  import { createHmac } from "node:crypto";
3
+ import { FileContentProvider } from "npm-pkgbuild";
3
4
  import { writeLines, isIPv6Address, normalizeIPAddress } from "./utils.mjs";
4
5
  import { Base } from "./base.mjs";
5
6
  import { addType } from "./types.mjs";
@@ -103,17 +104,18 @@ export class DNSService extends Base {
103
104
  };
104
105
  }
105
106
 
106
- get packageName() {
107
- return `named-${this.owner.name}`;
108
- }
109
-
110
107
  async *preparePackages(stagingDir) {
111
108
  for await (const result of super.preparePackages(stagingDir)) {
112
109
  await generateNamedDefs(this, stagingDir);
113
110
 
111
+ result.properties.name = `named-${this.owner.name}`;
114
112
  result.properties.dependencies = ["mf-named"];
115
113
  result.properties.replaces = ["mf-named-zones"];
116
114
 
115
+ result.sources.push(
116
+ new FileContentProvider(stagingDir + "/")[Symbol.asyncIterator]()
117
+ );
118
+
117
119
  yield result;
118
120
  }
119
121
  }
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 { FileContentProvider } from "npm-pkgbuild";
3
4
  import { Base } from "./base.mjs";
4
5
  import { networkProperties } from "./network-support.mjs";
5
6
  import {
@@ -340,10 +341,6 @@ export class Host extends Base {
340
341
  return readFile(join(this.directory, `ssh_host_${type}_key.pub`), "utf8");
341
342
  }
342
343
 
343
- get packageName() {
344
- return `${this.constructor.typeDefinition.name}-${this.owner.name}-${this.name}`;
345
- }
346
-
347
344
  async *preparePackages(stagingDir) {
348
345
  for await (const result of super.preparePackages(stagingDir)) {
349
346
  await generateNetworkDefs(this, stagingDir);
@@ -354,14 +351,19 @@ export class Host extends Base {
354
351
  join(stagingDir, "root", ".ssh")
355
352
  );
356
353
 
354
+ result.properties.name = `${this.typeName}-${this.owner.name}-${this.name}`;
357
355
  result.properties.dependencies = [
358
- this.location.packageName,
356
+ `${this.location.typeName}-${this.location.name}`,
359
357
  ...this.depends
360
358
  ];
361
359
  result.properties.provides = [...this.provides];
362
360
  result.properties.replaces = [`mf-${this.hostName}`, ...this.replaces];
363
361
  result.properties.backup = "root/.ssh/known_hosts";
364
362
 
363
+ result.sources.push(
364
+ new FileContentProvider(stagingDir + "/")[Symbol.asyncIterator]()
365
+ );
366
+
365
367
  yield result;
366
368
  }
367
369
  }
package/src/location.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { mkdir, copyFile } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
+ import { FileContentProvider } from "npm-pkgbuild";
3
4
  import { Owner } from "./owner.mjs";
4
5
  import { addType } from "./types.mjs";
5
6
  import { writeLines, sectionLines } from "./utils.mjs";
@@ -82,6 +83,8 @@ export class Location extends Owner {
82
83
  join(locationDir, "location.json")
83
84
  );
84
85
 
86
+ result.properties.name = `${this.typeName}-${this.name}`;
87
+
85
88
  result.properties.provides = [
86
89
  "location",
87
90
  "mf-location",
@@ -89,6 +92,10 @@ export class Location extends Owner {
89
92
  ];
90
93
  result.properties.replaces = [`mf-location-${this.name}`];
91
94
 
95
+ result.sources.push(
96
+ new FileContentProvider(stagingDir + "/")[Symbol.asyncIterator]()
97
+ );
98
+
92
99
  /*
93
100
  const install = "location.install";
94
101
 
package/types/base.d.mts CHANGED
@@ -67,15 +67,14 @@ export class Base {
67
67
  set directory(directory: any);
68
68
  get directory(): any;
69
69
  get fullName(): any;
70
- get packageName(): string;
71
70
  set packaging(value: Set<any>);
72
71
  get packaging(): Set<any>;
73
72
  get derivedPackaging(): any;
74
73
  get outputs(): Set<typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").DOCKER>;
75
74
  preparePackages(stagingDir: any): AsyncGenerator<{
76
75
  outputs: Set<typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").DOCKER>;
76
+ sources: any[];
77
77
  properties: {
78
- name: string;
79
78
  description: string;
80
79
  access: string;
81
80
  };