-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[eas-cli] Add metadata commands (#1136)
* [eas-cli] Add metadata commands * Add myself as codeowner to the metadata * [eas-cli] Hide the metadata commands for now * Add metadata changelog entry * [eas-cli] Update metadata configure command description * [eas-cli] Drop non-interactive due to limitations in AppStoreApi * [eas-cli] Reimplement credentials context for metadata * [eas-cli] Drop non-interactive flag in metadata command * [eas-cli] Drop args from metadata:configure Co-authored-by: Wojciech Kozyra <wojciech.kozyra@swmansion.com> * [eas-cli] Add retroactive code review changes (#1147) * [eas-cli] Add public access modifiers to classes * [eas-cli] Add specific types to date precision remover * [eas-cli] Add try catch around writing json to always unsubscribe * [eas-cli] Add async return await to uploadAsync log methods * [eas-cli] Fix date precision type and test * [eas-cli] Use submission profile bundle id if defined * [eas-cli] Drop catch from IO try catch block * [eas-cli] Move unique helper to global utils * [eas-cli] Prefer nullish coalescing * [eas-cli] Move metadata commands to pull and push * [eas-cli] Drop the platform option from the push command * [eas-cli] Remove alias and reword descriptions * [eas-cli] Auto-configure eas.json with metadata when missing (#1156) * [eas-cli] Polish the command output for release (#1159) * [eas-cli] Finalize metadata logging output * [eas-cli] Fix logging validation errors when store.config.json is not found * [eas-cli] Make all localized entites bold * [eas-cli] Make version string visible in logs * [eas-cli] Add note about early beta * [eas-cli] Remove hidden from meta commands * [eas-cli] Add metadata topic * [eas-cli] Rename eas metadata to eas metadata:push in logging * [eas-cli] Remove unused arg flag from push Co-authored-by: Wojciech Kozyra <wojciech.kozyra@swmansion.com>
- Loading branch information
Showing
20 changed files
with
236 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { getConfig } from '@expo/config'; | ||
import { Flags } from '@oclif/core'; | ||
import chalk from 'chalk'; | ||
import path from 'path'; | ||
|
||
import { ensureProjectConfiguredAsync } from '../../build/configure'; | ||
import EasCommand from '../../commandUtils/EasCommand'; | ||
import { CredentialsContext } from '../../credentials/context'; | ||
import Log, { learnMore } from '../../log'; | ||
import { createMetadataContextAsync } from '../../metadata/context'; | ||
import { downloadMetadataAsync } from '../../metadata/download'; | ||
import { handleMetadataError } from '../../metadata/errors'; | ||
import { findProjectRootAsync, getProjectIdAsync } from '../../project/projectUtils'; | ||
import { ensureLoggedInAsync } from '../../user/actions'; | ||
|
||
export default class MetadataPull extends EasCommand { | ||
static description = 'generate the local store configuration from the app stores'; | ||
|
||
static flags = { | ||
profile: Flags.string({ | ||
description: | ||
'Name of the submit profile from eas.json. Defaults to "production" if defined in eas.json.', | ||
}), | ||
}; | ||
|
||
async runAsync(): Promise<void> { | ||
Log.warn('EAS Metadata is in beta and subject to breaking changes.'); | ||
|
||
const { flags } = await this.parse(MetadataPull); | ||
const projectDir = await findProjectRootAsync(); | ||
const { exp } = getConfig(projectDir, { skipSDKVersionRequirement: true }); | ||
await getProjectIdAsync(exp); | ||
await ensureProjectConfiguredAsync({ projectDir, nonInteractive: false }); | ||
|
||
const credentialsCtx = new CredentialsContext({ | ||
exp, | ||
projectDir, | ||
user: await ensureLoggedInAsync(), | ||
nonInteractive: false, | ||
}); | ||
|
||
const metadataCtx = await createMetadataContextAsync({ | ||
credentialsCtx, | ||
projectDir, | ||
exp, | ||
profileName: flags.profile, | ||
}); | ||
|
||
try { | ||
const filePath = await downloadMetadataAsync(metadataCtx); | ||
const relativePath = path.relative(process.cwd(), filePath); | ||
|
||
Log.addNewLineIfNone(); | ||
Log.log(`🎉 Your store configuration is ready. | ||
- Update the ${chalk.bold(relativePath)} file to prepare the app information. | ||
- Run ${chalk.bold('eas submit')} or manually upload a new app version to the app stores. | ||
- Once the app is uploaded, run ${chalk.bold('eas metadata:push')} to sync the store configuration. | ||
- ${learnMore('https://docs.expo.dev/eas-metadata/introduction/')}`); | ||
} catch (error: any) { | ||
handleMetadataError(error); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { getConfig } from '@expo/config'; | ||
import { Flags } from '@oclif/core'; | ||
|
||
import { ensureProjectConfiguredAsync } from '../../build/configure'; | ||
import EasCommand from '../../commandUtils/EasCommand'; | ||
import { CredentialsContext } from '../../credentials/context'; | ||
import Log from '../../log'; | ||
import { createMetadataContextAsync } from '../../metadata/context'; | ||
import { handleMetadataError } from '../../metadata/errors'; | ||
import { uploadMetadataAsync } from '../../metadata/upload'; | ||
import { findProjectRootAsync, getProjectIdAsync } from '../../project/projectUtils'; | ||
import { ensureLoggedInAsync } from '../../user/actions'; | ||
|
||
export default class MetadataPush extends EasCommand { | ||
static description = 'sync the local store configuration to the app stores'; | ||
|
||
static flags = { | ||
profile: Flags.string({ | ||
description: | ||
'Name of the submit profile from eas.json. Defaults to "production" if defined in eas.json.', | ||
}), | ||
}; | ||
|
||
async runAsync(): Promise<void> { | ||
Log.warn('EAS Metadata is in beta and subject to breaking changes.'); | ||
|
||
const { flags } = await this.parse(MetadataPush); | ||
const projectDir = await findProjectRootAsync(); | ||
const { exp } = getConfig(projectDir, { skipSDKVersionRequirement: true }); | ||
await getProjectIdAsync(exp); | ||
await ensureProjectConfiguredAsync({ projectDir, nonInteractive: false }); | ||
|
||
const credentialsCtx = new CredentialsContext({ | ||
exp, | ||
projectDir, | ||
user: await ensureLoggedInAsync(), | ||
nonInteractive: false, | ||
}); | ||
|
||
const metadataCtx = await createMetadataContextAsync({ | ||
credentialsCtx, | ||
projectDir, | ||
exp, | ||
profileName: flags.profile, | ||
}); | ||
|
||
try { | ||
await uploadMetadataAsync(metadataCtx); | ||
Log.addNewLineIfNone(); | ||
Log.log(`🎉 Store configuration is synced with the app stores.`); | ||
} catch (error: any) { | ||
handleMetadataError(error); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.