Dev

Gotchas

Dependency Management of IDendronExtension

As you will likely notice currently we have plenty of usage of static reach out to get an instance of DendronExtension through call out to getExtension() this is causing a myriad of circular dependencies.

You will also notice that getExtension() call is now marked @deprecated. Going forward we should be using IDendronExtension and preferably use constructor injection of IDendronExtension. Currently the interface is injected into command constructors upon initialization.

If you are unable to constructor inject IDendronExtension to the required dependency (there really shouldn't be a reason long term but in the medium term it could be cost prohibitive to do mass refactors), in that case use ExtensionProvider to get a hold of IDendronExtension.

Also at the time of this writing IDendronExtension does not have everything that DendronExtension has. The plan is to refactor piece by piece: if you need a concrete implementation that is within DendronExtension that is not yet within IDendronExtension the plan is to add the interface at that time.

Highly highly avoid adding concrete imports into IDendronExtension since that will likely just re-introduce circular dependencies. Follow the Dependency inversion principle "Depend upon abstractions not concretions".

Cleaning up artifacts

Compiled javascript doesn't get deleted from plugin-core/out which means that deleting a typescript file won't remove it from the compiled javascript. If you are seeing an error that you can't explain, try deleting the out folder by running the following command

cd packages/plugin-core
rm -rf out
yarn compile

Run

  1. Follow steps from Dendron Plugin Quickstart to get started
  2. Run the Extension: Local (plugin-core) Launch Task (Private).

Tips

Regular Workflow

  1. Checkout a feature branch for your task
  2. Work on code
  3. Submit a Review

Getting Help

Dendron is actively being developed and it could be quite confusing to start developing for the first time. In this case, we recommend asking for help with whatever blockers you might have with setting up or understanding part of the codebase.

Generally, a member of the Dendron team or the community will chime in for help if you post a specific question in the #dev channel in our Discord server.

For more information, check out our handbook entry on Getting help for development described here

Advanced

Working with the API Server

Dendron connects to a local express server which is responsible for indexing your notes. This express server also serves up static files generated by Dendron Next Server.

Dendron compiles the static assets from the next server to the express server during publication so that everything is bundled when published. When you are developing, you can launch the next server independently for faster development. You can follow the instructions here to start the next-server.

To start Dendron with the next server active, you can set the following value in dendron.yml

dev:
  nextServerUrl: "http://localhost:3000"

Working with the CLI

Symlink dendron

cd packages/dendorn-cli
npm link

npm link -g @dendronhq/dendron-cli

Working with Verdaccio

Verdaccio is an open source local NPM registry. We use it to test out publishing and link together projects internally before publishing

  • NOTE: only run verdaccio when you need to test publishing. otherwise, this will pollute the yarn.lock file with localhost entries which will fail in CI/CD


Children
  1. Best
  2. Build
  3. Cook
  4. Deploy
  5. Errors Encountered
  6. Logs
  7. Run
  8. Trouble

Backlinks