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

Cherry-picking monorepo CI scripts to 0.71-stable #35946

Merged
merged 8 commits into from
Jan 25, 2023

Commits on Jan 24, 2023

  1. refactor(circleci/template): publish all packages to Verdaccio before…

    … template initialization
    
    Summary:
    Changelog:
    [Internal] [Changed] - now bootstrapping Verdaccio before template app initialization, this is required because react-native migh depend on some package which version is not yet published to npm
    
    Differential Revision: D41521496
    
    fbshipit-source-id: 7a32d4de80ff1de0840760380cda410bed626808
    hoxyq authored and Ruslan Lesiutin committed Jan 24, 2023
    Configuration menu
    Copy the full SHA
    bdd901e View commit details
    Browse the repository at this point in the history
  2. feat(react-native-github): automate publishing bumped packages via ci…

    …rcleci (facebook#35621)
    
    Summary:
    Pull Request resolved: facebook#35621
    
    Changelog: [Internal]
    
    1. Added `for-each-package.js` script. This can be used to iterate through all of the packages inside `/packages` with the access to package manifest. This soon can be used as a replacement for `yarn workspaces --info`
    2. Added `find-and-publish-all-bumped-packages.js` script. This script iterates through all the packages and detects if the version was changed via `git log -p` (same as `git diff`). If so, it tries to publish it to npm.
    3. Added corresponding job and workflow to CircleCI config, which will use this script
    
    Reviewed By: cortinico
    
    Differential Revision: D41972733
    
    fbshipit-source-id: d9de31365d5a68381d3326674ca12608472a6f96
    hoxyq authored and Ruslan Lesiutin committed Jan 24, 2023
    Configuration menu
    Copy the full SHA
    7e3d13b View commit details
    Browse the repository at this point in the history
  3. refactor(scripts): use forEachPackage instead of yarn workspaces info

    Summary:
    Changelog: [Internal]
    
    These changes add usage of `forEachPackage` as a replacement for `yarn --json workspaces info`.
    
    This is because at some point in release cycle there is a script which removed `workspaces` block from react-native's `package.json`, so `yarn --info workspaces info` produces an error
    
    Reviewed By: cortinico
    
    Differential Revision: D41996732
    
    fbshipit-source-id: f1f89c6766aed213df6f1fb18305925ff2e4928c
    hoxyq authored and Ruslan Lesiutin committed Jan 24, 2023
    Configuration menu
    Copy the full SHA
    a7f2b3b View commit details
    Browse the repository at this point in the history
  4. feat(react-native-github): automate publishing bumped packages via ci…

    …rcleci
    
    Summary:
    Changelog: [Internal]
    
    1. Added `for-each-package.js` script. This can be used to iterate through all of the packages inside `/packages` with the access to package manifest. This soon can be used as a replacement for `yarn workspaces --info`
    2. Added `find-and-publish-all-bumped-packages.js` script. This script iterates through all the packages and detects if the version was changed via `git log -p` (same as `git diff`). If so, it tries to publish it to npm.
    3. Added corresponding job and workflow to CircleCI config, which will use this script
    
    Differential Revision: D41972733
    
    fbshipit-source-id: 6a8b8c2995943d6c8421cbe19cd291069655183b
    Ruslan Lesiutin committed Jan 24, 2023
    Configuration menu
    Copy the full SHA
    058defb View commit details
    Browse the repository at this point in the history
  5. 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: 54b667adb3ee5f28d19ee9c7991570451549aac2
    hoxyq authored and Ruslan Lesiutin committed Jan 24, 2023
    Configuration menu
    Copy the full SHA
    ce9a79e View commit details
    Browse the repository at this point in the history
  6. refactor(scripts/monorepo/tests): moved related tests to scripts/mono…

    …repo/__tests__
    
    Summary:
    Changelog: [Internal]
    just a small cleanup, moved all tests related to monorepo scripts under `/scripts/monorepo`
    
    Reviewed By: cortinico
    
    Differential Revision: D42308455
    
    fbshipit-source-id: 7743a2af1381ff748556c15b89cf980f8f907674
    hoxyq authored and Ruslan Lesiutin committed Jan 24, 2023
    Configuration menu
    Copy the full SHA
    6a3752e View commit details
    Browse the repository at this point in the history
  7. refactor(bump-all-updated-packages): support force-bump to next minor…

    … version of the package (facebook#35810)
    
    Summary:
    Pull Request resolved: facebook#35810
    
    Changelog: [Internal]
    
    `bump-all-updated-packages` script now supports `release-branch-cutoff` argument
    
    If this argument is provided, the script will bump each public package to next minor version
    
    Updated [wiki](https://github.com/facebook/react-native/wiki/Release-and-its-automated-processes) with relevant information about how to use it
    
    Reviewed By: cortinico
    
    Differential Revision: D42455329
    
    fbshipit-source-id: a40d2f5dc356f22d3182da3a118c6383b634817d
    hoxyq authored and Ruslan Lesiutin committed Jan 24, 2023
    Configuration menu
    Copy the full SHA
    1ca223f View commit details
    Browse the repository at this point in the history
  8. feat(react-native/template): use verdaccio to publish local packages …

    …before testing template app (facebook#35444)
    
    Summary:
    Pull Request resolved: facebook#35444
    
    Changelog:
    [Internal][Changed] - now using Verdaccio to publish necessary packages for template app
    
    - Adds script `/scripts/template/install-dependencies.js`, which incapsulates the logic of installing dependencies of template app
    - The idea of the script is to run verdaccio and publish all necessary packages to node_modules, since these packages might not yet be present on npm
    - This should also potentially resolve some template app test failures on CircleCI related to package-ifying Animated, VirtualizedList, FlatList modules
    
    Reviewed By: cortinico
    
    Differential Revision: D41498086
    
    fbshipit-source-id: 48fbbb1c9334e7a9e7657e6275b7b04f9ce290b5
    hoxyq authored and Ruslan Lesiutin committed Jan 24, 2023
    Configuration menu
    Copy the full SHA
    526c194 View commit details
    Browse the repository at this point in the history