Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add mobile app release version in Sentry issues #3249

Merged
merged 3 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"env": {
"es6": true
},
"root": true,
"ignorePatterns": [
"projects/**/*",
Expand Down
4 changes: 2 additions & 2 deletions hooks/prebuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ module.exports = function (ctx) {
'/node_modules/@capacitor-community/camera-preview/android/src/main/java/com/ahm/capacitor/camera/preview/CameraPreview.java',
};

// Adding GIT_COMMIT_SHA for sentry
// Adding mobile app version for tracking the release in sentry
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git commit sha wasn't working earlier, check release property

image

var mainPath = path.resolve(process.cwd(), 'src/main.ts');
var mainPathContent = fs.readFileSync(mainPath).toString();
Comment on lines 50 to 51
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Listen, my friend! Let's use 'let' or 'const' instead of 'var'

Using 'let' or 'const' helps avoid hoisting issues and keeps your code tight and clean.

Here's how we can fix it:

- var mainPath = path.resolve(process.cwd(), 'src/main.ts');
- var mainPathContent = fs.readFileSync(mainPath).toString();
+ const mainPath = path.resolve(process.cwd(), 'src/main.ts');
+ const mainPathContent = fs.readFileSync(mainPath).toString();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
var mainPath = path.resolve(process.cwd(), 'src/main.ts');
var mainPathContent = fs.readFileSync(mainPath).toString();
const mainPath = path.resolve(process.cwd(), 'src/main.ts');
const mainPathContent = fs.readFileSync(mainPath).toString();
🧰 Tools
🪛 Biome

[error] 50-50: Use let or const instead of var.

A variable declared with var is accessible in the whole body of the function. Thus, the variable can be accessed before its initialization and outside the block where it is declared.
See MDN web docs for more details.
Unsafe fix: Use 'const' instead.

(lint/style/noVar)


[error] 51-51: Use let or const instead of var.

A variable declared with var is accessible in the whole body of the function. Thus, the variable can be accessed before its initialization and outside the block where it is declared.
See MDN web docs for more details.
Unsafe fix: Use 'const' instead.

(lint/style/noVar)

fs.writeFileSync(
mainPath,
mainPathContent.replace(/please-replace-your-git-commit-version/g, process.env.CI_GIT_COMMIT_SHA),
mainPathContent.replace(/please-replace-your-mobile-app-version/g, ctx.env.FYLE_MOBILE_RELEASE_VERSION),
'utf8'
);

Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Sentry.init({
dsn: environment.SENTRY_DSN,
integrations: [],
tracesSampleRate: 0.1,
release: 'please-replace-your-git-commit-version',
release: 'please-replace-your-mobile-app-version',
ignoreErrors: ['Non-Error exception captured', 'Non-Error promise rejection captured'],
});

Expand Down
Loading