pmcf 1.59.6 → 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 +6 -12
- package/package.json +3 -3
- package/src/base.mjs +2 -6
- package/src/cluster.mjs +15 -15
- package/src/dns.mjs +6 -4
- package/src/host.mjs +7 -5
- package/src/location.mjs +7 -0
- package/types/base.d.mts +1 -2
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 {
|
|
8
|
+
import { createPublishingDetails } from "npm-pkgbuild";
|
|
9
9
|
import { prepare } from "../src/cmd.mjs";
|
|
10
10
|
import { asArray } from "../src/utils.mjs";
|
|
11
11
|
|
|
@@ -17,13 +17,16 @@ if (!options.output) {
|
|
|
17
17
|
|
|
18
18
|
const pkgDir = await packageDirectory({ cwd: options.root });
|
|
19
19
|
const pkg = JSON.parse(await readFile(join(pkgDir, "package.json"), "utf8"));
|
|
20
|
-
const publishingDetails = createPublishingDetails(
|
|
20
|
+
const publishingDetails = createPublishingDetails(
|
|
21
|
+
asArray(options.publish),
|
|
22
|
+
env
|
|
23
|
+
);
|
|
21
24
|
|
|
22
25
|
for (const name of args) {
|
|
23
26
|
const object = await root.load(name);
|
|
24
27
|
const stagingDir = join(options.output, object.fullName);
|
|
25
28
|
|
|
26
|
-
for await (const {
|
|
29
|
+
for await (const { sources, outputs, properties } of object.preparePackages(
|
|
27
30
|
stagingDir
|
|
28
31
|
)) {
|
|
29
32
|
for (const outputFactory of outputs) {
|
|
@@ -33,15 +36,10 @@ for (const name of args) {
|
|
|
33
36
|
c => c.name + (c.email ? ` <${c.email}>` : "")
|
|
34
37
|
);
|
|
35
38
|
|
|
36
|
-
console.log(properties.name);
|
|
37
39
|
if (properties.verbose) {
|
|
38
40
|
console.log(properties);
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
const sources = [
|
|
42
|
-
new FileContentProvider(stagingDir + "/")[Symbol.asyncIterator]()
|
|
43
|
-
];
|
|
44
|
-
|
|
45
43
|
const output = new outputFactory(properties);
|
|
46
44
|
|
|
47
45
|
const artifact = await output.create(
|
|
@@ -51,10 +49,6 @@ for (const name of args) {
|
|
|
51
49
|
options
|
|
52
50
|
);
|
|
53
51
|
|
|
54
|
-
if (properties.verbose) {
|
|
55
|
-
console.log(artifact);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
52
|
await Promise.all(
|
|
59
53
|
publishingDetails.map(publishDetail =>
|
|
60
54
|
output.publish(artifact, publishDetail)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmcf",
|
|
3
|
-
"version": "1.59.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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(
|
|
74
|
+
join(packageStagingDir, "etc/keepalived"),
|
|
81
75
|
"keepalived.conf",
|
|
82
76
|
cfg
|
|
83
77
|
);
|
|
84
78
|
|
|
85
|
-
result.properties.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.
|
|
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
|
};
|