cli icon indicating copy to clipboard operation
cli copied to clipboard

refactor: local registry

Open BioPhoton opened this issue 6 months ago • 2 comments

Precondition:

  • #796

[!NOTE] It looks rather chunky but 25 of the files are renaming a target and 5 files are deleted. To make it easier to review I added comments for the deleted code blocks and their new location. I also added excessive docs to help debug and explain the current situation.

I suggest starting with the CONTRIBUTING.md and then dive into the comments.

This PR does not change the previous flow nor fixes bigger issues in the setup. It focuses on maintainability and documentation as well as good error handling and user feedback.

This PR includes:

  • move all files to TS 🔥
  • verdaccio
    • separated logic into verdaccio folder and created plugin to add targets dynamically
    • control port number
    • unique folder per port for storage and registry folder
    • added docs
  • npm
    • separated logic into npm folder and created plugin to add targets dynamically
    • intro bin folder for all executed scripts and added error handling and process exit
    • dynamic targets:
      • nx npm-check <project-name> --pkgVersion=<version>
      • nx npm-install <project-name> --pkgVersion=<version> --registry=<registry> --tag=<tag>
      • nx npm-uninstall <project-name> --pkgVersion=<version> --registry=<registry> --tag=<tag>
      • added docs
  • publish
    • separated logic into npm and publish folder and created plugins to add targets dynamically
    • intro bin folder for all executed scripts and added error handling and process exit
    • untangle Nx graph logic out of publish script
    • install packages only if they do not exist in the registry already
      • nx npm-check <project-name> --pkgVersion=<version>
      • nx publish <project-name> --nextVersion=<version> --registry=<registry> --tag=<tag>
    • added docs
  • updates CONTRIBUTORS.md with information on the current e2e process

Before:

  • nx e2e cli-e2e
    • global-setup.e2e.ts
      • tools/scripts/start-registry.ts - one globally shared registry
        • publish.mjs all packages
        • npm install <package-name> all packages
      • npm uninstall <package-name> all packages

After:

  • nx e2e cli-e2e
    • global-setup.e2e.ts
      • nx start-verdaccio - one registry per e2e project but still one globally shared npm env (node_modules folder, npm config)
      • nx publish <project-name> all packages
      • nx npm-install <project-name> all packages
      • nx npm-uninstall <project-name> all packages

BioPhoton avatar Aug 16 '24 02:08 BioPhoton