@techdocs/cli 1.0.1-next.0 → 1.1.1-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/dist/cjs/{PublisherConfig-162efac5.cjs.js → PublisherConfig-7a0dc71c.cjs.js} +32 -28
- package/dist/cjs/PublisherConfig-7a0dc71c.cjs.js.map +1 -0
- package/dist/cjs/{generate-143a6de3.cjs.js → generate-b637bb78.cjs.js} +15 -13
- package/dist/cjs/generate-b637bb78.cjs.js.map +1 -0
- package/dist/cjs/{migrate-181e95f5.cjs.js → migrate-122ec4bf.cjs.js} +9 -9
- package/dist/cjs/migrate-122ec4bf.cjs.js.map +1 -0
- package/dist/cjs/{mkdocs-30f530ff.cjs.js → mkdocs-3c3898e8.cjs.js} +12 -11
- package/dist/cjs/mkdocs-3c3898e8.cjs.js.map +1 -0
- package/dist/cjs/{mkdocsServer-758a3ae9.cjs.js → mkdocsServer-0af6527d.cjs.js} +2 -1
- package/dist/cjs/mkdocsServer-0af6527d.cjs.js.map +1 -0
- package/dist/cjs/{publish-7bf1e5f7.cjs.js → publish-efa348a5.cjs.js} +7 -7
- package/dist/cjs/publish-efa348a5.cjs.js.map +1 -0
- package/dist/cjs/{serve-21d1e885.cjs.js → serve-aa1ff626.cjs.js} +13 -12
- package/dist/cjs/serve-aa1ff626.cjs.js.map +1 -0
- package/dist/cjs/utility-51f4a306.cjs.js.map +1 -1
- package/dist/embedded-app/.config-schema.json +56 -0
- package/dist/embedded-app/index.html +1 -1
- package/dist/embedded-app/static/{1553.925835b9.chunk.js → 1553.a6edce0e.chunk.js} +1 -1
- package/dist/embedded-app/static/1553.a6edce0e.chunk.js.map +1 -0
- package/dist/embedded-app/static/{1959.2eb957a4.chunk.js → 1959.55365235.chunk.js} +1 -1
- package/dist/embedded-app/static/{1959.2eb957a4.chunk.js.map → 1959.55365235.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{2426.f9952783.chunk.js → 2426.b371eaed.chunk.js} +1 -1
- package/dist/embedded-app/static/2426.b371eaed.chunk.js.map +1 -0
- package/dist/embedded-app/static/{390.cd301478.chunk.js → 390.5623153b.chunk.js} +1 -1
- package/dist/embedded-app/static/390.5623153b.chunk.js.map +1 -0
- package/dist/embedded-app/static/{4022.313be9b5.chunk.js → 4022.6f52e9cc.chunk.js} +1 -1
- package/dist/embedded-app/static/{2426.f9952783.chunk.js.map → 4022.6f52e9cc.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{6235.b3634d50.chunk.js → 6235.7e3710fd.chunk.js} +1 -1
- package/dist/embedded-app/static/6235.7e3710fd.chunk.js.map +1 -0
- package/dist/embedded-app/static/{6583.c98b5125.chunk.js → 6583.9071ac96.chunk.js} +1 -1
- package/dist/embedded-app/static/{6583.c98b5125.chunk.js.map → 6583.9071ac96.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{7110.527cc68b.chunk.js → 7110.7d2c1934.chunk.js} +1 -1
- package/dist/embedded-app/static/{7110.527cc68b.chunk.js.map → 7110.7d2c1934.chunk.js.map} +1 -1
- package/dist/embedded-app/static/7758.f316879f.chunk.js +3 -0
- package/dist/embedded-app/static/7758.f316879f.chunk.js.map +1 -0
- package/dist/embedded-app/static/{8061.fd1f45d1.chunk.js → 8061.3f3d9ba3.chunk.js} +1 -1
- package/dist/embedded-app/static/8061.3f3d9ba3.chunk.js.map +1 -0
- package/dist/embedded-app/static/{8718.930c97ad.chunk.js → 8718.8f60efd2.chunk.js} +1 -1
- package/dist/embedded-app/static/{8718.930c97ad.chunk.js.map → 8718.8f60efd2.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{8792.867bf73e.chunk.js → 8792.b1d581fc.chunk.js} +1 -1
- package/dist/embedded-app/static/8792.b1d581fc.chunk.js.map +1 -0
- package/dist/embedded-app/static/{9028.200536ea.chunk.js → 9028.abe94909.chunk.js} +1 -1
- package/dist/embedded-app/static/9028.abe94909.chunk.js.map +1 -0
- package/dist/embedded-app/static/main.42d41e6f.js +476 -0
- package/dist/embedded-app/static/main.42d41e6f.js.map +1 -0
- package/dist/embedded-app/static/{module-ajv.3b80984f.js → module-ajv.d6f6d109.js} +5 -5
- package/dist/embedded-app/static/module-ajv.d6f6d109.js.map +1 -0
- package/dist/embedded-app/static/module-aria-query.f720b73c.js +9 -0
- package/dist/embedded-app/static/module-aria-query.f720b73c.js.map +1 -0
- package/dist/embedded-app/static/module-date-fns.5015b34b.js +3 -0
- package/dist/embedded-app/static/module-date-fns.5015b34b.js.map +1 -0
- package/dist/embedded-app/static/module-hot-loader.7955a91c.js +32 -0
- package/dist/embedded-app/static/module-hot-loader.7955a91c.js.map +1 -0
- package/dist/embedded-app/static/module-jss.cb0efade.js +38 -0
- package/dist/embedded-app/static/module-jss.cb0efade.js.map +1 -0
- package/dist/embedded-app/static/{module-lodash.f158b49a.js → module-lodash.055be129.js} +1 -1
- package/dist/embedded-app/static/{module-lodash.f158b49a.js.map → module-lodash.055be129.js.map} +1 -1
- package/dist/embedded-app/static/{module-material-table.cbad0c40.js → module-material-table.fcca9670.js} +2 -2
- package/dist/embedded-app/static/{module-material-table.cbad0c40.js.map → module-material-table.fcca9670.js.map} +1 -1
- package/dist/embedded-app/static/{module-material-ui.3c0e2d92.js → module-material-ui.84a6ac87.js} +11 -11
- package/dist/embedded-app/static/module-material-ui.84a6ac87.js.map +1 -0
- package/dist/embedded-app/static/module-testing-library.633b23c6.js +57 -0
- package/dist/embedded-app/static/module-testing-library.633b23c6.js.map +1 -0
- package/dist/embedded-app/static/{module-yaml.574c3290.js → module-yaml.57b26e04.js} +1 -1
- package/dist/embedded-app/static/{module-yaml.574c3290.js.map → module-yaml.57b26e04.js.map} +1 -1
- package/dist/embedded-app/static/react-syntax-highlighter/lowlight-import.c14d776e.chunk.js +1 -1
- package/dist/embedded-app/static/react-syntax-highlighter_languages_highlight_sqlMore.beecb919.chunk.js +3 -0
- package/dist/embedded-app/static/react-syntax-highlighter_languages_highlight_sqlMore.beecb919.chunk.js.map +1 -0
- package/dist/embedded-app/static/runtime.42d41e6f.js +4 -0
- package/dist/embedded-app/static/runtime.42d41e6f.js.map +1 -0
- package/dist/embedded-app/static/vendor.42d41e6f.js +117 -0
- package/dist/embedded-app/static/vendor.42d41e6f.js.map +1 -0
- package/dist/index.cjs.js +10 -14
- package/dist/index.cjs.js.map +1 -1
- package/package.json +9 -9
- package/dist/cjs/PublisherConfig-162efac5.cjs.js.map +0 -1
- package/dist/cjs/generate-143a6de3.cjs.js.map +0 -1
- package/dist/cjs/migrate-181e95f5.cjs.js.map +0 -1
- package/dist/cjs/mkdocs-30f530ff.cjs.js.map +0 -1
- package/dist/cjs/mkdocsServer-758a3ae9.cjs.js.map +0 -1
- package/dist/cjs/publish-7bf1e5f7.cjs.js.map +0 -1
- package/dist/cjs/serve-21d1e885.cjs.js.map +0 -1
- package/dist/embedded-app/static/1553.925835b9.chunk.js.map +0 -1
- package/dist/embedded-app/static/3825.b0488503.chunk.js +0 -3
- package/dist/embedded-app/static/3825.b0488503.chunk.js.map +0 -1
- package/dist/embedded-app/static/390.cd301478.chunk.js.map +0 -1
- package/dist/embedded-app/static/4022.313be9b5.chunk.js.map +0 -1
- package/dist/embedded-app/static/6105.6eda23ad.chunk.js +0 -3
- package/dist/embedded-app/static/6105.6eda23ad.chunk.js.map +0 -1
- package/dist/embedded-app/static/6235.b3634d50.chunk.js.map +0 -1
- package/dist/embedded-app/static/7758.a6ab2713.chunk.js +0 -3
- package/dist/embedded-app/static/7758.a6ab2713.chunk.js.map +0 -1
- package/dist/embedded-app/static/8061.fd1f45d1.chunk.js.map +0 -1
- package/dist/embedded-app/static/8792.867bf73e.chunk.js.map +0 -1
- package/dist/embedded-app/static/9028.200536ea.chunk.js.map +0 -1
- package/dist/embedded-app/static/main.70e241d2.js +0 -476
- package/dist/embedded-app/static/main.70e241d2.js.map +0 -1
- package/dist/embedded-app/static/module-ajv.3b80984f.js.map +0 -1
- package/dist/embedded-app/static/module-date-fns.a08d117e.js +0 -3
- package/dist/embedded-app/static/module-date-fns.a08d117e.js.map +0 -1
- package/dist/embedded-app/static/module-hot-loader.7c7a4226.js +0 -25
- package/dist/embedded-app/static/module-hot-loader.7c7a4226.js.map +0 -1
- package/dist/embedded-app/static/module-material-ui.3c0e2d92.js.map +0 -1
- package/dist/embedded-app/static/runtime.70e241d2.js +0 -4
- package/dist/embedded-app/static/runtime.70e241d2.js.map +0 -1
- package/dist/embedded-app/static/vendor.70e241d2.js +0 -140
- package/dist/embedded-app/static/vendor.70e241d2.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# @techdocs/cli
|
|
2
2
|
|
|
3
|
+
## 1.1.1-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 344ea56acc: Bump `commander` to version 9.1.0
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/backend-common@0.13.3-next.0
|
|
10
|
+
- @backstage/plugin-techdocs-node@1.1.1-next.0
|
|
11
|
+
|
|
12
|
+
## 1.1.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- 733187987b: Removed an undocumented, broken behavior where `README.md` files would be copied to `index.md` if it did not exist, leading to broken links in the TechDocs UI.
|
|
17
|
+
|
|
18
|
+
**WARNING**: If you notice 404s in TechDocs after updating, check to make sure that all markdown files referenced in your `mkdocs.yml`s' `nav` sections exist. The following flag may be passed to the `generate` command to temporarily revert to the broken behavior.
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
techdocs-cli generate --legacyCopyReadmeMdToIndexMd
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- 230ad0826f: Bump to using `@types/node` v16
|
|
27
|
+
- eb470ea54c: Adds a new flag to override the entrypoint when using a custom docker image. It could be used to reuse existing images with different entrypoints.
|
|
28
|
+
- Updated dependencies
|
|
29
|
+
- @backstage/catalog-model@1.0.1
|
|
30
|
+
- @backstage/backend-common@0.13.2
|
|
31
|
+
- @backstage/plugin-techdocs-node@1.1.0
|
|
32
|
+
|
|
33
|
+
## 1.1.0-next.1
|
|
34
|
+
|
|
35
|
+
### Minor Changes
|
|
36
|
+
|
|
37
|
+
- bcf1a2496c: BREAKING: The default Techdocs behavior will no longer attempt to copy `docs/README.md` or `README.md` to `docs/index.md` (if not found). To retain this behavior in your instance, you can set the following config in your `app-config.yaml`:
|
|
38
|
+
|
|
39
|
+
```yaml
|
|
40
|
+
techdocs:
|
|
41
|
+
generator:
|
|
42
|
+
mkdocs:
|
|
43
|
+
legacyCopyReadmeMdToIndexMd: true
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Patch Changes
|
|
47
|
+
|
|
48
|
+
- 230ad0826f: Bump to using `@types/node` v16
|
|
49
|
+
- eb470ea54c: Adds a new flag to override the entrypoint when using a custom docker image. It could be used to reuse existing images with different entrypoints.
|
|
50
|
+
- Updated dependencies
|
|
51
|
+
- @backstage/backend-common@0.13.2-next.2
|
|
52
|
+
- @backstage/plugin-techdocs-node@1.1.0-next.2
|
|
53
|
+
|
|
3
54
|
## 1.0.1-next.0
|
|
4
55
|
|
|
5
56
|
### Patch Changes
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
var config = require('@backstage/config');
|
|
4
4
|
|
|
5
5
|
const _PublisherConfig = class {
|
|
6
|
-
static getValidConfig(
|
|
7
|
-
const publisherType =
|
|
6
|
+
static getValidConfig(opts) {
|
|
7
|
+
const publisherType = opts.publisherType;
|
|
8
8
|
if (!_PublisherConfig.isKnownPublisher(publisherType)) {
|
|
9
|
-
throw new Error(`Unknown publisher type ${
|
|
9
|
+
throw new Error(`Unknown publisher type ${opts.publisherType}`);
|
|
10
10
|
}
|
|
11
11
|
return new config.ConfigReader({
|
|
12
12
|
backend: {
|
|
@@ -16,71 +16,75 @@ const _PublisherConfig = class {
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
techdocs: {
|
|
19
|
-
publisher: _PublisherConfig.configFactories[publisherType](
|
|
20
|
-
legacyUseCaseSensitiveTripletPaths:
|
|
19
|
+
publisher: _PublisherConfig.configFactories[publisherType](opts),
|
|
20
|
+
legacyUseCaseSensitiveTripletPaths: opts.legacyUseCaseSensitiveTripletPaths
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
static isKnownPublisher(type) {
|
|
25
25
|
return _PublisherConfig.configFactories.hasOwnProperty(type);
|
|
26
26
|
}
|
|
27
|
-
static getValidAwsS3Config(
|
|
27
|
+
static getValidAwsS3Config(opts) {
|
|
28
28
|
return {
|
|
29
29
|
type: "awsS3",
|
|
30
30
|
awsS3: {
|
|
31
|
-
bucketName:
|
|
32
|
-
...
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
...
|
|
36
|
-
...
|
|
31
|
+
bucketName: opts.storageName,
|
|
32
|
+
...opts.awsBucketRootPath && {
|
|
33
|
+
bucketRootPath: opts.awsBucketRootPath
|
|
34
|
+
},
|
|
35
|
+
...opts.awsRoleArn && { credentials: { roleArn: opts.awsRoleArn } },
|
|
36
|
+
...opts.awsEndpoint && { endpoint: opts.awsEndpoint },
|
|
37
|
+
...opts.awsS3ForcePathStyle && { s3ForcePathStyle: true },
|
|
38
|
+
...opts.awsS3sse && { sse: opts.awsS3sse }
|
|
37
39
|
}
|
|
38
40
|
};
|
|
39
41
|
}
|
|
40
|
-
static getValidAzureConfig(
|
|
41
|
-
if (!
|
|
42
|
+
static getValidAzureConfig(opts) {
|
|
43
|
+
if (!opts.azureAccountName) {
|
|
42
44
|
throw new Error(`azureBlobStorage requires --azureAccountName to be specified`);
|
|
43
45
|
}
|
|
44
46
|
return {
|
|
45
47
|
type: "azureBlobStorage",
|
|
46
48
|
azureBlobStorage: {
|
|
47
|
-
containerName:
|
|
49
|
+
containerName: opts.storageName,
|
|
48
50
|
credentials: {
|
|
49
|
-
accountName:
|
|
50
|
-
accountKey:
|
|
51
|
+
accountName: opts.azureAccountName,
|
|
52
|
+
accountKey: opts.azureAccountKey
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
55
|
};
|
|
54
56
|
}
|
|
55
|
-
static getValidGoogleGcsConfig(
|
|
57
|
+
static getValidGoogleGcsConfig(opts) {
|
|
56
58
|
return {
|
|
57
59
|
type: "googleGcs",
|
|
58
60
|
googleGcs: {
|
|
59
|
-
bucketName:
|
|
60
|
-
...
|
|
61
|
+
bucketName: opts.storageName,
|
|
62
|
+
...opts.gcsBucketRootPath && {
|
|
63
|
+
bucketRootPath: opts.gcsBucketRootPath
|
|
64
|
+
}
|
|
61
65
|
}
|
|
62
66
|
};
|
|
63
67
|
}
|
|
64
|
-
static getValidOpenStackSwiftConfig(
|
|
68
|
+
static getValidOpenStackSwiftConfig(opts) {
|
|
65
69
|
const missingParams = [
|
|
66
70
|
"osCredentialId",
|
|
67
71
|
"osSecret",
|
|
68
72
|
"osAuthUrl",
|
|
69
73
|
"osSwiftUrl"
|
|
70
|
-
].filter((param) => !
|
|
74
|
+
].filter((param) => !opts[param]);
|
|
71
75
|
if (missingParams.length) {
|
|
72
76
|
throw new Error(`openStackSwift requires the following params to be specified: ${missingParams.join(", ")}`);
|
|
73
77
|
}
|
|
74
78
|
return {
|
|
75
79
|
type: "openStackSwift",
|
|
76
80
|
openStackSwift: {
|
|
77
|
-
containerName:
|
|
81
|
+
containerName: opts.storageName,
|
|
78
82
|
credentials: {
|
|
79
|
-
id:
|
|
80
|
-
secret:
|
|
83
|
+
id: opts.osCredentialId,
|
|
84
|
+
secret: opts.osSecret
|
|
81
85
|
},
|
|
82
|
-
authUrl:
|
|
83
|
-
swiftUrl:
|
|
86
|
+
authUrl: opts.osAuthUrl,
|
|
87
|
+
swiftUrl: opts.osSwiftUrl
|
|
84
88
|
}
|
|
85
89
|
};
|
|
86
90
|
}
|
|
@@ -94,4 +98,4 @@ PublisherConfig.configFactories = {
|
|
|
94
98
|
};
|
|
95
99
|
|
|
96
100
|
exports.PublisherConfig = PublisherConfig;
|
|
97
|
-
//# sourceMappingURL=PublisherConfig-
|
|
101
|
+
//# sourceMappingURL=PublisherConfig-7a0dc71c.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PublisherConfig-7a0dc71c.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 },\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":";;;;AACA,MAAM,gBAAgB,GAAG,MAAM;AAC/B,EAAE,OAAO,cAAc,CAAC,IAAI,EAAE;AAC9B,IAAI,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;AAC7C,IAAI,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE;AAC3D,MAAM,MAAM,IAAI,KAAK,CAAC,CAAC,uBAAuB,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;AACtE,KAAK;AACL,IAAI,OAAO,IAAIA,mBAAY,CAAC;AAC5B,MAAM,OAAO,EAAE;AACf,QAAQ,OAAO,EAAE,uBAAuB;AACxC,QAAQ,MAAM,EAAE;AAChB,UAAU,IAAI,EAAE,IAAI;AACpB,SAAS;AACT,OAAO;AACP,MAAM,QAAQ,EAAE;AAChB,QAAQ,SAAS,EAAE,gBAAgB,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC;AACxE,QAAQ,kCAAkC,EAAE,IAAI,CAAC,kCAAkC;AACnF,OAAO;AACP,KAAK,CAAC,CAAC;AACP,GAAG;AACH,EAAE,OAAO,gBAAgB,CAAC,IAAI,EAAE;AAChC,IAAI,OAAO,gBAAgB,CAAC,eAAe,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;AACjE,GAAG;AACH,EAAE,OAAO,mBAAmB,CAAC,IAAI,EAAE;AACnC,IAAI,OAAO;AACX,MAAM,IAAI,EAAE,OAAO;A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
|
|
|
15
15
|
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
16
16
|
var Docker__default = /*#__PURE__*/_interopDefaultLegacy(Docker);
|
|
17
17
|
|
|
18
|
-
async function generate(
|
|
19
|
-
const logger = utility.createLogger({ verbose:
|
|
20
|
-
const sourceDir = path.resolve(
|
|
21
|
-
const outputDir = path.resolve(
|
|
22
|
-
const omitTechdocsCorePlugin =
|
|
23
|
-
const dockerImage =
|
|
24
|
-
const pullImage =
|
|
18
|
+
async function generate(opts) {
|
|
19
|
+
const logger = utility.createLogger({ verbose: opts.verbose });
|
|
20
|
+
const sourceDir = path.resolve(opts.sourceDir);
|
|
21
|
+
const outputDir = path.resolve(opts.outputDir);
|
|
22
|
+
const omitTechdocsCorePlugin = opts.omitTechdocsCoreMkdocsPlugin;
|
|
23
|
+
const dockerImage = opts.dockerImage;
|
|
24
|
+
const pullImage = opts.pull;
|
|
25
|
+
const legacyCopyReadmeMdToIndexMd = opts.legacyCopyReadmeMdToIndexMd;
|
|
25
26
|
logger.info(`Using source dir ${sourceDir}`);
|
|
26
27
|
logger.info(`Will output generated files in ${outputDir}`);
|
|
27
28
|
logger.verbose("Creating output directory if it does not exist.");
|
|
@@ -29,9 +30,10 @@ async function generate(cmd) {
|
|
|
29
30
|
const config$1 = new config.ConfigReader({
|
|
30
31
|
techdocs: {
|
|
31
32
|
generator: {
|
|
32
|
-
runIn:
|
|
33
|
+
runIn: opts.docker ? "docker" : "local",
|
|
33
34
|
dockerImage,
|
|
34
35
|
pullImage,
|
|
36
|
+
legacyCopyReadmeMdToIndexMd,
|
|
35
37
|
mkdocs: {
|
|
36
38
|
omitTechdocsCorePlugin
|
|
37
39
|
}
|
|
@@ -41,9 +43,9 @@ async function generate(cmd) {
|
|
|
41
43
|
const dockerClient = new Docker__default["default"]();
|
|
42
44
|
const containerRunner = new backendCommon.DockerContainerRunner({ dockerClient });
|
|
43
45
|
let parsedLocationAnnotation = {};
|
|
44
|
-
if (
|
|
46
|
+
if (opts.techdocsRef) {
|
|
45
47
|
try {
|
|
46
|
-
parsedLocationAnnotation = utility.convertTechDocsRefToLocationAnnotation(
|
|
48
|
+
parsedLocationAnnotation = utility.convertTechDocsRefToLocationAnnotation(opts.techdocsRef);
|
|
47
49
|
} catch (err) {
|
|
48
50
|
logger.error(err.message);
|
|
49
51
|
}
|
|
@@ -56,15 +58,15 @@ async function generate(cmd) {
|
|
|
56
58
|
await techdocsGenerator.run({
|
|
57
59
|
inputDir: sourceDir,
|
|
58
60
|
outputDir,
|
|
59
|
-
...
|
|
61
|
+
...opts.techdocsRef ? {
|
|
60
62
|
parsedLocationAnnotation
|
|
61
63
|
} : {},
|
|
62
64
|
logger,
|
|
63
|
-
etag:
|
|
65
|
+
etag: opts.etag,
|
|
64
66
|
...process.env.LOG_LEVEL === "debug" ? { logStream: process$1.stdout } : {}
|
|
65
67
|
});
|
|
66
68
|
logger.info("Done!");
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
exports["default"] = generate;
|
|
70
|
-
//# sourceMappingURL=generate-
|
|
72
|
+
//# sourceMappingURL=generate-b637bb78.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-b637bb78.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 Docker from 'dockerode';\nimport {\n TechdocsGenerator,\n ParsedLocationAnnotation,\n} from '@backstage/plugin-techdocs-node';\nimport { DockerContainerRunner } from '@backstage/backend-common';\nimport { ConfigReader } from '@backstage/config';\nimport {\n convertTechDocsRefToLocationAnnotation,\n createLogger,\n} from '../../lib/utility';\nimport { stdout } from 'process';\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\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 config = new ConfigReader({\n techdocs: {\n generator: {\n runIn: opts.docker ? 'docker' : 'local',\n dockerImage,\n pullImage,\n legacyCopyReadmeMdToIndexMd,\n mkdocs: {\n omitTechdocsCorePlugin,\n },\n },\n },\n });\n\n // Docker client (conditionally) used by the generators, based on techdocs.generators config.\n const dockerClient = new Docker();\n const containerRunner = new DockerContainerRunner({ dockerClient });\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 containerRunner,\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 ...(process.env.LOG_LEVEL === 'debug' ? { logStream: stdout } : {}),\n });\n\n logger.info('Done!');\n}\n"],"names":["createLogger","resolve","fs","config","ConfigReader","Docker","DockerContainerRunner","convertTechDocsRefToLocationAnnotation","TechdocsGenerator","stdout"],"mappings":";;;;;;;;;;;;;;;;;AAae,eAAe,QAAQ,CAAC,IAAI,EAAE;AAC7C,EAAE,MAAM,MAAM,GAAGA,oBAAY,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;AACzD,EAAE,MAAM,SAAS,GAAGC,YAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAC5C,EAAE,MAAM,SAAS,GAAGA,YAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAC5C,EAAE,MAAM,sBAAsB,GAAG,IAAI,CAAC,4BAA4B,CAAC;AACnE,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;AACvC,EAAE,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC;AAC9B,EAAE,MAAM,2BAA2B,GAAG,IAAI,CAAC,2BAA2B,CAAC;AACvE,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AAC/C,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,+BAA+B,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AAC7D,EAAE,MAAM,CAAC,OAAO,CAAC,iDAAiD,CAAC,CAAC;AACpE,EAAE,MAAMC,sBAAE,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AAChC,EAAE,MAAMC,QAAM,GAAG,IAAIC,mBAAY,CAAC;AAClC,IAAI,QAAQ,EAAE;AACd,MAAM,SAAS,EAAE;AACjB,QAAQ,KAAK,EAAE,IAAI,CAAC,MAAM,GAAG,QAAQ,GAAG,OAAO;AAC/C,QAAQ,WAAW;AACnB,QAAQ,SAAS;AACjB,QAAQ,2BAA2B;AACnC,QAAQ,MAAM,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pluginTechdocsNode = require('@backstage/plugin-techdocs-node');
|
|
5
5
|
var utility = require('./utility-51f4a306.cjs.js');
|
|
6
|
-
var PublisherConfig = require('./PublisherConfig-
|
|
6
|
+
var PublisherConfig = require('./PublisherConfig-7a0dc71c.cjs.js');
|
|
7
7
|
require('winston');
|
|
8
8
|
require('@backstage/config');
|
|
9
9
|
|
|
10
|
-
async function migrate(
|
|
11
|
-
const logger = utility.createLogger({ verbose:
|
|
12
|
-
const config = PublisherConfig.PublisherConfig.getValidConfig(
|
|
10
|
+
async function migrate(opts) {
|
|
11
|
+
const logger = utility.createLogger({ verbose: opts.verbose });
|
|
12
|
+
const config = PublisherConfig.PublisherConfig.getValidConfig(opts);
|
|
13
13
|
const discovery = backendCommon.SingleHostDiscovery.fromConfig(config);
|
|
14
14
|
const publisher = await pluginTechdocsNode.Publisher.fromConfig(config, { logger, discovery });
|
|
15
15
|
if (!publisher.migrateDocsCase) {
|
|
16
|
-
throw new Error(`Migration not implemented for ${
|
|
16
|
+
throw new Error(`Migration not implemented for ${opts.publisherType}`);
|
|
17
17
|
}
|
|
18
18
|
const { isAvailable } = await publisher.getReadiness();
|
|
19
19
|
if (!isAvailable) {
|
|
20
20
|
throw new Error("");
|
|
21
21
|
}
|
|
22
|
-
const removeOriginal =
|
|
23
|
-
const numericConcurrency = parseInt(
|
|
22
|
+
const removeOriginal = opts.removeOriginal;
|
|
23
|
+
const numericConcurrency = parseInt(opts.concurrency, 10);
|
|
24
24
|
if (!Number.isInteger(numericConcurrency) || numericConcurrency <= 0) {
|
|
25
|
-
throw new Error(`Concurrency must be a number greater than 1. ${
|
|
25
|
+
throw new Error(`Concurrency must be a number greater than 1. ${opts.concurrency} provided.`);
|
|
26
26
|
}
|
|
27
27
|
await publisher.migrateDocsCase({
|
|
28
28
|
concurrency: numericConcurrency,
|
|
@@ -31,4 +31,4 @@ async function migrate(cmd) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
exports["default"] = migrate;
|
|
34
|
-
//# sourceMappingURL=migrate-
|
|
34
|
+
//# sourceMappingURL=migrate-122ec4bf.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate-122ec4bf.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 { SingleHostDiscovery } from '@backstage/backend-common';\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 = SingleHostDiscovery.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","SingleHostDiscovery","Publisher"],"mappings":";;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"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var openBrowser = require('react-dev-utils/openBrowser');
|
|
4
4
|
var utility = require('./utility-51f4a306.cjs.js');
|
|
5
|
-
var mkdocsServer = require('./mkdocsServer-
|
|
5
|
+
var mkdocsServer = require('./mkdocsServer-0af6527d.cjs.js');
|
|
6
6
|
require('winston');
|
|
7
7
|
require('child_process');
|
|
8
8
|
|
|
@@ -10,15 +10,15 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
10
10
|
|
|
11
11
|
var openBrowser__default = /*#__PURE__*/_interopDefaultLegacy(openBrowser);
|
|
12
12
|
|
|
13
|
-
async function serveMkdocs(
|
|
14
|
-
const logger = utility.createLogger({ verbose:
|
|
15
|
-
const dockerAddr = `http://0.0.0.0:${
|
|
16
|
-
const localAddr = `http://127.0.0.1:${
|
|
17
|
-
const expectedDevAddr =
|
|
13
|
+
async function serveMkdocs(opts) {
|
|
14
|
+
const logger = utility.createLogger({ verbose: opts.verbose });
|
|
15
|
+
const dockerAddr = `http://0.0.0.0:${opts.port}`;
|
|
16
|
+
const localAddr = `http://127.0.0.1:${opts.port}`;
|
|
17
|
+
const expectedDevAddr = opts.docker ? dockerAddr : localAddr;
|
|
18
18
|
let boolOpenBrowserTriggered = false;
|
|
19
19
|
const logFunc = (data) => {
|
|
20
20
|
const logLines = data.toString().split("\n");
|
|
21
|
-
const logPrefix =
|
|
21
|
+
const logPrefix = opts.docker ? "[docker/mkdocs]" : "[mkdocs]";
|
|
22
22
|
logLines.forEach((line) => {
|
|
23
23
|
if (line === "") {
|
|
24
24
|
return;
|
|
@@ -34,9 +34,10 @@ Starting mkdocs server on ${localAddr}
|
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
36
|
const childProcess = await mkdocsServer.runMkdocsServer({
|
|
37
|
-
port:
|
|
38
|
-
dockerImage:
|
|
39
|
-
|
|
37
|
+
port: opts.port,
|
|
38
|
+
dockerImage: opts.dockerImage,
|
|
39
|
+
dockerEntrypoint: opts.dockerEntrypoint,
|
|
40
|
+
useDocker: opts.docker,
|
|
40
41
|
stdoutLogFunc: logFunc,
|
|
41
42
|
stderrLogFunc: logFunc
|
|
42
43
|
});
|
|
@@ -44,4 +45,4 @@ Starting mkdocs server on ${localAddr}
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
exports["default"] = serveMkdocs;
|
|
47
|
-
//# sourceMappingURL=mkdocs-
|
|
48
|
+
//# sourceMappingURL=mkdocs-3c3898e8.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mkdocs-3c3898e8.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';\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 // 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 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"],"names":["createLogger","openBrowser","runMkdocsServer","waitForSignal"],"mappings":";;;;;;;;;;;;AAIe,eAAe,WAAW,CAAC,IAAI,EAAE;AAChD,EAAE,MAAM,MAAM,GAAGA,oBAAY,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;AACzD,EAAE,MAAM,UAAU,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACnD,EAAE,MAAM,SAAS,GAAG,CAAC,iBAAiB,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACpD,EAAE,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;AAC/D,EAAE,IAAI,wBAAwB,GAAG,KAAK,CAAC;AACvC,EAAE,MAAM,OAAO,GAAG,CAAC,IAAI,KAAK;AAC5B,IAAI,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACjD,IAAI,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,GAAG,iBAAiB,GAAG,UAAU,CAAC;AACnE,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,KAAK;AAC/B,MAAM,IAAI,IAAI,KAAK,EAAE,EAAE;AACvB,QAAQ,OAAO;AACf,OAAO;AACP,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AAC7C,MAAM,IAAI,CAAC,wBAAwB,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE;AACvF,QAAQ,MAAM,CAAC,IAAI,CAAC,CAAC;AACrB,0BAA0B,EAAE,SAAS,CAAC;AACtC,CAAC,CAAC,CAAC;AACH,QAAQC,+BAAW,CAAC,SAAS,CAAC,CAAC;AAC/B,QAAQ,wBAAwB,GAAG,IAAI,CAAC;AACxC,OAAO;AACP,KAAK,CAAC,CAAC;AACP,GAAG,CAAC;AACJ,EAAE,MAAM,YAAY,GAAG,MAAMC,4BAAe,CAAC;AAC7C,IAAI,IAAI,EAAE,IAAI,CAAC,IAAI;AACnB,IAAI,WAAW,EAAE,IAAI,CAAC,WAAW;AACjC,IAAI,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;AAC3C,IAAI,SAAS,EAAE,IAAI,CAAC,MAAM;AAC1B,IAAI,aAAa,EAAE,OAAO;AAC1B,IAAI,aAAa,EAAE,OAAO;AAC1B,GAAG,CAAC,CAAC;AACL,EAAE,MAAMC,0BAAa,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;AACtC;;;;"}
|
|
@@ -68,6 +68,7 @@ const runMkdocsServer = async (options) => {
|
|
|
68
68
|
"-p",
|
|
69
69
|
`${port}:${port}`,
|
|
70
70
|
"-it",
|
|
71
|
+
...options.dockerEntrypoint ? ["--entrypoint", options.dockerEntrypoint] : [],
|
|
71
72
|
dockerImage,
|
|
72
73
|
"serve",
|
|
73
74
|
"--dev-addr",
|
|
@@ -85,4 +86,4 @@ const runMkdocsServer = async (options) => {
|
|
|
85
86
|
|
|
86
87
|
exports.runMkdocsServer = runMkdocsServer;
|
|
87
88
|
exports.waitForSignal = waitForSignal;
|
|
88
|
-
//# sourceMappingURL=mkdocsServer-
|
|
89
|
+
//# sourceMappingURL=mkdocsServer-0af6527d.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mkdocsServer-0af6527d.cjs.js","sources":["../../src/lib/run.ts","../../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 */\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 kill 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","/*\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 stdoutLogFunc?: LogFunc;\n stderrLogFunc?: LogFunc;\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 dockerImage,\n 'serve',\n '--dev-addr',\n `0.0.0.0:${port}`,\n ],\n {\n stdoutLogFunc: options.stdoutLogFunc,\n stderrLogFunc: options.stderrLogFunc,\n },\n );\n }\n\n return await run('mkdocs', ['serve', '--dev-addr', `127.0.0.1:${port}`], {\n stdoutLogFunc: options.stdoutLogFunc,\n stderrLogFunc: options.stderrLogFunc,\n });\n};\n"],"names":["spawn"],"mappings":";;;;AACO,MAAM,GAAG,GAAG,OAAO,IAAI,EAAE,IAAI,GAAG,EAAE,EAAE,OAAO,GAAG,EAAE,KAAK;AAC5D,EAAE,IAAI,EAAE,CAAC;AACT,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;AACnD,EAAE,MAAM,GAAG,GAAG;AACd,IAAI,GAAG,OAAO,CAAC,GAAG;AAClB,IAAI,WAAW,EAAE,MAAM;AACvB,IAAI,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,KAAK,IAAI,GAAG,EAAE,GAAG,EAAE;AAC3C,GAAG,CAAC;AACJ,EAAE,MAAM,KAAK,GAAG;AAChB,IAAI,SAAS;AACb,IAAI,aAAa,GAAG,MAAM,GAAG,SAAS;AACtC,IAAI,aAAa,GAAG,MAAM,GAAG,SAAS;AACtC,GAAG,CAAC;AACJ,EAAE,MAAM,YAAY,GAAGA,mBAAK,CAAC,IAAI,EAAE,IAAI,EAAE;AACzC,IAAI,KAAK;AACT,IAAI,GAAG,OAAO;AACd,IAAI,GAAG;AACP,GAAG,CAAC,CAAC;AACL,EAAE,IAAI,aAAa,IAAI,YAAY,CAAC,MAAM,EAAE;AAC5C,IAAI,YAAY,CAA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,IAAI,aAAa,EAAE,OAAO,CAAC,aAAa;AACxC,IAAI,aAAa,EAAE,OAAO,CAAC,aAAa;AACxC,GAAG,CAAC,CAAC;AACL;;;;;"}
|
|
@@ -4,20 +4,20 @@ var path = require('path');
|
|
|
4
4
|
var utility = require('./utility-51f4a306.cjs.js');
|
|
5
5
|
var backendCommon = require('@backstage/backend-common');
|
|
6
6
|
var pluginTechdocsNode = require('@backstage/plugin-techdocs-node');
|
|
7
|
-
var PublisherConfig = require('./PublisherConfig-
|
|
7
|
+
var PublisherConfig = require('./PublisherConfig-7a0dc71c.cjs.js');
|
|
8
8
|
require('winston');
|
|
9
9
|
require('@backstage/config');
|
|
10
10
|
|
|
11
|
-
async function publish(
|
|
12
|
-
const logger = utility.createLogger({ verbose:
|
|
13
|
-
const config = PublisherConfig.PublisherConfig.getValidConfig(
|
|
11
|
+
async function publish(opts) {
|
|
12
|
+
const logger = utility.createLogger({ verbose: opts.verbose });
|
|
13
|
+
const config = PublisherConfig.PublisherConfig.getValidConfig(opts);
|
|
14
14
|
const discovery = backendCommon.SingleHostDiscovery.fromConfig(config);
|
|
15
15
|
const publisher = await pluginTechdocsNode.Publisher.fromConfig(config, { logger, discovery });
|
|
16
16
|
const { isAvailable } = await publisher.getReadiness();
|
|
17
17
|
if (!isAvailable) {
|
|
18
18
|
return Promise.reject(new Error(""));
|
|
19
19
|
}
|
|
20
|
-
const [namespace, kind, name] =
|
|
20
|
+
const [namespace, kind, name] = opts.entity.split("/");
|
|
21
21
|
const entity = {
|
|
22
22
|
kind,
|
|
23
23
|
metadata: {
|
|
@@ -25,10 +25,10 @@ async function publish(cmd) {
|
|
|
25
25
|
name
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
const directory = path.resolve(
|
|
28
|
+
const directory = path.resolve(opts.directory);
|
|
29
29
|
await publisher.publish({ entity, directory });
|
|
30
30
|
return true;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
exports["default"] = publish;
|
|
34
|
-
//# sourceMappingURL=publish-
|
|
34
|
+
//# sourceMappingURL=publish-efa348a5.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish-efa348a5.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 { SingleHostDiscovery } from '@backstage/backend-common';\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 = SingleHostDiscovery.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","SingleHostDiscovery","Publisher","resolve"],"mappings":";;;;;;;;;;AAKe,eAAe,OAAO,CAAC,IAAI,EAAE;AAC5C,EAAE,MAAM,MAAM,GAAGA,oBAAY,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;AACzD,EAAE,MAAM,MAAM,GAAGC,+BAAe,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;AACtD,EAAE,MAAM,SAAS,GAAGC,iCAAmB,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AAC3D,EAAE,MAAM,SAAS,GAAG,MAAMC,4BAAS,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;AAC9E,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,SAAS,CAAC,YAAY,EAAE,CAAC;AACzD,EAAE,IAAI,CAAC,WAAW,EAAE;AACpB,IAAI,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;AACzC,GAAG;AACH,EAAE,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACzD,EAAE,MAAM,MAAM,GAAG;AACjB,IAAI,IAAI;AACR,IAAI,QAAQ,EAAE;AACd,MAAM,SAAS;AACf,MAAM,IAAI;AACV,KAAK;AACL,GAAG,CAAC;AACJ,EAAE,MAAM,SAAS,GAAGC,YAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAC5C,EAAE,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;AACjD,EAAE,OAAO,IAAI,CAAC;AACd;;;;"}
|
|
@@ -7,7 +7,7 @@ var serveHandler = require('serve-handler');
|
|
|
7
7
|
var http = require('http');
|
|
8
8
|
var httpProxy = require('http-proxy');
|
|
9
9
|
var utility = require('./utility-51f4a306.cjs.js');
|
|
10
|
-
var mkdocsServer = require('./mkdocsServer-
|
|
10
|
+
var mkdocsServer = require('./mkdocsServer-0af6527d.cjs.js');
|
|
11
11
|
require('winston');
|
|
12
12
|
require('child_process');
|
|
13
13
|
|
|
@@ -86,18 +86,18 @@ function findPreviewBundlePath() {
|
|
|
86
86
|
return cliCommon.findPaths(__dirname).resolveOwn("dist/embedded-app");
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
async function serve(
|
|
90
|
-
const logger = utility.createLogger({ verbose:
|
|
89
|
+
async function serve(opts) {
|
|
90
|
+
const logger = utility.createLogger({ verbose: opts.verbose });
|
|
91
91
|
const isDevMode = Object.keys(process.env).includes("TECHDOCS_CLI_DEV_MODE") ? true : false;
|
|
92
92
|
const backstagePort = 3e3;
|
|
93
93
|
const backstageBackendPort = 7007;
|
|
94
|
-
const mkdocsDockerAddr = `http://0.0.0.0:${
|
|
95
|
-
const mkdocsLocalAddr = `http://127.0.0.1:${
|
|
96
|
-
const mkdocsExpectedDevAddr =
|
|
94
|
+
const mkdocsDockerAddr = `http://0.0.0.0:${opts.mkdocsPort}`;
|
|
95
|
+
const mkdocsLocalAddr = `http://127.0.0.1:${opts.mkdocsPort}`;
|
|
96
|
+
const mkdocsExpectedDevAddr = opts.docker ? mkdocsDockerAddr : mkdocsLocalAddr;
|
|
97
97
|
let mkdocsServerHasStarted = false;
|
|
98
98
|
const mkdocsLogFunc = (data) => {
|
|
99
99
|
const logLines = data.toString().split("\n");
|
|
100
|
-
const logPrefix =
|
|
100
|
+
const logPrefix = opts.docker ? "[docker/mkdocs]" : "[mkdocs]";
|
|
101
101
|
logLines.forEach((line) => {
|
|
102
102
|
if (line === "") {
|
|
103
103
|
return;
|
|
@@ -110,9 +110,10 @@ async function serve(cmd) {
|
|
|
110
110
|
};
|
|
111
111
|
logger.info("Starting mkdocs server.");
|
|
112
112
|
const mkdocsChildProcess = await mkdocsServer.runMkdocsServer({
|
|
113
|
-
port:
|
|
114
|
-
dockerImage:
|
|
115
|
-
|
|
113
|
+
port: opts.mkdocsPort,
|
|
114
|
+
dockerImage: opts.dockerImage,
|
|
115
|
+
dockerEntrypoint: opts.dockerEntrypoint,
|
|
116
|
+
useDocker: opts.docker,
|
|
116
117
|
stdoutLogFunc: mkdocsLogFunc,
|
|
117
118
|
stderrLogFunc: mkdocsLogFunc
|
|
118
119
|
});
|
|
@@ -127,7 +128,7 @@ async function serve(cmd) {
|
|
|
127
128
|
logger.error("mkdocs server did not start. Exiting. Try re-running command with -v option for more details.");
|
|
128
129
|
}
|
|
129
130
|
const port = isDevMode ? backstageBackendPort : backstagePort;
|
|
130
|
-
const httpServer = new HTTPServer(findPreviewBundlePath(), port,
|
|
131
|
+
const httpServer = new HTTPServer(findPreviewBundlePath(), port, opts.mkdocsPort, opts.verbose);
|
|
131
132
|
httpServer.serve().catch((err) => {
|
|
132
133
|
logger.error(err);
|
|
133
134
|
mkdocsChildProcess.kill();
|
|
@@ -141,4 +142,4 @@ Opening browser.`);
|
|
|
141
142
|
}
|
|
142
143
|
|
|
143
144
|
exports["default"] = serve;
|
|
144
|
-
//# sourceMappingURL=serve-
|
|
145
|
+
//# sourceMappingURL=serve-aa1ff626.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve-aa1ff626.cjs.js","sources":["../../src/lib/httpServer.ts","../../src/commands/serve/serve.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 mkdocsPort: number;\n private readonly verbose: boolean;\n\n constructor(\n backstageBundleDir: string,\n backstagePort: number,\n mkdocsPort: number,\n verbose: boolean,\n ) {\n this.proxyEndpoint = '/api/';\n this.backstageBundleDir = backstageBundleDir;\n this.backstagePort = backstagePort;\n this.mkdocsPort = mkdocsPort;\n this.verbose = verbose;\n }\n\n // Create a Proxy for mkdocs server\n private createProxy() {\n const proxy = httpProxy.createProxyServer({\n target: `http://localhost:${this.mkdocsPort}`,\n });\n\n return (request: http.IncomingMessage): [httpProxy, string] => {\n // If the request goes to /api/ we want to remove /api/ from the prefix of the request URL.\n // e.g. ['/', 'api', pathChunks]\n const [, , ...pathChunks] = request.url?.split('/') ?? [];\n const forwardPath = pathChunks.join('/');\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 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","/*\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 path from 'path';\nimport openBrowser from 'react-dev-utils/openBrowser';\nimport { findPaths } from '@backstage/cli-common';\nimport HTTPServer from '../../lib/httpServer';\nimport { runMkdocsServer } from '../../lib/mkdocsServer';\nimport { LogFunc, waitForSignal } from '../../lib/run';\nimport { createLogger } from '../../lib/utility';\n\nfunction findPreviewBundlePath(): string {\n try {\n return path.join(\n path.dirname(require.resolve('techdocs-cli-embedded-app/package.json')),\n 'dist',\n );\n } catch {\n // If the techdocs-cli-embedded-app package is not available it means we're\n // running a published package. For published packages the preview bundle is\n // copied to dist/embedded-app be the prepack script.\n //\n // This can be tested by running `yarn pack` and extracting the resulting tarball into a directory.\n // Within the extracted directory, run `npm install --only=prod`.\n // Once that's done you can test the CLI in any directory using `node <tmp-dir>/package <command>`.\n // eslint-disable-next-line no-restricted-syntax\n return findPaths(__dirname).resolveOwn('dist/embedded-app');\n }\n}\n\nexport default async function serve(opts: OptionValues) {\n const logger = createLogger({ verbose: opts.verbose });\n\n // Determine if we want to run in local dev mode or not\n // This will run the backstage http server on a different port and only used\n // for proxying mkdocs to the backstage app running locally (e.g. with webpack-dev-server)\n const isDevMode = Object.keys(process.env).includes('TECHDOCS_CLI_DEV_MODE')\n ? true\n : false;\n\n // TODO: Backstage app port should also be configurable as a CLI option. However, since we bundle\n // a backstage app, we define app.baseUrl in the app-config.yaml.\n // Hence, it is complicated to make this configurable.\n const backstagePort = 3000;\n const backstageBackendPort = 7007;\n\n const mkdocsDockerAddr = `http://0.0.0.0:${opts.mkdocsPort}`;\n const mkdocsLocalAddr = `http://127.0.0.1:${opts.mkdocsPort}`;\n const mkdocsExpectedDevAddr = opts.docker\n ? mkdocsDockerAddr\n : mkdocsLocalAddr;\n\n let mkdocsServerHasStarted = false;\n const mkdocsLogFunc: LogFunc = data => {\n // Sometimes the lines contain an unnecessary extra new line\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 logger.verbose(`${logPrefix} ${line}`);\n\n // When the server has started, open a new browser tab for the user.\n if (\n !mkdocsServerHasStarted &&\n line.includes(`Serving on ${mkdocsExpectedDevAddr}`)\n ) {\n mkdocsServerHasStarted = 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 logger.info('Starting mkdocs server.');\n const mkdocsChildProcess = await runMkdocsServer({\n port: opts.mkdocsPort,\n dockerImage: opts.dockerImage,\n dockerEntrypoint: opts.dockerEntrypoint,\n useDocker: opts.docker,\n stdoutLogFunc: mkdocsLogFunc,\n stderrLogFunc: mkdocsLogFunc,\n });\n\n // Wait until mkdocs server has started so that Backstage starts with docs loaded\n // Takes 1-5 seconds\n for (let attempt = 0; attempt < 30; attempt++) {\n await new Promise(r => setTimeout(r, 3000));\n if (mkdocsServerHasStarted) {\n break;\n }\n logger.info('Waiting for mkdocs server to start...');\n }\n\n if (!mkdocsServerHasStarted) {\n logger.error(\n 'mkdocs server did not start. Exiting. Try re-running command with -v option for more details.',\n );\n }\n\n const port = isDevMode ? backstageBackendPort : backstagePort;\n const httpServer = new HTTPServer(\n findPreviewBundlePath(),\n port,\n opts.mkdocsPort,\n opts.verbose,\n );\n\n httpServer\n .serve()\n .catch(err => {\n logger.error(err);\n mkdocsChildProcess.kill();\n process.exit(1);\n })\n .then(() => {\n // The last three things default/component/local/ don't matter. They can be anything.\n openBrowser(`http://localhost:${port}/docs/default/component/local/`);\n logger.info(\n `Serving docs in Backstage at http://localhost:${port}/docs/default/component/local/\\nOpening browser.`,\n );\n });\n\n await waitForSignal([mkdocsChildProcess]);\n}\n"],"names":["httpProxy","http","serveHandler","createLogger","path","findPaths","runMkdocsServer","openBrowser","waitForSignal"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAIe,MAAM,UAAU,CAAC;AAChC,EAAE,WAAW,CAAC,kBAAkB,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE;AACtE,IAAI,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;AACjC,IAAI,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;AACjD,IAAI,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;AACvC,IAAI,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;AACjC,IAAI,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AAC3B,GAAG;AACH,EAAE,WAAW,GAAG;AAChB,IAAI,MAAM,KAAK,GAAGA,6BAAS,CAAC,iBAAiB,CAAC;AAC9C,MAAM,MAAM,EAAE,CAAC,iBAAiB,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;AACnD,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,CAAC,OAAO,KAAK;AACxB,MAAM,IAAI,EAAE,EAAE,EAAE,CAAC;AACjB,MAAM,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC;AAC/G,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,OAAO,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;AAClC,KAAK,CAAC;AACN,GAAG;AACH,EAAE,MAAM,KAAK,GAAG;AAChB,IAAI,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;A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,CAAC,CAAC,CAAC;AACnB,GAAG,CAAC,CAAC;AACL,EAAE,MAAMC,0BAAa,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAC5C;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utility-51f4a306.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';\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"],"names":["winston"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"utility-51f4a306.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';\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"],"names":["winston"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACY,MAAC,sCAAsC,GAAG,CAAC,WAAW,KAAK;AACvE,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACpD,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE;AACxB,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC,6BAA6B,EAAE,WAAW,CAAC,6BAA6B,CAAC,CAAC,CAAC;AAChG,GAAG;AACH,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1B,EAAE;AACU,MAAC,YAAY,GAAG,CAAC;AAC7B,EAAE,OAAO,GAAG,KAAK;AACjB,CAAC,KAAK;AACN,EAAE,MAAM,MAAM,GAAGA,kBAAO,CAAC,YAAY,CAAC;AACtC,IAAI,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM;AACvC,IAAI,UAAU,EAAE;AAChB,MAAM,IAAIA,kBAAO,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,EAAEA,kBAAO,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;AACzE,KAAK;AACL,GAAG,CAAC,CAAC;AACL,EAAE,OAAO,MAAM,CAAC;AAChB;;;;;"}
|