question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Help with plugin development and publishing on NPM

See original GitHub issue

Hi 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:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
loreanvictorcommented, Aug 14, 2021

@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 either main or master branches, but I suspect you can configure the action even further.

1reaction
danielsitnikcommented, Aug 13, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Learn How to Develop and Publish an NPM Package - Auth0
Learn, through a practical tutorial, what tools we can leverage to develop and publish high-quality NPM packages.
Read more >
Creating and publishing private packages - npm Docs
To share your code with a limited set of users or teams, you can publish private user-scoped or organization-scoped packages to the npm...
Read more >
A Simple Guide to Publishing an npm Package - Medium
In this guide, I will walk you through the process of building and publishing a simple package to the npm registry.
Read more >
Best practices for creating a modern npm package - Snyk
Let's first get acquainted with the process of creating and publishing an npm package by using a simple example. If you're already familiar...
Read more >
Why publishing your own npm packages can make you a ...
For example, the popular request package enables developers to make http calls by simplifying the functions needed to handle all the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found