You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TIP: Siblings are other Sentry SDKs other than @sentry/capacitor, like @sentry/browser, @sentry/angular, @sentry/react,...
Since it is possible to invoke yarn from a node script, we can actually offer to the users to automatically update their siblings to the correct version.
If we implement the snippet below, we will be able to ask users if they want to patch their package.json and fix the correct sibling version of the Sibling SDK automatically.
Impact
This is not ideal when running CI since it doesn't have any input, we would need to add some safeguards to not run this code on CI.
On the other hand, it will be way easier for users to update their dependencies and issues with wrong versions should be a thing in the past.
CONSOLE:
⚠️ This version of Sentry Capacitor is incompatible with the following installed packages:
@sentry/angular version 8.0.0
Please install the mentioned packages exactly with version 8.37.1 and with the argument --update-sentry-capacitor.
Your project will build with the wrong package but you may face Runtime errors.
You can use the below command to fix your package.json:
yarn add --exact @sentry/[email protected] --update-sentry-capacitor
Sample snippet on postinstall
constrl=readline.createInterface({input: process.stdin,output: process.stdout});rl.question('Would you like to apply the patch above? ',(answer)=>{if(answer==='y'){constyarnAdd=spawn('yarn',["add","--exact","@sentry/[email protected]","--update-sentry-capacitor"],{cwd: rootPath,stdio: 'inherit'});yarnAdd.on('close',(code)=>{if(code===0){console.log(`Successfully updated`);exit(0);}else{console.error(`Failed to update. Exit code: ${code}`);exit(1);}});}else{exit(0);}rl.close();});
Sample after accepting:
c:/ yarn install
yarn install v1.22.22
[1/4] Resolving packages...
success Already up-to-date.
$ node node_modules/@sentry/capacitor/scripts/check-siblings.js
⚠️ This version of Sentry Capacitor is incompatible with the following installed packages:
@sentry/angular version 8.0.0
Please install the mentioned packages exactly with version 8.37.1 and with the argument --update-sentry-capacitor.
Your project will build with the wrong package but you may face Runtime errors.
You can use the below command to fix your package.json:
yarn add --exact @sentry/[email protected] --update-sentry-capacitor
Would you like to apply the patch above? y
yarn add v1.22.22
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ @sentry/[email protected]
info All dependencies
└─ @sentry/[email protected]
Done in 0.78s.
Successfully updated
Done in 6.66s.
The text was updated successfully, but these errors were encountered:
TIP: Siblings are other Sentry SDKs other than @sentry/capacitor, like @sentry/browser, @sentry/angular, @sentry/react,...
Since it is possible to invoke yarn from a node script, we can actually offer to the users to automatically update their siblings to the correct version.
If we implement the snippet below, we will be able to ask users if they want to patch their package.json and fix the correct sibling version of the Sibling SDK automatically.
Impact
This is not ideal when running CI since it doesn't have any input, we would need to add some safeguards to not run this code on CI.
On the other hand, it will be way easier for users to update their dependencies and issues with wrong versions should be a thing in the past.
Sample snippet on postinstall
Sample after accepting:
The text was updated successfully, but these errors were encountered: