@techdocs/cli 1.8.20-next.0 → 1.8.20-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 +22 -0
- package/dist/{cjs/generate-CHbYjdPP.cjs.js → commands/generate/generate.cjs.js} +4 -5
- package/dist/commands/generate/generate.cjs.js.map +1 -0
- package/dist/commands/index.cjs.js +231 -0
- package/dist/commands/index.cjs.js.map +1 -0
- package/dist/{cjs/migrate-Ddd_MQkE.cjs.js → commands/migrate/migrate.cjs.js} +5 -7
- package/dist/commands/migrate/migrate.cjs.js.map +1 -0
- package/dist/{cjs/publish-DH7Mbt7b.cjs.js → commands/publish/publish.cjs.js} +5 -7
- package/dist/commands/publish/publish.cjs.js.map +1 -0
- package/dist/{cjs/mkdocs-HM8xNBvh.cjs.js → commands/serve/mkdocs.cjs.js} +9 -10
- package/dist/commands/serve/mkdocs.cjs.js.map +1 -0
- package/dist/{cjs/serve-QoNUyZPw.cjs.js → commands/serve/serve.cjs.js} +12 -94
- package/dist/commands/serve/serve.cjs.js.map +1 -0
- package/dist/commands/serve/utils.cjs.js +24 -0
- package/dist/commands/serve/utils.cjs.js.map +1 -0
- package/dist/embedded-app/.config-schema.json +541 -141
- package/dist/embedded-app/index.html +1 -1
- package/dist/embedded-app/index.html.tmpl +1 -1
- package/dist/embedded-app/static/{2177.9af93c36.chunk.js → 2177.e1184707.chunk.js} +2 -2
- package/dist/embedded-app/static/{2177.9af93c36.chunk.js.map → 2177.e1184707.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{4036.a109c6eb.chunk.js → 4036.c70fd6f0.chunk.js} +2 -2
- package/dist/embedded-app/static/{4036.a109c6eb.chunk.js.map → 4036.c70fd6f0.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{9605.7441e12c.chunk.js → 9605.6d4a0d4f.chunk.js} +3 -3
- package/dist/embedded-app/static/{9605.7441e12c.chunk.js.map → 9605.6d4a0d4f.chunk.js.map} +1 -1
- package/dist/embedded-app/static/main.4da17177.js +553 -0
- package/dist/embedded-app/static/main.4da17177.js.map +1 -0
- package/dist/embedded-app/static/{module-material-ui.116dde6e.js → module-material-ui.05c1a36a.js} +4 -4
- package/dist/embedded-app/static/{module-material-ui.116dde6e.js.map → module-material-ui.05c1a36a.js.map} +1 -1
- package/dist/embedded-app/static/module-remix-run.e486ee73.js +14 -0
- package/dist/embedded-app/static/module-remix-run.e486ee73.js.map +1 -0
- package/dist/embedded-app/static/{runtime.500b1c12.js → runtime.4da17177.js} +2 -2
- package/dist/embedded-app/static/{runtime.500b1c12.js.map → runtime.4da17177.js.map} +1 -1
- package/dist/embedded-app/static/vendor.4da17177.js +169 -0
- package/dist/embedded-app/static/vendor.4da17177.js.map +1 -0
- package/dist/index.cjs.js +4 -230
- package/dist/index.cjs.js.map +1 -1
- package/dist/{cjs/PublisherConfig-Cn5i8vF5.cjs.js → lib/PublisherConfig.cjs.js} +1 -1
- package/dist/lib/PublisherConfig.cjs.js.map +1 -0
- package/dist/lib/httpServer.cjs.js +93 -0
- package/dist/lib/httpServer.cjs.js.map +1 -0
- package/dist/lib/mkdocsServer.cjs.js +58 -0
- package/dist/lib/mkdocsServer.cjs.js.map +1 -0
- package/dist/lib/run.cjs.js +58 -0
- package/dist/lib/run.cjs.js.map +1 -0
- package/dist/{cjs/utility-CsspJYjU.cjs.js → lib/utility.cjs.js} +1 -1
- package/dist/lib/utility.cjs.js.map +1 -0
- package/dist/package.json.cjs.js +6 -0
- package/dist/package.json.cjs.js.map +1 -0
- package/package.json +7 -7
- package/dist/cjs/PublisherConfig-Cn5i8vF5.cjs.js.map +0 -1
- package/dist/cjs/generate-CHbYjdPP.cjs.js.map +0 -1
- package/dist/cjs/migrate-Ddd_MQkE.cjs.js.map +0 -1
- package/dist/cjs/mkdocs-HM8xNBvh.cjs.js.map +0 -1
- package/dist/cjs/publish-DH7Mbt7b.cjs.js.map +0 -1
- package/dist/cjs/serve-QoNUyZPw.cjs.js.map +0 -1
- package/dist/cjs/utility-CsspJYjU.cjs.js.map +0 -1
- package/dist/cjs/utils-FcpnJ4zG.cjs.js +0 -129
- package/dist/cjs/utils-FcpnJ4zG.cjs.js.map +0 -1
- package/dist/embedded-app/static/main.500b1c12.js +0 -533
- package/dist/embedded-app/static/main.500b1c12.js.map +0 -1
- package/dist/embedded-app/static/module-react-router-dom.bf7ca63f.js +0 -23
- package/dist/embedded-app/static/module-react-router-dom.bf7ca63f.js.map +0 -1
- package/dist/embedded-app/static/module-react-router.fae32787.js +0 -23
- package/dist/embedded-app/static/module-react-router.fae32787.js.map +0 -1
- package/dist/embedded-app/static/vendor.500b1c12.js +0 -151
- package/dist/embedded-app/static/vendor.500b1c12.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @techdocs/cli
|
|
2
2
|
|
|
3
|
+
## 1.8.20-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/backend-defaults@0.5.1-next.2
|
|
9
|
+
- @backstage/plugin-techdocs-node@1.12.12-next.2
|
|
10
|
+
- @backstage/catalog-model@1.7.0
|
|
11
|
+
- @backstage/cli-common@0.1.14
|
|
12
|
+
- @backstage/config@1.2.0
|
|
13
|
+
|
|
14
|
+
## 1.8.20-next.1
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
- @backstage/backend-defaults@0.5.1-next.1
|
|
20
|
+
- @backstage/catalog-model@1.7.0
|
|
21
|
+
- @backstage/cli-common@0.1.14
|
|
22
|
+
- @backstage/config@1.2.0
|
|
23
|
+
- @backstage/plugin-techdocs-node@1.12.12-next.1
|
|
24
|
+
|
|
3
25
|
## 1.8.20-next.0
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var path = require('path');
|
|
4
6
|
var fs = require('fs-extra');
|
|
5
7
|
var pluginTechdocsNode = require('@backstage/plugin-techdocs-node');
|
|
6
8
|
var config = require('@backstage/config');
|
|
7
|
-
var utility = require('
|
|
8
|
-
require('winston');
|
|
9
|
-
require('stream');
|
|
10
|
-
require('process');
|
|
9
|
+
var utility = require('../../lib/utility.cjs.js');
|
|
11
10
|
|
|
12
11
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
13
12
|
|
|
@@ -78,4 +77,4 @@ async function generate(opts) {
|
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
exports.default = generate;
|
|
81
|
-
//# sourceMappingURL=generate
|
|
80
|
+
//# sourceMappingURL=generate.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.cjs.js","sources":["../../../src/commands/generate/generate.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { resolve } from 'path';\nimport { OptionValues } from 'commander';\nimport fs from 'fs-extra';\nimport {\n TechdocsGenerator,\n ParsedLocationAnnotation,\n getMkdocsYml,\n} from '@backstage/plugin-techdocs-node';\nimport { ConfigReader } from '@backstage/config';\nimport {\n convertTechDocsRefToLocationAnnotation,\n createLogger,\n getLogStream,\n} from '../../lib/utility';\n\nexport default async function generate(opts: OptionValues) {\n // Use techdocs-node package to generate docs. Keep consistency between Backstage and CI generating docs.\n // Docs can be prepared using actions/checkout or git clone, or similar paradigms on CI. The TechDocs CI workflow\n // will run on the CI pipeline containing the documentation files.\n\n const logger = createLogger({ verbose: opts.verbose });\n\n const sourceDir = resolve(opts.sourceDir);\n const outputDir = resolve(opts.outputDir);\n const omitTechdocsCorePlugin = opts.omitTechdocsCoreMkdocsPlugin;\n const dockerImage = opts.dockerImage;\n const pullImage = opts.pull;\n const legacyCopyReadmeMdToIndexMd = opts.legacyCopyReadmeMdToIndexMd;\n const defaultPlugins = opts.defaultPlugin;\n\n logger.info(`Using source dir ${sourceDir}`);\n logger.info(`Will output generated files in ${outputDir}`);\n\n logger.verbose('Creating output directory if it does not exist.');\n\n await fs.ensureDir(outputDir);\n\n const { path: mkdocsYmlPath, configIsTemporary } = await getMkdocsYml(\n sourceDir,\n );\n\n const config = new ConfigReader({\n techdocs: {\n generator: {\n runIn: opts.docker ? 'docker' : 'local',\n dockerImage,\n pullImage,\n mkdocs: {\n legacyCopyReadmeMdToIndexMd,\n omitTechdocsCorePlugin,\n defaultPlugins,\n },\n },\n },\n });\n\n let parsedLocationAnnotation = {} as ParsedLocationAnnotation;\n if (opts.techdocsRef) {\n try {\n parsedLocationAnnotation = convertTechDocsRefToLocationAnnotation(\n opts.techdocsRef,\n );\n } catch (err) {\n logger.error(err.message);\n }\n }\n\n // Generate docs using @backstage/plugin-techdocs-node\n const techdocsGenerator = await TechdocsGenerator.fromConfig(config, {\n logger,\n });\n\n logger.info('Generating documentation...');\n\n await techdocsGenerator.run({\n inputDir: sourceDir,\n outputDir,\n ...(opts.techdocsRef\n ? {\n parsedLocationAnnotation,\n }\n : {}),\n logger,\n etag: opts.etag,\n logStream: getLogStream(logger),\n siteOptions: { name: opts.siteName },\n runAsDefaultUser: opts.runAsDefaultUser,\n });\n\n if (configIsTemporary) {\n process.on('exit', async () => {\n fs.rmSync(mkdocsYmlPath, {});\n });\n }\n\n logger.info('Done!');\n}\n"],"names":["createLogger","resolve","fs","getMkdocsYml","config","ConfigReader","convertTechDocsRefToLocationAnnot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require('@backstage/plugin-techdocs-node');
|
|
4
|
+
|
|
5
|
+
const defaultDockerImage = pluginTechdocsNode.TechdocsGenerator.defaultDockerImage;
|
|
6
|
+
const defaultPreviewAppPort = "3000";
|
|
7
|
+
function registerCommands(program) {
|
|
8
|
+
program.command("generate").description("Generate TechDocs documentation site using MkDocs.").option(
|
|
9
|
+
"--source-dir <PATH>",
|
|
10
|
+
"Source directory containing mkdocs.yml and docs/ directory.",
|
|
11
|
+
"."
|
|
12
|
+
).option(
|
|
13
|
+
"--output-dir <PATH>",
|
|
14
|
+
"Output directory containing generated TechDocs site.",
|
|
15
|
+
"./site/"
|
|
16
|
+
).option(
|
|
17
|
+
"--docker-image <DOCKER_IMAGE>",
|
|
18
|
+
"The mkdocs docker container to use",
|
|
19
|
+
defaultDockerImage
|
|
20
|
+
).option("--no-pull", "Do not pull the latest docker image").option(
|
|
21
|
+
"--no-docker",
|
|
22
|
+
"Do not use Docker, use MkDocs executable and plugins in current user environment."
|
|
23
|
+
).option(
|
|
24
|
+
"--techdocs-ref <HOST_TYPE:URL>",
|
|
25
|
+
"The repository hosting documentation source files e.g. url:https://ghe.mycompany.net.com/org/repo.\nThis value is same as the backstage.io/techdocs-ref annotation of the corresponding Backstage entity.\nIt is completely fine to skip this as it is only being used to set repo_url in mkdocs.yml if not found.\n"
|
|
26
|
+
).option(
|
|
27
|
+
"--etag <ETAG>",
|
|
28
|
+
"A unique identifier for the prepared tree e.g. commit SHA. If provided it will be stored in techdocs_metadata.json."
|
|
29
|
+
).option(
|
|
30
|
+
"--site-name",
|
|
31
|
+
"Name for site when using default MkDocs config",
|
|
32
|
+
"Documentation Site"
|
|
33
|
+
).option("-v --verbose", "Enable verbose output.", false).option(
|
|
34
|
+
"--omitTechdocsCoreMkdocsPlugin",
|
|
35
|
+
"Don't patch MkDocs file automatically with techdocs-core plugin.",
|
|
36
|
+
false
|
|
37
|
+
).option(
|
|
38
|
+
"--legacyCopyReadmeMdToIndexMd",
|
|
39
|
+
"Attempt to ensure an index.md exists falling back to using <docs-dir>/README.md or README.md in case a default <docs-dir>/index.md is not provided.",
|
|
40
|
+
false
|
|
41
|
+
).option(
|
|
42
|
+
"--defaultPlugin [defaultPlugins...]",
|
|
43
|
+
"Plugins which should be added automatically to the mkdocs.yaml file",
|
|
44
|
+
[]
|
|
45
|
+
).option(
|
|
46
|
+
"--runAsDefaultUser",
|
|
47
|
+
"Bypass setting the container user as the same user and group id as host for Linux and MacOS",
|
|
48
|
+
false
|
|
49
|
+
).alias("build").action(lazy(() => Promise.resolve().then(function () { return require('./generate/generate.cjs.js'); }).then((m) => m.default)));
|
|
50
|
+
program.command("migrate").description(
|
|
51
|
+
"Migrate objects with case-sensitive entity triplets to lower-case versions."
|
|
52
|
+
).requiredOption(
|
|
53
|
+
"--publisher-type <TYPE>",
|
|
54
|
+
"(Required always) awsS3 | googleGcs | azureBlobStorage | openStackSwift - same as techdocs.publisher.type in Backstage app-config.yaml"
|
|
55
|
+
).requiredOption(
|
|
56
|
+
"--storage-name <BUCKET/CONTAINER NAME>",
|
|
57
|
+
"(Required always) In case of AWS/GCS, use the bucket name. In case of Azure, use container name. Same as techdocs.publisher.[TYPE].bucketName"
|
|
58
|
+
).option(
|
|
59
|
+
"--azureAccountName <AZURE ACCOUNT NAME>",
|
|
60
|
+
"(Required for Azure) specify when --publisher-type azureBlobStorage"
|
|
61
|
+
).option(
|
|
62
|
+
"--azureAccountKey <AZURE ACCOUNT KEY>",
|
|
63
|
+
"Azure Storage Account key to use for authentication. If not specified, you must set AZURE_TENANT_ID, AZURE_CLIENT_ID & AZURE_CLIENT_SECRET as environment variables."
|
|
64
|
+
).option(
|
|
65
|
+
"--awsRoleArn <AWS ROLE ARN>",
|
|
66
|
+
"Optional AWS ARN of role to be assumed."
|
|
67
|
+
).option(
|
|
68
|
+
"--awsEndpoint <AWS ENDPOINT>",
|
|
69
|
+
"Optional AWS endpoint to send requests to."
|
|
70
|
+
).option(
|
|
71
|
+
"--awsS3ForcePathStyle",
|
|
72
|
+
"Optional AWS S3 option to force path style."
|
|
73
|
+
).option(
|
|
74
|
+
"--osCredentialId <OPENSTACK SWIFT APPLICATION CREDENTIAL ID>",
|
|
75
|
+
"(Required for OpenStack) specify when --publisher-type openStackSwift"
|
|
76
|
+
).option(
|
|
77
|
+
"--osSecret <OPENSTACK SWIFT APPLICATION CREDENTIAL SECRET>",
|
|
78
|
+
"(Required for OpenStack) specify when --publisher-type openStackSwift"
|
|
79
|
+
).option(
|
|
80
|
+
"--osAuthUrl <OPENSTACK SWIFT AUTHURL>",
|
|
81
|
+
"(Required for OpenStack) specify when --publisher-type openStackSwift"
|
|
82
|
+
).option(
|
|
83
|
+
"--osSwiftUrl <OPENSTACK SWIFT SWIFTURL>",
|
|
84
|
+
"(Required for OpenStack) specify when --publisher-type openStackSwift"
|
|
85
|
+
).option(
|
|
86
|
+
"--removeOriginal",
|
|
87
|
+
"Optional Files are copied by default. If flag is set, files are renamed/moved instead.",
|
|
88
|
+
false
|
|
89
|
+
).option(
|
|
90
|
+
"--concurrency <MAX CONCURRENT REQS>",
|
|
91
|
+
"Optional Controls the number of API requests allowed to be performed simultaneously.",
|
|
92
|
+
"25"
|
|
93
|
+
).option("-v --verbose", "Enable verbose output.", false).action(lazy(() => Promise.resolve().then(function () { return require('./migrate/migrate.cjs.js'); }).then((m) => m.default)));
|
|
94
|
+
program.command("publish").description(
|
|
95
|
+
"Publish generated TechDocs site to an external storage AWS S3, Google GCS, etc."
|
|
96
|
+
).requiredOption(
|
|
97
|
+
"--publisher-type <TYPE>",
|
|
98
|
+
"(Required always) awsS3 | googleGcs | azureBlobStorage | openStackSwift - same as techdocs.publisher.type in Backstage app-config.yaml"
|
|
99
|
+
).requiredOption(
|
|
100
|
+
"--storage-name <BUCKET/CONTAINER NAME>",
|
|
101
|
+
"(Required always) In case of AWS/GCS, use the bucket name. In case of Azure, use container name. Same as techdocs.publisher.[TYPE].bucketName"
|
|
102
|
+
).requiredOption(
|
|
103
|
+
"--entity <NAMESPACE/KIND/NAME>",
|
|
104
|
+
"(Required always) Entity uid separated by / in namespace/kind/name order (case-sensitive). Example: default/Component/myEntity "
|
|
105
|
+
).option(
|
|
106
|
+
"--legacyUseCaseSensitiveTripletPaths",
|
|
107
|
+
"Publishes objects with cased entity triplet prefix when set (e.g. namespace/Kind/name). Only use if your TechDocs backend is configured the same way.",
|
|
108
|
+
false
|
|
109
|
+
).option(
|
|
110
|
+
"--azureAccountName <AZURE ACCOUNT NAME>",
|
|
111
|
+
"(Required for Azure) specify when --publisher-type azureBlobStorage"
|
|
112
|
+
).option(
|
|
113
|
+
"--azureAccountKey <AZURE ACCOUNT KEY>",
|
|
114
|
+
"Azure Storage Account key to use for authentication. If not specified, you must set AZURE_TENANT_ID, AZURE_CLIENT_ID & AZURE_CLIENT_SECRET as environment variables."
|
|
115
|
+
).option(
|
|
116
|
+
"--awsRoleArn <AWS ROLE ARN>",
|
|
117
|
+
"Optional AWS ARN of role to be assumed."
|
|
118
|
+
).option(
|
|
119
|
+
"--awsEndpoint <AWS ENDPOINT>",
|
|
120
|
+
"Optional AWS endpoint to send requests to."
|
|
121
|
+
).option(
|
|
122
|
+
"--awsProxy <HTTPS Proxy>",
|
|
123
|
+
"Optional Proxy to use for AWS requests."
|
|
124
|
+
).option("--awsS3sse <AWS SSE>", "Optional AWS S3 Server Side Encryption.").option(
|
|
125
|
+
"--awsS3ForcePathStyle",
|
|
126
|
+
"Optional AWS S3 option to force path style."
|
|
127
|
+
).option(
|
|
128
|
+
"--awsBucketRootPath <AWS BUCKET ROOT PATH>",
|
|
129
|
+
"Optional sub-directory to store files in Amazon S3"
|
|
130
|
+
).option(
|
|
131
|
+
"--osCredentialId <OPENSTACK SWIFT APPLICATION CREDENTIAL ID>",
|
|
132
|
+
"(Required for OpenStack) specify when --publisher-type openStackSwift"
|
|
133
|
+
).option(
|
|
134
|
+
"--osSecret <OPENSTACK SWIFT APPLICATION CREDENTIAL SECRET>",
|
|
135
|
+
"(Required for OpenStack) specify when --publisher-type openStackSwift"
|
|
136
|
+
).option(
|
|
137
|
+
"--osAuthUrl <OPENSTACK SWIFT AUTHURL>",
|
|
138
|
+
"(Required for OpenStack) specify when --publisher-type openStackSwift"
|
|
139
|
+
).option(
|
|
140
|
+
"--osSwiftUrl <OPENSTACK SWIFT SWIFTURL>",
|
|
141
|
+
"(Required for OpenStack) specify when --publisher-type openStackSwift"
|
|
142
|
+
).option(
|
|
143
|
+
"--gcsBucketRootPath <GCS BUCKET ROOT PATH>",
|
|
144
|
+
"Optional sub-directory to store files in Google cloud storage"
|
|
145
|
+
).option(
|
|
146
|
+
"--directory <PATH>",
|
|
147
|
+
"Path of the directory containing generated files to publish",
|
|
148
|
+
"./site/"
|
|
149
|
+
).action(lazy(() => Promise.resolve().then(function () { return require('./publish/publish.cjs.js'); }).then((m) => m.default)));
|
|
150
|
+
program.command("serve:mkdocs").description("Serve a documentation project locally using MkDocs serve.").option(
|
|
151
|
+
"-i, --docker-image <DOCKER_IMAGE>",
|
|
152
|
+
"The mkdocs docker container to use",
|
|
153
|
+
defaultDockerImage
|
|
154
|
+
).option(
|
|
155
|
+
"--docker-entrypoint <DOCKER_ENTRYPOINT>",
|
|
156
|
+
"Override the image entrypoint"
|
|
157
|
+
).option(
|
|
158
|
+
"--docker-option <DOCKER_OPTION...>",
|
|
159
|
+
'Extra options to pass to the docker run command, e.g. "--add-host=internal.host:192.168.11.12" (can be added multiple times).'
|
|
160
|
+
).option(
|
|
161
|
+
"--no-docker",
|
|
162
|
+
"Do not use Docker, run `mkdocs serve` in current user environment."
|
|
163
|
+
).option(
|
|
164
|
+
"--site-name",
|
|
165
|
+
"Name for site when using default MkDocs config",
|
|
166
|
+
"Documentation Site"
|
|
167
|
+
).option("-p, --port <PORT>", "Port to serve documentation locally", "8000").option("-v --verbose", "Enable verbose output.", false).action(lazy(() => Promise.resolve().then(function () { return require('./serve/mkdocs.cjs.js'); }).then((m) => m.default)));
|
|
168
|
+
program.command("serve").description(
|
|
169
|
+
"Serve a documentation project locally in a Backstage app-like environment"
|
|
170
|
+
).option(
|
|
171
|
+
"-i, --docker-image <DOCKER_IMAGE>",
|
|
172
|
+
"The mkdocs docker container to use",
|
|
173
|
+
defaultDockerImage
|
|
174
|
+
).option(
|
|
175
|
+
"--docker-entrypoint <DOCKER_ENTRYPOINT>",
|
|
176
|
+
"Override the image entrypoint"
|
|
177
|
+
).option(
|
|
178
|
+
"--docker-option <DOCKER_OPTION...>",
|
|
179
|
+
'Extra options to pass to the docker run command, e.g. "--add-host=internal.host:192.168.11.12" (can be added multiple times).'
|
|
180
|
+
).option(
|
|
181
|
+
"--no-docker",
|
|
182
|
+
"Do not use Docker, use MkDocs executable in current user environment."
|
|
183
|
+
).option(
|
|
184
|
+
"--site-name",
|
|
185
|
+
"Name for site when using default MkDocs config",
|
|
186
|
+
"Documentation Site"
|
|
187
|
+
).option("--mkdocs-port <PORT>", "Port for MkDocs server to use", "8000").option("-v --verbose", "Enable verbose output.", false).option(
|
|
188
|
+
"--preview-app-bundle-path <PATH_TO_BUNDLE>",
|
|
189
|
+
"Preview documentation using another web app"
|
|
190
|
+
).option(
|
|
191
|
+
"--preview-app-port <PORT>",
|
|
192
|
+
"Port for the preview app to be served on",
|
|
193
|
+
defaultPreviewAppPort
|
|
194
|
+
).option(
|
|
195
|
+
"-c, --mkdocs-config-file-name <FILENAME>",
|
|
196
|
+
"Mkdocs config file name"
|
|
197
|
+
).option(
|
|
198
|
+
"--mkdocs-parameter-clean",
|
|
199
|
+
'Pass "--clean" parameter to mkdocs server running in containerized environment',
|
|
200
|
+
false
|
|
201
|
+
).option(
|
|
202
|
+
"--mkdocs-parameter-dirtyreload",
|
|
203
|
+
'Pass "--dirtyreload" parameter to mkdocs server running in containerized environment',
|
|
204
|
+
false
|
|
205
|
+
).option(
|
|
206
|
+
"--mkdocs-parameter-strict",
|
|
207
|
+
'Pass "--strict" parameter to mkdocs server running in containerized environment',
|
|
208
|
+
false
|
|
209
|
+
).hook("preAction", (command) => {
|
|
210
|
+
if (command.opts().previewAppPort !== defaultPreviewAppPort && !command.opts().previewAppBundlePath) {
|
|
211
|
+
command.error(
|
|
212
|
+
"--preview-app-port can only be used together with --preview-app-bundle-path"
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
}).action(lazy(() => Promise.resolve().then(function () { return require('./serve/serve.cjs.js'); }).then((m) => m.default)));
|
|
216
|
+
}
|
|
217
|
+
function lazy(getActionFunc) {
|
|
218
|
+
return async (...args) => {
|
|
219
|
+
try {
|
|
220
|
+
const actionFunc = await getActionFunc();
|
|
221
|
+
await actionFunc(...args);
|
|
222
|
+
process.exit(0);
|
|
223
|
+
} catch (error) {
|
|
224
|
+
console.error(error.message);
|
|
225
|
+
process.exit(1);
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
exports.registerCommands = registerCommands;
|
|
231
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../src/commands/index.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Command } from 'commander';\nimport { TechdocsGenerator } from '@backstage/plugin-techdocs-node';\n\nconst defaultDockerImage = TechdocsGenerator.defaultDockerImage;\nconst defaultPreviewAppPort = '3000';\n\nexport function registerCommands(program: Command) {\n program\n .command('generate')\n .description('Generate TechDocs documentation site using MkDocs.')\n .option(\n '--source-dir <PATH>',\n 'Source directory containing mkdocs.yml and docs/ directory.',\n '.',\n )\n .option(\n '--output-dir <PATH>',\n 'Output directory containing generated TechDocs site.',\n './site/',\n )\n .option(\n '--docker-image <DOCKER_IMAGE>',\n 'The mkdocs docker container to use',\n defaultDockerImage,\n )\n .option('--no-pull', 'Do not pull the latest docker image')\n .option(\n '--no-docker',\n 'Do not use Docker, use MkDocs executable and plugins in current user environment.',\n )\n .option(\n '--techdocs-ref <HOST_TYPE:URL>',\n 'The repository hosting documentation source files e.g. url:https://ghe.mycompany.net.com/org/repo.' +\n '\\nThis value is same as the backstage.io/techdocs-ref annotation of the corresponding Backstage entity.' +\n '\\nIt is completely fine to skip this as it is only being used to set repo_url in mkdocs.yml if not found.\\n',\n )\n .option(\n '--etag <ETAG>',\n 'A unique identifier for the prepared tree e.g. commit SHA. If provided it will be stored in techdocs_metadata.json.',\n )\n .option(\n '--site-name',\n 'Name for site when using default MkDocs config',\n 'Documentation Site',\n )\n .option('-v --verbose', 'Enable verbose output.', false)\n .option(\n '--omitTechdocsCoreMkdocsPlugin',\n \"Don't patch MkDocs file automatically with techdocs-core plugin.\",\n false,\n )\n .option(\n '--legacyCopyReadmeMdToIndexMd',\n 'Attempt to ensure an index.md exists falling back to using <docs-dir>/README.md or README.md in case a default <docs-dir>/index.md is not provided.',\n false,\n )\n .option(\n '--defaultPlugin [defaultPlugins...]',\n 'Plugins which should be added automatically to the mkdocs.yaml file',\n [],\n )\n .option(\n '--runAsDefaultUser',\n 'Bypass setting the container user as the same user and group id as host for Linux and MacOS',\n false,\n )\n .alias('build')\n .action(lazy(() => import('./generate/generate').then(m => m.default)));\n\n program\n .command('migrate')\n .description(\n 'Migrate objects with case-sensitive entity triplets to lower-case versions.',\n )\n .requiredOption(\n '--publisher-type <TYPE>',\n '(Required always) awsS3 | googleGcs | azureBlobStorage | openStackSwift - same as techdocs.publisher.type in Backstage app-config.yaml',\n )\n .requiredOption(\n '--storage-name <BUCKET/CONTAINER NAME>',\n '(Required always) In case of AWS/GCS, use the bucket name. In case of Azure, use container name. Same as techdocs.publisher.[TYPE].bucketName',\n )\n .option(\n '--azureAccountName <AZURE ACCOUNT NAME>',\n '(Required for Azure) specify when --publisher-type azureBlobStorage',\n )\n .option(\n '--azureAccountKey <AZURE ACCOUNT KEY>',\n 'Azure Storage Account key to use for authentication. If not specified, you must set AZURE_TENANT_ID, AZURE_CLIENT_ID & AZURE_CLIENT_SECRET as environment variables.',\n )\n .option(\n '--awsRoleArn <AWS ROLE ARN>',\n 'Optional AWS ARN of role to be assumed.',\n )\n .option(\n '--awsEndpoint <AWS ENDPOINT>',\n 'Optional AWS endpoint to send requests to.',\n )\n .option(\n '--awsS3ForcePathStyle',\n 'Optional AWS S3 option to force path style.',\n )\n .option(\n '--osCredentialId <OPENSTACK SWIFT APPLICATION CREDENTIAL ID>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osSecret <OPENSTACK SWIFT APPLICATION CREDENTIAL SECRET>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osAuthUrl <OPENSTACK SWIFT AUTHURL>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osSwiftUrl <OPENSTACK SWIFT SWIFTURL>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--removeOriginal',\n 'Optional Files are copied by default. If flag is set, files are renamed/moved instead.',\n false,\n )\n .option(\n '--concurrency <MAX CONCURRENT REQS>',\n 'Optional Controls the number of API requests allowed to be performed simultaneously.',\n '25',\n )\n .option('-v --verbose', 'Enable verbose output.', false)\n .action(lazy(() => import('./migrate/migrate').then(m => m.default)));\n\n program\n .command('publish')\n .description(\n 'Publish generated TechDocs site to an external storage AWS S3, Google GCS, etc.',\n )\n .requiredOption(\n '--publisher-type <TYPE>',\n '(Required always) awsS3 | googleGcs | azureBlobStorage | openStackSwift - same as techdocs.publisher.type in Backstage app-config.yaml',\n )\n .requiredOption(\n '--storage-name <BUCKET/CONTAINER NAME>',\n '(Required always) In case of AWS/GCS, use the bucket name. In case of Azure, use container name. Same as techdocs.publisher.[TYPE].bucketName',\n )\n .requiredOption(\n '--entity <NAMESPACE/KIND/NAME>',\n '(Required always) Entity uid separated by / in namespace/kind/name order (case-sensitive). Example: default/Component/myEntity ',\n )\n .option(\n '--legacyUseCaseSensitiveTripletPaths',\n 'Publishes objects with cased entity triplet prefix when set (e.g. namespace/Kind/name). Only use if your TechDocs backend is configured the same way.',\n false,\n )\n .option(\n '--azureAccountName <AZURE ACCOUNT NAME>',\n '(Required for Azure) specify when --publisher-type azureBlobStorage',\n )\n .option(\n '--azureAccountKey <AZURE ACCOUNT KEY>',\n 'Azure Storage Account key to use for authentication. If not specified, you must set AZURE_TENANT_ID, AZURE_CLIENT_ID & AZURE_CLIENT_SECRET as environment variables.',\n )\n .option(\n '--awsRoleArn <AWS ROLE ARN>',\n 'Optional AWS ARN of role to be assumed.',\n )\n .option(\n '--awsEndpoint <AWS ENDPOINT>',\n 'Optional AWS endpoint to send requests to.',\n )\n .option(\n '--awsProxy <HTTPS Proxy>',\n 'Optional Proxy to use for AWS requests.',\n )\n .option('--awsS3sse <AWS SSE>', 'Optional AWS S3 Server Side Encryption.')\n .option(\n '--awsS3ForcePathStyle',\n 'Optional AWS S3 option to force path style.',\n )\n .option(\n '--awsBucketRootPath <AWS BUCKET ROOT PATH>',\n 'Optional sub-directory to store files in Amazon S3',\n )\n .option(\n '--osCredentialId <OPENSTACK SWIFT APPLICATION CREDENTIAL ID>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osSecret <OPENSTACK SWIFT APPLICATION CREDENTIAL SECRET>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osAuthUrl <OPENSTACK SWIFT AUTHURL>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osSwiftUrl <OPENSTACK SWIFT SWIFTURL>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--gcsBucketRootPath <GCS BUCKET ROOT PATH>',\n 'Optional sub-directory to store files in Google cloud storage',\n )\n .option(\n '--directory <PATH>',\n 'Path of the directory containing generated files to publish',\n './site/',\n )\n .action(lazy(() => import('./publish/publish').then(m => m.default)));\n\n program\n .command('serve:mkdocs')\n .description('Serve a documentation project locally using MkDocs serve.')\n .option(\n '-i, --docker-image <DOCKER_IMAGE>',\n 'The mkdocs docker container to use',\n defaultDockerImage,\n )\n .option(\n '--docker-entrypoint <DOCKER_ENTRYPOINT>',\n 'Override the image entrypoint',\n )\n .option(\n '--docker-option <DOCKER_OPTION...>',\n 'Extra options to pass to the docker run command, e.g. \"--add-host=internal.host:192.168.11.12\" (can be added multiple times).',\n )\n .option(\n '--no-docker',\n 'Do not use Docker, run `mkdocs serve` in current user environment.',\n )\n .option(\n '--site-name',\n 'Name for site when using default MkDocs config',\n 'Documentation Site',\n )\n .option('-p, --port <PORT>', 'Port to serve documentation locally', '8000')\n .option('-v --verbose', 'Enable verbose output.', false)\n .action(lazy(() => import('./serve/mkdocs').then(m => m.default)));\n\n program\n .command('serve')\n .description(\n 'Serve a documentation project locally in a Backstage app-like environment',\n )\n .option(\n '-i, --docker-image <DOCKER_IMAGE>',\n 'The mkdocs docker container to use',\n defaultDockerImage,\n )\n .option(\n '--docker-entrypoint <DOCKER_ENTRYPOINT>',\n 'Override the image entrypoint',\n )\n .option(\n '--docker-option <DOCKER_OPTION...>',\n 'Extra options to pass to the docker run command, e.g. \"--add-host=internal.host:192.168.11.12\" (can be added multiple times).',\n )\n .option(\n '--no-docker',\n 'Do not use Docker, use MkDocs executable in current user environment.',\n )\n .option(\n '--site-name',\n 'Name for site when using default MkDocs config',\n 'Documentation Site',\n )\n .option('--mkdocs-port <PORT>', 'Port for MkDocs server to use', '8000')\n .option('-v --verbose', 'Enable verbose output.', false)\n .option(\n '--preview-app-bundle-path <PATH_TO_BUNDLE>',\n 'Preview documentation using another web app',\n )\n .option(\n '--preview-app-port <PORT>',\n 'Port for the preview app to be served on',\n defaultPreviewAppPort,\n )\n .option(\n '-c, --mkdocs-config-file-name <FILENAME>',\n 'Mkdocs config file name',\n )\n .option(\n '--mkdocs-parameter-clean',\n 'Pass \"--clean\" parameter to mkdocs server running in containerized environment',\n false,\n )\n .option(\n '--mkdocs-parameter-dirtyreload',\n 'Pass \"--dirtyreload\" parameter to mkdocs server running in containerized environment',\n false,\n )\n .option(\n '--mkdocs-parameter-strict',\n 'Pass \"--strict\" parameter to mkdocs server running in containerized environment',\n false,\n )\n .hook('preAction', command => {\n if (\n command.opts().previewAppPort !== defaultPreviewAppPort &&\n !command.opts().previewAppBundlePath\n ) {\n command.error(\n '--preview-app-port can only be used together with --preview-app-bundle-path',\n );\n }\n })\n .action(lazy(() => import('./serve/serve').then(m => m.default)));\n}\n\n// Wraps an action function so that it always exits and handles errors\n// Humbly taken from backstage-cli's registerCommands\nfunction lazy(\n getActionFunc: () => Promise<(...args: any[]) => Promise<void>>,\n): (...args: any[]) => Promise<never> {\n return async (...args: any[]) => {\n try {\n const actionFunc = await getActionFunc();\n await actionFunc(...args);\n process.exit(0);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(error.message);\n process.exit(1);\n }\n };\n}\n"],"names":["TechdocsGenerator"],"mappings":";;;;AAmBA,MAAM,qBAAqBA,oCAAkB,CAAA,kBAAA,CAAA;AAC7C,MAAM,qBAAwB,GAAA,MAAA,CAAA;AAEvB,SAAS,iBAAiB,OAAkB,EAAA;AACjD,EAAA,OAAA,CACG,OAAQ,CAAA,UAAU,CAClB,CAAA,WAAA,CAAY,oDAAoD,CAChE,CAAA,MAAA;AAAA,IACC,qBAAA;AAAA,IACA,6DAAA;AAAA,IACA,GAAA;AAAA,GAED,CAAA,MAAA;AAAA,IACC,qBAAA;AAAA,IACA,sDAAA;AAAA,IACA,SAAA;AAAA,GAED,CAAA,MAAA;AAAA,IACC,+BAAA;AAAA,IACA,oCAAA;AAAA,IACA,kBAAA;AAAA,GAED,CAAA,MAAA,CAAO,WAAa,EAAA,qCAAqC,CACzD,CAAA,MAAA;AAAA,I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AAA;AAAA,KACF;AAAA,GACD,CAAA,CACA,MAAO,CAAA,IAAA,CAAK,MAAM,oDAAO,sBAAe,KAAA,CAAE,IAAK,CAAA,CAAA,CAAA,KAAK,CAAE,CAAA,OAAO,CAAC,CAAC,CAAA,CAAA;AACpE,CAAA;AAIA,SAAS,KACP,aACoC,EAAA;AACpC,EAAA,OAAO,UAAU,IAAgB,KAAA;AAC/B,IAAI,IAAA;AACF,MAAM,MAAA,UAAA,GAAa,MAAM,aAAc,EAAA,CAAA;AACvC,MAAM,MAAA,UAAA,CAAW,GAAG,IAAI,CAAA,CAAA;AACxB,MAAA,OAAA,CAAQ,KAAK,CAAC,CAAA,CAAA;AAAA,aACP,KAAO,EAAA;AAEd,MAAQ,OAAA,CAAA,KAAA,CAAM,MAAM,OAAO,CAAA,CAAA;AAC3B,MAAA,OAAA,CAAQ,KAAK,CAAC,CAAA,CAAA;AAAA,KAChB;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var discovery = require('@backstage/backend-defaults/discovery');
|
|
4
6
|
var pluginTechdocsNode = require('@backstage/plugin-techdocs-node');
|
|
5
|
-
var utility = require('
|
|
6
|
-
var PublisherConfig = require('
|
|
7
|
-
require('winston');
|
|
8
|
-
require('stream');
|
|
9
|
-
require('process');
|
|
10
|
-
require('@backstage/config');
|
|
7
|
+
var utility = require('../../lib/utility.cjs.js');
|
|
8
|
+
var PublisherConfig = require('../../lib/PublisherConfig.cjs.js');
|
|
11
9
|
|
|
12
10
|
async function migrate(opts) {
|
|
13
11
|
const logger = utility.createLogger({ verbose: opts.verbose });
|
|
@@ -35,4 +33,4 @@ async function migrate(opts) {
|
|
|
35
33
|
}
|
|
36
34
|
|
|
37
35
|
exports.default = migrate;
|
|
38
|
-
//# sourceMappingURL=migrate
|
|
36
|
+
//# sourceMappingURL=migrate.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.cjs.js","sources":["../../../src/commands/migrate/migrate.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { HostDiscovery } from '@backstage/backend-defaults/discovery';\nimport { Publisher } from '@backstage/plugin-techdocs-node';\nimport { OptionValues } from 'commander';\nimport { createLogger } from '../../lib/utility';\nimport { PublisherConfig } from '../../lib/PublisherConfig';\n\nexport default async function migrate(opts: OptionValues) {\n const logger = createLogger({ verbose: opts.verbose });\n\n const config = PublisherConfig.getValidConfig(opts);\n const discovery = HostDiscovery.fromConfig(config);\n const publisher = await Publisher.fromConfig(config, { logger, discovery });\n\n if (!publisher.migrateDocsCase) {\n throw new Error(`Migration not implemented for ${opts.publisherType}`);\n }\n\n // Check that the publisher's underlying storage is ready and available.\n const { isAvailable } = await publisher.getReadiness();\n if (!isAvailable) {\n // Error messages printed in getReadiness() call. This ensures exit code 1.\n throw new Error('');\n }\n\n // Validate and parse migration arguments.\n const removeOriginal = opts.removeOriginal;\n const numericConcurrency = parseInt(opts.concurrency, 10);\n\n if (!Number.isInteger(numericConcurrency) || numericConcurrency <= 0) {\n throw new Error(\n `Concurrency must be a number greater than 1. ${opts.concurrency} provided.`,\n );\n }\n\n await publisher.migrateDocsCase({\n concurrency: numericConcurrency,\n removeOriginal,\n });\n}\n"],"names":["createLogger","PublisherConfig","discovery","HostDiscovery","Publisher"],"mappings":";;;;;;;;;AAsBA,eAA8B,QAAQ,IAAoB,EAAA;AACxD,EAAA,MA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
+
|
|
3
5
|
var path = require('path');
|
|
4
|
-
var utility = require('
|
|
6
|
+
var utility = require('../../lib/utility.cjs.js');
|
|
5
7
|
var discovery = require('@backstage/backend-defaults/discovery');
|
|
6
8
|
var pluginTechdocsNode = require('@backstage/plugin-techdocs-node');
|
|
7
|
-
var PublisherConfig = require('
|
|
8
|
-
require('winston');
|
|
9
|
-
require('stream');
|
|
10
|
-
require('process');
|
|
11
|
-
require('@backstage/config');
|
|
9
|
+
var PublisherConfig = require('../../lib/PublisherConfig.cjs.js');
|
|
12
10
|
|
|
13
11
|
async function publish(opts) {
|
|
14
12
|
const logger = utility.createLogger({ verbose: opts.verbose });
|
|
@@ -33,4 +31,4 @@ async function publish(opts) {
|
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
exports.default = publish;
|
|
36
|
-
//# sourceMappingURL=publish
|
|
34
|
+
//# sourceMappingURL=publish.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.cjs.js","sources":["../../../src/commands/publish/publish.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { resolve } from 'path';\nimport { OptionValues } from 'commander';\nimport { createLogger } from '../../lib/utility';\nimport { HostDiscovery } from '@backstage/backend-defaults/discovery';\nimport { Publisher } from '@backstage/plugin-techdocs-node';\nimport { Entity } from '@backstage/catalog-model';\nimport { PublisherConfig } from '../../lib/PublisherConfig';\n\nexport default async function publish(opts: OptionValues): Promise<any> {\n const logger = createLogger({ verbose: opts.verbose });\n\n const config = PublisherConfig.getValidConfig(opts);\n const discovery = HostDiscovery.fromConfig(config);\n const publisher = await Publisher.fromConfig(config, { logger, discovery });\n\n // Check that the publisher's underlying storage is ready and available.\n const { isAvailable } = await publisher.getReadiness();\n if (!isAvailable) {\n // Error messages printed in getReadiness() call. This ensures exit code 1.\n return Promise.reject(new Error(''));\n }\n\n const [namespace, kind, name] = opts.entity.split('/');\n const entity = {\n kind,\n metadata: {\n namespace,\n name,\n },\n } as Entity;\n\n const directory = resolve(opts.directory);\n await publisher.publish({ entity, directory });\n\n return true;\n}\n"],"names":["createLogger","PublisherConfig","discovery","HostDiscovery","Publisher","resolve"],"mappings":";;;;;;;;;;AAwBA,eAA8B,QAAQ,IAAkC,EAAA;AACtE,EAAA,MAAM,SAASA,oBAAa,CAAA,EAAE,OAAS,EAAA,IAAA,CAAK,SAAS,CAAA,CAAA;AAErD,EAAM,MAAA,MAAA,GAASC,+BAAgB,CAAA,cAAA,CAAe,IAAI,CAAA,CAAA;AAClD,EAAM,MAAAC,WAAA,GAAYC,uBAAc,CAAA,UAAA,CAAW,MAAM,CAAA,CAAA;AACjD,EAAM,MAAA,SAAA,GAAY,MAAMC,4BAAU,CAAA,UAAA,CAAW,QAAQ,EAAE,MAAA,aAAQF,aAAW,CAAA,CAAA;AAG1E,EAAA,MAAM,EAAE,WAAA,EAAgB,GAAA,MAAM,UAAU,YAAa,EAAA,CAAA;AACrD,EAAA,IAAI,CAAC,WAAa,EAAA;AAEhB,IAAA,OAAO,OAAQ,CAAA,MAAA,CAAO,IAAI,KAAA,CAAM,EAAE,CAAC,CAAA,CAAA;AAAA,GACrC;AAEA,EAAM,MAAA,CAAC,WAAW,IAAM,EAAA,IAAI,IAAI,IAAK,CAAA,MAAA,CAAO,MAAM,GAAG,CAAA,CAAA;AACrD,EAAA,MAAM,MAAS,GAAA;AAAA,IACb,IAAA;AAAA,IACA,QAAU,EAAA;AAAA,MACR,SAAA;AAAA,MACA,IAAA;AAAA,KACF;AAAA,GACF,CAAA;AAEA,EAAM,MAAA,SAAA,GAAYG,YAAQ,CAAA,IAAA,CAAK,SAAS,CAAA,CAAA;AACxC,EAAA,MAAM,SAAU,CAAA,OAAA,CAAQ,EAAE,MAAA,EAAQ,WAAW,CAAA,CAAA;AAE7C,EAAO,OAAA,IAAA,CAAA;AACT;;;;"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var openBrowser = require('react-dev-utils/openBrowser');
|
|
4
|
-
var utility = require('
|
|
5
|
-
var
|
|
6
|
+
var utility = require('../../lib/utility.cjs.js');
|
|
7
|
+
var mkdocsServer = require('../../lib/mkdocsServer.cjs.js');
|
|
8
|
+
var run = require('../../lib/run.cjs.js');
|
|
6
9
|
var pluginTechdocsNode = require('@backstage/plugin-techdocs-node');
|
|
7
10
|
var fs = require('fs-extra');
|
|
8
|
-
require('
|
|
9
|
-
require('stream');
|
|
10
|
-
require('process');
|
|
11
|
-
require('child_process');
|
|
12
|
-
require('util');
|
|
11
|
+
var utils = require('./utils.cjs.js');
|
|
13
12
|
|
|
14
13
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
15
14
|
|
|
@@ -49,7 +48,7 @@ Starting mkdocs server on ${localAddr}
|
|
|
49
48
|
}
|
|
50
49
|
});
|
|
51
50
|
};
|
|
52
|
-
const childProcess = await
|
|
51
|
+
const childProcess = await mkdocsServer.runMkdocsServer({
|
|
53
52
|
port: opts.port,
|
|
54
53
|
dockerImage: opts.dockerImage,
|
|
55
54
|
dockerEntrypoint: opts.dockerEntrypoint,
|
|
@@ -58,7 +57,7 @@ Starting mkdocs server on ${localAddr}
|
|
|
58
57
|
stdoutLogFunc: logFunc,
|
|
59
58
|
stderrLogFunc: logFunc
|
|
60
59
|
});
|
|
61
|
-
await
|
|
60
|
+
await run.waitForSignal([childProcess]);
|
|
62
61
|
if (configIsTemporary) {
|
|
63
62
|
process.on("exit", async () => {
|
|
64
63
|
fs__default.default.rmSync(mkdocsYmlPath, {});
|
|
@@ -67,4 +66,4 @@ Starting mkdocs server on ${localAddr}
|
|
|
67
66
|
}
|
|
68
67
|
|
|
69
68
|
exports.default = serveMkdocs;
|
|
70
|
-
//# sourceMappingURL=mkdocs
|
|
69
|
+
//# sourceMappingURL=mkdocs.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mkdocs.cjs.js","sources":["../../../src/commands/serve/mkdocs.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { OptionValues } from 'commander';\nimport openBrowser from 'react-dev-utils/openBrowser';\nimport { createLogger } from '../../lib/utility';\nimport { runMkdocsServer } from '../../lib/mkdocsServer';\nimport { LogFunc, waitForSignal } from '../../lib/run';\nimport { getMkdocsYml } from '@backstage/plugin-techdocs-node';\nimport fs from 'fs-extra';\nimport { checkIfDockerIsOperational } from './utils';\n\nexport default async function serveMkdocs(opts: OptionValues) {\n const logger = createLogger({ verbose: opts.verbose });\n\n const dockerAddr = `http://0.0.0.0:${opts.port}`;\n const localAddr = `http://127.0.0.1:${opts.port}`;\n const expectedDevAddr = opts.docker ? dockerAddr : localAddr;\n\n if (opts.docker) {\n const isDockerOperational = await checkIfDockerIsOperational(logger);\n if (!isDockerOperational) {\n return;\n }\n }\n\n const { path: mkdocsYmlPath, configIsTemporary } = await getMkdocsYml(\n './',\n opts.siteName,\n );\n\n // We want to open browser only once based on a log.\n let boolOpenBrowserTriggered = false;\n\n const logFunc: LogFunc = data => {\n // Sometimes the lines contain an unnecessary extra new line in between\n const logLines = data.toString().split('\\n');\n const logPrefix = opts.docker ? '[docker/mkdocs]' : '[mkdocs]';\n logLines.forEach(line => {\n if (line === '') {\n return;\n }\n\n // Logs from container is verbose.\n logger.verbose(`${logPrefix} ${line}`);\n\n // When the server has started, open a new browser tab for the user.\n if (\n !boolOpenBrowserTriggered &&\n line.includes(`Serving on ${expectedDevAddr}`)\n ) {\n // Always open the local address, since 0.0.0.0 belongs to docker\n logger.info(`\\nStarting mkdocs server on ${localAddr}\\n`);\n openBrowser(localAddr);\n boolOpenBrowserTriggered = true;\n }\n });\n };\n // mkdocs writes all of its logs to stderr by default, and not stdout.\n // https://github.com/mkdocs/mkdocs/issues/879#issuecomment-203536006\n // Had me questioning this whole implementation for half an hour.\n\n // Commander stores --no-docker in cmd.docker variable\n const childProcess = await runMkdocsServer({\n port: opts.port,\n dockerImage: opts.dockerImage,\n dockerEntrypoint: opts.dockerEntrypoint,\n dockerOptions: opts.dockerOption,\n useDocker: opts.docker,\n stdoutLogFunc: logFunc,\n stderrLogFunc: logFunc,\n });\n\n // Keep waiting for user to cancel the process\n await waitForSignal([childProcess]);\n\n if (configIsTemporary) {\n process.on('exit', async () => {\n fs.rmSync(mkdocsYmlPath, {});\n });\n }\n}\n"],"names":["createLogger","checkIfDockerIsOperational","getMkdocsYml","openBrowser","runMkdocsServer","waitForSignal","fs"],"mappings":";;;;;;;;;;;;;;;;;AAyBA,eAA8B,YAAY,IAAoB,EAAA;AAC5D,EAAA,MAAM,SAASA,oBAAa,CAAA,EAAE,OAAS,EAAA,IAAA,CAAK,SAAS,CAAA,CAAA;AAErD,EAAM,MAAA,UAAA,GAAa,CAAkB,eAAA,EAAA,IAAA,CAAK,IAAI,CAAA,CAAA,CAAA;AAC9C,EAAM,MAAA,SAAA,GAAY,CAAoB,iBAAA,EAAA,IAAA,CAAK,IAAI,CAAA,CAAA,CAAA;AAC/C,EAAM,MAAA,eAAA,GAAkB,IAAK,CAAA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ACzC,MAAM,IAAK,CAAA,IAAA;AAAA,IACX,aAAa,IAAK,CAAA,WAAA;AAAA,IAClB,kBAAkB,IAAK,CAAA,gBAAA;AAAA,IACvB,eAAe,IAAK,CAAA,YAAA;AAAA,IACpB,WAAW,IAAK,CAAA,MAAA;AAAA,IAChB,aAAe,EAAA,OAAA;AAAA,IACf,aAAe,EAAA,OAAA;AAAA,GAChB,CAAA,CAAA;AAGD,EAAM,MAAAC,iBAAA,CAAc,CAAC,YAAY,CAAC,CAAA,CAAA;AAElC,EAAA,IAAI,iBAAmB,EAAA;AACrB,IAAQ,OAAA,CAAA,EAAA,CAAG,QAAQ,YAAY;AAC7B,MAAGC,mBAAA,CAAA,MAAA,CAAO,aAAe,EAAA,EAAE,CAAA,CAAA;AAAA,KAC5B,CAAA,CAAA;AAAA,GACH;AACF;;;;"}
|
|
@@ -1,106 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var path = require('path');
|
|
4
6
|
var openBrowser = require('react-dev-utils/openBrowser');
|
|
5
7
|
var cliCommon = require('@backstage/cli-common');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var utility = require('
|
|
10
|
-
var utils = require('./utils-FcpnJ4zG.cjs.js');
|
|
8
|
+
var httpServer = require('../../lib/httpServer.cjs.js');
|
|
9
|
+
var mkdocsServer = require('../../lib/mkdocsServer.cjs.js');
|
|
10
|
+
var run = require('../../lib/run.cjs.js');
|
|
11
|
+
var utility = require('../../lib/utility.cjs.js');
|
|
11
12
|
var pluginTechdocsNode = require('@backstage/plugin-techdocs-node');
|
|
12
13
|
var fs = require('fs-extra');
|
|
13
|
-
require('
|
|
14
|
-
require('stream');
|
|
15
|
-
require('process');
|
|
16
|
-
require('child_process');
|
|
17
|
-
require('util');
|
|
14
|
+
var utils = require('./utils.cjs.js');
|
|
18
15
|
|
|
19
16
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
20
17
|
|
|
21
18
|
var path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
22
19
|
var openBrowser__default = /*#__PURE__*/_interopDefaultCompat(openBrowser);
|
|
23
|
-
var serveHandler__default = /*#__PURE__*/_interopDefaultCompat(serveHandler);
|
|
24
|
-
var http__default = /*#__PURE__*/_interopDefaultCompat(http);
|
|
25
|
-
var httpProxy__default = /*#__PURE__*/_interopDefaultCompat(httpProxy);
|
|
26
20
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
27
21
|
|
|
28
|
-
class HTTPServer {
|
|
29
|
-
proxyEndpoint;
|
|
30
|
-
backstageBundleDir;
|
|
31
|
-
backstagePort;
|
|
32
|
-
mkdocsTargetAddress;
|
|
33
|
-
verbose;
|
|
34
|
-
constructor(backstageBundleDir, backstagePort, mkdocsTargetAddress, verbose) {
|
|
35
|
-
this.proxyEndpoint = "/api/techdocs/";
|
|
36
|
-
this.backstageBundleDir = backstageBundleDir;
|
|
37
|
-
this.backstagePort = backstagePort;
|
|
38
|
-
this.mkdocsTargetAddress = mkdocsTargetAddress;
|
|
39
|
-
this.verbose = verbose;
|
|
40
|
-
}
|
|
41
|
-
// Create a Proxy for mkdocs server
|
|
42
|
-
createProxy() {
|
|
43
|
-
const proxy = httpProxy__default.default.createProxyServer({
|
|
44
|
-
target: this.mkdocsTargetAddress
|
|
45
|
-
});
|
|
46
|
-
return (request) => {
|
|
47
|
-
const proxyEndpointPath = new RegExp(`^${this.proxyEndpoint}`, "i");
|
|
48
|
-
const forwardPath = request.url?.replace(proxyEndpointPath, "") || "";
|
|
49
|
-
return [proxy, forwardPath];
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
async serve() {
|
|
53
|
-
return new Promise((resolve, reject) => {
|
|
54
|
-
const proxyHandler = this.createProxy();
|
|
55
|
-
const server = http__default.default.createServer(
|
|
56
|
-
(request, response) => {
|
|
57
|
-
if (request.url === "/api/techdocs/.backstage/auth/v1/cookie") {
|
|
58
|
-
const oneHourInMilliseconds = 60 * 60 * 1e3;
|
|
59
|
-
const expiresAt = new Date(Date.now() + oneHourInMilliseconds);
|
|
60
|
-
const cookie = { expiresAt: expiresAt.toISOString() };
|
|
61
|
-
response.setHeader("Content-Type", "application/json");
|
|
62
|
-
response.end(JSON.stringify(cookie));
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
if (request.url?.startsWith(this.proxyEndpoint)) {
|
|
66
|
-
const [proxy, forwardPath] = proxyHandler(request);
|
|
67
|
-
proxy.on("error", (error) => {
|
|
68
|
-
reject(error);
|
|
69
|
-
});
|
|
70
|
-
response.setHeader("Access-Control-Allow-Origin", "*");
|
|
71
|
-
response.setHeader("Access-Control-Allow-Methods", "GET, OPTIONS");
|
|
72
|
-
request.url = forwardPath;
|
|
73
|
-
proxy.web(request, response);
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
if (request.url === "/.detect") {
|
|
77
|
-
response.setHeader("Content-Type", "text/plain");
|
|
78
|
-
response.end("techdocs-cli-server");
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
serveHandler__default.default(request, response, {
|
|
82
|
-
public: this.backstageBundleDir,
|
|
83
|
-
trailingSlash: true,
|
|
84
|
-
rewrites: [{ source: "**", destination: "index.html" }]
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
);
|
|
88
|
-
const logger = utility.createLogger({ verbose: false });
|
|
89
|
-
server.listen(this.backstagePort, () => {
|
|
90
|
-
if (this.verbose) {
|
|
91
|
-
logger.info(
|
|
92
|
-
`[techdocs-preview-bundle] Running local version of Backstage at http://localhost:${this.backstagePort}`
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
resolve(server);
|
|
96
|
-
});
|
|
97
|
-
server.on("error", (error) => {
|
|
98
|
-
reject(error);
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
22
|
function findPreviewBundlePath() {
|
|
105
23
|
try {
|
|
106
24
|
return path__default.default.join(
|
|
@@ -148,7 +66,7 @@ async function serve(opts) {
|
|
|
148
66
|
});
|
|
149
67
|
};
|
|
150
68
|
logger.info("Starting mkdocs server.");
|
|
151
|
-
const mkdocsChildProcess = await
|
|
69
|
+
const mkdocsChildProcess = await mkdocsServer.runMkdocsServer({
|
|
152
70
|
port: opts.mkdocsPort,
|
|
153
71
|
dockerImage: opts.dockerImage,
|
|
154
72
|
dockerEntrypoint: opts.dockerEntrypoint,
|
|
@@ -175,13 +93,13 @@ async function serve(opts) {
|
|
|
175
93
|
}
|
|
176
94
|
const port = isDevMode ? backstageBackendPort : opts.previewAppPort;
|
|
177
95
|
const previewAppPath = getPreviewAppPath(opts);
|
|
178
|
-
const httpServer = new
|
|
96
|
+
const httpServer$1 = new httpServer.default(
|
|
179
97
|
previewAppPath,
|
|
180
98
|
port,
|
|
181
99
|
mkdocsExpectedDevAddr,
|
|
182
100
|
opts.verbose
|
|
183
101
|
);
|
|
184
|
-
httpServer.serve().catch((err) => {
|
|
102
|
+
httpServer$1.serve().catch((err) => {
|
|
185
103
|
logger.error("Failed to start HTTP server", err);
|
|
186
104
|
mkdocsChildProcess.kill();
|
|
187
105
|
process.exit(1);
|
|
@@ -192,7 +110,7 @@ async function serve(opts) {
|
|
|
192
110
|
Opening browser.`
|
|
193
111
|
);
|
|
194
112
|
});
|
|
195
|
-
await
|
|
113
|
+
await run.waitForSignal([mkdocsChildProcess]);
|
|
196
114
|
if (configIsTemporary) {
|
|
197
115
|
process.on("exit", async () => {
|
|
198
116
|
fs__default.default.rmSync(mkdocsYmlPath, {});
|
|
@@ -201,4 +119,4 @@ Opening browser.`
|
|
|
201
119
|
}
|
|
202
120
|
|
|
203
121
|
exports.default = serve;
|
|
204
|
-
//# sourceMappingURL=serve
|
|
122
|
+
//# sourceMappingURL=serve.cjs.js.map
|