Skip to content

Commit

Permalink
Merge branch 'main' into @bycedric/eas-cli/worker-deploy-json
Browse files Browse the repository at this point in the history
  • Loading branch information
byCedric authored Sep 13, 2024
2 parents ffbb1a3 + 66ce64e commit 904c15a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This is the log of notable changes to EAS CLI and related packages.
- Add `worker --alias` flag to assign custom aliases when deploying. ([#2551](https://github.com/expo/eas-cli/pull/2551) by [@byCedric](https://github.com/byCedric)))
- Add `worker --id` flag to use a custom deployment identifier. ([#2552](https://github.com/expo/eas-cli/pull/2552) by [@byCedric](https://github.com/byCedric)))
- Add `worker --environment` flag to deploy with EAS environment variables. ([#2557](https://github.com/expo/eas-cli/pull/2557) by [@kitten](https://github.com/kitten)))
- Add `worker --export-dir` flag to select exported directory. ([#2560](https://github.com/expo/eas-cli/pull/2560) by [@byCedric](https://github.com/byCedric)))
- Add `worker --json` flag to allow integrating with 3rd parties and custom tooling. ([#2561](https://github.com/expo/eas-cli/pull/2561) by [@byCedric](https://github.com/byCedric)))

### 🐛 Bug fixes
Expand Down
20 changes: 14 additions & 6 deletions packages/eas-cli/src/commands/worker/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ interface DeployFlags {
aliasName?: string;
environment?: EnvironmentVariableEnvironment;
deploymentIdentifier?: string;
exportDir: string;
}

interface RawDeployFlags {
Expand All @@ -41,6 +42,7 @@ interface RawDeployFlags {
prod: boolean;
alias?: string;
id?: string;
'export-dir': string;
}

export default class WorkerDeploy extends EasCommand {
Expand All @@ -66,6 +68,11 @@ export default class WorkerDeploy extends EasCommand {
description: 'Custom unique identifier for the new deployment',
helpValue: 'xyz123',
}),
'export-dir': Flags.string({
description: 'Directory where the Expo project was exported',
helpValue: 'dir',
default: 'dist',
}),
// TODO(@kitten): Allow deployment identifier to be specified
...EasNonInteractiveAndJsonFlags,
...EASEnvironmentFlag,
Expand Down Expand Up @@ -98,7 +105,7 @@ export default class WorkerDeploy extends EasCommand {
} = await this.getContextAsync(WorkerDeploy, flags);

const { projectId, exp } = await getDynamicPrivateProjectConfigAsync();
const distPath = path.resolve(projectDir, 'dist');
const distPath = path.join(projectDir, flags.exportDir);

let distServerPath: string | null;
let distClientPath: string;
Expand All @@ -107,21 +114,21 @@ export default class WorkerDeploy extends EasCommand {
distServerPath = null;
if (!(await isDirectory(distClientPath))) {
throw new Error(
`No "dist/" folder found. Prepare your project for deployment with "npx expo export"`
`No "${flags.exportDir}/" folder found. Prepare your project for deployment with "npx expo export"`
);
}

logDeploymentType('static');
} else if (exp.web?.output === 'server') {
distClientPath = path.resolve(distPath, 'client');
distServerPath = path.resolve(distPath, 'server');
distClientPath = path.join(distPath, 'client');
distServerPath = path.join(distPath, 'server');
if (!(await isDirectory(distClientPath))) {
throw new Error(
`No "dist/client/" folder found. Prepare your project for deployment with "npx expo export"`
`No "${flags.exportDir}/client/" folder found. Prepare your project for deployment with "npx expo export"`
);
} else if (!(await isDirectory(distServerPath))) {
throw new Error(
`No "dist/server/" folder found. Prepare your project for deployment with "npx expo export"`
`No "${flags.exportDir}/server/" folder found. Prepare your project for deployment with "npx expo export"`
);
}

Expand Down Expand Up @@ -329,6 +336,7 @@ export default class WorkerDeploy extends EasCommand {
isProduction: !!flags.prod,
aliasName: flags.alias?.trim().toLowerCase(),
deploymentIdentifier: flags.id?.trim(),
exportDir: flags['export-dir'],
};
}
}
Expand Down

0 comments on commit 904c15a

Please sign in to comment.