Skip to content

Commit

Permalink
Merge pull request #4259 from D4N14L/user/danade/MorePackageExtractor…
Browse files Browse the repository at this point in the history
…Patterns

[rush] Surface `patternsToInclude` and `patternsToExclude` on the deploy.json configuration
  • Loading branch information
D4N14L committed Aug 1, 2023
2 parents 1f9fe2c + b93a480 commit c101ff5
Show file tree
Hide file tree
Showing 24 changed files with 437 additions and 20 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ These GitHub repositories provide supplementary resources for Rush Stack:
| [/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. |
| [/build-tests/package-extractor-test-01](./build-tests/package-extractor-test-01/) | This project is used by tests in the @rushstack/package-extractor package. |
| [/build-tests/package-extractor-test-02](./build-tests/package-extractor-test-02/) | This project is used by tests in the @rushstack/package-extractor package. |
| [/build-tests/package-extractor-test-03](./build-tests/package-extractor-test-03/) | This project is used by tests in the @rushstack/package-extractor package. |
| [/build-tests/package-extractor-test-04](./build-tests/package-extractor-test-04/) | This project is used by tests in the @rushstack/package-extractor package. |
| [/build-tests/rush-amazon-s3-build-cache-plugin-integration-test](./build-tests/rush-amazon-s3-build-cache-plugin-integration-test/) | Tests connecting to an amazon S3 endpoint |
| [/build-tests/rush-lib-declaration-paths-test](./build-tests/rush-lib-declaration-paths-test/) | This project ensures all of the paths in rush-lib/lib/... have imports that resolve correctly. If this project builds, all `lib/**/*.d.ts` files in the `@microsoft/rush-lib` package are valid. |
| [/build-tests/rush-project-change-analyzer-test](./build-tests/rush-project-change-analyzer-test/) | This is an example project that uses rush-lib's ProjectChangeAnalyzer to |
Expand Down
15 changes: 15 additions & 0 deletions build-tests/package-extractor-test-01/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "package-extractor-test-01",
"description": "This project is used by tests in the @rushstack/package-extractor package.",
"version": "1.0.0",
"private": true,
"scripts": {
"_phase:build": ""
},
"dependencies": {
"package-extractor-test-02": "workspace:*"
},
"devDependencies": {
"package-extractor-test-03": "workspace:*"
}
}
1 change: 1 addition & 0 deletions build-tests/package-extractor-test-01/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
12 changes: 12 additions & 0 deletions build-tests/package-extractor-test-02/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "package-extractor-test-02",
"description": "This project is used by tests in the @rushstack/package-extractor package.",
"version": "1.0.0",
"private": true,
"scripts": {
"_phase:build": ""
},
"dependencies": {
"package-extractor-test-03": "workspace:*"
}
}
1 change: 1 addition & 0 deletions build-tests/package-extractor-test-02/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
9 changes: 9 additions & 0 deletions build-tests/package-extractor-test-03/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "package-extractor-test-03",
"description": "This project is used by tests in the @rushstack/package-extractor package.",
"version": "1.0.0",
"private": true,
"scripts": {
"_phase:build": ""
}
}
1 change: 1 addition & 0 deletions build-tests/package-extractor-test-03/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
12 changes: 12 additions & 0 deletions build-tests/package-extractor-test-04/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "package-extractor-test-04",
"description": "This project is used by tests in the @rushstack/package-extractor package.",
"version": "1.0.0",
"private": true,
"scripts": {
"_phase:build": ""
},
"dependencies": {
"@rushstack/node-core-library": "workspace:*"
}
}
1 change: 1 addition & 0 deletions build-tests/package-extractor-test-04/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/rush",
"comment": "Add `patternsToInclude` and `patternsToExclude` support to Rush deploy.json configurations. This will allow developers to include or exclude provided glob patterns within a local project when running `rush deploy`.",
"type": "none"
}
],
"packageName": "@microsoft/rush"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/node-core-library",
"comment": "Update error messages when modules or packages cannot be found using the \"Import.resolve*\" methods.",
"type": "none"
}
],
"packageName": "@rushstack/node-core-library"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/package-extractor",
"comment": "",
"type": "none"
}
],
"packageName": "@rushstack/package-extractor"
}
8 changes: 8 additions & 0 deletions common/config/rush/nonbrowser-approved-packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,14 @@
"name": "open",
"allowedCategories": [ "libraries" ]
},
{
"name": "package-extractor-test-02",
"allowedCategories": [ "tests" ]
},
{
"name": "package-extractor-test-03",
"allowedCategories": [ "tests" ]
},
{
"name": "postcss",
"allowedCategories": [ "libraries", "tests" ]
Expand Down
30 changes: 27 additions & 3 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/config/rush/repo-state.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
{
"pnpmShrinkwrapHash": "5b48f46bcf623f6b470ccb325aabfa560dac4337",
"pnpmShrinkwrapHash": "1acb86f1b88b96c9dfced5d5c8c20d96302b0b1f",
"preferredVersionsHash": "1926a5b12ac8f4ab41e76503a0d1d0dccc9c0e06"
}
16 changes: 8 additions & 8 deletions libraries/node-core-library/src/Import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ export class Import {
preserveSymlinks: false,
realpathSync: getRealPath
});
} catch (e) {
throw new Error(`Cannot find module "${modulePath}" from "${options.baseFolderPath}".`);
} catch (e: unknown) {
throw new Error(`Cannot find module "${modulePath}" from "${options.baseFolderPath}": ${e}`);
}
}

