Help with plugin development and publishing on NPM
See original GitHub issueHi guys. This a followup to my earlier issue #115.
I have managed to develop the plugin and its working like a charm when the source files are placed inside the .codedoc
folder.
However, I’m having errors when I bundle it into an NPM package and then install it into a fresh new project.
I have followed the same pattern of the coding-blog-plugin, so the package.json
and the Typescript configurations are exactly the same.
Right now I’m testing locally, so I do an npm link
inside the .codedoc folder to reference what would be the NPM package.
Here’s the output of the codedoc serve
command:
# Serving ...
# Fetching project configuration ...
[INFO] 13:13:31 ts-node-dev ver. 1.1.6 (using ts-node ver. 9.1.1, typescript ver. 3.9.10)
# Serving docs on http://localhost:3000
# building ........ docs/md/index.md
# BUILD FAILED!!
# ERROR in index.md
Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
There is nothing special inside index.md
, it fails even if there’s just plain text there.
And this is the output of codedoc build
:
# Building ...
# Fetching project configuration ...
# building ........ docs/md/index.md
(node:87550) UnhandledPromiseRejectionWarning: Error: # ERROR in index.md
Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
at /Users/daniel.sitnik/Dev/mermaid-test/.codedoc/node_modules/@codedoc/core/src/build/index.ts:54:19
at Object.error (/Users/daniel.sitnik/Dev/mermaid-test/.codedoc/node_modules/rxline/src/line/handle-error.ts:18:13)
at SafeSubscriber.__tryOrUnsub (/Users/daniel.sitnik/Dev/mermaid-test/.codedoc/node_modules/rxjs/src/internal/Subscriber.ts:265:10)
at SafeSubscriber.error (/Users/daniel.sitnik/Dev/mermaid-test/.codedoc/node_modules/rxjs/src/internal/Subscriber.ts:220:16)
at Subscriber._error (/Users/daniel.sitnik/Dev/mermaid-test/.codedoc/node_modules/rxjs/src/internal/Subscriber.ts:143:22)
at Subscriber.error (/Users/daniel.sitnik/Dev/mermaid-test/.codedoc/node_modules/rxjs/src/internal/Subscriber.ts:113:12)
at MergeMapSubscriber.SimpleOuterSubscriber.notifyError (/Users/daniel.sitnik/Dev/mermaid-test/.codedoc/node_modules/rxjs/src/internal/innerSubscribe.ts:70:22)
at SimpleInnerSubscriber._error (/Users/daniel.sitnik/Dev/mermaid-test/.codedoc/node_modules/rxjs/src/internal/innerSubscribe.ts:34:17)
at SimpleInnerSubscriber.Subscriber.error (/Users/daniel.sitnik/Dev/mermaid-test/.codedoc/node_modules/rxjs/src/internal/Subscriber.ts:113:12)
at /Users/daniel.sitnik/Dev/mermaid-test/.codedoc/node_modules/rxjs/src/internal/util/subscribeToPromise.ts:12:30
(node:87550) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:87550) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
The code can be cloned from my repo: https://github.com/danielsitnik/codedoc-mermaid-plugin/tree/develop
Appreciate it if @loreanvictor could please take a look at this. Thanks!
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
@danielsitnik something like this?
If you need to run some tests before publishing, this might be a good example as well.
Note that these will only publish to NPM when the version specified in
package.json
is increased and that change is pushed to eithermain
ormaster
branches, but I suspect you can configure the action even further.Ahhh yes yes! There are some Github actions for publishing to NPM. I did add one but it was being triggered on new releases, I just need to tweak it to publish when I merge to the
main
branch.