@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/dist/index.cjs.js
CHANGED
|
@@ -1,238 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var commander = require('commander');
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
const defaultDockerImage = pluginTechdocsNode.TechdocsGenerator.defaultDockerImage;
|
|
7
|
-
const defaultPreviewAppPort = "3000";
|
|
8
|
-
function registerCommands(program) {
|
|
9
|
-
program.command("generate").description("Generate TechDocs documentation site using MkDocs.").option(
|
|
10
|
-
"--source-dir <PATH>",
|
|
11
|
-
"Source directory containing mkdocs.yml and docs/ directory.",
|
|
12
|
-
"."
|
|
13
|
-
).option(
|
|
14
|
-
"--output-dir <PATH>",
|
|
15
|
-
"Output directory containing generated TechDocs site.",
|
|
16
|
-
"./site/"
|
|
17
|
-
).option(
|
|
18
|
-
"--docker-image <DOCKER_IMAGE>",
|
|
19
|
-
"The mkdocs docker container to use",
|
|
20
|
-
defaultDockerImage
|
|
21
|
-
).option("--no-pull", "Do not pull the latest docker image").option(
|
|
22
|
-
"--no-docker",
|
|
23
|
-
"Do not use Docker, use MkDocs executable and plugins in current user environment."
|
|
24
|
-
).option(
|
|
25
|
-
"--techdocs-ref <HOST_TYPE:URL>",
|
|
26
|
-
"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"
|
|
27
|
-
).option(
|
|
28
|
-
"--etag <ETAG>",
|
|
29
|
-
"A unique identifier for the prepared tree e.g. commit SHA. If provided it will be stored in techdocs_metadata.json."
|
|
30
|
-
).option(
|
|
31
|
-
"--site-name",
|
|
32
|
-
"Name for site when using default MkDocs config",
|
|
33
|
-
"Documentation Site"
|
|
34
|
-
).option("-v --verbose", "Enable verbose output.", false).option(
|
|
35
|
-
"--omitTechdocsCoreMkdocsPlugin",
|
|
36
|
-
"Don't patch MkDocs file automatically with techdocs-core plugin.",
|
|
37
|
-
false
|
|
38
|
-
).option(
|
|
39
|
-
"--legacyCopyReadmeMdToIndexMd",
|
|
40
|
-
"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.",
|
|
41
|
-
false
|
|
42
|
-
).option(
|
|
43
|
-
"--defaultPlugin [defaultPlugins...]",
|
|
44
|
-
"Plugins which should be added automatically to the mkdocs.yaml file",
|
|
45
|
-
[]
|
|
46
|
-
).option(
|
|
47
|
-
"--runAsDefaultUser",
|
|
48
|
-
"Bypass setting the container user as the same user and group id as host for Linux and MacOS",
|
|
49
|
-
false
|
|
50
|
-
).alias("build").action(lazy(() => Promise.resolve().then(function () { return require('./cjs/generate-CHbYjdPP.cjs.js'); }).then((m) => m.default)));
|
|
51
|
-
program.command("migrate").description(
|
|
52
|
-
"Migrate objects with case-sensitive entity triplets to lower-case versions."
|
|
53
|
-
).requiredOption(
|
|
54
|
-
"--publisher-type <TYPE>",
|
|
55
|
-
"(Required always) awsS3 | googleGcs | azureBlobStorage | openStackSwift - same as techdocs.publisher.type in Backstage app-config.yaml"
|
|
56
|
-
).requiredOption(
|
|
57
|
-
"--storage-name <BUCKET/CONTAINER NAME>",
|
|
58
|
-
"(Required always) In case of AWS/GCS, use the bucket name. In case of Azure, use container name. Same as techdocs.publisher.[TYPE].bucketName"
|
|
59
|
-
).option(
|
|
60
|
-
"--azureAccountName <AZURE ACCOUNT NAME>",
|
|
61
|
-
"(Required for Azure) specify when --publisher-type azureBlobStorage"
|
|
62
|
-
).option(
|
|
63
|
-
"--azureAccountKey <AZURE ACCOUNT KEY>",
|
|
64
|
-
"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."
|
|
65
|
-
).option(
|
|
66
|
-
"--awsRoleArn <AWS ROLE ARN>",
|
|
67
|
-
"Optional AWS ARN of role to be assumed."
|
|
68
|
-
).option(
|
|
69
|
-
"--awsEndpoint <AWS ENDPOINT>",
|
|
70
|
-
"Optional AWS endpoint to send requests to."
|
|
71
|
-
).option(
|
|
72
|
-
"--awsS3ForcePathStyle",
|
|
73
|
-
"Optional AWS S3 option to force path style."
|
|
74
|
-
).option(
|
|
75
|
-
"--osCredentialId <OPENSTACK SWIFT APPLICATION CREDENTIAL ID>",
|
|
76
|
-
"(Required for OpenStack) specify when --publisher-type openStackSwift"
|
|
77
|
-
).option(
|
|
78
|
-
"--osSecret <OPENSTACK SWIFT APPLICATION CREDENTIAL SECRET>",
|
|
79
|
-
"(Required for OpenStack) specify when --publisher-type openStackSwift"
|
|
80
|
-
).option(
|
|
81
|
-
"--osAuthUrl <OPENSTACK SWIFT AUTHURL>",
|
|
82
|
-
"(Required for OpenStack) specify when --publisher-type openStackSwift"
|
|
83
|
-
).option(
|
|
84
|
-
"--osSwiftUrl <OPENSTACK SWIFT SWIFTURL>",
|
|
85
|
-
"(Required for OpenStack) specify when --publisher-type openStackSwift"
|
|
86
|
-
).option(
|
|
87
|
-
"--removeOriginal",
|
|
88
|
-
"Optional Files are copied by default. If flag is set, files are renamed/moved instead.",
|
|
89
|
-
false
|
|
90
|
-
).option(
|
|
91
|
-
"--concurrency <MAX CONCURRENT REQS>",
|
|
92
|
-
"Optional Controls the number of API requests allowed to be performed simultaneously.",
|
|
93
|
-
"25"
|
|
94
|
-
).option("-v --verbose", "Enable verbose output.", false).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/migrate-Ddd_MQkE.cjs.js'); }).then((m) => m.default)));
|
|
95
|
-
program.command("publish").description(
|
|
96
|
-
"Publish generated TechDocs site to an external storage AWS S3, Google GCS, etc."
|
|
97
|
-
).requiredOption(
|
|
98
|
-
"--publisher-type <TYPE>",
|
|
99
|
-
"(Required always) awsS3 | googleGcs | azureBlobStorage | openStackSwift - same as techdocs.publisher.type in Backstage app-config.yaml"
|
|
100
|
-
).requiredOption(
|
|
101
|
-
"--storage-name <BUCKET/CONTAINER NAME>",
|
|
102
|
-
"(Required always) In case of AWS/GCS, use the bucket name. In case of Azure, use container name. Same as techdocs.publisher.[TYPE].bucketName"
|
|
103
|
-
).requiredOption(
|
|
104
|
-
"--entity <NAMESPACE/KIND/NAME>",
|
|
105
|
-
"(Required always) Entity uid separated by / in namespace/kind/name order (case-sensitive). Example: default/Component/myEntity "
|
|
106
|
-
).option(
|
|
107
|
-
"--legacyUseCaseSensitiveTripletPaths",
|
|
108
|
-
"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.",
|
|
109
|
-
false
|
|
110
|
-
).option(
|
|
111
|
-
"--azureAccountName <AZURE ACCOUNT NAME>",
|
|
112
|
-
"(Required for Azure) specify when --publisher-type azureBlobStorage"
|
|
113
|
-
).option(
|
|
114
|
-
"--azureAccountKey <AZURE ACCOUNT KEY>",
|
|
115
|
-
"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."
|
|
116
|
-
).option(
|
|
117
|
-
"--awsRoleArn <AWS ROLE ARN>",
|
|
118
|
-
"Optional AWS ARN of role to be assumed."
|
|
119
|
-
).option(
|
|
120
|
-
"--awsEndpoint <AWS ENDPOINT>",
|
|
121
|
-
"Optional AWS endpoint to send requests to."
|
|
122
|
-
).option(
|
|
123
|
-
"--awsProxy <HTTPS Proxy>",
|
|
124
|
-
"Optional Proxy to use for AWS requests."
|
|
125
|
-
).option("--awsS3sse <AWS SSE>", "Optional AWS S3 Server Side Encryption.").option(
|
|
126
|
-
"--awsS3ForcePathStyle",
|
|
127
|
-
"Optional AWS S3 option to force path style."
|
|
128
|
-
).option(
|
|
129
|
-
"--awsBucketRootPath <AWS BUCKET ROOT PATH>",
|
|
130
|
-
"Optional sub-directory to store files in Amazon S3"
|
|
131
|
-
).option(
|
|
132
|
-
"--osCredentialId <OPENSTACK SWIFT APPLICATION CREDENTIAL ID>",
|
|
133
|
-
"(Required for OpenStack) specify when --publisher-type openStackSwift"
|
|
134
|
-
).option(
|
|
135
|
-
"--osSecret <OPENSTACK SWIFT APPLICATION CREDENTIAL SECRET>",
|
|
136
|
-
"(Required for OpenStack) specify when --publisher-type openStackSwift"
|
|
137
|
-
).option(
|
|
138
|
-
"--osAuthUrl <OPENSTACK SWIFT AUTHURL>",
|
|
139
|
-
"(Required for OpenStack) specify when --publisher-type openStackSwift"
|
|
140
|
-
).option(
|
|
141
|
-
"--osSwiftUrl <OPENSTACK SWIFT SWIFTURL>",
|
|
142
|
-
"(Required for OpenStack) specify when --publisher-type openStackSwift"
|
|
143
|
-
).option(
|
|
144
|
-
"--gcsBucketRootPath <GCS BUCKET ROOT PATH>",
|
|
145
|
-
"Optional sub-directory to store files in Google cloud storage"
|
|
146
|
-
).option(
|
|
147
|
-
"--directory <PATH>",
|
|
148
|
-
"Path of the directory containing generated files to publish",
|
|
149
|
-
"./site/"
|
|
150
|
-
).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/publish-DH7Mbt7b.cjs.js'); }).then((m) => m.default)));
|
|
151
|
-
program.command("serve:mkdocs").description("Serve a documentation project locally using MkDocs serve.").option(
|
|
152
|
-
"-i, --docker-image <DOCKER_IMAGE>",
|
|
153
|
-
"The mkdocs docker container to use",
|
|
154
|
-
defaultDockerImage
|
|
155
|
-
).option(
|
|
156
|
-
"--docker-entrypoint <DOCKER_ENTRYPOINT>",
|
|
157
|
-
"Override the image entrypoint"
|
|
158
|
-
).option(
|
|
159
|
-
"--docker-option <DOCKER_OPTION...>",
|
|
160
|
-
'Extra options to pass to the docker run command, e.g. "--add-host=internal.host:192.168.11.12" (can be added multiple times).'
|
|
161
|
-
).option(
|
|
162
|
-
"--no-docker",
|
|
163
|
-
"Do not use Docker, run `mkdocs serve` in current user environment."
|
|
164
|
-
).option(
|
|
165
|
-
"--site-name",
|
|
166
|
-
"Name for site when using default MkDocs config",
|
|
167
|
-
"Documentation Site"
|
|
168
|
-
).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('./cjs/mkdocs-HM8xNBvh.cjs.js'); }).then((m) => m.default)));
|
|
169
|
-
program.command("serve").description(
|
|
170
|
-
"Serve a documentation project locally in a Backstage app-like environment"
|
|
171
|
-
).option(
|
|
172
|
-
"-i, --docker-image <DOCKER_IMAGE>",
|
|
173
|
-
"The mkdocs docker container to use",
|
|
174
|
-
defaultDockerImage
|
|
175
|
-
).option(
|
|
176
|
-
"--docker-entrypoint <DOCKER_ENTRYPOINT>",
|
|
177
|
-
"Override the image entrypoint"
|
|
178
|
-
).option(
|
|
179
|
-
"--docker-option <DOCKER_OPTION...>",
|
|
180
|
-
'Extra options to pass to the docker run command, e.g. "--add-host=internal.host:192.168.11.12" (can be added multiple times).'
|
|
181
|
-
).option(
|
|
182
|
-
"--no-docker",
|
|
183
|
-
"Do not use Docker, use MkDocs executable in current user environment."
|
|
184
|
-
).option(
|
|
185
|
-
"--site-name",
|
|
186
|
-
"Name for site when using default MkDocs config",
|
|
187
|
-
"Documentation Site"
|
|
188
|
-
).option("--mkdocs-port <PORT>", "Port for MkDocs server to use", "8000").option("-v --verbose", "Enable verbose output.", false).option(
|
|
189
|
-
"--preview-app-bundle-path <PATH_TO_BUNDLE>",
|
|
190
|
-
"Preview documentation using another web app"
|
|
191
|
-
).option(
|
|
192
|
-
"--preview-app-port <PORT>",
|
|
193
|
-
"Port for the preview app to be served on",
|
|
194
|
-
defaultPreviewAppPort
|
|
195
|
-
).option(
|
|
196
|
-
"-c, --mkdocs-config-file-name <FILENAME>",
|
|
197
|
-
"Mkdocs config file name"
|
|
198
|
-
).option(
|
|
199
|
-
"--mkdocs-parameter-clean",
|
|
200
|
-
'Pass "--clean" parameter to mkdocs server running in containerized environment',
|
|
201
|
-
false
|
|
202
|
-
).option(
|
|
203
|
-
"--mkdocs-parameter-dirtyreload",
|
|
204
|
-
'Pass "--dirtyreload" parameter to mkdocs server running in containerized environment',
|
|
205
|
-
false
|
|
206
|
-
).option(
|
|
207
|
-
"--mkdocs-parameter-strict",
|
|
208
|
-
'Pass "--strict" parameter to mkdocs server running in containerized environment',
|
|
209
|
-
false
|
|
210
|
-
).hook("preAction", (command) => {
|
|
211
|
-
if (command.opts().previewAppPort !== defaultPreviewAppPort && !command.opts().previewAppBundlePath) {
|
|
212
|
-
command.error(
|
|
213
|
-
"--preview-app-port can only be used together with --preview-app-bundle-path"
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
}).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/serve-QoNUyZPw.cjs.js'); }).then((m) => m.default)));
|
|
217
|
-
}
|
|
218
|
-
function lazy(getActionFunc) {
|
|
219
|
-
return async (...args) => {
|
|
220
|
-
try {
|
|
221
|
-
const actionFunc = await getActionFunc();
|
|
222
|
-
await actionFunc(...args);
|
|
223
|
-
process.exit(0);
|
|
224
|
-
} catch (error) {
|
|
225
|
-
console.error(error.message);
|
|
226
|
-
process.exit(1);
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
var version = "1.8.20-next.0";
|
|
4
|
+
var index = require('./commands/index.cjs.js');
|
|
5
|
+
var _package = require('./package.json.cjs.js');
|
|
232
6
|
|
|
233
7
|
const main = (argv) => {
|
|
234
|
-
commander.program.name("techdocs-cli").version(version);
|
|
235
|
-
registerCommands(commander.program);
|
|
8
|
+
commander.program.name("techdocs-cli").version(_package.version);
|
|
9
|
+
index.registerCommands(commander.program);
|
|
236
10
|
commander.program.parse(argv);
|
|
237
11
|
};
|
|
238
12
|
main(process.argv);
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/commands/index.ts","../src/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","/*\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 { program } from 'commander';\nimport { registerCommands } from './commands';\nimport { version } from '../package.json';\n\nconst main = (argv: string[]) => {\n program.name('techdocs-cli').version(version);\n\n registerCommands(program);\n\n program.parse(argv);\n};\n\nmain(process.argv);\n"],"names":["TechdocsGenerator","program"],"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,IAC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AA,CAAQ,IAAK,EAAA,CAAE,oBAChB,EAAA;AACA,MAAQ,OAAA,CAAA,KAAA;AAAA,QACN,6EAAA;AAAA,OACF,CAAA;AAAA,KACF;AAAA,GACD,CAAA,CACA,MAAO,CAAA,IAAA,CAAK,MAAM,oDAAO,6BAAe,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;;;;AChUA,MAAM,IAAA,GAAO,CAAC,IAAmB,KAAA;AAC/B,EAAAC,iBAAA,CAAQ,IAAK,CAAA,cAAc,CAAE,CAAA,OAAA,CAAQ,OAAO,CAAA,CAAA;AAE5C,EAAA,gBAAA,CAAiBA,iBAAO,CAAA,CAAA;AAExB,EAAAA,iBAAA,CAAQ,MAAM,IAAI,CAAA,CAAA;AACpB,CAAA,CAAA;AAEA,IAAA,CAAK,QAAQ,IAAI,CAAA;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/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 { program } from 'commander';\nimport { registerCommands } from './commands';\nimport { version } from '../package.json';\n\nconst main = (argv: string[]) => {\n program.name('techdocs-cli').version(version);\n\n registerCommands(program);\n\n program.parse(argv);\n};\n\nmain(process.argv);\n"],"names":["program","version","registerCommands"],"mappings":";;;;;;AAoBA,MAAM,IAAA,GAAO,CAAC,IAAmB,KAAA;AAC/B,EAAAA,iBAAA,CAAQ,IAAK,CAAA,cAAc,CAAE,CAAA,OAAA,CAAQC,gBAAO,CAAA,CAAA;AAE5C,EAAAC,sBAAA,CAAiBF,iBAAO,CAAA,CAAA;AAExB,EAAAA,iBAAA,CAAQ,MAAM,IAAI,CAAA,CAAA;AACpB,CAAA,CAAA;AAEA,IAAA,CAAK,QAAQ,IAAI,CAAA;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PublisherConfig.cjs.js","sources":["../../src/lib/PublisherConfig.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 { ConfigReader } from '@backstage/config';\nimport { OptionValues } from 'commander';\n\ntype Publisher = keyof (typeof PublisherConfig)['configFactories'];\ntype PublisherConfiguration = {\n [p in Publisher]?: any;\n} & {\n type: Publisher;\n};\n\n/**\n * Helper when working with publisher-related configurations.\n */\nexport class PublisherConfig {\n /**\n * Maps publisher-specific config keys to config getters.\n */\n private static configFactories = {\n awsS3: PublisherConfig.getValidAwsS3Config,\n azureBlobStorage: PublisherConfig.getValidAzureConfig,\n googleGcs: PublisherConfig.getValidGoogleGcsConfig,\n openStackSwift: PublisherConfig.getValidOpenStackSwiftConfig,\n };\n\n /**\n * Returns Backstage config suitable for use when instantiating a Publisher. If\n * there are any missing or invalid options provided, an error is thrown.\n *\n * Note: This assumes that proper credentials are set in Environment\n * variables for the respective GCS/AWS clients to work.\n */\n static getValidConfig(opts: OptionValues): ConfigReader {\n const publisherType = opts.publisherType;\n\n if (!PublisherConfig.isKnownPublisher(publisherType)) {\n throw new Error(`Unknown publisher type ${opts.publisherType}`);\n }\n\n return new ConfigReader({\n // This backend config is not used at all. Just something needed a create a mock discovery instance.\n backend: {\n baseUrl: 'http://localhost:7007',\n listen: {\n port: 7007,\n },\n },\n techdocs: {\n publisher: PublisherConfig.configFactories[publisherType](opts),\n legacyUseCaseSensitiveTripletPaths:\n opts.legacyUseCaseSensitiveTripletPaths,\n },\n });\n }\n\n /**\n * Typeguard to ensure the publisher has a known config getter.\n */\n private static isKnownPublisher(\n type: string,\n ): type is keyof (typeof PublisherConfig)['configFactories'] {\n return PublisherConfig.configFactories.hasOwnProperty(type);\n }\n\n /**\n * Retrieve valid AWS S3 configuration based on the command.\n */\n private static getValidAwsS3Config(\n opts: OptionValues,\n ): PublisherConfiguration {\n return {\n type: 'awsS3',\n awsS3: {\n bucketName: opts.storageName,\n ...(opts.awsBucketRootPath && {\n bucketRootPath: opts.awsBucketRootPath,\n }),\n ...(opts.awsRoleArn && { credentials: { roleArn: opts.awsRoleArn } }),\n ...(opts.awsEndpoint && { endpoint: opts.awsEndpoint }),\n ...(opts.awsS3ForcePathStyle && { s3ForcePathStyle: true }),\n ...(opts.awsS3sse && { sse: opts.awsS3sse }),\n ...(opts.awsProxy && { httpsProxy: opts.awsProxy }),\n },\n };\n }\n\n /**\n * Retrieve valid Azure Blob Storage configuration based on the command.\n */\n private static getValidAzureConfig(\n opts: OptionValues,\n ): PublisherConfiguration {\n if (!opts.azureAccountName) {\n throw new Error(\n `azureBlobStorage requires --azureAccountName to be specified`,\n );\n }\n\n return {\n type: 'azureBlobStorage',\n azureBlobStorage: {\n containerName: opts.storageName,\n credentials: {\n accountName: opts.azureAccountName,\n accountKey: opts.azureAccountKey,\n },\n },\n };\n }\n\n /**\n * Retrieve valid GCS configuration based on the command.\n */\n private static getValidGoogleGcsConfig(\n opts: OptionValues,\n ): PublisherConfiguration {\n return {\n type: 'googleGcs',\n googleGcs: {\n bucketName: opts.storageName,\n ...(opts.gcsBucketRootPath && {\n bucketRootPath: opts.gcsBucketRootPath,\n }),\n },\n };\n }\n\n /**\n * Retrieves valid OpenStack Swift configuration based on the command.\n */\n private static getValidOpenStackSwiftConfig(\n opts: OptionValues,\n ): PublisherConfiguration {\n const missingParams = [\n 'osCredentialId',\n 'osSecret',\n 'osAuthUrl',\n 'osSwiftUrl',\n ].filter((param: string) => !opts[param]);\n\n if (missingParams.length) {\n throw new Error(\n `openStackSwift requires the following params to be specified: ${missingParams.join(\n ', ',\n )}`,\n );\n }\n\n return {\n type: 'openStackSwift',\n openStackSwift: {\n containerName: opts.storageName,\n credentials: {\n id: opts.osCredentialId,\n secret: opts.osSecret,\n },\n authUrl: opts.osAuthUrl,\n swiftUrl: opts.osSwiftUrl,\n },\n };\n }\n}\n"],"names":["ConfigReader"],"mappings":";;;;AA6BO,MAAM,eAAgB,CAAA;AAAA;AAAA;AAAA;AAAA,EAI3B,OAAe,eAAkB,GAAA;AAAA,IAC/B,OAAO,eAAgB,CAAA,mBAAA;AAAA,IACvB,kBAAkB,eAAgB,CAAA,mBAAA;AAAA,IAClC,WAAW,eAAgB,CAAA,uBAAA;AAAA,IAC3B,gBAAgB,eAAgB,CAAA,4BAAA;AAAA,GAClC,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,OAAO,eAAe,IAAkC,EAAA;AACtD,IAAA,MAAM,gBAAgB,IAAK,CAAA,aAAA,CAAA;AAE3B,IAAA,IAAI,CAAC,e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OACH,CAAA;AAAA,KACF;AAEA,IAAO,OAAA;AAAA,MACL,IAAM,EAAA,gBAAA;AAAA,MACN,cAAgB,EAAA;AAAA,QACd,eAAe,IAAK,CAAA,WAAA;AAAA,QACpB,WAAa,EAAA;AAAA,UACX,IAAI,IAAK,CAAA,cAAA;AAAA,UACT,QAAQ,IAAK,CAAA,QAAA;AAAA,SACf;AAAA,QACA,SAAS,IAAK,CAAA,SAAA;AAAA,QACd,UAAU,IAAK,CAAA,UAAA;AAAA,OACjB;AAAA,KACF,CAAA;AAAA,GACF;AACF;;;;"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var serveHandler = require('serve-handler');
|
|
6
|
+
var http = require('http');
|
|
7
|
+
var httpProxy = require('http-proxy');
|
|
8
|
+
var utility = require('./utility.cjs.js');
|
|
9
|
+
|
|
10
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
11
|
+
|
|
12
|
+
var serveHandler__default = /*#__PURE__*/_interopDefaultCompat(serveHandler);
|
|
13
|
+
var http__default = /*#__PURE__*/_interopDefaultCompat(http);
|
|
14
|
+
var httpProxy__default = /*#__PURE__*/_interopDefaultCompat(httpProxy);
|
|
15
|
+
|
|
16
|
+
class HTTPServer {
|
|
17
|
+
proxyEndpoint;
|
|
18
|
+
backstageBundleDir;
|
|
19
|
+
backstagePort;
|
|
20
|
+
mkdocsTargetAddress;
|
|
21
|
+
verbose;
|
|
22
|
+
constructor(backstageBundleDir, backstagePort, mkdocsTargetAddress, verbose) {
|
|
23
|
+
this.proxyEndpoint = "/api/techdocs/";
|
|
24
|
+
this.backstageBundleDir = backstageBundleDir;
|
|
25
|
+
this.backstagePort = backstagePort;
|
|
26
|
+
this.mkdocsTargetAddress = mkdocsTargetAddress;
|
|
27
|
+
this.verbose = verbose;
|
|
28
|
+
}
|
|
29
|
+
// Create a Proxy for mkdocs server
|
|
30
|
+
createProxy() {
|
|
31
|
+
const proxy = httpProxy__default.default.createProxyServer({
|
|
32
|
+
target: this.mkdocsTargetAddress
|
|
33
|
+
});
|
|
34
|
+
return (request) => {
|
|
35
|
+
const proxyEndpointPath = new RegExp(`^${this.proxyEndpoint}`, "i");
|
|
36
|
+
const forwardPath = request.url?.replace(proxyEndpointPath, "") || "";
|
|
37
|
+
return [proxy, forwardPath];
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
async serve() {
|
|
41
|
+
return new Promise((resolve, reject) => {
|
|
42
|
+
const proxyHandler = this.createProxy();
|
|
43
|
+
const server = http__default.default.createServer(
|
|
44
|
+
(request, response) => {
|
|
45
|
+
if (request.url === "/api/techdocs/.backstage/auth/v1/cookie") {
|
|
46
|
+
const oneHourInMilliseconds = 60 * 60 * 1e3;
|
|
47
|
+
const expiresAt = new Date(Date.now() + oneHourInMilliseconds);
|
|
48
|
+
const cookie = { expiresAt: expiresAt.toISOString() };
|
|
49
|
+
response.setHeader("Content-Type", "application/json");
|
|
50
|
+
response.end(JSON.stringify(cookie));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (request.url?.startsWith(this.proxyEndpoint)) {
|
|
54
|
+
const [proxy, forwardPath] = proxyHandler(request);
|
|
55
|
+
proxy.on("error", (error) => {
|
|
56
|
+
reject(error);
|
|
57
|
+
});
|
|
58
|
+
response.setHeader("Access-Control-Allow-Origin", "*");
|
|
59
|
+
response.setHeader("Access-Control-Allow-Methods", "GET, OPTIONS");
|
|
60
|
+
request.url = forwardPath;
|
|
61
|
+
proxy.web(request, response);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (request.url === "/.detect") {
|
|
65
|
+
response.setHeader("Content-Type", "text/plain");
|
|
66
|
+
response.end("techdocs-cli-server");
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
serveHandler__default.default(request, response, {
|
|
70
|
+
public: this.backstageBundleDir,
|
|
71
|
+
trailingSlash: true,
|
|
72
|
+
rewrites: [{ source: "**", destination: "index.html" }]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
const logger = utility.createLogger({ verbose: false });
|
|
77
|
+
server.listen(this.backstagePort, () => {
|
|
78
|
+
if (this.verbose) {
|
|
79
|
+
logger.info(
|
|
80
|
+
`[techdocs-preview-bundle] Running local version of Backstage at http://localhost:${this.backstagePort}`
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
resolve(server);
|
|
84
|
+
});
|
|
85
|
+
server.on("error", (error) => {
|
|
86
|
+
reject(error);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
exports.default = HTTPServer;
|
|
93
|
+
//# sourceMappingURL=httpServer.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpServer.cjs.js","sources":["../../src/lib/httpServer.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 serveHandler from 'serve-handler';\nimport http from 'http';\nimport httpProxy from 'http-proxy';\nimport { createLogger } from './utility';\n\nexport default class HTTPServer {\n private readonly proxyEndpoint: string;\n private readonly backstageBundleDir: string;\n private readonly backstagePort: number;\n private readonly mkdocsTargetAddress: string;\n private readonly verbose: boolean;\n\n constructor(\n backstageBundleDir: string,\n backstagePort: number,\n mkdocsTargetAddress: string,\n verbose: boolean,\n ) {\n this.proxyEndpoint = '/api/techdocs/';\n this.backstageBundleDir = backstageBundleDir;\n this.backstagePort = backstagePort;\n this.mkdocsTargetAddress = mkdocsTargetAddress;\n this.verbose = verbose;\n }\n\n // Create a Proxy for mkdocs server\n private createProxy() {\n const proxy = httpProxy.createProxyServer({\n target: this.mkdocsTargetAddress,\n });\n\n return (request: http.IncomingMessage): [httpProxy, string] => {\n // If the request path is prefixed with this.proxyEndpoint, remove it.\n const proxyEndpointPath = new RegExp(`^${this.proxyEndpoint}`, 'i');\n const forwardPath = request.url?.replace(proxyEndpointPath, '') || '';\n\n return [proxy, forwardPath];\n };\n }\n\n public async serve(): Promise<http.Server> {\n return new Promise<http.Server>((resolve, reject) => {\n const proxyHandler = this.createProxy();\n const server = http.createServer(\n (request: http.IncomingMessage, response: http.ServerResponse) => {\n // This endpoind is used by the frontend to issue a cookie for the user.\n // But the MkDocs server doesn't expose it as a the Backestage backend does.\n // So we need to fake it here to prevent 404 errors.\n if (request.url === '/api/techdocs/.backstage/auth/v1/cookie') {\n const oneHourInMilliseconds = 60 * 60 * 1000;\n const expiresAt = new Date(Date.now() + oneHourInMilliseconds);\n const cookie = { expiresAt: expiresAt.toISOString() };\n response.setHeader('Content-Type', 'application/json');\n response.end(JSON.stringify(cookie));\n return;\n }\n\n if (request.url?.startsWith(this.proxyEndpoint)) {\n const [proxy, forwardPath] = proxyHandler(request);\n\n proxy.on('error', (error: Error) => {\n reject(error);\n });\n\n response.setHeader('Access-Control-Allow-Origin', '*');\n response.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');\n\n request.url = forwardPath;\n proxy.web(request, response);\n return;\n }\n\n // This endpoint is used by the frontend to detect where the backend is running.\n if (request.url === '/.detect') {\n response.setHeader('Content-Type', 'text/plain');\n response.end('techdocs-cli-server');\n return;\n }\n\n serveHandler(request, response, {\n public: this.backstageBundleDir,\n trailingSlash: true,\n rewrites: [{ source: '**', destination: 'index.html' }],\n });\n },\n );\n\n const logger = createLogger({ verbose: false });\n server.listen(this.backstagePort, () => {\n if (this.verbose) {\n logger.info(\n `[techdocs-preview-bundle] Running local version of Backstage at http://localhost:${this.backstagePort}`,\n );\n }\n resolve(server);\n });\n\n server.on('error', (error: Error) => {\n reject(error);\n });\n });\n }\n}\n"],"names":["httpProxy","http","serveHandler","createLogger"],"mappings":";;;;;;;;;;;;;;;AAqBA,MAAqB,UAAW,CAAA;AAAA,EACb,aAAA,CAAA;AAAA,EACA,kBAAA,CAAA;AAAA,EACA,aAAA,CAAA;AAAA,EACA,mBAAA,CAAA;AAAA,EACA,OAAA,CAAA;AAAA,EAEjB,WACE,CAAA,kBAAA,EACA,aACA,EAAA,mBAAA,EACA,OACA,EAAA;AACA,IAAA,IAAA,CAAK,aAAgB,GAAA,gBAAA,CAAA;AACrB,IAAA,IAAA,CAAK,kBAAqB,GAAA,kBAAA,CAAA;AAC1B,IAAA,IAAA,CAAK,aAAgB,GAAA,aAAA,CAAA;AACrB,IAAA,IAAA,CAAK,mBAAsB,GAAA,mBAAA,CAAA;AAC3B,IAAA,IAAA,CAAK,OAAU,GAAA,OAAA,CAAA;AAAA,GACjB;AAAA;AAAA,EAGQ,WAAc,GAAA;AACpB,IAAM,MAAA,KAAA,GAAQA,2BAAU,iBAAkB,CAAA;AAAA,MACxC,QAAQ,IAAK,CAAA,mBAAA;AAAA,KACd,CAAA,CAAA;AAED,IAAA,OAAO,CAAC,OAAuD,KAAA;AAE7D,MAAA,MAAM,oBAAoB,IAAI,MAAA,CAAO,IAAI,IAAK,CAAA,aAAa,IAAI,GAAG,CAAA,CAAA;AAClE,MAAA,MAAM,cAAc,OAAQ,CAAA,GAAA,EAAK,OAAQ,CAAA,iBAAA,EAAmB,EAAE,CAAK,IAAA,EAAA,CAAA;AAEnE,MAAO,OAAA,CAAC,OAAO,WAAW,CAAA,CAAA;AAAA,KAC5B,CAAA;AAAA,GACF;AAAA,EAEA,MAAa,KAA8B,GAAA;AACzC,IAAA,OAAO,IAAI,OAAA,CAAqB,CAAC,OAAA,EAAS,MAAW,KAAA;AACnD,MAAM,MAAA,YAAA,G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,YAAY,CAAA,CAAA;AAC/C,YAAA,QAAA,CAAS,IAAI,qBAAqB,CAAA,CAAA;AAClC,YAAA,OAAA;AAAA,WACF;AAEA,UAAAC,6BAAA,CAAa,SAAS,QAAU,EAAA;AAAA,YAC9B,QAAQ,IAAK,CAAA,kBAAA;AAAA,YACb,aAAe,EAAA,IAAA;AAAA,YACf,UAAU,CAAC,EAAE,QAAQ,IAAM,EAAA,WAAA,EAAa,cAAc,CAAA;AAAA,WACvD,CAAA,CAAA;AAAA,SACH;AAAA,OACF,CAAA;AAEA,MAAA,MAAM,MAAS,GAAAC,oBAAA,CAAa,EAAE,OAAA,EAAS,OAAO,CAAA,CAAA;AAC9C,MAAO,MAAA,CAAA,MAAA,CAAO,IAAK,CAAA,aAAA,EAAe,MAAM;AACtC,QAAA,IAAI,KAAK,OAAS,EAAA;AAChB,UAAO,MAAA,CAAA,IAAA;AAAA,YACL,CAAA,iFAAA,EAAoF,KAAK,aAAa,CAAA,CAAA;AAAA,WACxG,CAAA;AAAA,SACF;AACA,QAAA,OAAA,CAAQ,MAAM,CAAA,CAAA;AAAA,OACf,CAAA,CAAA;AAED,MAAO,MAAA,CAAA,EAAA,CAAG,OAAS,EAAA,CAAC,KAAiB,KAAA;AACnC,QAAA,MAAA,CAAO,KAAK,CAAA,CAAA;AAAA,OACb,CAAA,CAAA;AAAA,KACF,CAAA,CAAA;AAAA,GACH;AACF;;;;"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var run = require('./run.cjs.js');
|
|
4
|
+
|
|
5
|
+
const runMkdocsServer = async (options) => {
|
|
6
|
+
const port = options.port ?? "8000";
|
|
7
|
+
const useDocker = options.useDocker ?? true;
|
|
8
|
+
const dockerImage = options.dockerImage ?? "spotify/techdocs";
|
|
9
|
+
if (useDocker) {
|
|
10
|
+
return await run.run(
|
|
11
|
+
"docker",
|
|
12
|
+
[
|
|
13
|
+
"run",
|
|
14
|
+
"--rm",
|
|
15
|
+
"-w",
|
|
16
|
+
"/content",
|
|
17
|
+
"-v",
|
|
18
|
+
`${process.cwd()}:/content`,
|
|
19
|
+
"-p",
|
|
20
|
+
`${port}:${port}`,
|
|
21
|
+
"-it",
|
|
22
|
+
...options.dockerEntrypoint ? ["--entrypoint", options.dockerEntrypoint] : [],
|
|
23
|
+
...options.dockerOptions || [],
|
|
24
|
+
dockerImage,
|
|
25
|
+
"serve",
|
|
26
|
+
"--dev-addr",
|
|
27
|
+
`0.0.0.0:${port}`,
|
|
28
|
+
...options.mkdocsConfigFileName ? ["--config-file", options.mkdocsConfigFileName] : [],
|
|
29
|
+
...options.mkdocsParameterClean ? ["--clean"] : [],
|
|
30
|
+
...options.mkdocsParameterDirtyReload ? ["--dirtyreload"] : [],
|
|
31
|
+
...options.mkdocsParameterStrict ? ["--strict"] : []
|
|
32
|
+
],
|
|
33
|
+
{
|
|
34
|
+
stdoutLogFunc: options.stdoutLogFunc,
|
|
35
|
+
stderrLogFunc: options.stderrLogFunc
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
return await run.run(
|
|
40
|
+
"mkdocs",
|
|
41
|
+
[
|
|
42
|
+
"serve",
|
|
43
|
+
"--dev-addr",
|
|
44
|
+
`127.0.0.1:${port}`,
|
|
45
|
+
...options.mkdocsConfigFileName ? ["--config-file", options.mkdocsConfigFileName] : [],
|
|
46
|
+
...options.mkdocsParameterClean ? ["--clean"] : [],
|
|
47
|
+
...options.mkdocsParameterDirtyReload ? ["--dirtyreload"] : [],
|
|
48
|
+
...options.mkdocsParameterStrict ? ["--strict"] : []
|
|
49
|
+
],
|
|
50
|
+
{
|
|
51
|
+
stdoutLogFunc: options.stdoutLogFunc,
|
|
52
|
+
stderrLogFunc: options.stderrLogFunc
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
exports.runMkdocsServer = runMkdocsServer;
|
|
58
|
+
//# sourceMappingURL=mkdocsServer.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mkdocsServer.cjs.js","sources":["../../src/lib/mkdocsServer.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 { ChildProcess } from 'child_process';\nimport { run, LogFunc } from './run';\n\nexport const runMkdocsServer = async (options: {\n port?: string;\n useDocker?: boolean;\n dockerImage?: string;\n dockerEntrypoint?: string;\n dockerOptions?: string[];\n stdoutLogFunc?: LogFunc;\n stderrLogFunc?: LogFunc;\n mkdocsConfigFileName?: string;\n mkdocsParameterClean?: boolean;\n mkdocsParameterDirtyReload?: boolean;\n mkdocsParameterStrict?: boolean;\n}): Promise<ChildProcess> => {\n const port = options.port ?? '8000';\n const useDocker = options.useDocker ?? true;\n const dockerImage = options.dockerImage ?? 'spotify/techdocs';\n\n if (useDocker) {\n return await run(\n 'docker',\n [\n 'run',\n '--rm',\n '-w',\n '/content',\n '-v',\n `${process.cwd()}:/content`,\n '-p',\n `${port}:${port}`,\n '-it',\n ...(options.dockerEntrypoint\n ? ['--entrypoint', options.dockerEntrypoint]\n : []),\n ...(options.dockerOptions || []),\n dockerImage,\n 'serve',\n '--dev-addr',\n `0.0.0.0:${port}`,\n ...(options.mkdocsConfigFileName\n ? ['--config-file', options.mkdocsConfigFileName]\n : []),\n ...(options.mkdocsParameterClean ? ['--clean'] : []),\n ...(options.mkdocsParameterDirtyReload ? ['--dirtyreload'] : []),\n ...(options.mkdocsParameterStrict ? ['--strict'] : []),\n ],\n {\n stdoutLogFunc: options.stdoutLogFunc,\n stderrLogFunc: options.stderrLogFunc,\n },\n );\n }\n\n return await run(\n 'mkdocs',\n [\n 'serve',\n '--dev-addr',\n `127.0.0.1:${port}`,\n ...(options.mkdocsConfigFileName\n ? ['--config-file', options.mkdocsConfigFileName]\n : []),\n ...(options.mkdocsParameterClean ? ['--clean'] : []),\n ...(options.mkdocsParameterDirtyReload ? ['--dirtyreload'] : []),\n ...(options.mkdocsParameterStrict ? ['--strict'] : []),\n ],\n {\n stdoutLogFunc: options.stdoutLogFunc,\n stderrLogFunc: options.stderrLogFunc,\n },\n );\n};\n"],"names":["run"],"mappings":";;;;AAmBa,MAAA,eAAA,GAAkB,OAAO,OAYT,KAAA;AAC3B,EAAM,MAAA,IAAA,GAAO,QAAQ,IAAQ,IAAA,MAAA,CAAA;AAC7B,EAAM,MAAA,SAAA,GAAY,QAAQ,SAAa,IAAA,IAAA,CAAA;AACvC,EAAM,MAAA,WAAA,GAAc,QAAQ,WAAe,IAAA,kBAAA,CAAA;AAE3C,EAAA,IAAI,SAAW,EAAA;AACb,IAAA,OAAO,MAAMA,OAAA;AAAA,MACX,QAAA;AAAA,MACA;AAAA,QACE,KAAA;AAAA,QACA,MAAA;AAAA,QACA,IAAA;AAAA,QACA,UAAA;AAAA,QACA,IAAA;AAAA,QACA,CAAA,EAAG,OAAQ,CAAA,GAAA,EAAK,CAAA,SAAA,CAAA;AAAA,QAChB,IAAA;AAAA,QACA,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA;AAAA,QACf,KAAA;AAAA,QACA,GAAI,QAAQ,gBACR,GAAA,CAAC,gBAAgB,OAAQ,CAAA,gBAAgB,IACzC,EAAC;AAAA,QACL,GAAI,OAAQ,CAAA,aAAA,IAAiB,EAAC;AAAA,QAC9B,WAAA;AAAA,QACA,OAAA;AAAA,QACA,YAAA;AAAA,QACA,WAAW,IAAI,CAAA,CAAA;AAAA,QACf,GAAI,QAAQ,oBACR,GAAA,CAAC,iBAAiB,OAAQ,CAAA,oBAAoB,IAC9C,EAAC;AAAA,QACL,GAAI,OAAQ,CAAA,oBAAA,GAAuB,CAAC,SAAS,IAAI,EAAC;AAAA,QAClD,GAAI,OAAQ,CAAA,0BAAA,GAA6B,CAAC,eAAe,IAAI,EAAC;AAAA,QAC9D,GAAI,OAAQ,CAAA,qBAAA,GAAwB,CAAC,UAAU,IAAI,EAAC;AAAA,OACtD;AAAA,MACA;AAAA,QACE,eAAe,OAAQ,CAAA,aAAA;AAAA,QACvB,eAAe,OAAQ,CAAA,aAAA;AAAA,OACzB;AAAA,KACF,CAAA;AAAA,GACF;AAEA,EAAA,OAAO,MAAMA,OAAA;AAAA,IACX,QAAA;AAAA,IACA;AAAA,MACE,OAAA;AAAA,MACA,YAAA;AAAA,MACA,aAAa,IAAI,CAAA,CAAA;AAAA,MACjB,GAAI,QAAQ,oBACR,GAAA,CAAC,iBAAiB,OAAQ,CAAA,oBAAoB,IAC9C,EAAC;AAAA,MACL,GAAI,OAAQ,CAAA,oBAAA,GAAuB,CAAC,SAAS,IAAI,EAAC;AAAA,MAClD,GAAI,OAAQ,CAAA,0BAAA,GAA6B,CAAC,eAAe,IAAI,EAAC;AAAA,MAC9D,GAAI,OAAQ,CAAA,qBAAA,GAAwB,CAAC,UAAU,IAAI,EAAC;AAAA,KACtD;AAAA,IACA;AAAA,MACE,eAAe,OAAQ,CAAA,aAAA;AAAA,MACvB,eAAe,OAAQ,CAAA,aAAA;AAAA,KACzB;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var child_process = require('child_process');
|
|
4
|
+
|
|
5
|
+
const run = async (name, args = [], options = {}) => {
|
|
6
|
+
const { stdoutLogFunc, stderrLogFunc } = options;
|
|
7
|
+
const env = {
|
|
8
|
+
...process.env,
|
|
9
|
+
FORCE_COLOR: "true",
|
|
10
|
+
...options.env ?? {}
|
|
11
|
+
};
|
|
12
|
+
const stdio = [
|
|
13
|
+
"inherit",
|
|
14
|
+
stdoutLogFunc ? "pipe" : "inherit",
|
|
15
|
+
stderrLogFunc ? "pipe" : "inherit"
|
|
16
|
+
];
|
|
17
|
+
const childProcess = child_process.spawn(name, args, {
|
|
18
|
+
stdio,
|
|
19
|
+
...options,
|
|
20
|
+
env
|
|
21
|
+
});
|
|
22
|
+
if (stdoutLogFunc && childProcess.stdout) {
|
|
23
|
+
childProcess.stdout.on("data", stdoutLogFunc);
|
|
24
|
+
}
|
|
25
|
+
if (stderrLogFunc && childProcess.stderr) {
|
|
26
|
+
childProcess.stderr.on("data", stderrLogFunc);
|
|
27
|
+
}
|
|
28
|
+
return childProcess;
|
|
29
|
+
};
|
|
30
|
+
async function waitForSignal(childProcesses) {
|
|
31
|
+
const promises = [];
|
|
32
|
+
for (const signal of ["SIGINT", "SIGTERM"]) {
|
|
33
|
+
process.on(signal, () => {
|
|
34
|
+
childProcesses.forEach((childProcess) => {
|
|
35
|
+
childProcess.kill();
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
childProcesses.forEach((childProcess) => {
|
|
40
|
+
if (typeof childProcess.exitCode === "number") {
|
|
41
|
+
if (childProcess.exitCode) {
|
|
42
|
+
throw new Error(`Non zero exit code from child process`);
|
|
43
|
+
}
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
promises.push(
|
|
47
|
+
new Promise((resolve, reject) => {
|
|
48
|
+
childProcess.once("error", reject);
|
|
49
|
+
childProcess.once("exit", resolve);
|
|
50
|
+
})
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
await Promise.all(promises);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
exports.run = run;
|
|
57
|
+
exports.waitForSignal = waitForSignal;
|
|
58
|
+
//# sourceMappingURL=run.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.cjs.js","sources":["../../src/lib/run.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 */\nimport { spawn, SpawnOptions, ChildProcess } from 'child_process';\n\nexport type LogFunc = (data: Buffer | string) => void;\ntype SpawnOptionsPartialEnv = Omit<SpawnOptions, 'env'> & {\n env?: Partial<NodeJS.ProcessEnv>;\n // Pipe stdout to this log function\n stdoutLogFunc?: LogFunc;\n // Pipe stderr to this log function\n stderrLogFunc?: LogFunc;\n};\n\n// TODO: Accept log functions to pipe logs with.\n// Runs a child command, returning the child process instance.\n// Use it along with waitForSignal to run a long running process e.g. mkdocs serve\nexport const run = async (\n name: string,\n args: string[] = [],\n options: SpawnOptionsPartialEnv = {},\n): Promise<ChildProcess> => {\n const { stdoutLogFunc, stderrLogFunc } = options;\n\n const env: NodeJS.ProcessEnv = {\n ...process.env,\n FORCE_COLOR: 'true',\n ...(options.env ?? {}),\n };\n\n // Refer: https://nodejs.org/api/child_process.html#child_process_subprocess_stdio\n const stdio = [\n 'inherit',\n stdoutLogFunc ? 'pipe' : 'inherit',\n stderrLogFunc ? 'pipe' : 'inherit',\n ] as ('inherit' | 'pipe')[];\n\n const childProcess = spawn(name, args, {\n stdio: stdio,\n ...options,\n env,\n });\n\n if (stdoutLogFunc && childProcess.stdout) {\n childProcess.stdout.on('data', stdoutLogFunc);\n }\n if (stderrLogFunc && childProcess.stderr) {\n childProcess.stderr.on('data', stderrLogFunc);\n }\n\n return childProcess;\n};\n\n// Block indefinitely and wait for a signal to stop the child process(es)\n// Throw error if any child process errors\n// Resolves only when all processes exit with status code 0\nexport async function waitForSignal(\n childProcesses: Array<ChildProcess>,\n): Promise<void> {\n const promises: Array<Promise<void>> = [];\n\n for (const signal of ['SIGINT', 'SIGTERM'] as const) {\n process.on(signal, () => {\n childProcesses.forEach(childProcess => {\n childProcess.kill();\n });\n });\n }\n\n childProcesses.forEach(childProcess => {\n if (typeof childProcess.exitCode === 'number') {\n if (childProcess.exitCode) {\n throw new Error(`Non zero exit code from child process`);\n }\n return;\n }\n\n promises.push(\n new Promise<void>((resolve, reject) => {\n childProcess.once('error', reject);\n childProcess.once('exit', resolve);\n }),\n );\n });\n\n await Promise.all(promises);\n}\n"],"names":["spawn"],"mappings":";;;;AA6Ba,MAAA,GAAA,GAAM,OACjB,IACA,EAAA,IAAA,GAAiB,EACjB,EAAA,OAAA,GAAkC,EACR,KAAA;AAC1B,EAAM,MAAA,EAAE,aAAe,EAAA,aAAA,EAAkB,GAAA,OAAA,CAAA;AAEzC,EAAA,MAAM,GAAyB,GAAA;AAAA,IAC7B,GAAG,OAAQ,CAAA,GAAA;AAAA,IACX,WAAa,EAAA,MAAA;AAAA,IACb,GAAI,OAAQ,CAAA,GAAA,IAAO,EAAC;AAAA,GACtB,CAAA;AAGA,EAAA,MAAM,KAAQ,GAAA;AAAA,IACZ,SAAA;AAAA,IACA,gBAAgB,MAAS,GAAA,SAAA;AAAA,IACzB,gBAAgB,MAAS,GAAA,SAAA;AAAA,GAC3B,CAAA;AAEA,EAAM,MAAA,YAAA,GAAeA,mBAAM,CAAA,IAAA,EAAM,IAAM,EAAA;AAAA,IACrC,KAAA;AAAA,IACA,GAAG,OAAA;AAAA,IACH,GAAA;AAAA,GACD,CAAA,CAAA;AAED,EAAI,IAAA,aAAA,IAAiB,aAAa,MAAQ,EAAA;AACxC,IAAa,YAAA,CAAA,MAAA,CAAO,EAAG,CAAA,MAAA,EAAQ,aAAa,CAAA,CAAA;AAAA,GAC9C;AACA,EAAI,IAAA,aAAA,IAAiB,aAAa,MAAQ,EAAA;AACxC,IAAa,YAAA,CAAA,MAAA,CAAO,EAAG,CAAA,MAAA,EAAQ,aAAa,CAAA,CAAA;AAAA,GAC9C;AAEA,EAAO,OAAA,YAAA,CAAA;AACT,EAAA;AAKA,eAAsB,cACpB,cACe,EAAA;AACf,EAAA,MAAM,WAAiC,EAAC,CAAA;AAExC,EAAA,KAAA,MAAW,MAAU,IAAA,CAAC,QAAU,EAAA,SAAS,CAAY,EAAA;AACnD,IAAQ,OAAA,CAAA,EAAA,CAAG,QAAQ,MAAM;AACvB,MAAA,cAAA,CAAe,QAAQ,CAAgB,YAAA,KAAA;AACrC,QAAA,YAAA,CAAa,IAAK,EAAA,CAAA;AAAA,OACnB,CAAA,CAAA;AAAA,KACF,CAAA,CAAA;AAAA,GACH;AAEA,EAAA,cAAA,CAAe,QAAQ,CAAgB,YAAA,KAAA;AACrC,IAAI,IAAA,OAAO,YAAa,CAAA,QAAA,KAAa,QAAU,EAAA;AAC7C,MAAA,IAAI,aAAa,QAAU,EAAA;AACzB,QAAM,MAAA,IAAI,MAAM,CAAuC,qCAAA,CAAA,CAAA,CAAA;AAAA,OACzD;AACA,MAAA,OAAA;AAAA,KACF;AAEA,IAAS,QAAA,CAAA,IAAA;AAAA,MACP,IAAI,OAAA,CAAc,CAAC,OAAA,EAAS,MAAW,KAAA;AACrC,QAAa,YAAA,CAAA,IAAA,CAAK,SAAS,MAAM,CAAA,CAAA;AACjC,QAAa,YAAA,CAAA,IAAA,CAAK,QAAQ,OAAO,CAAA,CAAA;AAAA,OAClC,CAAA;AAAA,KACH,CAAA;AAAA,GACD,CAAA,CAAA;AAED,EAAM,MAAA,OAAA,CAAQ,IAAI,QAAQ,CAAA,CAAA;AAC5B;;;;;"}
|
|
@@ -60,4 +60,4 @@ const getLogStream = (logger) => {
|
|
|
60
60
|
exports.convertTechDocsRefToLocationAnnotation = convertTechDocsRefToLocationAnnotation;
|
|
61
61
|
exports.createLogger = createLogger;
|
|
62
62
|
exports.getLogStream = getLogStream;
|
|
63
|
-
//# sourceMappingURL=utility
|
|
63
|
+
//# sourceMappingURL=utility.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utility.cjs.js","sources":["../../src/lib/utility.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 */\nimport {\n RemoteProtocol,\n ParsedLocationAnnotation,\n} from '@backstage/plugin-techdocs-node';\nimport * as winston from 'winston';\nimport { Writable } from 'stream';\nimport { stdout } from 'process';\n\nexport const convertTechDocsRefToLocationAnnotation = (\n techdocsRef: string,\n): ParsedLocationAnnotation => {\n // Split on the first colon for the protocol and the rest after the first split\n // is the location.\n const [type, target] = techdocsRef.split(/:(.+)/) as [\n RemoteProtocol?,\n string?,\n ];\n\n if (!type || !target) {\n throw new Error(\n `Can not parse --techdocs-ref ${techdocsRef}. Should be of type HOST:URL.`,\n );\n }\n\n return { type, target };\n};\n\nexport const createLogger = ({\n verbose = false,\n}: {\n verbose: boolean;\n}): winston.Logger => {\n const logger = winston.createLogger({\n level: verbose ? 'verbose' : 'info',\n transports: [\n new winston.transports.Console({ format: winston.format.simple() }),\n ],\n });\n\n return logger;\n};\n\nexport const getLogStream = (logger: winston.Logger): Writable => {\n if (process.env.LOG_LEVEL === 'debug') {\n return stdout;\n }\n\n return new Writable({\n defaultEncoding: 'utf8',\n write(chunk, _encoding, next) {\n logger.verbose(chunk.toString().trim());\n next();\n },\n });\n};\n"],"names":["winston","stdout","Writable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuBa,MAAA,sCAAA,GAAyC,CACpD,WAC6B,KAAA;AAG7B,EAAA,MAAM,CAAC,IAAM,EAAA,MAAM,CAAI,GAAA,WAAA,CAAY,MAA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1
1
|
{
|
|
2
2
|
"name": "@techdocs/cli",
|
|
3
|
-
"version": "1.8.20-next.
|
|
3
|
+
"version": "1.8.20-next.2",
|
|
4
4
|
"description": "Utility CLI for managing TechDocs sites in Backstage.",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "cli"
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"watch": "./src"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@backstage/backend-defaults": "
|
|
48
|
-
"@backstage/catalog-model": "
|
|
49
|
-
"@backstage/cli-common": "
|
|
50
|
-
"@backstage/config": "
|
|
51
|
-
"@backstage/plugin-techdocs-node": "
|
|
47
|
+
"@backstage/backend-defaults": "0.5.1-next.2",
|
|
48
|
+
"@backstage/catalog-model": "1.7.0",
|
|
49
|
+
"@backstage/cli-common": "0.1.14",
|
|
50
|
+
"@backstage/config": "1.2.0",
|
|
51
|
+
"@backstage/plugin-techdocs-node": "1.12.12-next.2",
|
|
52
52
|
"commander": "^12.0.0",
|
|
53
53
|
"fs-extra": "^11.0.0",
|
|
54
54
|
"global-agent": "^3.0.0",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"winston": "^3.2.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@backstage/cli": "
|
|
61
|
+
"@backstage/cli": "0.28.0-next.2",
|
|
62
62
|
"@types/commander": "^2.12.2",
|
|
63
63
|
"@types/fs-extra": "^11.0.0",
|
|
64
64
|
"@types/http-proxy": "^1.17.4",
|