pmcf 4.16.13 → 4.16.14

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
@@ -67,7 +67,7 @@ for (const object of root.find(args)) {
67
67
  const output = new outputFactory(properties);
68
68
 
69
69
  const artifact = await output.create(
70
- sources.map(source => source[Symbol.asyncIterator]()),
70
+ sources.flat().map(source => source[Symbol.asyncIterator]()),
71
71
  [],
72
72
  publishingDetails,
73
73
  options
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "4.16.13",
3
+ "version": "4.16.14",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -55,7 +55,7 @@
55
55
  "dependencies": {
56
56
  "content-entry-transform": "^1.6.4",
57
57
  "ip-utilties": "^3.0.0",
58
- "npm-pkgbuild": "^20.5.1",
58
+ "npm-pkgbuild": "^20.6.1",
59
59
  "pacc": "^8.8.0",
60
60
  "package-directory": "^8.2.0"
61
61
  },
package/src/base.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import { join } from "node:path";
2
+ import { stat } from "node:fs/promises";
2
3
  import { allOutputs } from "npm-pkgbuild";
3
4
  import {
4
5
  createExpressionTransformer,
@@ -318,6 +319,11 @@ export class Base {
318
319
  return this.owner.addObject(object);
319
320
  }
320
321
 
322
+ /**
323
+ * Walk the object graph in some directions and deliver seen nodes.
324
+ * @param {string[]} directions
325
+ * @return {Iterable<Base>}
326
+ */
321
327
  *walkDirections(directions = ["this", "extends", "owner"]) {
322
328
  yield* this._walkDirections(
323
329
  directions,
@@ -567,17 +573,33 @@ export class Base {
567
573
  ];
568
574
  }
569
575
 
570
- templateContent(entryProperties, directoryProperties) {
571
- return [...this.walkDirections(["this", "extends"])].map(e =>
572
- transform(
573
- new FileContentProvider(
574
- { dir: join(e.directory, "content"), pattern: "**/*" },
575
- entryProperties,
576
- directoryProperties
577
- ),
578
- this.templateTransformers
579
- )
580
- );
576
+ /**
577
+ *
578
+ * @param {*} entryProperties
579
+ * @param {*} directoryProperties
580
+ * @returns {AsyncIterable<ContentProvider>}
581
+ */
582
+ async *templateContent(entryProperties, directoryProperties) {
583
+ for (const node of this.walkDirections(["this", "extends"])) {
584
+ const dir = join(node.directory, "content");
585
+
586
+ try {
587
+ if ((await stat(dir)).isDirectory) {
588
+ yield transform(
589
+ new FileContentProvider(
590
+ { dir, pattern: "**/*" },
591
+ entryProperties,
592
+ directoryProperties
593
+ ),
594
+ this.templateTransformers
595
+ );
596
+ }
597
+ } catch (e) {
598
+ if (e.code !== "ENOENT") {
599
+ throw e;
600
+ }
601
+ }
602
+ }
581
603
  }
582
604
 
583
605
  get tags() {
package/src/host.mjs CHANGED
@@ -412,7 +412,7 @@ export class Host extends ServiceOwner {
412
412
  const pkgName = `${this.typeName}-${this.owner.name}-${this.name}`;
413
413
  let packageData = {
414
414
  sources: [
415
- ...this.templateContent(),
415
+ await Array.fromAsync(this.templateContent()),
416
416
  new FileContentProvider(
417
417
  { dir: this.directory, pattern: "*.pub" },
418
418
  { destination: "/etc/ssh/", mode: 0o644 }
@@ -491,4 +491,3 @@ export class Host extends ServiceOwner {
491
491
  }
492
492
  }
493
493
  }
494
-
package/src/service.mjs CHANGED
@@ -272,7 +272,7 @@ export class Service extends Base {
272
272
 
273
273
  async *preparePackages(dir) {
274
274
  const pd = this.packageData;
275
- pd.sources = this.templateContent();
275
+ pd.sources = await Array.fromAsync(this.templateContent());
276
276
  if (pd.sources.length) {
277
277
  yield pd;
278
278
  }
@@ -55,17 +55,19 @@ export class MosquittoService extends Service {
55
55
  const group = "mosquitto";
56
56
 
57
57
  const packageData = this.packageData;
58
- packageData.sources = this.templateContent(
59
- {
60
- mode: 0o644,
61
- owner,
62
- group
63
- },
64
- {
65
- mode: 0o755,
66
- owner,
67
- group
68
- }
58
+ packageData.sources = await Array.fromAsync(
59
+ this.templateContent(
60
+ {
61
+ mode: 0o644,
62
+ owner,
63
+ group
64
+ },
65
+ {
66
+ mode: 0o755,
67
+ owner,
68
+ group
69
+ }
70
+ )
69
71
  );
70
72
 
71
73
  yield packageData;
@@ -63,17 +63,19 @@ export class OpenLDAPService extends Service {
63
63
 
64
64
  const packageData = this.packageData;
65
65
 
66
- packageData.sources = this.templateContent(
67
- {
68
- mode: 0o644,
69
- owner,
70
- group
71
- },
72
- {
73
- mode: 0o755,
74
- owner,
75
- group
76
- }
66
+ packageData.sources = await Array.fromAsync(
67
+ this.templateContent(
68
+ {
69
+ mode: 0o644,
70
+ owner,
71
+ group
72
+ },
73
+ {
74
+ mode: 0o755,
75
+ owner,
76
+ group
77
+ }
78
+ )
77
79
  );
78
80
 
79
81
  yield packageData;
package/types/base.d.mts CHANGED
@@ -63,7 +63,12 @@ export class Base {
63
63
  named(name: any): void;
64
64
  typeNamed(typeName: any, name: any): any;
65
65
  addObject(object: any): any;
66
- walkDirections(directions?: string[]): Generator<any, void, any>;
66
+ /**
67
+ * Walk the object graph in some directions and deliver seen nodes.
68
+ * @param {string[]} directions
69
+ * @return {Iterable<Base>}
70
+ */
71
+ walkDirections(directions?: string[]): Iterable<Base>;
67
72
  _walkDirections(directions: any, withThis: any, seen: any): Generator<any, void, any>;
68
73
  forOwner(owner: any): any;
69
74
  isNamed(name: any): boolean;
@@ -128,7 +133,13 @@ export class Base {
128
133
  get outputs(): Set<typeof import("npm-pkgbuild").DEBIAN | typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").OCI | typeof import("npm-pkgbuild").DOCKER>;
129
134
  preparePackages(stagingDir: any): AsyncGenerator<never, void, unknown>;
130
135
  get templateTransformers(): any[];
131
- templateContent(entryProperties: any, directoryProperties: any): any[];
136
+ /**
137
+ *
138
+ * @param {*} entryProperties
139
+ * @param {*} directoryProperties
140
+ * @returns {AsyncIterable<ContentProvider>}
141
+ */
142
+ templateContent(entryProperties: any, directoryProperties: any): AsyncIterable<ContentProvider>;
132
143
  set tags(value: Set<any>);
133
144
  get tags(): Set<any>;
134
145
  get isTemplate(): any;
package/types/host.d.mts CHANGED
@@ -261,7 +261,7 @@ export class Host extends ServiceOwner {
261
261
  get subnets(): Set<any>;
262
262
  publicKey(type?: string): Promise<string>;
263
263
  preparePackages(dir: any): AsyncGenerator<{
264
- sources: any[];
264
+ sources: (FileContentProvider | ContentProvider[])[];
265
265
  outputs: Set<typeof import("npm-pkgbuild").DEBIAN | typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").OCI | typeof import("npm-pkgbuild").DOCKER>;
266
266
  properties: {
267
267
  name: string;