-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: modify rush scan, support executing projects under rush and cus…
…tom scanning folders.
- Loading branch information
1 parent
fc48c64
commit 56179b4
Showing
9 changed files
with
216 additions
and
61 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
common/changes/@microsoft/rush/feat-rush-scan-support-folders_2024-12-16-03-01.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@microsoft/rush", | ||
"comment": " Modify rush scan, support executing projects under rush and custom scanning folders.", | ||
"type": "none" | ||
} | ||
], | ||
"packageName": "@microsoft/rush" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
libraries/rush-lib/src/cli/actions/test/ScanAction.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
import '../../test/mockRushCommandLineParser'; | ||
|
||
import '../../test/mockRushCommandLineParser'; | ||
import { ScanAction } from '../ScanAction'; | ||
import { RushCommandLineParser } from '../../RushCommandLineParser'; | ||
|
||
import { Terminal } from '@rushstack/terminal'; | ||
|
||
describe.skip(ScanAction.name, () => { | ||
describe('basic "rush remove" tests', () => { | ||
let terminalMock: jest.SpyInstance; | ||
let oldExitCode: number | undefined; | ||
let oldArgs: string[]; | ||
|
||
beforeEach(() => { | ||
terminalMock = jest.spyOn(Terminal.prototype, 'write').mockImplementation(() => {}); | ||
|
||
jest.spyOn(process, 'exit').mockImplementation(); | ||
|
||
oldExitCode = process.exitCode; | ||
oldArgs = process.argv; | ||
}); | ||
|
||
afterEach(() => { | ||
jest.clearAllMocks(); | ||
process.exitCode = oldExitCode; | ||
process.argv = oldArgs; | ||
}); | ||
|
||
describe("'scan' action", () => { | ||
it(`scan the repository to find phantom dependencies. `, async () => { | ||
const aPath: string = `${__dirname}/scanRepo/a`; | ||
|
||
const parser: RushCommandLineParser = new RushCommandLineParser({ cwd: aPath }); | ||
|
||
jest.spyOn(process, 'cwd').mockReturnValue(aPath); | ||
|
||
process.argv = ['pretend-this-is-node.exe', 'pretend-this-is-rush', 'scan', '--json']; | ||
await expect(parser.executeAsync()).resolves.toEqual(true); | ||
expect(terminalMock).toHaveBeenCalledTimes(1); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
common/temp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import { ConsoleTerminalProvider, Terminal } from '@rushstack/terminal'; |
8 changes: 8 additions & 0 deletions
8
libraries/rush-lib/src/cli/actions/test/scanRepo/a/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "a", | ||
"version": "1.0.0", | ||
"description": "Test package a", | ||
"dependencies": { | ||
"assert": "workspace:*" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
libraries/rush-lib/src/cli/actions/test/scanRepo/b/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "b", | ||
"version": "1.0.0", | ||
"description": "Test package b", | ||
"dependencies": { | ||
"assert": "workspace:*", | ||
"rimraf": "workspace:*" | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
libraries/rush-lib/src/cli/actions/test/scanRepo/b/test-folder1/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import { ConsoleTerminalProvider, Terminal } from '@rushstack/terminal'; |
17 changes: 17 additions & 0 deletions
17
libraries/rush-lib/src/cli/actions/test/scanRepo/rush.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"npmVersion": "6.4.1", | ||
"rushVersion": "5.5.2", | ||
"projectFolderMinDepth": 1, | ||
"projectFolderMaxDepth": 99, | ||
|
||
"projects": [ | ||
{ | ||
"packageName": "a", | ||
"projectFolder": "a" | ||
}, | ||
{ | ||
"packageName": "b", | ||
"projectFolder": "b" | ||
} | ||
] | ||
} |