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

[Upgrade Tool] Refactor #18995

Merged
merged 3 commits into from Dec 8, 2023
Merged

Conversation

Convly
Copy link
Member

@Convly Convly commented Dec 6, 2023

[V5 update for #18990]

What does it do?

  • Modified the CLI usage to match new criterias
    • upgrade Don't do anything and display the help
    • upgrade major Will try upgrading to the next available major (only if the project is already on the latest minor.patch version for the current major), if none is found, it'll abort
    • upgrade minor todo in another PR
    • upgrade patch todo in another PR
  • Refactored the overall structure of the upgrade package
    • src/cli/index.ts contains the overall definition of the CLI usage
    • src/cli/commands contains actual commands' definitions, including the one for the upgrade
    • The upgrade task is defined in the src/tasks directory and is directly called by the upgrade command
    • Every domain-related piece of logic has been split as individual modules available at src/modules/*
      • Each module has a consistent folder structure that can contain:
        • types.ts exports types related to the module
        • constants.ts exports constants related to the module
        • xyz.ts contains domain logic related to the module (usually it exports a factory to create related domain objects. e.g: xyzFactory())
        • index.ts is considered the public module API and only exports what can be used by anyone outside the module
        • A __tests__/ directory which contains domain-related tests
  • Added unit tests
  • Fixed lint & build issues
  • Bumped fs-extra from 10.0.0 to 10.1.0 to fix compatibility issues with memfs which is used for mocking fs during tests (see fs-extra's changelog and related issue / fix PR)

Why is it needed?

After discussing at length the scope of the upgrade tool internally, we've decided to modify it a bit (mainly related to available commands, options, and how they should behave)

This PR aims to refactor the tool to incorporate those changes while cleaning up the overall architecture.

How to test it?

  • Make sure your monorepository is up-to-date (install, setup, etc...)
  • From the examples/getstarted directory, use ../../packages/utils/upgrade/bin/upgrade.js <command> [...options] to test the upgrade CLI

Copy link
Contributor

github-actions bot commented Dec 6, 2023

Size Change: 0 B

Total Size: 627 kB

ℹ️ View Unchanged
Filename Size
examples/getstarted/build/bb4d0d527bdfb161bc5a.svg 2.33 kB
examples/getstarted/build/index.html 610 B
examples/getstarted/build/main.********.js 619 kB
examples/getstarted/build/runtime~main.********.js 4.23 kB

compressed-size-action

@Convly Convly force-pushed the upgrade-tool/refactor-v5 branch 2 times, most recently from 9c9bb2c to 759b8ea Compare December 6, 2023 17:05
Copy link
Member

@Bassel17 Bassel17 left a comment

Choose a reason for hiding this comment

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

LGTM, great work

@Convly Convly merged commit fdc903e into features/upgrade-tool Dec 8, 2023
83 checks passed
@Convly Convly deleted the upgrade-tool/refactor-v5 branch December 8, 2023 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants