Advanced Cookbook

Summary

The recipes here shouldn't need to be used except in very rare circumstances (if you're wondering if the current circumstance applies, it means it probably doesn't)

Upgrading all Dependencies

  • NOTE: this shouldn't be done but documented . ping @DendronTeam if you think you need to do this (you probably don't)
  1. Remove all build artifacts

  2. Remove yarn.lock at the top of the monorepo

    rm yarn.lock
    
  3. Run yarn setup

  4. Run tests to make sure everything is working correctly

  5. Commit the new yarn.lock file

  • NOTE: when you do this, you might end up updating other dependencies because of Semver. having a yarn.lock means that don't update dependencies even if a new dependency is available. in these cases, be sure to conduct Manual Testing when submitting the PR

Upgrading a single dependency

  1. Remove all build artifacts

  2. Run the following command at the top of the monorepo:

    yarn upgrade <name-of-package-to-upgrade>
    
  3. Run yarn setup

  4. Run tests to make sure everything is working correctly

  5. Commit the updated package.json and lockfile

  • This may make minor (*.*.X) upgrades to other packages as well, but that should be harmless.

Adding a new package

Example PR here: https://github.com/dendronhq/dendron/pull/3048

  1. Create the new package
    • NOTE: naming scheme is usually dendron-{name}
    cd packages
    cp -R _pkg-template dendron-viz
    
  2. Update the names
    • in package.json
      • replace $PKG_NAME with package name
      • replace $CURRENT_VERSION with current version in monorepo
  3. Add package to dendron-main.code-workspace
     {
       "path": "packages/dendron-viz"
     },
    
  4. Add new package to ../package.json (Private)
    "workspaces": {
       "packages": [
          ...
          "packages/common-test-utils",
    +      "packages/dendron-viz",
          "packages/engine-server",
          ...
    
  5. Add new package to ../bootstrap/scripts/watch.sh (Private)
    • NOTE: order matters. make sure that the package is added to that any package it depends on comes before and that packages that depend on it come after
      npx lerna run watch --parallel 
         \ --scope @dendronhq/common-all 
         \ --scope @dendronhq/common-server 
      +    \ --scope @dendronhq/dendron-viz
         \ --scope @dendronhq/engine-server 
         \ --scope @dendronhq/plugin-core 
         \ --scope @dendronhq/dendron-cli 
      
  6. Add new package to ../bootstrap/scripts/buildAll.js (Private)
    $(`npx lerna run build --scope @dendronhq/common-all`);
    $(`npx lerna run build --scope @dendronhq/common-server `);
    +$(`npx lerna run build --scope @dendronhq/dendron-viz `);
    $(`npx lerna run build --scope @dendronhq/engine-server `);
    $(`npx lerna run build --scope @dendronhq/pods-core `);
    
  7. Add to ../bootstrap/scripts/buildAllForTest.js (Private)

Verify New package

  1. Run yarn setup
  2. Run ts-node packages/dendron-viz/src/index.ts
ts-node packages/dendron-viz/src/index.ts
# hello world