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
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

| [/build-tests-samples/heft-webpack-basic-tutorial](./build-tests-samples/heft-webpack-basic-tutorial/) | (Copy of sample project) Building this project is a regression test for Heft |
| [/build-tests-samples/packlets-tutorial](./build-tests-samples/packlets-tutorial/) | (Copy of sample project) Building this project is a regression test for @rushstack/eslint-plugin-packlets |
| [/build-tests-subspace/rush-lib-test](./build-tests-subspace/rush-lib-test/) | A minimal example project that imports APIs from @rushstack/rush-lib |
| [/build-tests-subspace/rush-sdk-test](./build-tests-subspace/rush-sdk-test/) | A minimal example project that imports APIs from @rushstack/rush-sdk |
| [/build-tests-subspace/typescript-newest-test](./build-tests-subspace/typescript-newest-test/) | Building this project tests Heft with the newest supported TypeScript compiler version |
| [/build-tests-subspace/typescript-v4-test](./build-tests-subspace/typescript-v4-test/) | Building this project tests Heft with TypeScript v4 |
| [/build-tests/api-documenter-scenarios](./build-tests/api-documenter-scenarios/) | Building this project is a regression test for api-documenter |
| [/build-tests/api-documenter-test](./build-tests/api-documenter-test/) | Building this project is a regression test for api-documenter |
| [/build-tests/api-extractor-d-cts-test](./build-tests/api-extractor-d-cts-test/) | Building this project is a regression test for api-extractor |
Expand Down Expand Up @@ -167,7 +171,6 @@ These GitHub repositories provide supplementary resources for Rush Stack:
| [/build-tests/heft-web-rig-library-test](./build-tests/heft-web-rig-library-test/) | A test project for Heft that exercises the '@rushstack/heft-web-rig' package |
| [/build-tests/heft-webpack4-everything-test](./build-tests/heft-webpack4-everything-test/) | Building this project tests every task and config file for Heft when targeting the web browser runtime using Webpack 4 |
| [/build-tests/heft-webpack5-everything-test](./build-tests/heft-webpack5-everything-test/) | Building this project tests every task and config file for Heft when targeting the web browser runtime using Webpack 5 |
| [/build-tests/install-test-workspace](./build-tests/install-test-workspace/) | |
| [/build-tests/localization-plugin-test-01](./build-tests/localization-plugin-test-01/) | Building this project exercises @microsoft/localization-plugin. This tests that the plugin works correctly without any localized resources. |
| [/build-tests/localization-plugin-test-02](./build-tests/localization-plugin-test-02/) | Building this project exercises @microsoft/localization-plugin. This tests that the loader works correctly with the exportAsDefault option unset. |
| [/build-tests/localization-plugin-test-03](./build-tests/localization-plugin-test-03/) | Building this project exercises @microsoft/localization-plugin. This tests that the plugin works correctly with the exportAsDefault option set to true. |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/heft/v0/heft.schema.json",

// TODO: Add comments
"extends": "local-node-rig/profiles/default/config/heft.json",

"phasesByName": {
"build": {
"cleanFiles": [{ "includeGlobs": ["lib", "dist"] }],
Expand Down
7 changes: 7 additions & 0 deletions build-tests-subspace/rush-lib-test/config/rig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// The "rig.json" file directs tools to look for their config files in an external package.
// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",

"rigPackageName": "local-node-rig"
}
42 changes: 42 additions & 0 deletions build-tests-subspace/rush-lib-test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "rush-lib-test",
"version": "0.0.0",
"private": true,
"description": "A minimal example project that imports APIs from @rushstack/rush-lib",
"license": "MIT",
"scripts": {
"build": "heft build --clean",
"start": "node lib/start.js",
"_phase:build": "heft run --only build -- --clean"
},
"dependencies": {
"@microsoft/rush-lib": "workspace:*",
"@rushstack/terminal": "workspace:*"
},
"devDependencies": {
"local-node-rig": "workspace:*",
"@rushstack/eslint-config": "workspace:*",
"@rushstack/heft": "workspace:*",
"@rushstack/heft-lint-plugin": "workspace:*",
"@rushstack/heft-typescript-plugin": "workspace:*",
g-chao marked this conversation as resolved.
Show resolved Hide resolved
"@types/node": "18.17.15",
"typescript": "~5.3.3"
},
"dependenciesMeta": {
"@microsoft/rush-lib": {
"injected": true
},
"@rushstack/terminal": {
"injected": true
},
"@rushstack/heft": {
"injected": true
},
"@rushstack/heft-lint-plugin": {
"injected": true
},
"@rushstack/heft-typescript-plugin": {
"injected": true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ console.log('rush-lib-test loading Rush configuration...');
// instead of the normal .d.ts rollup
import { RushConfiguration } from '@microsoft/rush-lib/lib/';

const config = RushConfiguration.loadFromDefaultLocation();
const config: RushConfiguration = RushConfiguration.loadFromDefaultLocation();
console.log(config.commonFolder);

console.log('Calling an internal API...');
Expand All @@ -16,7 +16,7 @@ console.log('Calling an internal API...');
import { VersionMismatchFinder } from '@microsoft/rush-lib/lib/logic/versionMismatch/VersionMismatchFinder';
import { ConsoleTerminalProvider, Terminal } from '@rushstack/terminal';

const terminal = new Terminal(new ConsoleTerminalProvider());
const terminal: Terminal = new Terminal(new ConsoleTerminalProvider());
VersionMismatchFinder.ensureConsistentVersions(config, terminal);

console.log(new ConsoleTerminalProvider().supportsColor);
25 changes: 25 additions & 0 deletions build-tests-subspace/rush-sdk-test/config/heft.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/heft/v0/heft.schema.json",

"extends": "local-node-rig/profiles/default/config/heft.json",

"phasesByName": {
"build": {
"cleanFiles": [{ "includeGlobs": ["lib", "dist"] }],

"tasksByName": {
"typescript": {
g-chao marked this conversation as resolved.
Show resolved Hide resolved
"taskPlugin": {
"pluginPackage": "@rushstack/heft-typescript-plugin"
}
},
"lint": {
"taskDependencies": ["typescript"],
"taskPlugin": {
"pluginPackage": "@rushstack/heft-lint-plugin"
}
}
}
}
}
}
7 changes: 7 additions & 0 deletions build-tests-subspace/rush-sdk-test/config/rig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// The "rig.json" file directs tools to look for their config files in an external package.
// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",

"rigPackageName": "local-node-rig"
}
42 changes: 42 additions & 0 deletions build-tests-subspace/rush-sdk-test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "rush-sdk-test",
"version": "0.0.0",
"private": true,
"description": "A minimal example project that imports APIs from @rushstack/rush-sdk",
"license": "MIT",
"scripts": {
"build": "heft build --clean",
"start": "node lib/start.js",
"_phase:build": "heft run --only build -- --clean"
},
"dependencies": {
"@rushstack/rush-sdk": "workspace:*"
},
"devDependencies": {
"local-node-rig": "workspace:*",
"@rushstack/eslint-config": "workspace:*",
"@rushstack/heft": "workspace:*",
"@rushstack/heft-lint-plugin": "workspace:*",
g-chao marked this conversation as resolved.
Show resolved Hide resolved
"@rushstack/heft-typescript-plugin": "workspace:*",
"@microsoft/rush-lib": "workspace:*",
"@types/node": "18.17.15",
"typescript": "~5.3.3"
},
"dependenciesMeta": {
"@microsoft/rush-lib": {
"injected": true
},
"@rushstack/rush-sdk": {
"injected": true
},
"@rushstack/heft": {
"injected": true
},
"@rushstack/heft-lint-plugin": {
"injected": true
},
"@rushstack/heft-typescript-plugin": {
"injected": true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ console.log('rush-sdk-test loading Rush configuration...');
// instead of the normal .d.ts rollup
import { RushConfiguration } from '@rushstack/rush-sdk/lib/';

const config = RushConfiguration.loadFromDefaultLocation();
const config: RushConfiguration = RushConfiguration.loadFromDefaultLocation();
console.log(config.commonFolder);

console.log('Calling an internal API...');
Expand Down
7 changes: 7 additions & 0 deletions build-tests-subspace/typescript-newest-test/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');

module.exports = {
extends: ['@rushstack/eslint-config/profile/node'],
parserOptions: { tsconfigRootDir: __dirname }
};
25 changes: 25 additions & 0 deletions build-tests-subspace/typescript-newest-test/config/heft.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/heft/v0/heft.schema.json",

"extends": "local-node-rig/profiles/default/config/heft.json",

"phasesByName": {
"build": {
"cleanFiles": [{ "includeGlobs": ["lib", "dist"] }],

"tasksByName": {
"typescript": {
"taskPlugin": {
"pluginPackage": "@rushstack/heft-typescript-plugin"
}
},
"lint": {
"taskDependencies": ["typescript"],
"taskPlugin": {
"pluginPackage": "@rushstack/heft-lint-plugin"
}
}
}
}
}
}
7 changes: 7 additions & 0 deletions build-tests-subspace/typescript-newest-test/config/rig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// The "rig.json" file directs tools to look for their config files in an external package.
// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",

"rigPackageName": "local-node-rig"
}
36 changes: 36 additions & 0 deletions build-tests-subspace/typescript-newest-test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "typescript-newest-test",
"description": "Building this project tests Heft with the newest supported TypeScript compiler version",
"version": "1.0.0",
"private": true,
"main": "lib/index.js",
"license": "MIT",
"scripts": {
"build": "heft build --clean",
"_phase:build": "heft run --only build -- --clean"
},
"devDependencies": {
"local-node-rig": "workspace:*",
"@rushstack/eslint-config": "workspace:*",
"@rushstack/heft": "workspace:*",
"@rushstack/heft-lint-plugin": "workspace:*",
"@rushstack/heft-typescript-plugin": "workspace:*",
"typescript": "~5.3.3",
"tslint": "~5.20.1",
"eslint": "~8.7.0"
},
"dependenciesMeta": {
"@rushstack/eslint-config": {
"injected": true
},
"@rushstack/heft": {
"injected": true
},
"@rushstack/heft-lint-plugin": {
"injected": true
},
"@rushstack/heft-typescript-plugin": {
"injected": true
}
}
}
7 changes: 7 additions & 0 deletions build-tests-subspace/typescript-v4-test/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');

