diff --git a/bump-version.js b/bump-version.js new file mode 100755 index 0000000..ccda2b2 --- /dev/null +++ b/bump-version.js @@ -0,0 +1,84 @@ +#!/usr/bin/env node + +import { execSync } from 'child_process' +import fs from 'fs' +import path from 'path' +import { fileURLToPath } from 'url' + +const __filename = fileURLToPath(import.meta.url) +const __dirname = path.dirname(__filename) + +// Read package.json +const packageJsonPath = path.join(__dirname, 'package.json') +const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')) + +// Get current version +const currentVersion = packageJson.version +console.log(`Current version: ${currentVersion}`) + +// Parse version (assuming semver format: major.minor.patch) +const versionParts = currentVersion.split('.').map(Number) +const [major, minor, patch] = versionParts + +// Bump patch version by default (can be modified to accept arguments for major/minor) +const bumpType = process.argv[2] || 'patch' +let newVersion + +switch (bumpType) { + case 'major': + newVersion = `${major + 1}.0.0` + break + case 'minor': + newVersion = `${major}.${minor + 1}.0` + break + case 'patch': + default: + newVersion = `${major}.${minor}.${patch + 1}` + break +} + +console.log(`New version: ${newVersion}`) + +// Update package.json +packageJson.version = newVersion +fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n') +console.log('āœ“ Updated package.json') + +// Read Android build.gradle to get current versionCode +const buildGradlePath = path.join(__dirname, 'android', 'app', 'build.gradle') +let buildGradle = fs.readFileSync(buildGradlePath, 'utf8') + +// Extract current versionCode +const versionCodeMatch = buildGradle.match(/versionCode\s+(\d+)/) +const currentVersionCode = versionCodeMatch ? parseInt(versionCodeMatch[1]) : 1 +const newVersionCode = currentVersionCode + 1 + +console.log(`Android versionCode: ${currentVersionCode} → ${newVersionCode}`) + +// Use capacitor-set-version to update both iOS and Android +try { + console.log('\nUpdating iOS and Android versions...') + + // Set version and build number for both platforms + execSync( + `npx capacitor-set-version set -v ${newVersion} -b ${newVersionCode}`, + { + stdio: 'inherit', + }, + ) + + console.log('\nāœ“ Successfully bumped version to', newVersion) + console.log(`āœ“ Build number: ${newVersionCode}`) + console.log('\nNext steps:') + console.log('1. Review the changes') + console.log( + '2. Commit: git add . && git commit -m "Bump version to ' + + newVersion + + '"', + ) + console.log('3. Tag: git tag v' + newVersion) + console.log('4. Push: git push origin develop --tags') +} catch (error) { + console.error('Error updating versions:', error.message) + process.exit(1) +} diff --git a/src/utils/Fetcher.jsx b/src/utils/Fetcher.jsx index 4335705..167394a 100644 --- a/src/utils/Fetcher.jsx +++ b/src/utils/Fetcher.jsx @@ -514,7 +514,8 @@ const ChangePassword = (verifiticationCode, password) => { }) } -const ResetPassword = email => { +const ResetPassword = async email => { + await apiClient.init() const basedURL = apiManager.getApiURL() return fetch(`${basedURL}/auth/reset`, { method: 'POST', diff --git a/src/views/Authorization/ForgotPasswordView.jsx b/src/views/Authorization/ForgotPasswordView.jsx index 0e154bf..e2902d0 100644 --- a/src/views/Authorization/ForgotPasswordView.jsx +++ b/src/views/Authorization/ForgotPasswordView.jsx @@ -143,7 +143,6 @@ const ForgotPasswordView = () => {