@backstage/plugin-techdocs-node 1.12.7 → 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,30 +1,32 @@
1
1
  # @backstage/plugin-techdocs-node
2
2
 
3
- ## 1.12.7
3
+ ## 1.12.8-next.1
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - 9ecf5fd: Adds extension point for publishers to the techdocs backend
8
+ - 4c4d077: Bumps default version of techdocs docker image to latest
7
9
  - Updated dependencies
8
- - @backstage/backend-plugin-api@0.6.21
9
- - @backstage/backend-common@0.23.2
10
+ - @backstage/backend-common@0.23.3-next.1
11
+ - @backstage/backend-plugin-api@0.6.22-next.1
10
12
  - @backstage/catalog-model@1.5.0
11
13
  - @backstage/config@1.2.0
12
14
  - @backstage/errors@1.2.4
13
- - @backstage/integration@1.12.0
15
+ - @backstage/integration@1.13.0-next.0
14
16
  - @backstage/integration-aws-node@0.1.12
15
17
  - @backstage/plugin-search-common@1.2.12
16
18
 
17
- ## 1.12.6
19
+ ## 1.12.7-next.0
18
20
 
19
21
  ### Patch Changes
20
22
 
21
23
  - Updated dependencies
22
- - @backstage/backend-common@0.23.1
23
- - @backstage/backend-plugin-api@0.6.20
24
+ - @backstage/backend-plugin-api@0.6.21-next.0
25
+ - @backstage/backend-common@0.23.2-next.0
26
+ - @backstage/integration@1.13.0-next.0
24
27
  - @backstage/catalog-model@1.5.0
25
28
  - @backstage/config@1.2.0
26
29
  - @backstage/errors@1.2.4
27
- - @backstage/integration@1.12.0
28
30
  - @backstage/integration-aws-node@0.1.12
29
31
  - @backstage/plugin-search-common@1.2.12
30
32
 
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;
@@ -1581,8 +1581,7 @@ class AzureBlobStoragePublish {
1581
1581
  this.logger.warn(e.message);
1582
1582
  return;
1583
1583
  }
1584
- if (originalPath === newPath)
1585
- return;
1584
+ if (originalPath === newPath) return;
1586
1585
  try {
1587
1586
  this.logger.verbose(`Migrating ${originalPath}`);
1588
1587
  await this.renameBlob(originalPath, newPath, removeOriginal);
@@ -2417,40 +2416,88 @@ class OpenStackSwiftPublish {
2417
2416
  }
2418
2417
 
2419
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
+ }
2420
2438
  /**
2421
2439
  * Returns a instance of TechDocs publisher
2422
2440
  * @param config - A Backstage configuration
2423
2441
  * @param options - Options for configuring the publisher factory
2424
2442
  */
2425
2443
  static async fromConfig(config, options) {
2426
- 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
+ }
2427
2450
  const publisherType = config.getOptionalString(
2428
2451
  "techdocs.publisher.type"
2429
2452
  ) ?? "local";
2430
2453
  switch (publisherType) {
2431
2454
  case "googleGcs":
2432
2455
  logger.info("Creating Google Storage Bucket publisher for TechDocs");
2433
- return GoogleGCSPublish.fromConfig(config, logger);
2456
+ publishers.register(
2457
+ publisherType,
2458
+ GoogleGCSPublish.fromConfig(config, logger)
2459
+ );
2460
+ break;
2434
2461
  case "awsS3":
2435
2462
  logger.info("Creating AWS S3 Bucket publisher for TechDocs");
2436
- return await AwsS3Publish.fromConfig(config, logger);
2463
+ publishers.register(
2464
+ publisherType,
2465
+ await AwsS3Publish.fromConfig(config, logger)
2466
+ );
2467
+ break;
2437
2468
  case "azureBlobStorage":
2438
2469
  logger.info(
2439
2470
  "Creating Azure Blob Storage Container publisher for TechDocs"
2440
2471
  );
2441
- return AzureBlobStoragePublish.fromConfig(config, logger);
2472
+ publishers.register(
2473
+ publisherType,
2474
+ AzureBlobStoragePublish.fromConfig(config, logger)
2475
+ );
2476
+ break;
2442
2477
  case "openStackSwift":
2443
2478
  logger.info(
2444
2479
  "Creating OpenStack Swift Container publisher for TechDocs"
2445
2480
  );
2446
- return OpenStackSwiftPublish.fromConfig(config, logger);
2481
+ publishers.register(
2482
+ publisherType,
2483
+ OpenStackSwiftPublish.fromConfig(config, logger)
2484
+ );
2485
+ break;
2447
2486
  case "local":
2448
2487
  logger.info("Creating Local publisher for TechDocs");
2449
- return LocalPublish.fromConfig(config, logger, discovery);
2488
+ publishers.register(
2489
+ publisherType,
2490
+ LocalPublish.fromConfig(config, logger, discovery)
2491
+ );
2492
+ break;
2450
2493
  default:
2451
2494
  logger.info("Creating Local publisher for TechDocs");
2452
- return LocalPublish.fromConfig(config, logger, discovery);
2495
+ publishers.register(
2496
+ publisherType,
2497
+ LocalPublish.fromConfig(config, logger, discovery)
2498
+ );
2453
2499
  }
2500
+ return publishers.get(config);
2454
2501
  }
2455
2502
  }
2456
2503
 
@@ -2463,6 +2510,9 @@ const techdocsGeneratorExtensionPoint = backendPluginApi.createExtensionPoint({
2463
2510
  const techdocsPreparerExtensionPoint = backendPluginApi.createExtensionPoint({
2464
2511
  id: "techdocs.preparer"
2465
2512
  });
2513
+ const techdocsPublisherExtensionPoint = backendPluginApi.createExtensionPoint({
2514
+ id: "techdocs.publisher"
2515
+ });
2466
2516
 
2467
2517
  exports.DirectoryPreparer = DirectoryPreparer;
2468
2518
  exports.Generators = Generators;
@@ -2478,5 +2528,6 @@ exports.parseReferenceAnnotation = parseReferenceAnnotation;
2478
2528
  exports.techdocsBuildsExtensionPoint = techdocsBuildsExtensionPoint;
2479
2529
  exports.techdocsGeneratorExtensionPoint = techdocsGeneratorExtensionPoint;
2480
2530
  exports.techdocsPreparerExtensionPoint = techdocsPreparerExtensionPoint;
2531
+ exports.techdocsPublisherExtensionPoint = techdocsPublisherExtensionPoint;
2481
2532
  exports.transformDirLocation = transformDirLocation;
2482
2533
  //# sourceMappingURL=index.cjs.js.map