@backstage/plugin-techdocs-node 2.1.0 → 2.2.0-next.0
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 +13 -0
- package/dist/alpha.cjs.js +20 -0
- package/dist/alpha.cjs.js.map +1 -0
- package/dist/alpha.d.ts +35 -0
- package/dist/index.d.ts +4 -19
- package/dist/stages/generate/helpers.cjs.js +1 -1
- package/dist/stages/generate/helpers.cjs.js.map +1 -1
- package/dist/stages/generate/mkdocsPatchers.cjs.js.map +1 -1
- package/dist/stages/publish/awsS3.cjs.js +7 -1
- package/dist/stages/publish/awsS3.cjs.js.map +1 -1
- package/dist/stages/publish/azureBlobStorage.cjs.js +21 -1
- package/dist/stages/publish/azureBlobStorage.cjs.js.map +1 -1
- package/dist/stages/publish/googleStorage.cjs.js +7 -1
- package/dist/stages/publish/googleStorage.cjs.js.map +1 -1
- package/dist/types/helpers.d-DkvPJaTo.d.ts +100 -0
- package/package.json +38 -24
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { LoggerService } from '@backstage/backend-plugin-api';
|
|
2
|
+
import { SpawnOptionsWithoutStdio } from 'node:child_process';
|
|
3
|
+
import * as yaml from 'js-yaml';
|
|
4
|
+
import { Writable } from 'node:stream';
|
|
5
|
+
|
|
6
|
+
/** @alpha */
|
|
7
|
+
type RunCommandOptions = {
|
|
8
|
+
/** command to run */
|
|
9
|
+
command: string;
|
|
10
|
+
/** arguments to pass the command */
|
|
11
|
+
args: string[];
|
|
12
|
+
/** options to pass to spawn */
|
|
13
|
+
options: SpawnOptionsWithoutStdio;
|
|
14
|
+
/** stream to capture stdout and stderr output */
|
|
15
|
+
logStream?: Writable;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Run a command in a sub-process, normally a shell command.
|
|
19
|
+
* @alpha
|
|
20
|
+
*/
|
|
21
|
+
declare const runCommand: ({ command, args, options, logStream, }: RunCommandOptions) => Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Preserve YAML merge keys and MkDocs-specific tags while inspecting config.
|
|
24
|
+
*
|
|
25
|
+
* @alpha
|
|
26
|
+
*/
|
|
27
|
+
declare const MKDOCS_SCHEMA: yaml.Schema;
|
|
28
|
+
/**
|
|
29
|
+
* Finds and loads the contents of an mkdocs.yml, mkdocs.yaml file, a file
|
|
30
|
+
* with a specified name or an ad-hoc created file with minimal config.
|
|
31
|
+
* @public
|
|
32
|
+
*
|
|
33
|
+
* @param inputDir - base dir to be searched for either an mkdocs.yml or mkdocs.yaml file.
|
|
34
|
+
* @param options - name: default mkdocs site_name to be used with a ad hoc file default value is "Documentation Site"
|
|
35
|
+
* mkdocsConfigFileName (optional): a non-default file name to be used as the config
|
|
36
|
+
*/
|
|
37
|
+
declare const getMkdocsYml: (inputDir: string, options?: {
|
|
38
|
+
name?: string;
|
|
39
|
+
mkdocsConfigFileName?: string;
|
|
40
|
+
}) => Promise<{
|
|
41
|
+
path: string;
|
|
42
|
+
content: string;
|
|
43
|
+
configIsTemporary: boolean;
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* Validating mkdocs config file for incorrect/insecure values
|
|
47
|
+
* Throws on invalid configs
|
|
48
|
+
*
|
|
49
|
+
* @param inputDir - base dir to be used as a docs_dir path validity check
|
|
50
|
+
* @param mkdocsYmlFileString - The string contents of the loaded
|
|
51
|
+
* mkdocs.yml or equivalent of a docs site
|
|
52
|
+
* @returns the parsed docs_dir or undefined
|
|
53
|
+
* @alpha
|
|
54
|
+
*/
|
|
55
|
+
declare const validateMkdocsYaml: (inputDir: string, mkdocsYmlFileString: string) => Promise<string | undefined>;
|
|
56
|
+
/**
|
|
57
|
+
* Validates that the input directory doesn't contain symlinks pointing outside
|
|
58
|
+
* of it. This prevents path traversal attacks where malicious symlinks could be
|
|
59
|
+
* used to read arbitrary files from the host filesystem.
|
|
60
|
+
*
|
|
61
|
+
* The whole input directory is checked rather than only the docs directory,
|
|
62
|
+
* because MkDocs extensions can read files from anywhere in the input directory.
|
|
63
|
+
*
|
|
64
|
+
* @param inputDir - The input directory to validate (absolute path)
|
|
65
|
+
* @alpha
|
|
66
|
+
*/
|
|
67
|
+
declare const validateInputDirectory: (inputDir: string) => Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Update docs/index.md file before TechDocs generator uses it to generate docs site,
|
|
70
|
+
* falling back to docs/README.md or README.md in case a default docs/index.md
|
|
71
|
+
* is not provided.
|
|
72
|
+
* @alpha
|
|
73
|
+
*/
|
|
74
|
+
declare const patchIndexPreBuild: ({ inputDir, logger, docsDir, }: {
|
|
75
|
+
inputDir: string;
|
|
76
|
+
logger: LoggerService;
|
|
77
|
+
docsDir?: string;
|
|
78
|
+
}) => Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Create or update the techdocs_metadata.json. Values initialized/updated are:
|
|
81
|
+
* - The build_timestamp (now)
|
|
82
|
+
* - The list of files generated
|
|
83
|
+
*
|
|
84
|
+
* @param techdocsMetadataPath - File path to techdocs_metadata.json
|
|
85
|
+
* @alpha
|
|
86
|
+
*/
|
|
87
|
+
declare const createOrUpdateMetadata: (techdocsMetadataPath: string, logger: LoggerService, engine?: string) => Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Update the techdocs_metadata.json to add etag of the prepared tree (e.g. commit SHA or actual Etag of the resource).
|
|
90
|
+
* This is helpful to check if a TechDocs site in storage has gone outdated, without maintaining an in-memory build info
|
|
91
|
+
* per Backstage instance.
|
|
92
|
+
*
|
|
93
|
+
* @param techdocsMetadataPath - File path to techdocs_metadata.json
|
|
94
|
+
* @param etag - The ETag to use
|
|
95
|
+
* @alpha
|
|
96
|
+
*/
|
|
97
|
+
declare const storeEtagMetadata: (techdocsMetadataPath: string, etag: string) => Promise<void>;
|
|
98
|
+
|
|
99
|
+
export { MKDOCS_SCHEMA as M, validateMkdocsYaml as a, createOrUpdateMetadata as c, getMkdocsYml as g, patchIndexPreBuild as p, runCommand as r, storeEtagMetadata as s, validateInputDirectory as v };
|
|
100
|
+
export type { RunCommandOptions as R };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-techdocs-node",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0-next.0",
|
|
4
4
|
"description": "Common node.js functionalities for TechDocs, to be shared between techdocs-backend plugin and techdocs-cli",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "node-library",
|
|
@@ -14,9 +14,7 @@
|
|
|
14
14
|
]
|
|
15
15
|
},
|
|
16
16
|
"publishConfig": {
|
|
17
|
-
"access": "public"
|
|
18
|
-
"main": "dist/index.cjs.js",
|
|
19
|
-
"types": "dist/index.d.ts"
|
|
17
|
+
"access": "public"
|
|
20
18
|
},
|
|
21
19
|
"keywords": [
|
|
22
20
|
"techdocs",
|
|
@@ -32,8 +30,31 @@
|
|
|
32
30
|
"directory": "plugins/techdocs-node"
|
|
33
31
|
},
|
|
34
32
|
"license": "Apache-2.0",
|
|
35
|
-
"
|
|
36
|
-
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"require": "./dist/index.cjs.js",
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"default": "./dist/index.cjs.js"
|
|
38
|
+
},
|
|
39
|
+
"./alpha": {
|
|
40
|
+
"require": "./dist/alpha.cjs.js",
|
|
41
|
+
"types": "./dist/alpha.d.ts",
|
|
42
|
+
"default": "./dist/alpha.cjs.js"
|
|
43
|
+
},
|
|
44
|
+
"./package.json": "./package.json"
|
|
45
|
+
},
|
|
46
|
+
"main": "./dist/index.cjs.js",
|
|
47
|
+
"types": "./dist/index.d.ts",
|
|
48
|
+
"typesVersions": {
|
|
49
|
+
"*": {
|
|
50
|
+
"alpha": [
|
|
51
|
+
"dist/alpha.d.ts"
|
|
52
|
+
],
|
|
53
|
+
"package.json": [
|
|
54
|
+
"package.json"
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
},
|
|
37
58
|
"files": [
|
|
38
59
|
"dist"
|
|
39
60
|
],
|
|
@@ -53,18 +74,19 @@
|
|
|
53
74
|
"@aws-sdk/types": "^3.347.0",
|
|
54
75
|
"@azure/identity": "^4.0.0",
|
|
55
76
|
"@azure/storage-blob": "^12.5.0",
|
|
56
|
-
"@backstage/backend-plugin-api": "
|
|
57
|
-
"@backstage/catalog-model": "
|
|
58
|
-
"@backstage/config": "
|
|
59
|
-
"@backstage/errors": "
|
|
60
|
-
"@backstage/integration": "
|
|
61
|
-
"@backstage/integration-aws-node": "
|
|
62
|
-
"@backstage/plugin-search-common": "
|
|
63
|
-
"@backstage/plugin-techdocs-common": "
|
|
77
|
+
"@backstage/backend-plugin-api": "1.11.1-next.0",
|
|
78
|
+
"@backstage/catalog-model": "1.10.2",
|
|
79
|
+
"@backstage/config": "1.3.10",
|
|
80
|
+
"@backstage/errors": "1.3.2",
|
|
81
|
+
"@backstage/integration": "2.1.3",
|
|
82
|
+
"@backstage/integration-aws-node": "0.2.3",
|
|
83
|
+
"@backstage/plugin-search-common": "1.2.26",
|
|
84
|
+
"@backstage/plugin-techdocs-common": "0.1.2",
|
|
64
85
|
"@google-cloud/storage": "^7.0.0",
|
|
65
86
|
"@smithy/node-http-handler": "^3.0.0",
|
|
66
87
|
"@trendyol-js/openstack-swift-sdk": "^0.0.7",
|
|
67
88
|
"@types/express": "^4.17.6",
|
|
89
|
+
"@types/js-yaml": "^4.0.0",
|
|
68
90
|
"dockerode": "^4.0.0",
|
|
69
91
|
"express": "^4.22.0",
|
|
70
92
|
"fs-extra": "^11.2.0",
|
|
@@ -78,20 +100,12 @@
|
|
|
78
100
|
"winston": "^3.2.1"
|
|
79
101
|
},
|
|
80
102
|
"devDependencies": {
|
|
81
|
-
"@backstage/backend-test-utils": "
|
|
82
|
-
"@backstage/cli": "
|
|
103
|
+
"@backstage/backend-test-utils": "1.11.9-next.0",
|
|
104
|
+
"@backstage/cli": "0.36.8-next.0",
|
|
83
105
|
"@types/fs-extra": "^11.0.0",
|
|
84
|
-
"@types/js-yaml": "^4.0.0",
|
|
85
106
|
"@types/mime-types": "^2.1.0",
|
|
86
107
|
"@types/recursive-readdir": "^2.2.0",
|
|
87
108
|
"@types/supertest": "^2.0.8",
|
|
88
109
|
"supertest": "^7.0.0"
|
|
89
|
-
},
|
|
90
|
-
"typesVersions": {
|
|
91
|
-
"*": {
|
|
92
|
-
"package.json": [
|
|
93
|
-
"package.json"
|
|
94
|
-
]
|
|
95
|
-
}
|
|
96
110
|
}
|
|
97
111
|
}
|