Skip to content

Commit

Permalink
Merge pull request microsoft#3944 from iclanton/internal-node-rig
Browse files Browse the repository at this point in the history
Use an internal node build rig for internal, non-cyclic projects and fix caching across the repo.
  • Loading branch information
iclanton authored Sep 19, 2023
2 parents 6e382e1 + 4babaa2 commit d8c728a
Show file tree
Hide file tree
Showing 365 changed files with 2,310 additions and 1,407 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ These GitHub repositories provide supplementary resources for Rush Stack:
| [/repo-scripts/generate-api-docs](./repo-scripts/generate-api-docs/) | Used to generate API docs for the rushstack.io website |
| [/repo-scripts/repo-toolbox](./repo-scripts/repo-toolbox/) | Used to execute various operations specific to this repo |
| [/rush-plugins/rush-litewatch-plugin](./rush-plugins/rush-litewatch-plugin/) | An experimental alternative approach for multi-project watch mode |
| [/rushstack-internal-rigs/heft-rushstack-internal-node-rig](./rushstack-internal-rigs/heft-rushstack-internal-node-rig/) | A rig package for Node.js projects that build using Heft inside the RushStack repository. |
| [/vscode-extensions/rush-vscode-command-webview](./vscode-extensions/rush-vscode-command-webview/) | Part of the Rush Stack VSCode extension, provides a UI for invoking Rush commands |
| [/vscode-extensions/rush-vscode-extension](./vscode-extensions/rush-vscode-extension/) | Enhanced experience for monorepos that use the Rush Stack toolchain |
| [/webpack/webpack-deep-imports-plugin](./webpack/webpack-deep-imports-plugin/) | This plugin creates a bundle and commonJS files in a 'lib' folder mirroring modules in another 'lib' folder. |
Expand Down
2 changes: 1 addition & 1 deletion apps/api-documenter/config/jest.config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "@rushstack/heft-node-rig/profiles/default/config/jest.config.json"
"extends": "heft-rushstack-internal-node-rig/profiles/default/config/jest.config.json"
}
2 changes: 1 addition & 1 deletion apps/api-documenter/config/rig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
// 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": "@rushstack/heft-node-rig"
"rigPackageName": "heft-rushstack-internal-node-rig"
}
3 changes: 1 addition & 2 deletions apps/api-documenter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@
"devDependencies": {
"@rushstack/eslint-config": "workspace:*",
"@rushstack/heft": "workspace:*",
"@rushstack/heft-node-rig": "workspace:*",
"heft-rushstack-internal-node-rig": "workspace:*",
"@types/js-yaml": "3.12.1",
"@types/node": "18.17.15",
"@types/resolve": "1.20.2"
}
}
5 changes: 1 addition & 4 deletions apps/api-documenter/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json",
"compilerOptions": {
"resolveJsonModule": true
}
"extends": "./node_modules/heft-rushstack-internal-node-rig/profiles/default/tsconfig-base.json"
}
10 changes: 9 additions & 1 deletion apps/api-extractor/config/jest.config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
{
"extends": "@rushstack/heft-node-rig/profiles/default/config/jest.config.json"
"extends": "@rushstack/heft-node-rig/profiles/default/config/jest.config.json",

// Enable code coverage for Jest
"collectCoverage": true,
"coverageDirectory": "<rootDir>/coverage",
"coverageReporters": ["cobertura", "html"],

// Use v8 coverage provider to avoid Babel
"coverageProvider": "v8"
}
14 changes: 14 additions & 0 deletions apps/api-extractor/config/rush-project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "@rushstack/heft-node-rig/profiles/default/config/rush-project.json",

"operationSettings": [
{
"operationName": "_phase:build",
"outputFolderNames": [".heft", "release"]
},
{
"operationName": "_phase:test",
"outputFolderNames": ["coverage"]
}
]
}
10 changes: 9 additions & 1 deletion apps/heft/config/jest.config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
{
"extends": "@rushstack/heft-node-rig/profiles/default/config/jest.config.json"
"extends": "@rushstack/heft-node-rig/profiles/default/config/jest.config.json",

// Enable code coverage for Jest
"collectCoverage": true,
"coverageDirectory": "<rootDir>/coverage",
"coverageReporters": ["cobertura", "html"],

// Use v8 coverage provider to avoid Babel
"coverageProvider": "v8"
}
14 changes: 14 additions & 0 deletions apps/heft/config/rush-project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "@rushstack/heft-node-rig/profiles/default/config/rush-project.json",

"operationSettings": [
{
"operationName": "_phase:build",
"outputFolderNames": [".heft", "release"]
},
{
"operationName": "_phase:test",
"outputFolderNames": ["coverage"]
}
]
}
8 changes: 8 additions & 0 deletions apps/lockfile-explorer-web/config/jest.config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"extends": "@rushstack/heft-web-rig/profiles/app/config/jest.config.json",

// Enable code coverage for Jest
"collectCoverage": true,
"coverageDirectory": "<rootDir>/coverage",
"coverageReporters": ["cobertura", "html"],

