Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: local registry #798

Merged
merged 78 commits into from
Aug 27, 2024
Merged

refactor: local registry #798

merged 78 commits into from
Aug 27, 2024

Conversation

BioPhoton
Copy link
Collaborator

@BioPhoton BioPhoton commented Aug 16, 2024

Precondition:

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

@github-actions github-actions bot added 📖 Project documentation improvements or additions to the project documentation 🔬 testing writing tests 🛠️ tooling labels Aug 16, 2024
Copy link

github-actions bot commented Aug 16, 2024

Code PushUp

🤨 Code PushUp report has both improvements and regressions – compared target commit bece330 with source commit f8f6b74.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Categories

🏷️ Category ⭐ Previous score ⭐ Current score 🔄 Score change
Performance 🔴 38 🟡 50 ↑ +12.5
Security 🟢 100 🟢 98 ↓ −1.6
Updates 🟡 78 🟡 78 ↓ −0.1
Code coverage 🟡 90 🟡 90 ↓ +0
Custom checks 🟡 67 🟡 67
Accessibility 🟢 91 🟢 91
Best Practices 🟢 100 🟢 100
SEO 🟡 61 🟡 61
Bug prevention 🟢 100 🟢 100
Code style 🟢 99 🟢 99
👍 1 group improved, 👎 3 groups regressed, 👍 5 audits improved, 👎 3 audits regressed, 13 audits changed without impacting score

🗃️ Groups

🔌 Plugin 🗃️ Group ⭐ Previous score ⭐ Current score 🔄 Score change
Lighthouse Performance 🔴 38 🟡 50 ↑ +12.5
JS Packages NPM audit 🟢 100 🟢 98 ↓ −1.6
JS Packages NPM outdated dependencies 🟡 78 🟡 78 ↓ −0.1
Code coverage Code coverage metrics 🟡 90 🟡 90 ↓ +0

16 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
Lighthouse Speed Index 🟥 12.7 s 🟥 6.5 s ↓ −49 %
Lighthouse Largest Contentful Paint 🟥 4.4 s 🟨 3.3 s ↓ −25 %
Lighthouse First Meaningful Paint 🟥 4.4 s 🟨 3.3 s ↓ −25 %
Lighthouse First Contentful Paint 🟥 3.8 s 🟥 3.3 s ↓ −13 %
JS Packages Vulnerabilities for NPM dev dependencies. 🟩 0 vulnerabilities 🟩 2 vulnerabilities (2 moderate) ↑ +∞ %
Lighthouse Time to Interactive 🟥 24.6 s 🟥 15.8 s ↓ −36 %
JS Packages Outdated NPM dev dependencies. 🟨 55 outdated package versions (30 major, 19 minor, 5 patch, 1 prerelease) 🟨 56 outdated package versions (31 major, 18 minor, 6 patch, 1 prerelease) ↑ +2 %
Code coverage Line coverage 🟩 91.9 % 🟩 91.9 % ↓ +0 %
Lighthouse Minimizes main-thread work 🟥 37.0 s 🟥 17.6 s ↓ −52 %
Lighthouse Total Blocking Time 🟥 18,340 ms 🟥 5,230 ms ↓ −72 %
Lighthouse Metrics 🟩 100% 🟩 100% ↓ −36 %
Lighthouse JavaScript execution time 🟥 14.9 s 🟥 8.2 s ↓ −45 %
Lighthouse Max Potential First Input Delay 🟥 5,460 ms 🟥 2,660 ms ↓ −51 %
Lighthouse Eliminate render-blocking resources 🟥 Potential savings of 1,500 ms 🟥 Potential savings of 680 ms ↓ −55 %
Lighthouse Avoids enormous network payloads 🟩 Total size was 1,807 KiB 🟩 Total size was 1,807 KiB ↓ +0 %
Lighthouse Reduce unused CSS 🟥 Potential savings of 106 KiB 🟥 Potential savings of 106 KiB ↑ +45 %
Lighthouse Network Round Trip Times 🟩 20 ms 🟩 140 ms ↑ +710 %
Lighthouse Uses efficient cache policy on static assets 🟨 27 resources found 🟨 27 resources found ↓ +0 %
Lighthouse Initial server response time was short 🟩 Root document took 420 ms 🟩 Root document took 500 ms ↑ +18 %
Lighthouse Server Backend Latencies 🟩 120 ms 🟩 180 ms ↑ +53 %
Lighthouse Avoids an excessive DOM size 🟥 2,213 elements 🟥 2,212 elements ↓ +0 %

489 other audits are unchanged.

# Conflicts:
#	global-setup.e2e.ts
#	tools/scripts/publish.plugin.ts
#	tools/scripts/start-local-registry.ts
#	tools/scripts/utils.ts
@github-actions github-actions bot removed the 🔬 testing writing tests label Aug 17, 2024
Copy link
Collaborator

@matejchalk matejchalk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the documentation effort 👍 Due to the size of this PR I have a lot of comments 😅

CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
tools/src/verdaccio/utils.ts Outdated Show resolved Hide resolved
tools/src/verdaccio/utils.ts Show resolved Hide resolved
tools/src/publish/types.ts Outdated Show resolved Hide resolved
global-setup.e2e.ts Outdated Show resolved Hide resolved
tools/src/verdaccio/start-local-registry.ts Outdated Show resolved Hide resolved
matejchalk
matejchalk previously approved these changes Aug 26, 2024
tools/src/npm/README.md Outdated Show resolved Hide resolved
docs/e2e.md Outdated Show resolved Hide resolved
docs/e2e.md Outdated Show resolved Hide resolved
BioPhoton and others added 2 commits August 26, 2024 16:26
Co-authored-by: Matěj Chalk <[email protected]>
Co-authored-by: Matěj Chalk <[email protected]>
@BioPhoton BioPhoton merged commit e0d7e7f into main Aug 27, 2024
30 checks passed
@BioPhoton BioPhoton deleted the start-registry-2 branch August 27, 2024 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📖 Project documentation improvements or additions to the project documentation 🔬 testing writing tests 🛠️ tooling 🧩 utils
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants