Skip to content

Commit

Permalink
[eas-cli] add clear cache option to updates (#1839)
Browse files Browse the repository at this point in the history
* [eas-cli] add clear cache option to updates

* update CHANGELOG.md
  • Loading branch information
quinlanj authored May 15, 2023
1 parent 3c82a2f commit c8e57f0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ This is the log of notable changes to EAS CLI and related packages.

### 🎉 New features

- Add clear cache flag to eas update. ([#1839](https://github.com/expo/eas-cli/pull/1839) by [@quinlanj](https://github.com/quinlanj))

### 🐛 Bug fixes

### 🧹 Chores
Expand Down
10 changes: 9 additions & 1 deletion packages/eas-cli/src/commands/update/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type RawUpdateFlags = {
platform: string;
'input-dir': string;
'skip-bundler': boolean;
'clear-cache': boolean;
'private-key-path'?: string;
'non-interactive': boolean;
json: boolean;
Expand All @@ -76,6 +77,7 @@ type UpdateFlags = {
updateMessage?: string;
inputDir: string;
skipBundler: boolean;
clearCache: boolean;
privateKeyPath?: string;
json: boolean;
nonInteractive: boolean;
Expand Down Expand Up @@ -114,6 +116,10 @@ export default class UpdatePublish extends EasCommand {
description: `Skip running Expo CLI to bundle the app before publishing`,
default: false,
}),
'clear-cache': Flags.boolean({
description: `Clear the bundler cache before publishing`,
default: false,
}),
platform: Flags.enum({
char: 'p',
options: [
Expand Down Expand Up @@ -151,6 +157,7 @@ export default class UpdatePublish extends EasCommand {
updateMessage: updateMessageArg,
inputDir,
skipBundler,
clearCache,
privateKeyPath,
json: jsonFlag,
nonInteractive,
Expand Down Expand Up @@ -212,7 +219,7 @@ export default class UpdatePublish extends EasCommand {
if (!skipBundler) {
const bundleSpinner = ora().start('Exporting...');
try {
await buildBundlesAsync({ projectDir, inputDir, exp, platformFlag });
await buildBundlesAsync({ projectDir, inputDir, exp, platformFlag, clearCache });
bundleSpinner.succeed('Exported bundle(s)');
} catch (e) {
bundleSpinner.fail('Export failed');
Expand Down Expand Up @@ -488,6 +495,7 @@ export default class UpdatePublish extends EasCommand {
updateMessage,
inputDir: flags['input-dir'],
skipBundler: flags['skip-bundler'],
clearCache: flags['clear-cache'],
platform: flags.platform as RequestedPlatform,
privateKeyPath: flags['private-key-path'],
nonInteractive,
Expand Down
4 changes: 4 additions & 0 deletions packages/eas-cli/src/project/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,13 @@ export async function buildBundlesAsync({
inputDir,
exp,
platformFlag,
clearCache,
}: {
projectDir: string;
inputDir: string;
exp: Pick<ExpoConfig, 'sdkVersion'>;
platformFlag: ExpoCLIExportPlatformFlag;
clearCache?: boolean;
}): Promise<void> {
const packageJSON = JsonFile.read(path.resolve(projectDir, 'package.json'));
if (!packageJSON) {
Expand All @@ -200,6 +202,7 @@ export async function buildBundlesAsync({
'--dump-assetmap',
'--platform',
platformFlag,
...(clearCache ? ['--clear'] : []),
]);
} else {
// Legacy global Expo CLI
Expand All @@ -213,6 +216,7 @@ export async function buildBundlesAsync({
'--dump-assetmap',
'--platform',
platformFlag,
...(clearCache ? ['--clear'] : []),
]);
}
}
Expand Down

0 comments on commit c8e57f0

Please sign in to comment.