Allow for exact dependencies
RnbWd opened this issue · 2 comments
What happened?
I use exact versions for all of my app dependencies. This is really important for me because I need to make sure that the native dependencies are identical to the javascript dependencies in live apps when I use code-push to make changes. It would be really nice to have a setting which would allow me upgrade dependencies with align-deps
using exact versioning, instead of the ^
(any patch) versions used by default.
Affected Package
@rnx-kit/align-deps
Version
^2.0.3
Which platforms are you seeing this issue on?
- Android
- iOS
- macOS
- Windows
System Information
...
Steps to Reproduce
Try to running yarn check-dependencies
or yarn fix-dependencies
with libraries in npm that use exact versioning. Meaning no ^
before the version number.
Code of Conduct
- I agree to follow this project's Code of Conduct
Hi @RnbWd, all our recommendations are based on profiles you can find in https://github.com/microsoft/rnx-kit/tree/main/packages/align-deps/src/presets/microsoft/react-native. You can also create your own preset. Starting with 2.0, we've made it easier to reuse the built-in ones. For example, you could import them and strip out all the carets like below:
// exactVersionsPreset.js
const { presets } = require("@rnx-kit/align-deps");
const reactNativePreset = presets["microsoft/react-native"];
const profiles = Object.values(reactNativePreset);
for (const profile of profiles) {
const packages = Object.values(profile);
for (const pkg of packages) {
if (pkg.version?.startsWith("^")) {
pkg.version = pkg.version.slice(1);
}
}
}
module.exports = reactNativePreset;
In your config, specify the preset you just made:
"rnx-kit": {
"alignDeps": {
"presets": [
+ "/path/to/exactVersionsPreset.js"
],
"requirements": [
...
],
"capabilities": [
...
]
}
}
Since you're using exact dependencies, you'll likely want better control over the versions you use. The custom preset will give you this control.
Closing due to inactivity. If you think this is a mistake, please reply and we'll reopen it.