Git Product home page Git Product logo

backstage / techdocs-cli Goto Github PK

View Code? Open in Web Editor NEW
14.0 13.0 19.0 5.44 MB

Former repository housing the utility CLI for managing TechDocs sites in Backstage (now in the main backstage/backstage monorepo)

Home Page: https://github.com/backstage/backstage/tree/master/packages/techdocs-cli

License: Apache License 2.0

Shell 1.40% JavaScript 1.90% TypeScript 94.23% HTML 2.47%
backstage techdocs-cli hacktoberfest cli

techdocs-cli's Introduction

techdocs-cli

Development of the TechDocs CLI has moved back to the backstage/backstage monorepo.

See you there, friends!

techdocs-cli's People

Contributors

adamdmharvey avatar andrewthauer avatar bodilb avatar camilaibs avatar dependabot[bot] avatar dhenneke avatar dorn- avatar egnwd avatar emmaindal avatar github-actions[bot] avatar hooloovooo avatar iameap avatar mertcb avatar minkimcello avatar orkohunter avatar ottosichert avatar rbideau avatar realandersn avatar soapraj avatar stephane-mori avatar taras avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

techdocs-cli's Issues

`techdocs-cli serve` opens port 3000 but the page does not exist

The serve command seems to start the mkdocs server at port 8000 and Backstage app on 3000.

▶ /Users/himanshum/workspace/github.com/backstage/techdocs-cli/packages/techdocs-cli/bin/techdocs-cli serve
[techdocs-preview-bundle] Running local version of Backstage at http://localhost:3000
INFO    -  Building documentation...
WARNING -  Config value: 'dev_addr'. Warning: The use of the IP address '0.0.0.0' suggests a production environment or the use of a proxy to connect to the MkDocs server. However, the MkDocs' server is intended for local development purposes only. Please use a third party production-ready server instead.
INFO    -  Cleaning site directory
INFO    -  Documentation built in 0.17 seconds
[I 201221 12:56:11 server:335] Serving on http://0.0.0.0:8000
INFO    -  Serving on http://0.0.0.0:8000
[I 201221 12:56:11 handlers:62] Start watching changes
INFO    -  Start watching changes
[I 201221 12:56:11 handlers:64] Start detecting changes
INFO    -  Start detecting changes
[I 201221 12:56:12 handlers:135] Browser Connected: http://0.0.0.0:8000/
INFO    -  Browser Connected: http://0.0.0.0:8000/
[I 201221 12:56:12 handlers:82] Ignore: /usr/local/lib/python3.8/site-packages/mkdocs/templates/sitemap.xml
INFO    -  Ignore: /usr/local/lib/python3.8/site-packages/mkdocs/templates/sitemap.xml

However, visiting http://localhost:3000/docs/local/dev/env/ gives me a 404 page.

Screenshot 2020-12-21 at 14 01 26

@hooloovooo What do you recommend?

techdocs-cli serve command shows warning about building documentation

The following warning shows up when previewing documentation.

image

I see the same thing in backstage as well and suspect it's related to recent backstage package dependency updates. I haven't looked into the underlying issue yet to know if it's in the CLI or perhaps @backstage/plugin-techdocs (more likely). However, this particular warning does not seem like it should be displayed here. Might require maybe added a setting to disable it the techdocs-cli can use.

techdocs serve does not work

what:
when running techdocs serve it does not work

env:
MacOS 10.15.7

$ techdocs-cli --version
0.5.0
$ cat mkdocs.yml
site_name: 'site'
site_description: 'desc'

plugins:
  - techdocs-core

nav:
  - Overview:
      - goal: 'overview/goal.md'
$ npx --version               
6.14.13

logs:

