Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): move checkAndCleanWithSemver to devkit
- Loading branch information
Showing
11 changed files
with
24 additions
and
27 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
packages/angular/src/generators/ngrx/lib/add-ngrx-to-package-json.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
2 changes: 1 addition & 1 deletion
2
packages/angular/src/generators/setup-tailwind/lib/detect-tailwind-installed-version.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
5 changes: 4 additions & 1 deletion
5
packages/nx/src/utils/version-utils.ts → packages/devkit/src/utils/semver.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
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 |
---|---|---|
@@ -1,21 +1,12 @@ | ||
import { valid } from 'semver'; | ||
import { checkAndCleanWithSemver as _checkAndCleanWithSemver } from '@nrwl/devkit/src/utils/semver'; | ||
import { logger } from '@nrwl/devkit'; | ||
|
||
/** @deprecated Use checkAndCleanWithSemver from @nrwl/devkit/src/utils/semver instead. | ||
* TODO(v17): Remove this function from workspace. Keep it for now since there are projects that use it (e.g. https://github.com/gperdomor/nx-tools). | ||
*/ | ||
export function checkAndCleanWithSemver(pkgName: string, version: string) { | ||
let newVersion = version; | ||
|
||
if (valid(newVersion)) { | ||
return newVersion; | ||
} | ||
|
||
if (version.startsWith('~') || version.startsWith('^')) { | ||
newVersion = version.substring(1); | ||
} | ||
|
||
if (!valid(newVersion)) { | ||
throw new Error( | ||
`The package.json lists a version of ${pkgName} that Nx is unable to validate - (${version})` | ||
); | ||
} | ||
|
||
return newVersion; | ||
logger.warn( | ||
`checkAndCleanWithSemver has been moved to @nrwl/devkit/src/utils/semver` | ||
); | ||
return _checkAndCleanWithSemver(pkgName, version); | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/workspace/src/utils/update-packages-in-package-json.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