Skip to content

Commit

Permalink
[1/1][eas-cli] generate eas-update-metadata.json on publish (#2158)
Browse files Browse the repository at this point in the history
* [eas-cli] publish: patch metadata.json with eas info

* feedback
  • Loading branch information
quinlanj authored Dec 19, 2023
1 parent 06466e5 commit 183fe87
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/eas-cli/src/commands/update/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
collectAssetsAsync,
defaultPublishPlatforms,
filterExportedPlatformsByFlag,
generateEasMetadataAsync,
getBranchNameForCommandAsync,
getRequestedPlatform,
getRuntimeToPlatformMappingFromRuntimeVersions,
Expand Down Expand Up @@ -468,6 +469,9 @@ export default class UpdatePublish extends EasCommand {
throw e;
}

if (!skipBundler) {
await generateEasMetadataAsync(distRoot, getUpdateJsonInfosForUpdates(newUpdates));
}
if (jsonFlag) {
printJsonOnlyOutput(getUpdateJsonInfosForUpdates(newUpdates));
} else {
Expand Down
16 changes: 14 additions & 2 deletions packages/eas-cli/src/project/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import nullthrows from 'nullthrows';
import path from 'path';
import promiseLimit from 'promise-limit';

import { resolveWorkflowAsync } from './workflow';

Check warning on line 15 in packages/eas-cli/src/project/publish.ts

View workflow job for this annotation

GitHub Actions / Test with Node 14

`./workflow` import should occur after import of `../vcs/vcs`

Check warning on line 15 in packages/eas-cli/src/project/publish.ts

View workflow job for this annotation

GitHub Actions / Test with Node 16

`./workflow` import should occur after import of `../vcs/vcs`

Check warning on line 15 in packages/eas-cli/src/project/publish.ts

View workflow job for this annotation

GitHub Actions / Test with Node 18

`./workflow` import should occur after import of `../vcs/vcs`
import { selectBranchOnAppAsync } from '../branch/queries';
import { getDefaultBranchNameAsync } from '../branch/utils';
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
Expand All @@ -23,7 +24,11 @@ import Log, { learnMore } from '../log';
import { RequestedPlatform, requestedPlatformDisplayNames } from '../platform';
import { promptAsync } from '../prompts';
import { getBranchNameFromChannelNameAsync } from '../update/getBranchNameFromChannelNameAsync';
import { formatUpdateMessage, truncateString as truncateUpdateMessage } from '../update/utils';
import {
UpdateJsonInfo,
formatUpdateMessage,
truncateString as truncateUpdateMessage,
} from '../update/utils';
import { PresignedPost, uploadWithPresignedPostWithRetryAsync } from '../uploads';
import {
expoCommandAsync,
Expand All @@ -34,7 +39,6 @@ import chunk from '../utils/expodash/chunk';
import { truthy } from '../utils/expodash/filter';
import uniqBy from '../utils/expodash/uniqBy';
import { Client } from '../vcs/vcs';
import { resolveWorkflowAsync } from './workflow';

export type ExpoCLIExportPlatformFlag = Platform | 'all';

Expand Down Expand Up @@ -294,6 +298,14 @@ export function loadMetadata(distRoot: string): Metadata {
return metadata;
}

export async function generateEasMetadataAsync(
distRoot: string,
metadata: UpdateJsonInfo[]
): Promise<void> {
const easMetadataPath = path.join(distRoot, 'eas-update-metadata.json');
await JsonFile.writeAsync(easMetadataPath, { updates: metadata });
}

export function filterExportedPlatformsByFlag<T extends Partial<Record<Platform, any>>>(
record: T,
platformFlag: ExpoCLIExportPlatformFlag
Expand Down

0 comments on commit 183fe87

Please sign in to comment.