pmcf 1.55.0 → 1.56.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/bin/pmcf-package +33 -28
- package/package.json +2 -2
- package/src/base.mjs +5 -0
- package/src/dns.mjs +4 -4
- package/src/host.mjs +13 -6
- package/src/location.mjs +9 -8
- package/src/owner.mjs +9 -0
- package/types/base.d.mts +2 -0
- package/types/host.d.mts +1 -0
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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.
|
|
3
|
+
"version": "1.56.0",
|
|
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.
|
|
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
|
|
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
|
|
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 {
|
|
@@ -17,6 +18,7 @@ import {
|
|
|
17
18
|
copySshKeys,
|
|
18
19
|
generateKnownHosts
|
|
19
20
|
} from "./host-utils.mjs";
|
|
21
|
+
import { OutputFileType } from "typescript";
|
|
20
22
|
|
|
21
23
|
const HostTypeDefinition = {
|
|
22
24
|
name: "host",
|
|
@@ -335,8 +337,13 @@ export class Host extends Base {
|
|
|
335
337
|
return readFile(join(this.directory, `ssh_host_${type}_key.pub`), "utf8");
|
|
336
338
|
}
|
|
337
339
|
|
|
340
|
+
get outputs()
|
|
341
|
+
{
|
|
342
|
+
return new Set(allOutputs.filter(o=>o.name === this.packaging));
|
|
343
|
+
}
|
|
344
|
+
|
|
338
345
|
async preparePackage(stagingDir) {
|
|
339
|
-
const
|
|
346
|
+
const result = await super.preparePackage(stagingDir);
|
|
340
347
|
await generateNetworkDefs(this, stagingDir);
|
|
341
348
|
await generateMachineInfo(this, stagingDir);
|
|
342
349
|
await copySshKeys(this, stagingDir);
|
|
@@ -345,12 +352,12 @@ export class Host extends Base {
|
|
|
345
352
|
join(stagingDir, "root", ".ssh")
|
|
346
353
|
);
|
|
347
354
|
|
|
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";
|
|
355
|
+
result.properties.dependencies = [this.location.packageName, ...this.depends];
|
|
356
|
+
result.properties.provides = [...this.provides];
|
|
357
|
+
result.properties.replaces = [`mf-${this.hostName}`, ...this.replaces];
|
|
358
|
+
result.properties.backup = "root/.ssh/known_hosts";
|
|
352
359
|
|
|
353
|
-
return
|
|
360
|
+
return result;
|
|
354
361
|
}
|
|
355
362
|
}
|
|
356
363
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
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 {
|