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

Replace install-test-workspace with usePnpmSyncForInjectedDependencies=true #4530

Merged
merged 13 commits into from
Feb 27, 2024

Conversation

g-chao
Copy link
Contributor

@g-chao g-chao commented Feb 21, 2024

Summary

Before, the install-test-worspace is a standalone pnpm workspace project inside Rushstack.
Now, we have integrated the pnpm-sync feature, so we can refactor this project to use pnpm-sync to manage injected dependencies.

Details

  1. Enable usePnpmSyncForInjectedDependencies in experiments.json
  2. Move the install-test-worspace folders into a new Rush category folder build-tests-subspace

👉 This PR introduces injected dependencies but not subspaces yet. The folder is named build-tests-subspace because a future PR will enable the Rush subspaces feature to reintroduce a separate lockfile for these projects.

How it was tested

  • Make sure all CI checks passed in the new set up
  • Confirm that the feature works with rush:
    1. Build the repo with rush build
    2. Add console.log("TEST 1") to rush-lib/src/index.ts
    3. Run incremental build: rush build --to rush-lib-test --verbose
    4. Confirm that cd rush-lib-test && node lib/start.js prints TEST 1, showing the updated files were copied successfully
  • Confirm that the feature works with rushx:
    1. Add console.log("TEST 2") to rush-lib/src/index.ts
    2. cd rush-lib && rushx build
    3. Confirm that cd rush-lib-test && node lib/start.js prints TEST 2, showing the updated files were again copied successfully

Impacted documentation

N/A

@g-chao g-chao changed the title WIP: enable pnpm-sync Turn on usePnpmSyncForInjectedDependencies Feb 21, 2024
@g-chao g-chao changed the title Turn on usePnpmSyncForInjectedDependencies Refactor install-test-workspace Feb 21, 2024
common/config/rush/browser-approved-packages.json Outdated Show resolved Hide resolved
rush.json Outdated Show resolved Hide resolved
rush.json Outdated Show resolved Hide resolved
@iclanton
Copy link
Member

The new projects should have build cache configured.

@octogonz octogonz changed the title Refactor install-test-workspace Replace install-test-workspace with usePnpmSyncForInjectedDependencies=true Feb 27, 2024
@@ -129,6 +129,10 @@ These GitHub repositories provide supplementary resources for Rush Stack:
| [/build-tests-samples/heft-web-rig-library-tutorial](./build-tests-samples/heft-web-rig-library-tutorial/) | (Copy of sample project) Building this project is a regression test for Heft |
Copy link
Collaborator

Choose a reason for hiding this comment

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

image

It can be fixed in a separate PR, but this log notice can be improved.

  1. Like the build cache notices, it should only be shown when invoking rush build --verbose.

  2. Also I would suggest to improve the formatting of the message:

    pnpm-sync: Copied 107 files in 95ms from C:\Git\rushstack\libraries\terminal
    
  3. It seems pnpmSyncCopy() is printing this message directly to the console. We should improve the API to provide a messaging callback that allows the output to be redirected and (ideally) optionally reformatted. Something like this:

    pnpmSyncCopy({
      pnpmSyncJsonPath,
      messageCallback: ({ message, messageKind: 'error'|'warning'|'info'|'verbose'|'timing', messageId, details }) => {
        if (messageKind === 'verbose' && !debug) {
          return;
        }
        switch (messageId) {
          case 'sync-finished':
            // customized logging; the structure of details can depend on messageId
            terminal.writeLine(colors.green('pnpm-sync') 
              + ` copied ${details.fileCount} files in ${details.totalMs} ms from ${details.sourcePath}`);
            break;
          default:
            // simple preformatted logging
            if (messageKind === 'error' | messageKind === 'warning') {
              console.error(message);
            } else {
              console.log(message);
            }
            break;
        }
      }
    })

    This would ensure that Rush (and in the future PNPM) has full ownership of its CLI UX.

@g-chao @iclanton

Copy link
Collaborator

Choose a reason for hiding this comment

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

@octogonz octogonz merged commit b856fc9 into microsoft:main Feb 27, 2024
5 checks passed
iclanton added a commit to iclanton/rushstack that referenced this pull request Feb 28, 2024
iclanton added a commit to iclanton/rushstack that referenced this pull request Feb 28, 2024
iclanton added a commit that referenced this pull request Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants