@backstage/plugin-techdocs-node 1.7.6 → 1.8.0-next.2

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,25 +1,43 @@
1
1
  # @backstage/plugin-techdocs-node
2
2
 
3
- ## 1.7.6
3
+ ## 1.8.0-next.2
4
4
 
5
5
  ### Patch Changes
6
6
 
7
7
  - Updated dependencies
8
- - @backstage/integration@1.6.2
9
- - @backstage/backend-common@0.19.4
10
- - @backstage/catalog-model@1.4.1
11
- - @backstage/config@1.0.8
8
+ - @backstage/config@1.1.0-next.1
9
+ - @backstage/backend-common@0.19.5-next.2
10
+ - @backstage/integration@1.7.0-next.2
11
+ - @backstage/integration-aws-node@0.1.6-next.1
12
+ - @backstage/catalog-model@1.4.2-next.1
12
13
  - @backstage/errors@1.2.1
13
- - @backstage/integration-aws-node@0.1.5
14
- - @backstage/plugin-search-common@1.2.5
14
+ - @backstage/plugin-search-common@1.2.6-next.1
15
+
16
+ ## 1.8.0-next.1
17
+
18
+ ### Minor Changes
19
+
20
+ - 5985d458ee30: Add a `techdocs.publisher.azureBlobStorage.connectionString` app-config setting, which can be leveraged for improved Azurite support.
21
+ - 10a86bd4ae12: Add optional config and cli option for techdocs to specify default mkdocs plugins.
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies
26
+ - @backstage/config@1.1.0-next.0
27
+ - @backstage/integration@1.7.0-next.1
28
+ - @backstage/backend-common@0.19.5-next.1
29
+ - @backstage/catalog-model@1.4.2-next.0
30
+ - @backstage/integration-aws-node@0.1.6-next.0
31
+ - @backstage/errors@1.2.1
32
+ - @backstage/plugin-search-common@1.2.6-next.0
15
33
 
16
- ## 1.7.5
34
+ ## 1.7.6-next.0
17
35
 
18
36
  ### Patch Changes
19
37
 
20
38
  - Updated dependencies
21
- - @backstage/integration@1.6.1
22
- - @backstage/backend-common@0.19.3
39
+ - @backstage/backend-common@0.19.4-next.0
40
+ - @backstage/integration@1.7.0-next.0
23
41
  - @backstage/catalog-model@1.4.1
24
42
  - @backstage/config@1.0.8
25
43
  - @backstage/errors@1.2.1
package/dist/index.cjs.js CHANGED
@@ -410,14 +410,16 @@ const patchMkdocsYmlPreBuild = async (mkdocsYmlPath, logger, parsedLocationAnnot
410
410
  return false;
411
411
  });
412
412
  };
413
- const pathMkdocsYmlWithTechdocsPlugin = async (mkdocsYmlPath, logger) => {
413
+ const patchMkdocsYmlWithPlugins = async (mkdocsYmlPath, logger, defaultPlugins = ["techdocs-core"]) => {
414
414
  await patchMkdocsFile(mkdocsYmlPath, logger, (mkdocsYml) => {
415
415
  if (!("plugins" in mkdocsYml)) {
416
- mkdocsYml.plugins = ["techdocs-core"];
416
+ mkdocsYml.plugins = defaultPlugins;
417
417
  return true;
418
418
  }
419
- if (mkdocsYml.plugins && !mkdocsYml.plugins.includes("techdocs-core")) {
420
- mkdocsYml.plugins.push("techdocs-core");
419
+ if (mkdocsYml.plugins && !defaultPlugins.every((plugin) => mkdocsYml.plugins.includes(plugin))) {
420
+ mkdocsYml.plugins = [
421
+ .../* @__PURE__ */ new Set([...mkdocsYml.plugins, ...defaultPlugins])
422
+ ];
421
423
  return true;
422
424
  }
423
425
  return false;
@@ -458,7 +460,7 @@ const _TechdocsGenerator = class _TechdocsGenerator {
458
460
  }
459
461
  /** {@inheritDoc GeneratorBase.run} */
460
462
  async run(options) {
461
- var _a;
463
+ var _a, _b;
462
464
  const {
463
465
  inputDir,
464
466
  outputDir,
@@ -484,9 +486,11 @@ const _TechdocsGenerator = class _TechdocsGenerator {
484
486
  if (this.options.legacyCopyReadmeMdToIndexMd) {
485
487
  await patchIndexPreBuild({ inputDir, logger: childLogger, docsDir });
486
488
  }
487
- if (!this.options.omitTechdocsCoreMkdocsPlugin) {
488
- await pathMkdocsYmlWithTechdocsPlugin(mkdocsYmlPath, childLogger);
489
+ const defaultPlugins = (_a = this.options.defaultPlugins) != null ? _a : [];
490
+ if (!this.options.omitTechdocsCoreMkdocsPlugin && !defaultPlugins.includes("techdocs-core")) {
491
+ defaultPlugins.push("techdocs-core");
489
492
  }
493
+ await patchMkdocsYmlWithPlugins(mkdocsYmlPath, childLogger, defaultPlugins);
490
494
  const mountDirs = {
491
495
  [inputDir]: "/input",
492
496
  [outputDir]: "/output"
@@ -513,7 +517,7 @@ const _TechdocsGenerator = class _TechdocsGenerator {
513
517
  );
514
518
  }
515
519
  await this.containerRunner.runContainer({
516
- imageName: (_a = this.options.dockerImage) != null ? _a : _TechdocsGenerator.defaultDockerImage,
520
+ imageName: (_b = this.options.dockerImage) != null ? _b : _TechdocsGenerator.defaultDockerImage,
517
521
  args: ["build", "-d", "/output"],
518
522
  logStream,
519
523
  mountDirs,
@@ -578,6 +582,9 @@ function readGeneratorConfig(config, logger) {
578
582
  ),
579
583
  legacyCopyReadmeMdToIndexMd: config.getOptionalBoolean(
580
584
  "techdocs.generator.mkdocs.legacyCopyReadmeMdToIndexMd"
585
+ ),
586
+ defaultPlugins: config.getOptionalStringArray(
587
+ "techdocs.generator.mkdocs.defaultPlugins"
581
588
  )
582
589
  };
583
590
  }
@@ -1273,6 +1280,7 @@ class AzureBlobStoragePublish {
1273
1280
  this.logger = options.logger;
1274
1281
  }
1275
1282
  static fromConfig(config, logger) {
1283
+ let storageClient;
1276
1284
  let containerName = "";
1277
1285
  try {
1278
1286
  containerName = config.getString(
@@ -1283,32 +1291,41 @@ class AzureBlobStoragePublish {
1283
1291
  "Since techdocs.publisher.type is set to 'azureBlobStorage' in your app config, techdocs.publisher.azureBlobStorage.containerName is required."
1284
1292
  );
1285
1293
  }
1286
- let accountName = "";
1287
- try {
1288
- accountName = config.getString(
1289
- "techdocs.publisher.azureBlobStorage.credentials.accountName"
1290
- );
1291
- } catch (error) {
1292
- throw new Error(
1293
- "Since techdocs.publisher.type is set to 'azureBlobStorage' in your app config, techdocs.publisher.azureBlobStorage.credentials.accountName is required."
1294
- );
1295
- }
1296
- const accountKey = config.getOptionalString(
1297
- "techdocs.publisher.azureBlobStorage.credentials.accountKey"
1298
- );
1299
- let credential;
1300
- if (accountKey) {
1301
- credential = new storageBlob.StorageSharedKeyCredential(accountName, accountKey);
1302
- } else {
1303
- credential = new identity.DefaultAzureCredential();
1304
- }
1305
- const storageClient = new storageBlob.BlobServiceClient(
1306
- `https://${accountName}.blob.core.windows.net`,
1307
- credential
1308
- );
1309
1294
  const legacyPathCasing = config.getOptionalBoolean(
1310
1295
  "techdocs.legacyUseCaseSensitiveTripletPaths"
1311
1296
  ) || false;
1297
+ const connectionStringKey = "techdocs.publisher.azureBlobStorage.connectionString";
1298
+ const connectionString = config.getOptionalString(connectionStringKey);
1299
+ if (connectionString) {
1300
+ logger.info(
1301
+ `Using '${connectionStringKey}' configuration to create storage client`
1302
+ );
1303
+ storageClient = storageBlob.BlobServiceClient.fromConnectionString(connectionString);
1304
+ } else {
1305
+ let accountName = "";
1306
+ try {
1307
+ accountName = config.getString(
1308
+ "techdocs.publisher.azureBlobStorage.credentials.accountName"
1309
+ );
1310
+ } catch (error) {
1311
+ throw new Error(
1312
+ "Since techdocs.publisher.type is set to 'azureBlobStorage' in your app config, techdocs.publisher.azureBlobStorage.credentials.accountName is required."
1313
+ );
1314
+ }
1315
+ const accountKey = config.getOptionalString(
1316
+ "techdocs.publisher.azureBlobStorage.credentials.accountKey"
1317
+ );
1318
+ let credential;
1319
+ if (accountKey) {
1320
+ credential = new storageBlob.StorageSharedKeyCredential(accountName, accountKey);
1321
+ } else {
1322
+ credential = new identity.DefaultAzureCredential();
1323
+ }
1324
+ storageClient = new storageBlob.BlobServiceClient(
1325
+ `https://${accountName}.blob.core.windows.net`,
1326
+ credential
1327
+ );
1328
+ }
1312
1329
  return new AzureBlobStoragePublish({
1313
1330
  storageClient,
1314
1331
  containerName,