Expand Down Expand Up @@ -383,8 +383,8 @@ export class Import {
}
);
return await resolvePromise;
} catch (e) {
throw new Error(`Cannot find module "${modulePath}" from "${options.baseFolderPath}".`);
} catch (e: unknown) {
throw new Error(`Cannot find module "${modulePath}" from "${options.baseFolderPath}": ${e}`);
}
}

Expand Down Expand Up @@ -444,8 +444,8 @@ export class Import {

const packagePath: string = path.dirname(resolvedPath);
return packagePath;
} catch {
throw new Error(`Cannot find package "${packageName}" from "${baseFolderPath}".`);
} catch (e: unknown) {
throw new Error(`Cannot find package "${packageName}" from "${baseFolderPath}": ${e}.`);
}
}

Expand Down Expand Up @@ -536,8 +536,8 @@ export class Import {

const packagePath: string = path.dirname(resolvedPath);
return packagePath;
} catch {
throw new Error(`Cannot find package "${packageName}" from "${baseFolderPath}".`);
} catch (e: unknown) {
throw new Error(`Cannot find package "${packageName}" from "${baseFolderPath}": ${e}`);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Import resolveModule allowSelfReference throws on an attempt to reference this package without allowSelfReference turned on 1`] = `"Cannot find module \\"@rushstack/node-core-library\\" from \\"<packageRoot>/lib/test\\"."`;
exports[`Import resolveModule allowSelfReference throws on an attempt to reference this package without allowSelfReference turned on 1`] = `"Cannot find module \\"@rushstack/node-core-library\\" from \\"<packageRoot>/lib/test\\": Error: Cannot find module '@rushstack/node-core-library' from '<dirname>'"`;
exports[`Import resolveModule allowSelfReference throws on an attempt to reference this package without allowSelfReference turned on 2`] = `"Cannot find module \\"@rushstack/node-core-library/lib/Constants.js\\" from \\"<packageRoot>/lib/test\\"."`;
exports[`Import resolveModule allowSelfReference throws on an attempt to reference this package without allowSelfReference turned on 2`] = `"Cannot find module \\"@rushstack/node-core-library/lib/Constants.js\\" from \\"<packageRoot>/lib/test\\": Error: Cannot find module '@rushstack/node-core-library/lib/Constants.js' from '<dirname>'"`;
exports[`Import resolveModule includeSystemModules throws on an attempt to resolve a non-existing path inside a system module with includeSystemModules turned on 1`] = `"Cannot find module \\"fs/foo/bar\\" from \\"<packageRoot>/lib/test\\"."`;
exports[`Import resolveModule includeSystemModules throws on an attempt to resolve a non-existing path inside a system module with includeSystemModules turned on 1`] = `"Cannot find module \\"fs/foo/bar\\" from \\"<packageRoot>/lib/test\\": Error: Cannot find module 'fs/foo/bar' from '<dirname>'"`;
exports[`Import resolveModule includeSystemModules throws on an attempt to resolve a system module without includeSystemModules turned on 1`] = `"Cannot find module \\"fs\\" from \\"<packageRoot>/lib/test\\"."`;
exports[`Import resolvePackage allowSelfReference fails to resolve a path inside this package with allowSelfReference turned on 1`] = `"The package name \\"@rushstack/node-core-library/lib/Constants.js\\" contains an invalid character: \\"/\\""`;
exports[`Import resolvePackage allowSelfReference throws on an attempt to reference this package without allowSelfReference turned on 1`] = `"Cannot find package \\"@rushstack/node-core-library\\" from \\"<packageRoot>/lib/test\\"."`;
exports[`Import resolvePackage allowSelfReference throws on an attempt to reference this package without allowSelfReference turned on 1`] = `"Cannot find package \\"@rushstack/node-core-library\\" from \\"<packageRoot>/lib/test\\": Error: Cannot find module '@rushstack/node-core-library/' from '<dirname>'."`;
exports[`Import resolvePackage fails to resolve a path inside a dependency 1`] = `"The package name \\"@rushstack/heft/lib/start.js\\" contains an invalid character: \\"/\\""`;
exports[`Import resolvePackage fails to resolve a path inside a dependency of a dependency 1`] = `"The package name \\"@rushstack/ts-command-line/lib/Constants.js\\" contains an invalid character: \\"/\\""`;
exports[`Import resolvePackage includeSystemModules throws on an attempt to resolve a non-existing path inside a system module with includeSystemModules turned on 1`] = `"The package name \\"fs/foo/bar\\" contains an invalid character: \\"/\\""`;
exports[`Import resolvePackage includeSystemModules throws on an attempt to resolve a system module without includeSystemModules turned on 1`] = `"Cannot find package \\"fs\\" from \\"<packageRoot>/lib/test\\"."`;
exports[`Import resolvePackage includeSystemModules throws on an attempt to resolve a system module without includeSystemModules turned on 1`] = `"Cannot find package \\"fs\\" from \\"<packageRoot>/lib/test\\": Error: Cannot find module 'fs/' from '<dirname>'."`;
3 changes: 1 addition & 2 deletions libraries/package-extractor/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# Keep temp folders in mocked 'repos' that are used for unit tests
!**/test/**/temp
test-output
4 changes: 4 additions & 0 deletions libraries/package-extractor/config/heft.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
}
}
}
},

"test": {
"cleanFiles": [{ "sourcePath": "test-output" }]
}
}
}
Loading

0 comments on commit c101ff5

Please sign in to comment.