Skip to content
/ lerna Public
forked from lerna/lerna

🐉 A tool for managing JavaScript projects with multiple packages.

License

Notifications You must be signed in to change notification settings

okonech/lerna

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Merna

A tool for managing JavaScript projects with multiple packages.

MERNA (Meditech Lerna)

Before you begin:

  • Login to NPM (via your CLI)
  • Clone this repository (pull latest changes)

Debug Merna Commands with npm link

  • This will use the merna audit command as an example

  • navigate to the command's folder (commands/audit) and run 'npm link'

    • This will symlink your merna repo's version of the command for use in the merna cli
    • repeat this for every command you want to test
  • navigate to the exported cli core module (core/lerna) and run 'npm link'

    • This will symlink the merna cli which allows running newly created and unpublished commands
    • This step is only necessary if testing an unpublished command not already handled by a merna cli
  • From the webapi-server repo (or whichever test repo) run 'npm link [command]' for each symlinked command

  • If the core cli module was symlinked, run 'npm link lerna'

  • The commands are now testable and VSCode Debugger can be used with no additional configuration


Merna Audit

  • Symlink the merna repo to the monorepo you wish to run Audit over

    • View "Debug Merna Commands with npm link" for steps on how to do this
  • The merna Audit command can be run with the following:

    • audit

      • This will run the audit over the entire monorepo, but it will not make any changes packages
      • If any available audit fixes or errors are found, they are caught and documented in the package dir
      • After running "Audit", there are 3 files you can expect to see:
        • path/to/package/lerna-audit-fixes.txt - containing any available audit fixes
        • path/to/package/lerna-audit-err.txt - containing any errors during
        • path/to/package/audit.json - package.json with hoisted and local dependencies removed
          • if you wish to apply any of the fixes, rename audit.json to package.json.
            • Be sure to keep the copy of your original package.json.
            • audit.json is ONLY there to provide a means of quickly being able to manually apply changes.
          • if any dependencies or versions changed, add them back to your original package.json before committing any changes
            • audit --fix & audit --force-fix do this for you automatically
    • audit --fix [RECOMMENDED]

      • This will run the audit over the entire monorepo, applying any [non-breaking] fixes where it can.
      • Once the audit has finished, navigate to source control and view any changes made in the package.json & package-lock.json
    • audit --force-fix

      • This will run the audit over the entire monorepo, applying ALL fixes where it can.
      • Once the audit has finished, navigate to source control and view any changes made in the package.json & package-lock.json
      • Be sure to run tests to make sure no breaking changes were introduced

Follow these steps to Publish or Update a Package to NPM:

  • In your CLI, navigate to the directory containing the package[.json] that you wish to publish
    • Example "unhoist": "merna/commands/unhoist/"
  • Checkout the publish-packages branch
    • git checkout publish-packages
  • Rebase from master (resolve any conflicts if necessary)
    • git rebase -i origin/master
  • "Undogfood" all dependencies in the package.json
    • To "Undogfood" simply means to replace any dependency paths in the package.json, with its current version
      • i.e. "dependencies": {
        "@lerna/child-process": "file:../../core/child-process",
        }
      • To "undogfood" this, get the version of the package from its package.json
        • In this case, we find that "@lerna/child-process" is located in the directory:
          merna/core/child-process/
        • Upon evaluating the package.json, we find that its current version is at:
          3.16.5
      • Now replace the path, with the version. Your new entry should look like this:
      • "dependencies": {
        "@lerna/child-process": "3.16.5",
        }
    • Repeat this process for all dependencies in the package.json
  • If you're updating a package, make sure to bump the version number in the package.json.
    • i.e. merna/unhoist/package.json changes from "version": "1.0.1" to "version": "1.0.2"
  • Commit your changes to the branch
  • Publish the package by simply running the following
    • npm publish

About

🐉 A tool for managing JavaScript projects with multiple packages.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 97.6%
  • TypeScript 2.4%