module.exports = {
extends: ['@rushstack/eslint-config/profile/node'],
parserOptions: { tsconfigRootDir: __dirname }
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/heft/v0/heft.schema.json",

// TODO: Add comments
"phasesByName": {
"build": {
"cleanFiles": [{ "includeGlobs": ["dist", "lib", "temp"] }],
Expand Down
35 changes: 35 additions & 0 deletions build-tests-subspace/typescript-v4-test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "typescript-v4-test",
"description": "Building this project tests Heft with TypeScript v4",
"version": "1.0.0",
"private": true,
"main": "lib/index.js",
"license": "MIT",
"scripts": {
"build": "heft build --clean",
"_phase:build": "heft run --only build -- --clean"
},
"devDependencies": {
"@rushstack/eslint-config": "workspace:*",
"@rushstack/heft": "workspace:*",
"@rushstack/heft-lint-plugin": "workspace:*",
"@rushstack/heft-typescript-plugin": "workspace:*",
"typescript": "~4.9.5",
"tslint": "~5.20.1",
"eslint": "~8.7.0"
},
"dependenciesMeta": {
"@rushstack/eslint-config": {
"injected": true
},
"@rushstack/heft": {
"injected": true
},
"@rushstack/heft-lint-plugin": {
"injected": true
},
"@rushstack/heft-typescript-plugin": {
"injected": true
}
}
}
23 changes: 0 additions & 23 deletions build-tests/install-test-workspace/.vscode/launch.json

This file was deleted.