Use @backstage/plugin-techdocs-node instead of @backstage/techdocs-common

Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Eric Peterson
2022-03-03 13:33:47 +01:00
parent 84a8788794
commit 91bf1e6c1a
34 changed files with 54 additions and 47 deletions
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/plugin-techdocs-backend': patch
'@techdocs/cli': patch
---
Use `@backstage/plugin-techdocs-node` package instead of `@backstage/techdocs-common`.
+1 -1
View File
@@ -46,7 +46,7 @@
/plugins/search-* @backstage/reviewers @backstage/techdocs-core
/plugins/sonarqube @backstage/reviewers @backstage/sda-se-reviewers
/plugins/techdocs @backstage/reviewers @backstage/techdocs-core
/plugins/techdocs-backend @backstage/reviewers @backstage/techdocs-core
/plugins/techdocs-* @backstage/reviewers @backstage/techdocs-core
/tech-insights-backend @backstage/reviewers @xantier @iain-b
/tech-insights-backend-module-jsonfc @backstage/reviewers @xantier @iain-b
/tech-insights-tech-insights-common @backstage/reviewers @xantier @iain-b
+1 -1
View File
@@ -97,7 +97,7 @@ techdocs-cli generate
Alias: `techdocs-cli build`
The generate command uses the
[`@backstage/techdocs-common`](https://github.com/backstage/backstage/tree/master/packages/techdocs-common)
[`@backstage/plugin-techdocs-node`](https://github.com/backstage/backstage/tree/master/plugins/techdocs-node)
package from Backstage for consistency. A Backstage app can also generate and
publish TechDocs sites if `techdocs.builder` is set to `'local'` in
`app-config.yaml`. See
+2 -2
View File
@@ -160,8 +160,8 @@ are separated out into their own folder, see further down.
reusable React components. Stories are within the core package, and are
published in the [Backstage Storybook](https://backstage.io/storybook).
- [`techdocs-common/`](https://github.com/backstage/backstage/tree/master/packages/techdocs-common) -
Common functionalities for TechDocs, to be shared between
- [`techdocs-node/`](https://github.com/backstage/backstage/tree/master/plugins/techdocs-node) -
Common node.js functionalities for TechDocs, to be shared between
[techdocs-backend](https://github.com/backstage/backstage/tree/master/plugins/techdocs-backend)
plugin and [techdocs-cli](https://github.com/backstage/techdocs-cli).
+1 -1
View File
@@ -66,7 +66,7 @@
"@backstage/catalog-model": "^0.12.0",
"@backstage/cli-common": "^0.1.8",
"@backstage/config": "^0.1.15",
"@backstage/techdocs-common": "^0.11.11",
"@backstage/plugin-techdocs-node": "^0.11.11",
"@types/dockerode": "^3.3.0",
"commander": "^6.1.0",
"dockerode": "^3.3.1",
@@ -21,7 +21,7 @@ import Docker from 'dockerode';
import {
TechdocsGenerator,
ParsedLocationAnnotation,
} from '@backstage/techdocs-common';
} from '@backstage/plugin-techdocs-node';
import { DockerContainerRunner } from '@backstage/backend-common';
import { ConfigReader } from '@backstage/config';
import {
@@ -31,7 +31,7 @@ import {
import { stdout } from 'process';
export default async function generate(cmd: Command) {
// Use techdocs-common package to generate docs. Keep consistency between Backstage and CI generating docs.
// Use techdocs-node package to generate docs. Keep consistency between Backstage and CI generating docs.
// Docs can be prepared using actions/checkout or git clone, or similar paradigms on CI. The TechDocs CI workflow
// will run on the CI pipeline containing the documentation files.
@@ -78,7 +78,7 @@ export default async function generate(cmd: Command) {
}
}
// Generate docs using @backstage/techdocs-common
// Generate docs using @backstage/plugin-techdocs-node
const techdocsGenerator = await TechdocsGenerator.fromConfig(config, {
logger,
containerRunner,
+1 -1
View File
@@ -15,7 +15,7 @@
*/
import { CommanderStatic } from 'commander';
import { TechdocsGenerator } from '@backstage/techdocs-common';
import { TechdocsGenerator } from '@backstage/plugin-techdocs-node';
const defaultDockerImage = TechdocsGenerator.defaultDockerImage;
@@ -15,7 +15,7 @@
*/
import { SingleHostDiscovery } from '@backstage/backend-common';
import { Publisher } from '@backstage/techdocs-common';
import { Publisher } from '@backstage/plugin-techdocs-node';
import { Command } from 'commander';
import { createLogger } from '../../lib/utility';
import { PublisherConfig } from '../../lib/PublisherConfig';
@@ -18,7 +18,7 @@ import { resolve } from 'path';
import { Command } from 'commander';
import { createLogger } from '../../lib/utility';
import { SingleHostDiscovery } from '@backstage/backend-common';
import { Publisher } from '@backstage/techdocs-common';
import { Publisher } from '@backstage/plugin-techdocs-node';
import { Entity } from '@backstage/catalog-model';
import { PublisherConfig } from '../../lib/PublisherConfig';
+1 -1
View File
@@ -16,7 +16,7 @@
import {
RemoteProtocol,
ParsedLocationAnnotation,
} from '@backstage/techdocs-common';
} from '@backstage/plugin-techdocs-node';
import * as winston from 'winston';
export const convertTechDocsRefToLocationAnnotation = (
+1 -1
View File
@@ -21,7 +21,7 @@ yarn start
This provides serving and building of documentation for any entity.
To configure various storage providers and building options, see http://backstage.io/docs/features/techdocs/configuration.
The techdocs-backend re-exports the [techdocs-common](https://github.com/backstage/backstage/tree/master/packages/techdocs-common) package which has the features to prepare, generate and publish docs.
The techdocs-backend re-exports the [techdocs-node](https://github.com/backstage/backstage/tree/master/plugins/techdocs-node) package which has the features to prepare, generate and publish docs.
The Publishers are also used to fetch the static documentation files and render them in TechDocs.
## Links
+5 -5
View File
@@ -10,16 +10,16 @@ import { Config } from '@backstage/config';
import { DocumentCollatorFactory } from '@backstage/search-common';
import { Entity } from '@backstage/catalog-model';
import express from 'express';
import { GeneratorBuilder } from '@backstage/techdocs-common';
import { GeneratorBuilder } from '@backstage/plugin-techdocs-node';
import { Knex } from 'knex';
import { Logger as Logger_2 } from 'winston';
import { Permission } from '@backstage/plugin-permission-common';
import { PluginCacheManager } from '@backstage/backend-common';
import { PluginEndpointDiscovery } from '@backstage/backend-common';
import { PreparerBuilder } from '@backstage/techdocs-common';
import { PublisherBase } from '@backstage/techdocs-common';
import { PreparerBuilder } from '@backstage/plugin-techdocs-node';
import { PublisherBase } from '@backstage/plugin-techdocs-node';
import { Readable } from 'stream';
import { TechDocsDocument } from '@backstage/techdocs-common';
import { TechDocsDocument } from '@backstage/plugin-techdocs-node';
import { TokenManager } from '@backstage/backend-common';
// @public
@@ -123,5 +123,5 @@ export type TechDocsCollatorOptions = {
export { TechDocsDocument };
export * from '@backstage/techdocs-common';
export * from '@backstage/plugin-techdocs-node';
```
+1 -1
View File
@@ -41,8 +41,8 @@
"@backstage/errors": "^0.2.2",
"@backstage/integration": "^0.8.0",
"@backstage/plugin-catalog-common": "^0.2.0",
"@backstage/plugin-techdocs-node": "^0.11.11",
"@backstage/search-common": "^0.3.0",
"@backstage/techdocs-common": "^0.11.11",
"@types/express": "^4.17.6",
"dockerode": "^3.3.1",
"express": "^4.17.1",
@@ -29,7 +29,7 @@ import {
PreparerBuilder,
PublisherBase,
UrlPreparer,
} from '@backstage/techdocs-common';
} from '@backstage/plugin-techdocs-node';
import fs from 'fs-extra';
import os from 'os';
import path from 'path';
+3 -3
View File
@@ -39,8 +39,8 @@ export type {
} from './search';
/**
* @deprecated Use directly from @backstage/techdocs-common
* @deprecated Use directly from @backstage/plugin-techdocs-node
*/
export type { TechDocsDocument } from '@backstage/techdocs-common';
export type { TechDocsDocument } from '@backstage/plugin-techdocs-node';
export * from '@backstage/techdocs-common';
export * from '@backstage/plugin-techdocs-node';
@@ -35,7 +35,7 @@ import {
CatalogClient,
CATALOG_FILTER_EXISTS,
} from '@backstage/catalog-client';
import { TechDocsDocument } from '@backstage/techdocs-common';
import { TechDocsDocument } from '@backstage/plugin-techdocs-node';
interface MkSearchIndexDoc {
title: string;
@@ -32,7 +32,7 @@ import {
import { Config } from '@backstage/config';
import { catalogEntityReadPermission } from '@backstage/plugin-catalog-common';
import { DocumentCollatorFactory } from '@backstage/search-common';
import { TechDocsDocument } from '@backstage/techdocs-common';
import { TechDocsDocument } from '@backstage/plugin-techdocs-node';
import unescape from 'lodash/unescape';
import fetch from 'node-fetch';
import pLimit from 'p-limit';
@@ -24,7 +24,7 @@ import {
GeneratorBuilder,
PreparerBuilder,
PublisherBase,
} from '@backstage/techdocs-common';
} from '@backstage/plugin-techdocs-node';
import { TechDocsCache } from '../cache';
import { DocsBuilder, shouldCheckForUpdate } from '../DocsBuilder';
import { DocsSynchronizer, DocsSynchronizerSyncOpts } from './DocsSynchronizer';
@@ -23,7 +23,7 @@ import {
GeneratorBuilder,
PreparerBuilder,
PublisherBase,
} from '@backstage/techdocs-common';
} from '@backstage/plugin-techdocs-node';
import fetch from 'node-fetch';
import { PassThrough } from 'stream';
import * as winston from 'winston';
@@ -26,7 +26,7 @@ import {
GeneratorBuilder,
PreparerBuilder,
PublisherBase,
} from '@backstage/techdocs-common';
} from '@backstage/plugin-techdocs-node';
import express, { Response } from 'express';
import request from 'supertest';
import { DocsSynchronizer, DocsSynchronizerSyncOpts } from './DocsSynchronizer';
@@ -26,7 +26,7 @@ import {
getLocationForEntity,
PreparerBuilder,
PublisherBase,
} from '@backstage/techdocs-common';
} from '@backstage/plugin-techdocs-node';
import express, { Response } from 'express';
import Router from 'express-promise-router';
import { Knex } from 'knex';
@@ -28,7 +28,7 @@ import {
Preparers,
Publisher,
TechdocsGenerator,
} from '@backstage/techdocs-common';
} from '@backstage/plugin-techdocs-node';
import Docker from 'dockerode';
import { Server } from 'http';
import { Logger } from 'winston';
+1 -1
View File
@@ -1,4 +1,4 @@
# @backstage/techdocs-common
# @backstage/plugin-techdocs-node
## 0.11.11
+5 -5
View File
@@ -1,15 +1,15 @@
# @backstage/techdocs-common
# @backstage/plugin-techdocs-node
Common functionalities for TechDocs, to be shared between techdocs-backend plugin and techdocs-cli
Common node.js functionalities for TechDocs, to be shared between techdocs-backend plugin and techdocs-cli
This package is used by `techdocs-backend` to serve docs from different types of publishers (Google GCS, Local, etc.).
It is also used to build docs and publish them to storage, by both `techdocs-backend` and `techdocs-cli`.
## Usage
Create a preparer instance from the [preparers available](/packages/techdocs-common/src/stages/prepare) at which takes an Entity instance.
Run the [docs generator](/packages/techdocs-common/src/stages/generate) on the prepared directory.
Publish the generated directory files to a [storage](/packages/techdocs-common/src/stages/publish) of your choice.
Create a preparer instance from the [preparers available](/plugins/techdocs-node/src/stages/prepare) at which takes an Entity instance.
Run the [docs generator](/plugins/techdocs-node/src/stages/generate) on the prepared directory.
Publish the generated directory files to a [storage](/plugins/techdocs-node/src/stages/publish) of your choice.
Example:
+1 -1
View File
@@ -1,4 +1,4 @@
## API Report File for "@backstage/techdocs-common"
## API Report File for "@backstage/plugin-techdocs-node"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@backstage/techdocs-common",
"description": "Common functionalities for TechDocs, to be shared between techdocs-backend plugin and techdocs-cli",
"name": "@backstage/plugin-techdocs-node",
"description": "Common node.js functionalities for TechDocs, to be shared between techdocs-backend plugin and techdocs-cli",
"version": "0.11.11",
"main": "src/index.ts",
"types": "src/index.ts",
@@ -17,7 +17,7 @@
"repository": {
"type": "git",
"url": "https://github.com/backstage/backstage",
"directory": "packages/techdocs-common"
"directory": "plugins/techdocs-node"
},
"keywords": [
"techdocs",
@@ -51,7 +51,7 @@ import { ForwardedError } from '@backstage/errors';
export class TechdocsGenerator implements GeneratorBase {
/**
* The default docker image (and version) used to generate content. Public
* and static so that techdocs-common consumers can use the same version.
* and static so that techdocs-node consumers can use the same version.
*/
public static readonly defaultDockerImage = 'spotify/techdocs:v0.3.7';
private readonly logger: Logger;
@@ -24,7 +24,7 @@ import path from 'path';
import fs from 'fs-extra';
import { AwsS3Publish } from './awsS3';
// NOTE: /packages/techdocs-common/__mocks__ is being used to mock aws-sdk client library
// NOTE: /plugins/techdocs-node/__mocks__ is being used to mock aws-sdk client library
const rootDir = (global as any).rootDir; // Set by setupTests.ts
@@ -24,7 +24,7 @@ import path from 'path';
import fs from 'fs-extra';
import { AzureBlobStoragePublish } from './azureBlobStorage';
// NOTE: /packages/techdocs-common/__mocks__ is being used to mock Azure client library
// NOTE: /plugins/techdocs-node/__mocks__ is being used to mock Azure client library
const rootDir = (global as any).rootDir; // Set by setupTests.ts
@@ -24,7 +24,7 @@ import path from 'path';
import fs from 'fs-extra';
import { GoogleGCSPublish } from './googleStorage';
// NOTE: /packages/techdocs-common/__mocks__ is being used to mock Google Cloud Storage client library
// NOTE: /plugins/techdocs-node/__mocks__ is being used to mock Google Cloud Storage client library
const rootDir = (global as any).rootDir; // Set by setupTests.ts
@@ -49,7 +49,7 @@ try {
);
} catch (err) {
// This will most probably never be used.
// The try/catch is introduced so that techdocs-cli can import @backstage/techdocs-common
// The try/catch is introduced so that techdocs-cli can import @backstage/plugin-techdocs-node
// on CI/CD without installing techdocs backend plugin.
staticDocsDir = os.tmpdir();
}
@@ -29,7 +29,7 @@ import path from 'path';
import { OpenStackSwiftPublish } from './openStackSwift';
import { PublisherBase, TechDocsMetadata } from './types';
// NOTE: /packages/techdocs-common/__mocks__ is being used to mock @trendyol-js/openstack-swift-sdk client library
// NOTE: /plugins/techdocs-node/__mocks__ is being used to mock @trendyol-js/openstack-swift-sdk client library
const createMockEntity = (annotations = {}): Entity => {
return {
@@ -153,7 +153,7 @@ export interface PublisherBase {
* `techdocs-cli` version `{0.x.y}` and `techdocs-backend` version `{0.x.y}`.
*
* Implementation of this method is unnecessary in publishers introduced
* after version `{0.x.y}` of `techdocs-common`.
* after version `{0.x.y}` of `techdocs-node`.
*/
migrateDocsCase?(migrateRequest: MigrateRequest): Promise<void>;
}
+1
View File
@@ -238,6 +238,7 @@ const NO_WARNING_PACKAGES = [
'plugins/scaffolder-common',
'plugins/search-backend-node',
'plugins/techdocs-backend',
'plugins/techdocs-node',
'plugins/tech-insights',
'plugins/tech-insights-backend',
'plugins/tech-insights-backend-module-jsonfc',