$ techdocs-cli serve -v
info: Starting mkdocs server.
info: Waiting for mkdocs server to start...
verbose: [docker/mkdocs] INFO     -  Building documentation...
verbose: [docker/mkdocs] WARNING  -  Config value: 'dev_addr'. Warning: The use of the IP address '0.0.0.0' suggests a production environment or the use of a proxy to connect to the MkDocs server. However, the MkDocs' server is intended for local development purposes only. Please use a third party production-ready server instead.
verbose: [docker/mkdocs] INFO     -  Cleaning site directory
verbose: [docker/mkdocs] INFO     -  The following pages exist in the docs directory, but are not included in the "nav" configuration:
verbose: [docker/mkdocs]   - index.md
verbose: [docker/mkdocs] INFO     -  Documentation built in 0.23 seconds
verbose: [docker/mkdocs] Traceback (most recent call last):
verbose: [docker/mkdocs]   File "/usr/local/bin/mkdocs", line 8, in <module>
verbose: [docker/mkdocs]     sys.exit(cli())
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1137, in __call__
verbose: [docker/mkdocs]     return self.main(*args, **kwargs)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1062, in main
verbose: [docker/mkdocs]     rv = self.invoke(ctx)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1668, in invoke
verbose: [docker/mkdocs]     return _process_result(sub_ctx.command.invoke(sub_ctx))
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
verbose: [docker/mkdocs]     return ctx.invoke(self.callback, **ctx.params)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/click/core.py", line 763, in invoke
verbose: [docker/mkdocs]     return __callback(*args, **kwargs)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/mkdocs/__main__.py", line 173, in serve_command
verbose: [docker/mkdocs]     serve.serve(dev_addr=dev_addr, livereload=livereload, **kwargs)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/mkdocs/commands/serve.py", line 78, in serve
verbose: [docker/mkdocs]     server = config['plugins'].run_event('serve', server, config=config, builder=builder)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/mkdocs/plugins.py", line 94, in run_event
verbose: [docker/mkdocs]     result = method(item, **kwargs)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/mkdocs_monorepo_plugin/plugin.py", line 67, in on_serve
verbose: [docker/mkdocs]     buildfunc = list(server.watcher._tasks.values())[0]['func']
verbose: [docker/mkdocs] AttributeError: 'LiveReloadServer' object has no attribute 'watcher'
info: Waiting for mkdocs server to start...
info: Waiting for mkdocs server to start...
info: Waiting for mkdocs server to start...
info: Waiting for mkdocs server to start...
info: Waiting for mkdocs server to start...
info: Waiting for mkdocs server to start...
info: Waiting for mkdocs server to start...
info: Waiting for mkdocs server to start...
info: Waiting for mkdocs server to start...
error: mkdocs server did not start. Exiting. Try re-running command with -v option for more details.
Non zero exit code from child process

relevant issues:
mkdocs/mkdocs#2446

The 0.6.0 release is missing the --azureAccountKey parameter when publishing

LS,

I've bumped our own pipelines to use the latest and greatest techdocs-cli in order to fix an issue we are facing described here: backstage/backstage#6069 (comment)

I updated from 0.3.1 to 0.6.0 and since then my pipelines break because the techdocs-cli does not support the --azureAccountKey parameter anymore. I can't find any documentation whether this is intentional or a bug, by my guess is that this is by accident since the documentation on the trunk still talks still contains this parameter.

To simply reproduce run:

npx @techdocs/[email protected] publish --publisher-type azureBlobStorage --azureAccountName accountName --azureAccountKey key --storage-name container --entity entity

This will result in the error: error: unknown option '--azureAccountKey'

or

npx @techdocs/[email protected] publish -h

npx command failing

I'm trying to execute npx @techdocs/cli generate --verbose command but is failing with:

info: Using source dir /path/to/repos/techdocs-cli
info: Will output generated files in /path/to/repos/techdocs-cli/site
warn: The 'techdocs.generators.techdocs' configuration key is deprecated and will be removed in the future. Please use 'techdocs.generator' instead.
info: Generating documentation...
Failed to generate docs from /path/to/repos/techdocs-cli into /path/to/repos/techdocs-cli/site with error Cannot read property 'info' of undefined

Tried with args --verbose --no-docker and got the same result.


Repository used for docs: github.com/backstage/techdocs-cli
Versions:

$ npx @techdocs/cli --version
0.4.1

$ npx --version
6.14.13

$ node --version
v14.17.3

The error does not occur when building from master branch

v0.3.6 release broke the generate command

Running techdocs-cli generate --no-docker --verbose stopped working with the v0.3.6 release. If I roll back to v0.3.5, the same command works. Relevant logs:

info: Using source dir /home/runner/work/developer-portal/developer-portal
info: Will output generated files in /home/runner/work/developer-portal/developer-portal/site
verbose: Creating output directory if it does not exist.
Cannot read property 'getOptionalString' of undefined

The same error is observed by other users as per this message on Discord

Bug: not working with markdown_extensions : md_in_html

Bug: Should remove trailing whitespace in HTML tags.

I have markdown content inside HTML tag.
For example, the following:

<div markdown="1">

This is a *Markdown* Paragraph.

