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

[cli] CLI picks up version from MARKETING_VERSION but ideally should pick CFBundleShortVersionString #84

Open
regalstreak opened this issue Feb 5, 2025 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@regalstreak
Copy link

Noticed this thing where while running yarn hot-updater deploy -i, the default version shows up as the MARKETING_VERSION in project.pbxproj, ideal DX should pick it up from the Info.plist as that's picked up during updates if I'm right?

Don't know why we're not updating the MARKETING_VERSION though 🥲

Image

@gronxb gronxb added enhancement New feature or request good first issue Good for newcomers labels Feb 5, 2025
@gronxb
Copy link
Owner

gronxb commented Feb 5, 2025

Great point! But I don’t have time right now, and since it’s a low priority, I’ll check it later when I have some free time.

It looks like I need to update the following code:

export const getIOSVersion = async (cwd: string): Promise<string | null> => {
const filename = await findXCodeProjectFilename(cwd);
if (!filename) return null;
const projectPath = path.join(cwd, "ios", filename);
try {
const execPromise = util.promisify(exec);
const { stdout } = await execPromise(
`xcodebuild -project ${projectPath} -showBuildSettings | grep MARKETING_VERSION`,
);
const versionMatch = stdout.match(/MARKETING_VERSION = ([\d.]+)/);
return versionMatch?.[1] ? versionMatch[1] : null;
} catch (error) {
return null;
}
};
export const getAndroidVersion = async (
cwd: string,
): Promise<string | null> => {
const buildGradlePath = path.join(cwd, "android", "app", "build.gradle");
try {
const buildGradleContent = await fs.readFile(buildGradlePath, "utf8");
const versionNameMatch = buildGradleContent.match(
/versionName\s+"([\d.]+)"/,
);
return versionNameMatch?.[1] ? versionNameMatch[1] : null;
} catch (error) {
return null;
}
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants