Skip to content

Commit

Permalink
[eas-cli] Remove support for classic updates release channel in 50+ (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
wschurman authored Jan 19, 2024
1 parent 02c8dca commit 8ea0579
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 17 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ This is the log of notable changes to EAS CLI and related packages.

### 🧹 Chores

- Remove support for classic updates release channel in 50+. ([#2189](https://github.com/expo/eas-cli/pull/2189) by [@wschurman](https://github.com/wschurman))

## [7.0.0](https://github.com/expo/eas-cli/releases/tag/v7.0.0) - 2024-01-19

### 🛠 Breaking changes
Expand Down
18 changes: 14 additions & 4 deletions packages/eas-cli/src/build/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import { BuildContext } from './context';
import { maybeResolveVersionsAsync as maybeResolveIosVersionsAsync } from './ios/version';
import { LocalBuildMode } from './local';
import Log from '../log';
import { getUsername, isExpoUpdatesInstalled } from '../project/projectUtils';
import {
getUsername,
isClassicUpdatesSupportedAsync,
isExpoUpdatesInstalled,
} from '../project/projectUtils';
import {
readChannelSafelyAsync as readAndroidChannelSafelyAsync,
readReleaseChannelSafelyAsync as readAndroidReleaseChannelSafelyAsync,
Expand Down Expand Up @@ -125,13 +129,19 @@ async function resolveChannelOrReleaseChannelAsync<T extends Platform>(
if (ctx.buildProfile.channel) {
return { channel: ctx.buildProfile.channel };
}
if (ctx.buildProfile.releaseChannel) {
return { releaseChannel: ctx.buildProfile.releaseChannel };
}
const channel = await getNativeChannelAsync(ctx);
if (channel) {
return { channel };
}

if (!(await isClassicUpdatesSupportedAsync(ctx.projectDir))) {
return null;
}

if (ctx.buildProfile.releaseChannel) {
return { releaseChannel: ctx.buildProfile.releaseChannel };
}

const releaseChannel = await getNativeReleaseChannelAsync(ctx);
return { releaseChannel };
}
Expand Down
39 changes: 26 additions & 13 deletions packages/eas-cli/src/project/projectUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ export function isUsingEASUpdate(exp: ExpoConfig, projectId: string): boolean {
return exp.updates?.url === getEASUpdateURL(projectId);
}

async function getExpoUpdatesPackageVersionIfInstalledAsync(
projectDir: string
): Promise<string | null> {
const maybePackageJson = resolveFrom.silent(projectDir, 'expo-updates/package.json');
if (!maybePackageJson) {
return null;
}
const { version } = await fs.readJson(maybePackageJson);
return version ?? null;
}

export async function validateAppVersionRuntimePolicySupportAsync(
projectDir: string,
exp: ExpoConfig
Expand All @@ -96,12 +107,9 @@ export async function validateAppVersionRuntimePolicySupportAsync(
return;
}

const maybePackageJson = resolveFrom.silent(projectDir, 'expo-updates/package.json');
if (maybePackageJson) {
const { version } = await fs.readJson(maybePackageJson);
if (semver.gte(version, '0.14.4')) {
return;
}
const expoUpdatesPackageVersion = await getExpoUpdatesPackageVersionIfInstalledAsync(projectDir);
if (expoUpdatesPackageVersion !== null && semver.gte(expoUpdatesPackageVersion, '0.14.4')) {
return;
}

Log.warn(
Expand All @@ -112,13 +120,9 @@ export async function validateAppVersionRuntimePolicySupportAsync(
export async function enforceRollBackToEmbeddedUpdateSupportAsync(
projectDir: string
): Promise<void> {
const maybePackageJson = resolveFrom.silent(projectDir, 'expo-updates/package.json');

if (maybePackageJson) {
const { version } = await fs.readJson(maybePackageJson);
if (semver.gte(version, '0.19.0')) {
return;
}
const expoUpdatesPackageVersion = await getExpoUpdatesPackageVersionIfInstalledAsync(projectDir);
if (expoUpdatesPackageVersion !== null && semver.gte(expoUpdatesPackageVersion, '0.19.0')) {
return;
}

throw new Error(
Expand All @@ -128,6 +132,15 @@ export async function enforceRollBackToEmbeddedUpdateSupportAsync(
);
}

export async function isClassicUpdatesSupportedAsync(projectDir: string): Promise<boolean> {
const expoUpdatesPackageVersion = await getExpoUpdatesPackageVersionIfInstalledAsync(projectDir);
if (expoUpdatesPackageVersion === null) {
return false;
}

return semver.lt(expoUpdatesPackageVersion, '0.19.0');
}

export async function installExpoUpdatesAsync(
projectDir: string,
options?: { silent: boolean }
Expand Down

0 comments on commit 8ea0579

Please sign in to comment.