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

feat(react-native-github): a script to automate patch version bumping of packages #35767

Closed
wants to merge 1 commit into from

Commits on Jan 10, 2023

  1. feat(react-native-github): a script to automate patch version bumping…

    … of packages (facebook#35767)
    
    Summary:
    Pull Request resolved: facebook#35767
    
    Changelog: [Internal]
    
    Introducing a script, which can be used to identify all packages inside `/packages`, which contain any changes after the last time its version was changed
    
    How it works step by step:
    
    ```
    check that no git changes are present
    
    for each package:
        if package is private -> skip
    
        grep id of the last commit that changed package
        grep id of the last commit that changed version of the package
    
        if these ids are different:
            bump package patch version
    
    commit changes if required
    ```
    
    Can be executed only in git environment and by running: `node ./scripts/bump-all-updated-packages`
    
     ---
    
    Also adding a separate script `align-package-versions.js`, which can be used to update versions of packages inside consumer packages
    
    ```
    check that no git changes are present
    
    for each package x:
       for each package y:
           if y has x as dependency:
               validate that y uses the latest version of x
    
    if some changes were made:
       run yarn
    ```
    
     ---
    
    Q: Why `run_yarn` step was removed from CircleCI flow?
    A: For *-stable branches, there are no yarn workspaces and all packages are specified as direct dependencies, so if we update `react-native/assets-registry` to the next version, we won't be able to run `yarn` for react-native root package, because updated version is not yet published to npm
    
    To avoid this, we first need publish new versions and then update them in consumer packages
    
     ---
    The final flow:
    1. Developer uses `node ./scripts/bump-all-updated-packages` to bump versions of all updated packages.
    2. Commit created from step 1 being merged or directly pushed to `main` or `*-stable` branches
    3. A workflow from CircleCI publishes all updated versions to npm
    4. Developer can use `align-package-versions.js` script to create required changes to align all packages versions
    
    Reviewed By: cortinico
    
    Differential Revision: D42295344
    
    fbshipit-source-id: 1a4bbe33a996a93af37a6642ed4a11341066e6ee
    hoxyq authored and facebook-github-bot committed Jan 10, 2023
    Configuration menu
    Copy the full SHA
    104a05f View commit details
    Browse the repository at this point in the history