</div>

...is rendered as:

<div>
<p>This is a <em>Markdown</em> Paragraph.</p>
</div>

However, it breaks when there's trailing whitespace

For example, the following:

<div markdown = "1">

This is a *Markdown* Paragraph.

</div>

...is rendered as:

<div>
<p>= "1"&gt;</p>
<p>This is a <em>Markdown</em> Paragraph.</p>
</div>

Expected behavior:

Should be rendered as:

<div>
<p>This is a <em>Markdown</em> Paragraph.</p>
</div>

Context:

techdocs-cli --version 0.7.0

Note

This seems not to be a bug of mkdocs. If I run mkdocs:serve (version 1.2.2), I get the expected behaviour.
Only happens if I run techdocs-cli serve:mkdocs

serve:mkdocs fails to start when a mkdocs project is located in a directory with spaces

The following is displayed when the project under use is in a path that contains spaces.

verbose: [docker/mkdocs] docker: invalid reference format.
verbose: [docker/mkdocs] See 'docker run --help'.

This line does not quote the path for the docker command. https://github.com/backstage/techdocs-cli/blob/main/packages/techdocs-cli/src/lib/mkdocsServer.ts#L36

Add single quotes around the content resolves the issue.

server isn't running when using npx @techdocs/cli serve

Trying to preview docs using techdocs cli and seeing an error message.

Command:

npx @techdocs/cli serve

Error:

ld: warning: object file (<path>) was built for newer macOS version (11.0) than being linked (10.13)
info: Starting mkdocs server.
info: Waiting for mkdocs server to start...
info: Waiting for mkdocs server to start...
info: Waiting for mkdocs server to start...
info: Waiting for mkdocs server to start...
info: Waiting for mkdocs server to start...
info: Waiting for mkdocs server to start...
info: Waiting for mkdocs server to start...
info: Waiting for mkdocs server to start...
info: Waiting for mkdocs server to start...
info: Waiting for mkdocs server to start...
error: mkdocs server did not start. Exiting. Try re-running command with -v option for more details.
info: Serving docs in Backstage at http://localhost:3000/docs/default/component/local/
Opening browser.

The browser window opens and waits, then eventually becomes a blank screen. I'm assuming the server isn't running at all.

Techdocs CLI fails to import a module upon hitting serve

I have an mkdoc setup in a repo (external to my backstage repo). I'm trying to run techdocs-cli from a folder which contains mkdocs documentation but i get the following:

$ npx run @techdocs/cli serve
npx: installed 5 in 1.147s
Watching /Users/swistak/code/notifications and all sub-directories not excluded by your .gitignore. Will not monitor dotfiles.

Starting: @techdocs/cli serve
internal/modules/cjs/loader.js:969
  throw err;
  ^

Error: Cannot find module '/Users/swistak/code/notifications/@techdocs/cli'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}


I'm not sure if the repo containing docs needs to be an npm repo? Why? It appears that there's no dist or src folder in the cli uploaded to npm

Investigate if the Backstage mono-repo app can be removed in favor of running techdocs individually

Ref: backstage/backstage#2707 (comment)

techdocs-cli has a Backstage mono-repo in packages/embedded-techdocs which is used in the techdocs-cli serve command. Instead of spinning up an entire Backstage app, we could just run a development environment of the TechDocs plugin. This feature was broken until recently for many months; and hence @hooloovooo and I decided to just go ahead with an embedded app.

But the embedded-techdocs way of serving TechDocs comes with a lot of complexity (mono-repo inside a mono-repo, the Backstage packages get outdated quickly, the custom APIs need to be adjusted...). So, investigate if it's possible to spin up just the TechDocs plugin for the techdocs-cli serve command, without starting a Backstage app.

Version 0.8.0 of the package is missing the dist folder

Unless I'm doing something horribly wrong, I'm under the impression @techdocs/[email protected] is missing the dist folder which results in the following

npx techdocs-cli generate
node:internal/modules/cjs/loader:357
      throw err;
      ^

Error: Cannot find module '/Users/aris.plakias/Workspace/repos/product-licenses/node_modules/@techdocs/cli/dist/index.cjs.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (node:internal/modules/cjs/loader:349:19)
    at Function.Module._findPath (node:internal/modules/cjs/loader:562:18)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:927:27)
    at Function.Module._load (node:internal/modules/cjs/loader:774:27)
    at Module.require (node:internal/modules/cjs/loader:1013:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at Object.<anonymous> (/Users/aris.plakias/Workspace/repos/product-licenses/node_modules/@techdocs/cli/bin/techdocs-cli:25:3)
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Module.load (node:internal/modules/cjs/loader:989:32) {
  code: 'MODULE_NOT_FOUND',
  path: '/Users/aris.plakias/Workspace/repos/product-licenses/node_modules/@techdocs/cli/package.json',
  requestPath: '..'

Add support for endpoint config for AWS publisher

Support for configuring the endpoint for aws publisher was added in backstage with backstage/backstage#4867 and should be added to techdocs-cli when the next version of backstage is released.

Implementation

Add an optional parameter awsEndpoint to the publish command which the user can set when publisher type is set to awsS3.

See #36 for additional reference.

`techdocs-cli:serve` doesn't display the docs

When running techdocs-cli serve (or npx @techdocs/cli) in the latest version 0.3.4, the browser only displays a white page with the following errors:

image

Seems like some migrations were not applied to the app after the latest update, but I'm not sure which are missing.

Check readiness before publishing

Context

In backstage/backstage#5260, we moved run-time checks for storage availability out of the Publisher::fromConfig constructor and into a separate readiness method.

We should update to the version of techdocs-common that includes this change, and when we do so, invoke the readiness method in the publish command to provide the same error/success feedback that we provided previously.

refresh the lockfile to automatically remove the vulnerability introduced by node-forge

Hi, @emmaindal, I have reported a vulnerability issue in package google-p12-pem.

As far as I am aware, vulnerability CVE-2020-7720 detected in package node-forge(<0.10.0) is directly referenced by  [email protected], on which your package @techdocs/[email protected] transitively depends. As such, this vulnerability can also affect @techdocs/[email protected] via the following path:
@techdocs/[email protected] ➔ @backstage/[email protected][email protected] ➔ @google-cloud/[email protected] ➔ @google-cloud/[email protected][email protected][email protected][email protected][email protected](vulnerable version)

Since google-p12-pem has released a new patched version [email protected] to resolve this issue ([email protected][email protected](fix version)), then this vulnerability patch can be automatically propagated into your project only if you update your lockfile. The following is your new dependency path :
@techdocs/[email protected] ➔ @backstage/[email protected][email protected] ➔ @google-cloud/[email protected] ➔ @google-cloud/[email protected][email protected][email protected][email protected][email protected](vulnerability fix version).

A warm tip.^_^
Best regards,
Paimon

generate not working

Use case

I'm unable to generate any documentation from the .md files. I tried with different ways and it always fail with the following error: Failed to generate docs from /input into input/site with error spawn mkdocs ENOENT.
The following is a series of steps to reproduce this issue.

While on the console:

  1. Clone the sample repository.
  2. Position yourself on the directory mock-docs (which contains the mkdocs.yml file).
  3. Run the command techdocs-cli generate --no-docker --verbose.

The output should be something like:
info: Using source /dir techdocs-container-main/mock-docs
info: Will output generated files in /techdocs-container-main/mock-docs/site
verbose: Creating output directory if it does not exist.
info: Generating documentation...
Failed to generate docs from /techdocs-container-main/mock-docs into /techdocs-container-main/mock-docs/site with error spawn mkdocs ENOENT

Expeced behaviour

The command should generate the documentation and store it under the /site directory.

Context

techdocs-cli: 0.7.0
mkdocs-techdocs-core: 0.1.2
mkdocs: 1.2.2

Edit: formating

Add support for roleArn config for AWS publisher

Allow techdocs-cli publish command to authenticate with AWS using roleArn config.

Implementation

Add an optional paramater awsRoleArn to the publish command which the user can set when publisher type is set to awsS3.

Split this config constructor block for awsS3 and googleGcs publishers. In the awsS3 block, if awsRoleArn is provided by the CLI user, assign it as credentials (see config schema).

For reference, see how roleArn is taken from config and passed to the AWS SDK for authentication.

0.8.0 release does not have dist

Today I started getting:

Cannot find module '/home/runner/.npm/_npx/451/lib/node_modules/@techdocs/cli/dist/index.cjs.js'. Please verify that the package.json has a valid "main" entry

I've checked:

$ npm i @techdocs/[email protected]
$ ls node_modules/@techdocs/cli/dist
cjs  esm  index.cjs.js  index.cjs.js.map  index.d.ts  index.esm.js  index.esm.js.map  techdocs-preview-bundle
$ ls node_modules/@techdocs/cli
bin  CHANGELOG.md  dist  package.json  README.md
$ npm i @techdocs/[email protected]
$ ls node_modules/@techdocs/cli/dist
ls: cannot access 'node_modules/@techdocs/cli/dist': No such file or directory
$ ls node_modules/@techdocs/cli
bin  CHANGELOG.md  package.json  README.md

Looks like the new version release build failed.

TechDocs serve not killing process

While improving the tests in #169 (comment) occasionally the serve process on port 8000 is not terminated, causing subsequent tests to fail, or trying to start the server locally.

The server has been observed to not terminate specifically when using then --no-docker flag, although this is not 100% reproducible. Without the --no-docker flag we weren't able to reproduce this behaviour yet.

Worth noting: in #169 we bumped the usage of latest TechDocs common package, and use the default docker image provided by it

This is a follow-up from

Possibly related:

Expected Behavior

  • Run npx @techdocs/cli serve --no-docker or npx @techdocs/cli serve:mkdocs--no-docker
  • Abort command, or kill with SIGTERM
  • MkDocs server is not running anymore

Current Behavior

  • Run techdocs-cli serve --no-docker or techdocs-cli serve:mkdocs--no-docker
  • Abort command, or kill with SIGTERM
  • MkDocs server is still running, occasionally

Your Environment

  • TechDocs CLI version 0.8.2

techdocs-cli serve --no-docker loads a blank page

Running techdocs-cli serve --no-docker serves up a blank page with error in the devtools console (See below)

Expected Behavior

TechDocs preview should load the content and not show a white blank page.

Current Behavior

Blank Page with the following error in the devtools console

react-dom.production.min.js:209 
        
       Error: No implementation available for apiRef{plugin.search.queryservice}
    at u (index.esm.js:51)
    at B (index-9c0d67e6.esm.js:154)
    at Yi (react-dom.production.min.js:153)
    at wo (react-dom.production.min.js:261)
    at pu (react-dom.production.min.js:246)
    at fu (react-dom.production.min.js:246)
    at ru (react-dom.production.min.js:239)
    at react-dom.production.min.js:123
    at t.unstable_runWithPriority (scheduler.production.min.js:19)
    at Bl (react-dom.production.min.js:122)
to @ react-dom.production.min.js:209
n.payload @ react-dom.production.min.js:227
di @ react-dom.production.min.js:129
Ua @ react-dom.production.min.js:179
wo @ react-dom.production.min.js:263
pu @ react-dom.production.min.js:246
fu @ react-dom.production.min.js:246
ru @ react-dom.production.min.js:239
(anonymous) @ react-dom.production.min.js:123
t.unstable_runWithPriority @ scheduler.production.min.js:19
Bl @ react-dom.production.min.js:122
ql @ react-dom.production.min.js:123
$l @ react-dom.production.min.js:122
wu @ react-dom.production.min.js:257
t.unstable_runWithPriority @ scheduler.production.min.js:19
Bl @ react-dom.production.min.js:122
bu @ react-dom.production.min.js:257
(anonymous) @ react-dom.production.min.js:256
F @ scheduler.production.min.js:17
_.port1.onmessage @ scheduler.production.min.js:14
react-dom.production.min.js:209 
        
       Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at Ou (react-dom.production.min.js:275)
    at react-dom.production.min.js:148
    at Aa (react-dom.production.min.js:182)
    at Ua (react-dom.production.min.js:181)
    at wo (react-dom.production.min.js:263)
    at pu (react-dom.production.min.js:246)
    at fu (react-dom.production.min.js:246)
    at ru (react-dom.production.min.js:239)
    at react-dom.production.min.js:123
    at t.unstable_runWithPriority (scheduler.production.min.js:19)
to @ react-dom.production.min.js:209
n.callback @ react-dom.production.min.js:226
pi @ react-dom.production.min.js:131
ao @ react-dom.production.min.js:212
vu @ react-dom.production.min.js:255
t.unstable_runWithPriority @ scheduler.production.min.js:19
Bl @ react-dom.production.min.js:122
gu @ react-dom.production.min.js:248
ru @ react-dom.production.min.js:239
(anonymous) @ react-dom.production.min.js:123
t.unstable_runWithPriority @ scheduler.production.min.js:19
Bl @ react-dom.production.min.js:122
ql @ react-dom.production.min.js:123
$l @ react-dom.production.min.js:122
wu @ react-dom.production.min.js:257
t.unstable_runWithPriority @ scheduler.production.min.js:19
Bl @ react-dom.production.min.js:122
bu @ react-dom.production.min.js:257
(anonymous) @ react-dom.production.min.js:256
F @ scheduler.production.min.js:17
_.port1.onmessage @ scheduler.production.min.js:14
scheduler.production.min.js:14 
        
       Uncaught Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at Ou (react-dom.production.min.js:275)
    at react-dom.production.min.js:148
    at Aa (react-dom.production.min.js:182)
    at Ua (react-dom.production.min.js:181)
    at wo (react-dom.production.min.js:263)
    at pu (react-dom.production.min.js:246)
    at fu (react-dom.production.min.js:246)
    at ru (react-dom.production.min.js:239)
    at react-dom.production.min.js:123
    at t.unstable_runWithPriority (scheduler.production.min.js:19)

Steps to Reproduce

Either install latest version of techdocs-cli @ version 0.8.3 or run npx @techdocs/cli serve --no-docker inside a techdocs repo

Context

When performing local preview of techdocs content, we prefer to run it through the techdocs-cli preview without the performance impact of running docker.

When running the preview with docker, the preview works fine.

This issue seems similar to a past issue here: backstage/backstage#2135

Your Environment

MacOS 10.15.7
Node v14.17.0
npm v6.14.13
techdocs-cli v0.8.3

techdocs-cli serve WSOD (v0.3.5) when mkdocs.yml contains edit_uri

First time trying techdocs-cli on an existing mkdocs project. Installed 0.3.5 of techdocs-cli

The mkdocs project renders and serves fine with techdocs-cli serve:mkdocs However with the just the 'serve' command it starts to render the Backstage UI in the browser, then errors:

JSConsole shows:

Error: Missing required config value at 'integrations.github'
    at b.getConfigArray (index.esm.js:104)
    at index.esm.js:240
    at index.esm.js:973
    at Array.forEach (<anonymous>)
    at J (index.esm.js:972)
    at index.esm.js:1104
    at ro (react-dom.production.min.js:211)
    at gu (react-dom.production.min.js:257)
    at e.unstable_runWithPriority (scheduler.production.min.js:19)
    at Wl (react-dom.production.min.js:122)

The rendered js looks like:

const addGitFeedbackLink = (configApi) => {
  return (dom) => {
    const sourceAnchor = dom.querySelector('[title="Edit this page"]');
    if (!sourceAnchor || !sourceAnchor.href) {
      return dom;
    }
    let gitHost = "";
    const sourceURL = new URL(sourceAnchor.href);
    const githubHosts = configApi.getConfigArray("integrations.github").map((integration) => integration.data.host);
    const gitlabHosts = configApi.getConfigArray("integrations.gitlab").map((integration) => integration.data.host);
    if (githubHosts.includes(sourceURL.hostname) || sourceURL.origin.includes("github")) {
      gitHost = "github";
    } else if (gitlabHosts.includes(sourceURL.hostname) || sourceURL.origin.includes("gitlab")) {
      gitHost = "gitlab";
    } else {
      return dom;
    }
    const title = dom.querySelector("article>h1").childNodes[0].textContent;
    const issueTitle = encodeURIComponent(`Documentation Feedback: ${title}`);
    const issueDesc = encodeURIComponent(`Page source:
${sourceAnchor.href}

Feedback:`);
    const repoPath = sourceURL.pathname.split("/").slice(0, 3).join("/");
    const feedbackLink = sourceAnchor.cloneNode();
    switch (gitHost) {
      case "gitlab":
        feedbackLink.href = `${sourceURL.origin}${repoPath}/issues/new?issue[title]=${issueTitle}&issue[description]=${issueDesc}`;
        break;
      case "github":
        feedbackLink.href = `${sourceURL.origin}${repoPath}/issues/new?title=${issueTitle}&body=${issueDesc}`;
        break;
      default:
        return dom;
    }
    ReactDOM.render(React.createElement(FeedbackOutlinedIcon), feedbackLink);
    feedbackLink.style.paddingLeft = "5px";
    feedbackLink.title = "Leave feedback for this page";
    feedbackLink.id = "git-feedback-link";
    sourceAnchor == null ? void 0 : sourceAnchor.insertAdjacentElement("beforebegin", feedbackLink);
    return dom;
  };

node --version
v16.0.0
OSX Big Sur
Latest Chrome

Private gitlab repo, also

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.