// Use v8 coverage provider to avoid Babel
"coverageProvider": "v8",

// Load the initappcontext.js stub when running tests
"setupFiles": ["../lib-commonjs/stub/initappcontext.js"]
}
14 changes: 14 additions & 0 deletions apps/lockfile-explorer-web/config/rush-project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "@rushstack/heft-web-rig/profiles/app/config/rush-project.json",

"operationSettings": [
{
"operationName": "_phase:build",
"outputFolderNames": [".heft", "release"]
},
{
"operationName": "_phase:test",
"outputFolderNames": ["coverage"]
}
]
}
2 changes: 1 addition & 1 deletion apps/lockfile-explorer/config/heft.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Optionally specifies another JSON config file that this file extends from. This provides a way for standard
* settings to be shared across multiple projects.
*/
"extends": "@rushstack/heft-node-rig/profiles/default/config/heft.json",
"extends": "heft-rushstack-internal-node-rig/profiles/default/config/heft.json",

"phasesByName": {
"build": {
Expand Down
2 changes: 1 addition & 1 deletion apps/lockfile-explorer/config/jest.config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "@rushstack/heft-node-rig/profiles/default/config/jest.config.json"
"extends": "heft-rushstack-internal-node-rig/profiles/default/config/jest.config.json"
}
2 changes: 1 addition & 1 deletion apps/lockfile-explorer/config/rig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* (Required) The name of the rig package to inherit from.
* It should be an NPM package name with the "-rig" suffix.
*/
"rigPackageName": "@rushstack/heft-node-rig"
"rigPackageName": "heft-rushstack-internal-node-rig"

/**
* (Optional) Selects a config profile from the rig package. The name must consist of
Expand Down
4 changes: 1 addition & 3 deletions apps/lockfile-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,12 @@
"devDependencies": {
"@microsoft/rush-lib": "workspace:*",
"@rushstack/eslint-config": "workspace:*",
"@rushstack/heft-node-rig": "workspace:*",
"heft-rushstack-internal-node-rig": "workspace:*",
"@rushstack/heft": "workspace:*",
"@rushstack/lockfile-explorer-web": "workspace:*",
"@types/cors": "~2.8.12",
"@types/express": "4.17.13",
"@types/heft-jest": "1.0.1",
"@types/js-yaml": "3.12.1",
"@types/node": "18.17.15",
"@types/update-notifier": "~6.0.1"
},
"dependencies": {
Expand Down
6 changes: 3 additions & 3 deletions apps/lockfile-explorer/src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ import open from 'open';
import updateNotifier from 'update-notifier';
import { FileSystem, type IPackageJson, JsonFile, PackageJsonLookup } from '@rushstack/node-core-library';
import type { IAppContext } from '@rushstack/lockfile-explorer-web/lib/AppContext';
import packageJSON from '../package.json';
import { init } from './init';
import type { IAppState } from './state';
import { AlreadyReportedError } from '@rushstack/node-core-library';

function startApp(debugMode: boolean): void {
const lockfileExplorerProjectRoot: string = PackageJsonLookup.instance.tryGetPackageFolderFor(__dirname)!;
const appVersion: string = JsonFile.load(`${lockfileExplorerProjectRoot}/package.json`).version;
const packageJson: IPackageJson = JsonFile.load(`${lockfileExplorerProjectRoot}/package.json`);
const appVersion: string = packageJson.version;

console.log(
colors.bold(`\nRush Lockfile Explorer ${appVersion}`) + colors.cyan(' - https://lfx.rushstack.io/\n')
);

updateNotifier({
pkg: packageJSON,
pkg: packageJson,
// Normally update-notifier waits a day or so before it starts displaying upgrade notices.
// In debug mode, show the notice right away.
updateCheckInterval: debugMode ? 0 : undefined
Expand Down
5 changes: 1 addition & 4 deletions apps/lockfile-explorer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json",
"compilerOptions": {
"types": ["heft-jest", "node"]
}
"extends": "./node_modules/heft-rushstack-internal-node-rig/profiles/default/tsconfig-base.json"
}
2 changes: 1 addition & 1 deletion apps/rundown/config/rig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
// 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": "@rushstack/heft-node-rig"
"rigPackageName": "heft-rushstack-internal-node-rig"
}
4 changes: 1 addition & 3 deletions apps/rundown/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
"devDependencies": {
"@rushstack/eslint-config": "workspace:*",
"@rushstack/heft": "workspace:*",
"@rushstack/heft-node-rig": "workspace:*",
"@types/heft-jest": "1.0.1",
"@types/node": "18.17.15"
"heft-rushstack-internal-node-rig": "workspace:*"
}
}
5 changes: 1 addition & 4 deletions apps/rundown/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json",
"compilerOptions": {
"types": ["heft-jest", "node"]
}
"extends": "./node_modules/heft-rushstack-internal-node-rig/profiles/default/tsconfig-base.json"
}
2 changes: 1 addition & 1 deletion apps/rush/config/jest.config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "@rushstack/heft-node-rig/profiles/default/config/jest.config.json"
"extends": "heft-rushstack-internal-node-rig/profiles/default/config/jest.config.json"
}
2 changes: 1 addition & 1 deletion apps/rush/config/rig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
// 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": "@rushstack/heft-node-rig"
"rigPackageName": "heft-rushstack-internal-node-rig"
}
3 changes: 1 addition & 2 deletions apps/rush/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@
"devDependencies": {
"@rushstack/eslint-config": "workspace:*",
"@rushstack/heft": "workspace:*",
"@rushstack/heft-node-rig": "workspace:*",
"heft-rushstack-internal-node-rig": "workspace:*",
"@rushstack/rush-amazon-s3-build-cache-plugin": "workspace:*",
"@rushstack/rush-azure-storage-build-cache-plugin": "workspace:*",
"@rushstack/rush-http-build-cache-plugin": "workspace:*",
"@types/heft-jest": "1.0.1",
"@types/node": "18.17.15",
"@types/semver": "7.5.0"
}
}
5 changes: 1 addition & 4 deletions apps/rush/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json",
"compilerOptions": {
"types": ["heft-jest", "node"]
}
"extends": "./node_modules/heft-rushstack-internal-node-rig/profiles/default/tsconfig-base.json"
}
2 changes: 1 addition & 1 deletion apps/trace-import/config/jest.config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "@rushstack/heft-node-rig/profiles/default/config/jest.config.json"
"extends": "heft-rushstack-internal-node-rig/profiles/default/config/jest.config.json"
}
2 changes: 1 addition & 1 deletion apps/trace-import/config/rig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
// 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": "@rushstack/heft-node-rig"
"rigPackageName": "heft-rushstack-internal-node-rig"
}
4 changes: 1 addition & 3 deletions apps/trace-import/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
"devDependencies": {
"@rushstack/eslint-config": "workspace:*",
"@rushstack/heft": "workspace:*",
"@rushstack/heft-node-rig": "workspace:*",
"@types/heft-jest": "1.0.1",
"@types/node": "18.17.15",
"heft-rushstack-internal-node-rig": "workspace:*",
"@types/resolve": "1.20.2",
"@types/semver": "7.5.0"
}
Expand Down
6 changes: 1 addition & 5 deletions apps/trace-import/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{
"extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json",

"compilerOptions": {
"types": ["heft-jest", "node"]
}
"extends": "./node_modules/heft-rushstack-internal-node-rig/profiles/default/tsconfig-base.json"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
{
"extends": "@rushstack/heft-jest-plugin/includes/jest-shared.config.json"
"extends": "@rushstack/heft-jest-plugin/includes/jest-shared.config.json",

// These additional properties exist for caching purposes in the rushstack repo

// Enable code coverage for Jest
"collectCoverage": true,
"coverageDirectory": "<rootDir>/coverage",
"coverageReporters": ["cobertura", "html"],

// Use v8 coverage provider to avoid Babel
"coverageProvider": "v8"
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
// This file exists for caching purposes in the rushstack repo
{
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush-project.schema.json",

"operationSettings": [
{
"operationName": "build",
"outputFolderNames": ["lib", "dist"]
"operationName": "_phase:build",
"outputFolderNames": [".heft", "lib", "dist"]
},
{
"operationName": "_phase:test",
"outputFolderNames": ["coverage"]
}
]
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
{
"extends": "@rushstack/heft-jest-plugin/includes/jest-shared.config.json",
"collectCoverage": true,

"coverageThreshold": {
"global": {
"branches": 50,
"functions": 50,
"lines": 50,
"statements": 50
}
}
},

// These additional properties exist for caching purposes in the rushstack repo

// Enable code coverage for Jest
"collectCoverage": true,
"coverageDirectory": "<rootDir>/coverage",
"coverageReporters": ["cobertura", "html"],

// Use v8 coverage provider to avoid Babel
"coverageProvider": "v8"
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
// This file exists for caching purposes in the rushstack repo
{
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush-project.schema.json",

"operationSettings": [
{
"operationName": "build",
"outputFolderNames": ["lib", "dist"]
"operationName": "_phase:build",
"outputFolderNames": [".heft", "lib", "dist"]
},
{
"operationName": "_phase:test",
"outputFolderNames": ["coverage"]
}
]
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
{
"extends": "@rushstack/heft-node-rig/profiles/default/config/jest.config.json"
"extends": "@rushstack/heft-node-rig/profiles/default/config/jest.config.json",

// These additional properties exist for caching purposes in the rushstack repo

// Enable code coverage for Jest
"collectCoverage": true,
"coverageDirectory": "<rootDir>/coverage",
"coverageReporters": ["cobertura", "html"],

// Use v8 coverage provider to avoid Babel
"coverageProvider": "v8"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This file exists for caching purposes in the rushstack repo
{
"extends": "@rushstack/heft-node-rig/profiles/default/config/rush-project.json",

"operationSettings": [
{
"operationName": "_phase:build",
"outputFolderNames": [".heft", "release"]
},
{
"operationName": "_phase:test",
"outputFolderNames": ["coverage"]
}
]
}
Loading

0 comments on commit d8c728a

Please sign in to comment.