-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): allow skipping lockfile for affected
- Loading branch information
1 parent
dd6eda8
commit f1b930b
Showing
8 changed files
with
76 additions
and
23 deletions.
There are no files selected for viewing
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
15 changes: 15 additions & 0 deletions
15
packages/nx/src/plugins/js/project-graph/affected/lock-file-changes.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
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
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
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
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
13 changes: 13 additions & 0 deletions
13
packages/nx/src/utils/get-package-name-from-import-path.spec.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,13 @@ | ||
import { getPackageNameFromImportPath } from './get-package-name-from-import-path'; | ||
|
||
describe('getPackageNameFromImportPath', () => { | ||
it.each([ | ||
['@nx/workspace', '@nx/workspace'], | ||
['@nx/workspace/plugin', '@nx/workspace'], | ||
['@nx/workspace/other', '@nx/workspace'], | ||
['nx/plugin', 'nx'], | ||
['nx', 'nx'], | ||
])('should return %s for %s', (input, expected) => { | ||
expect(getPackageNameFromImportPath(input)).toEqual(expected); | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
packages/nx/src/utils/get-package-name-from-import-path.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,14 @@ | ||
//# Converts import paths to package names. | ||
//# e.g. - `@nx/workspace` -> `@nx/workspace` | ||
//# - `@nx/workspace/plugin` -> `@nx/workspace` | ||
//# - `@nx/workspace/other` -> `@nx/workspace` | ||
//# - `nx/plugin` -> `nx` | ||
export function getPackageNameFromImportPath(importExpression: string) { | ||
// Check if the package is scoped | ||
if (importExpression.startsWith('@')) { | ||
// For scoped packages, the package name is up to the second '/' | ||
return importExpression.split('/').slice(0, 2).join('/'); | ||
} | ||
// For unscoped packages, the package name is up to the first '/' | ||
return importExpression.split('/')[0]; | ||
} |