@backstage/plugin-techdocs-node 1.12.7-next.0 → 1.12.8-next.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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @backstage/plugin-techdocs-node
2
2
 
3
+ ## 1.12.8-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 9ecf5fd: Adds extension point for publishers to the techdocs backend
8
+ - 4c4d077: Bumps default version of techdocs docker image to latest
9
+ - Updated dependencies
10
+ - @backstage/backend-common@0.23.3-next.1
11
+ - @backstage/backend-plugin-api@0.6.22-next.1
12
+ - @backstage/catalog-model@1.5.0
13
+ - @backstage/config@1.2.0
14
+ - @backstage/errors@1.2.4
15
+ - @backstage/integration@1.13.0-next.0
16
+ - @backstage/integration-aws-node@0.1.12
17
+ - @backstage/plugin-search-common@1.2.12
18
+
3
19
  ## 1.12.7-next.0
4
20
 
5
21
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -517,7 +517,7 @@ class TechdocsGenerator {
517
517
  * The default docker image (and version) used to generate content. Public
518
518
  * and static so that techdocs-node consumers can use the same version.
519
519
  */
520
- static defaultDockerImage = "spotify/techdocs:v1.2.3";
520
+ static defaultDockerImage = "spotify/techdocs:v1.2.4";
521
521
  logger;
522
522
  containerRunner;
523
523
  options;
@@ -2416,40 +2416,88 @@ class OpenStackSwiftPublish {
2416
2416
  }
2417
2417
 
2418
2418
  class Publisher {
2419
+ publishers = /* @__PURE__ */ new Map();
2420
+ register(type, publisher) {
2421
+ this.publishers.set(type, publisher);
2422
+ }
2423
+ get(config) {
2424
+ const publisherType = config.getOptionalString(
2425
+ "techdocs.publisher.type"
2426
+ ) ?? "local";
2427
+ if (!publisherType) {
2428
+ throw new Error("TechDocs publisher type not specified for the entity");
2429
+ }
2430
+ const publisher = this.publishers.get(publisherType);
2431
+ if (!publisher) {
2432
+ throw new Error(
2433
+ `TechDocs publisher '${publisherType}' is not registered`
2434
+ );
2435
+ }
2436
+ return publisher;
2437
+ }
2419
2438
  /**
2420
2439
  * Returns a instance of TechDocs publisher
2421
2440
  * @param config - A Backstage configuration
2422
2441
  * @param options - Options for configuring the publisher factory
2423
2442
  */
2424
2443
  static async fromConfig(config, options) {
2425
- const { logger, discovery } = options;
2444
+ const { logger, discovery, customPublisher } = options;
2445
+ const publishers = new Publisher();
2446
+ if (customPublisher) {
2447
+ publishers.register("techdocs", customPublisher);
2448
+ return customPublisher;
2449
+ }
2426
2450
  const publisherType = config.getOptionalString(
2427
2451
  "techdocs.publisher.type"
2428
2452
  ) ?? "local";
2429
2453
  switch (publisherType) {
2430
2454
  case "googleGcs":
2431
2455
  logger.info("Creating Google Storage Bucket publisher for TechDocs");
2432
- return GoogleGCSPublish.fromConfig(config, logger);
2456
+ publishers.register(
2457
+ publisherType,
2458
+ GoogleGCSPublish.fromConfig(config, logger)
2459
+ );
2460
+ break;
2433
2461
  case "awsS3":
2434
2462
  logger.info("Creating AWS S3 Bucket publisher for TechDocs");
2435
- return await AwsS3Publish.fromConfig(config, logger);
2463
+ publishers.register(
2464
+ publisherType,
2465
+ await AwsS3Publish.fromConfig(config, logger)
2466
+ );
2467
+ break;
2436
2468
  case "azureBlobStorage":
2437
2469
  logger.info(
2438
2470
  "Creating Azure Blob Storage Container publisher for TechDocs"
2439
2471
  );
2440
- return AzureBlobStoragePublish.fromConfig(config, logger);
2472
+ publishers.register(
2473
+ publisherType,
2474
+ AzureBlobStoragePublish.fromConfig(config, logger)
2475
+ );
2476
+ break;
2441
2477
  case "openStackSwift":
2442
2478
  logger.info(
2443
2479
  "Creating OpenStack Swift Container publisher for TechDocs"
2444
2480
  );
2445
- return OpenStackSwiftPublish.fromConfig(config, logger);
2481
+ publishers.register(
2482
+ publisherType,
2483
+ OpenStackSwiftPublish.fromConfig(config, logger)
2484
+ );
2485
+ break;
2446
2486
  case "local":
2447
2487
  logger.info("Creating Local publisher for TechDocs");
2448
- return LocalPublish.fromConfig(config, logger, discovery);
2488
+ publishers.register(
2489
+ publisherType,
2490
+ LocalPublish.fromConfig(config, logger, discovery)
2491
+ );
2492
+ break;
2449
2493
  default:
2450
2494
  logger.info("Creating Local publisher for TechDocs");
2451
- return LocalPublish.fromConfig(config, logger, discovery);
2495
+ publishers.register(
2496
+ publisherType,
2497
+ LocalPublish.fromConfig(config, logger, discovery)
2498
+ );
2452
2499
  }
2500
+ return publishers.get(config);
2453
2501
  }
2454
2502
  }
2455
2503
 
@@ -2462,6 +2510,9 @@ const techdocsGeneratorExtensionPoint = backendPluginApi.createExtensionPoint({
2462
2510
  const techdocsPreparerExtensionPoint = backendPluginApi.createExtensionPoint({
2463
2511
  id: "techdocs.preparer"
2464
2512
  });
2513
+ const techdocsPublisherExtensionPoint = backendPluginApi.createExtensionPoint({
2514
+ id: "techdocs.publisher"
2515
+ });
2465
2516
 
2466
2517
  exports.DirectoryPreparer = DirectoryPreparer;
2467
2518
  exports.Generators = Generators;
@@ -2477,5 +2528,6 @@ exports.parseReferenceAnnotation = parseReferenceAnnotation;
2477
2528
  exports.techdocsBuildsExtensionPoint = techdocsBuildsExtensionPoint;
2478
2529
  exports.techdocsGeneratorExtensionPoint = techdocsGeneratorExtensionPoint;
2479
2530
  exports.techdocsPreparerExtensionPoint = techdocsPreparerExtensionPoint;
2531
+ exports.techdocsPublisherExtensionPoint = techdocsPublisherExtensionPoint;
2480
2532
  exports.transformDirLocation = transformDirLocation;
2481
2533
  //# sourceMappingURL=index.cjs.js.map