easc 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,14 +24,40 @@ tsx index.ts --help
24
24
  tsx index.ts update --help
25
25
  ```
26
26
 
27
+ ## Commands
28
+
29
+ ### update
30
+
31
+ Deploy an OTA update to the specified channel.
32
+
33
+ ```bash
34
+ easc update --channel production # Deploy OTA update
35
+ easc update --prod # Shorthand for production
36
+ easc update --dry-run # Preview without uploading
37
+ easc update --skip-build # Use existing export
38
+ ```
39
+
40
+ ### build
41
+
42
+ Build the app locally and optionally submit to app stores.
43
+
44
+ ```bash
45
+ easc build # Build all platforms locally
46
+ easc build --platform ios # iOS only
47
+ easc build --platform android # Android only
48
+ easc build --profile development # Use dev profile
49
+ easc build --auto-submit # Auto-submit to stores
50
+ easc build --clear-cache # Clean prebuild
51
+ easc build --output ./build.ipa # Custom output path
52
+ ```
53
+
27
54
  ## Publishing
28
55
 
29
56
  To publish this package to npm:
30
57
 
31
58
  ```bash
32
- cd packages/deploy
33
- pnpm run build
34
- pnpm publish
59
+ cd apps/easc
60
+ npm publish
35
61
  ```
36
62
 
37
63
  Keep in mind that you'll have to change the name to somthing other than easc if you are not a admin on this project. You may wish to publish your own custom version for extra security.
package/bin/easc.js CHANGED
@@ -5,22 +5,35 @@ import { dirname, join } from "path";
5
5
  import { existsSync } from "fs";
6
6
  import { createRequire } from "module";
7
7
 
8
+ const Runtime = {
9
+ BUN: "bun",
10
+ NODE: "node",
11
+ };
12
+
8
13
  const __dirname = dirname(fileURLToPath(import.meta.url));
9
- const require = createRequire(import.meta.url);
10
- const tsxPath = require.resolve("tsx/esm");
11
14
  const indexPath = join(__dirname, "..", "index.ts");
12
-
13
15
  const envPath = join(process.cwd(), ".env");
14
- const nodeArgs = ["--import", tsxPath];
16
+ const envArgs = existsSync(envPath) ? ["--env-file", envPath] : [];
17
+ const scriptArgs = [indexPath, ...process.argv.slice(2)];
15
18
 
16
- if (existsSync(envPath)) {
17
- nodeArgs.push("--env-file", envPath);
18
- }
19
+ function getRuntime() {
20
+ const runtime = typeof Bun !== "undefined" ? Runtime.BUN : Runtime.NODE;
19
21
 
20
- nodeArgs.push(indexPath, ...process.argv.slice(2));
22
+ switch (runtime) {
23
+ case Runtime.BUN:
24
+ return { runtime, args: [...envArgs, ...scriptArgs] };
25
+ case Runtime.NODE:
26
+ const require = createRequire(import.meta.url);
27
+ const tsxPath = require.resolve("tsx/esm");
28
+ return {
29
+ runtime,
30
+ args: ["--import", tsxPath, ...envArgs, ...scriptArgs],
31
+ };
32
+ }
33
+ }
21
34
 
22
- const child = spawn("node", nodeArgs, { stdio: "inherit" });
35
+ const { runtime, args } = getRuntime();
23
36
 
24
- child.on("exit", (code) => {
37
+ spawn(runtime, args, { stdio: "inherit" }).on("exit", (code) => {
25
38
  process.exit(code || 0);
26
39
  });
package/index.ts CHANGED
@@ -1,166 +1,18 @@
1
1
  #!/usr/bin/env node
2
- import { execSync } from "child_process";
3
- import fs from "fs";
4
- import chalk from "chalk";
5
- import { parseArguments } from "./src/utils/cli";
6
- import { validateConfig, getConfig } from "./src/utils/schema";
7
- import { resolveRuntimeVersion, getPlatforms } from "./src/utils/runtime";
8
- import { getCommitHash, getShortCommitHash, isGitClean } from "./src/utils/git";
9
- import {
10
- readAppJson,
11
- readMetadata,
12
- findBundleFile,
13
- getAssetFiles,
14
- checkExportDirectory,
15
- } from "./src/utils/files";
16
- import { uploadBundle, createDryRunSummary } from "./src/utils/upload";
17
- import { Logger } from "./src/utils/logger";
18
- import { PlatformType } from "./src/enums/platform";
19
-
20
- type IDeploymentResult = {
21
- platform: PlatformType;
22
- status: "dry_run" | "uploaded" | "failed";
23
- bundle_size: number;
24
- asset_count: number;
25
- error?: string;
26
- };
27
-
28
- (async () => {
29
- let logger: Logger;
30
-
31
- try {
32
- const options = parseArguments();
33
-
34
- logger = new Logger();
35
-
36
- const validation = validateConfig(options.channel);
37
- if (!validation.valid) {
38
- validation.errors.forEach((error) => logger.error(error));
39
- process.exit(1);
40
- }
41
-
42
- const config = getConfig(options.channel!);
43
-
44
- if (!isGitClean()) {
45
- logger.warn("Working directory has uncommitted changes");
46
- }
47
-
48
- // Build if needed
49
- if (!options.skipBuild) {
50
- logger.startSpinner("Building app bundles...");
51
-
52
- execSync(
53
- options.exportDir !== "dist"
54
- ? `npx expo export --output-dir ${options.exportDir}`
55
- : "npx expo export",
56
- {
57
- cwd: process.cwd(),
58
- stdio: "ignore",
59
- }
60
- );
61
-
62
- logger.succeedSpinner("Build completed");
63
- } else {
64
- logger.info(
65
- `Skipping build (using existing export from ${options.exportDir})`
66
- );
67
- }
68
-
69
- const exportDir = checkExportDirectory(options.exportDir);
70
- const appJson = readAppJson();
71
- const metadata = readMetadata(exportDir);
72
- const runtimeVersion = resolveRuntimeVersion(appJson);
73
- const platforms = getPlatforms(appJson);
74
- const commitHash = getCommitHash();
75
- const shortCommit = getShortCommitHash();
76
-
77
- logger.section("📤 Deployment Info");
78
- logger.table([
79
- ["Server", config.otaServer],
80
- ["Runtime", runtimeVersion],
81
- ["Commit", shortCommit || ""],
82
- ["Export Dir", options.exportDir],
83
- ["Channel", options.channel || ""],
84
- ]);
85
-
86
- const results: IDeploymentResult[] = [];
87
-
88
- for (const platform of platforms) {
89
- logger.section(platform.toUpperCase());
90
-
91
- try {
92
- // Find bundle and assets
93
- const bundlePath = findBundleFile(exportDir, platform);
94
- const assetPaths = getAssetFiles(exportDir, metadata, platform);
95
-
96
- if (options.dryRun) {
97
- // Dry run - just show what would be uploaded
98
- const summary = createDryRunSummary({
99
- platform,
100
- bundlePath,
101
- assetPaths,
102
- channel: options.channel!,
103
- runtimeVersion,
104
- commitHash,
105
- });
106
-
107
- logger.box(summary);
108
- logger.success(`${platform} (dry run)`);
109
-
110
- results.push({
111
- platform,
112
- status: "dry_run",
113
- bundle_size: fs.statSync(bundlePath).size,
114
- asset_count: assetPaths.length,
115
- });
116
- } else {
117
- // Actual upload
118
- logger.startSpinner(`Uploading ${platform}...`);
119
-
120
- await uploadBundle({
121
- platform,
122
- channel: options.channel!,
123
- runtimeVersion,
124
- commitHash,
125
- bundlePath,
126
- assetPaths,
127
- expoConfig: appJson.expo,
128
- metadata,
129
- config,
130
- });
131
-
132
- logger.succeedSpinner(`${platform} uploaded`);
133
-
134
- results.push({
135
- platform,
136
- status: "uploaded",
137
- bundle_size: fs.statSync(bundlePath).size,
138
- asset_count: assetPaths.length,
139
- });
140
- }
141
- } catch (error) {
142
- logger.failSpinner(`${platform} failed`);
143
- results.push({
144
- platform,
145
- status: "failed",
146
- bundle_size: 0,
147
- asset_count: 0,
148
- error: error instanceof Error ? error.message : String(error),
149
- });
150
- throw error;
151
- }
152
- }
153
-
154
- logger.section("");
155
- if (options.dryRun) {
156
- logger.success("Dry run completed successfully!");
157
- logger.info("Run without --dry-run to perform actual upload");
158
- } else {
159
- logger.success("✨ Updates published successfully!");
160
- }
161
- } catch (error) {
162
- const errorMessage = error instanceof Error ? error.message : String(error);
163
- console.error(chalk.red(`Deployment Failed: ${errorMessage}`));
164
- process.exit(1);
165
- }
166
- })();
2
+ import yargs from "yargs";
3
+ import { hideBin } from "yargs/helpers";
4
+ import { build } from "./src/commands/build";
5
+ import { update } from "./src/commands/update";
6
+
7
+ yargs(hideBin(process.argv))
8
+ .scriptName("easc")
9
+ .usage("$0 <command> [options]")
10
+ .command(build)
11
+ .command(update)
12
+ .demandCommand(1, "")
13
+ .showHelpOnFail(true)
14
+ .help()
15
+ .alias("help", "h")
16
+ .alias("version", "V")
17
+ .strict()
18
+ .parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easc",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "Expo App Services for Cloudflare - Deploy tool for Expo OTA updates to Cloudflare Workers",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -0,0 +1,149 @@
1
+ import { execSync } from "child_process";
2
+ import fs from "fs";
3
+ import path from "path";
4
+ import chalk from "chalk";
5
+ import type { CommandModule } from "yargs";
6
+ import { Logger } from "../utils/logger";
7
+ import { Platform, PlatformType } from "../enums/platform";
8
+
9
+ interface IArgs {
10
+ platform: PlatformType | "all";
11
+ profile: string;
12
+ autoSubmit: boolean;
13
+ clearCache: boolean;
14
+ output?: string;
15
+ }
16
+
17
+ function findBuildArtifact(pattern: string): string | null {
18
+ const cwd = process.cwd();
19
+ const files = fs.readdirSync(cwd).filter((f) => {
20
+ const regex = new RegExp(pattern.replace("*", ".*"));
21
+ return regex.test(f);
22
+ });
23
+
24
+ if (files.length === 0) return null;
25
+
26
+ return files
27
+ .map((f) => ({ name: f, mtime: fs.statSync(path.join(cwd, f)).mtime }))
28
+ .sort((a, b) => b.mtime.getTime() - a.mtime.getTime())[0]?.name ?? null;
29
+ }
30
+
31
+ export const build: CommandModule = {
32
+ command: "build",
33
+ describe: "Build the app locally",
34
+ builder: (yargs) =>
35
+ yargs
36
+ .option("platform", {
37
+ alias: "p",
38
+ type: "string",
39
+ choices: [Platform.iOS, Platform.Android, "all"] as const,
40
+ description: "Target platform",
41
+ default: "all",
42
+ })
43
+ .option("profile", {
44
+ alias: "e",
45
+ type: "string",
46
+ description: "EAS build profile",
47
+ default: "production",
48
+ })
49
+ .option("auto-submit", {
50
+ alias: "s",
51
+ type: "boolean",
52
+ description: "Submit to app stores after building",
53
+ default: false,
54
+ })
55
+ .option("clear-cache", {
56
+ type: "boolean",
57
+ description: "Clear cache before building",
58
+ default: false,
59
+ })
60
+ .option("output", {
61
+ type: "string",
62
+ description: "Output path for the build artifact",
63
+ })
64
+ .example("$0 build", "Build all platforms locally")
65
+ .example("$0 build -p ios -e development", "Build iOS with dev profile")
66
+ .example("$0 build -s", "Build and submit to stores"),
67
+ async handler(argv) {
68
+ const args = argv as unknown as IArgs;
69
+ const logger = new Logger();
70
+
71
+ try {
72
+ const platforms: PlatformType[] =
73
+ args.platform === "all"
74
+ ? [Platform.iOS, Platform.Android]
75
+ : [args.platform];
76
+
77
+ for (const platform of platforms) {
78
+ const platformName = platform === Platform.iOS ? "iOS" : "Android";
79
+
80
+ logger.section(`${platformName} Build`);
81
+
82
+ if (args.clearCache) {
83
+ logger.startSpinner(`Running prebuild for ${platformName}...`);
84
+ execSync(`npx expo prebuild --platform ${platform} --clean`, {
85
+ cwd: process.cwd(),
86
+ stdio: "ignore",
87
+ });
88
+ logger.succeedSpinner("Prebuild completed");
89
+ }
90
+
91
+ logger.startSpinner(`Building ${platformName} locally...`);
92
+
93
+ const buildFlags = [
94
+ `--platform ${platform}`,
95
+ `--profile ${args.profile}`,
96
+ "--local",
97
+ "--non-interactive",
98
+ args.clearCache ? "--clear-cache" : "",
99
+ args.output ? `--output ${args.output}` : "",
100
+ ]
101
+ .filter(Boolean)
102
+ .join(" ");
103
+
104
+ execSync(`eas build ${buildFlags}`, {
105
+ cwd: process.cwd(),
106
+ stdio: "inherit",
107
+ });
108
+
109
+ logger.succeedSpinner(`${platformName} build completed`);
110
+
111
+ if (args.autoSubmit) {
112
+ logger.startSpinner(`Submitting ${platformName} build...`);
113
+
114
+ const artifactPath =
115
+ platform === Platform.iOS
116
+ ? findBuildArtifact("build-*.ipa")
117
+ : findBuildArtifact("build-*.aab") ||
118
+ findBuildArtifact("build-*.apk");
119
+
120
+ if (!artifactPath) {
121
+ logger.failSpinner(`No ${platformName} build artifact found`);
122
+ process.exit(1);
123
+ }
124
+
125
+ logger.info(`Found artifact: ${artifactPath}`);
126
+
127
+ execSync(
128
+ `eas submit --platform ${platform} --path "${artifactPath}" --non-interactive`,
129
+ { cwd: process.cwd(), stdio: "inherit" }
130
+ );
131
+
132
+ logger.succeedSpinner(`${platformName} submitted`);
133
+
134
+ if (fs.existsSync(artifactPath)) {
135
+ fs.unlinkSync(artifactPath);
136
+ logger.info(`Cleaned up: ${artifactPath}`);
137
+ }
138
+ }
139
+ }
140
+
141
+ logger.section("");
142
+ logger.success("Build completed!");
143
+ } catch (error) {
144
+ const message = error instanceof Error ? error.message : String(error);
145
+ console.error(chalk.red(`Build failed: ${message}`));
146
+ process.exit(1);
147
+ }
148
+ },
149
+ };
@@ -0,0 +1,222 @@
1
+ import { execSync } from "child_process";
2
+ import fs from "fs";
3
+ import chalk from "chalk";
4
+ import type { CommandModule } from "yargs";
5
+ import { validateConfig, getConfig } from "../utils/schema";
6
+ import { resolveRuntimeVersion, getPlatforms } from "../utils/runtime";
7
+ import { getCommitHash, getShortCommitHash, isGitClean } from "../utils/git";
8
+ import {
9
+ readAppJson,
10
+ readMetadata,
11
+ findBundleFile,
12
+ getAssetFiles,
13
+ checkExportDirectory,
14
+ } from "../utils/files";
15
+ import { uploadBundle, createDryRunSummary } from "../utils/upload";
16
+ import { Logger } from "../utils/logger";
17
+ import { PlatformType } from "../enums/platform";
18
+
19
+ interface IArgs {
20
+ channel?: string;
21
+ skipBuild: boolean;
22
+ dryRun: boolean;
23
+ environment?: "development" | "preview" | "production";
24
+ exportDir: string;
25
+ prod: boolean;
26
+ }
27
+
28
+ function mapEnvironmentToChannel(
29
+ environment?: string,
30
+ isShorthandProd?: boolean
31
+ ): string | undefined {
32
+ if (environment === "production" || isShorthandProd) return "production";
33
+ if (environment === "preview") return "staging";
34
+ if (environment === "development") return "dev";
35
+ return undefined;
36
+ }
37
+
38
+ export const update: CommandModule = {
39
+ command: "update",
40
+ describe: "Deploy an OTA update to the specified channel",
41
+ builder: (yargs) =>
42
+ yargs
43
+ .option("channel", {
44
+ alias: "c",
45
+ type: "string",
46
+ description: "Deployment channel (e.g., production, staging)",
47
+ })
48
+ .option("skip-build", {
49
+ type: "boolean",
50
+ description: "Skip running 'expo export' (use existing build)",
51
+ default: false,
52
+ })
53
+ .option("dry-run", {
54
+ type: "boolean",
55
+ description: "Outputs deployment info instead of uploading",
56
+ default: false,
57
+ })
58
+ .option("environment", {
59
+ type: "string",
60
+ choices: ["development", "preview", "production"] as const,
61
+ description: "Environment variable's environment",
62
+ })
63
+ .option("export-dir", {
64
+ type: "string",
65
+ description: "Directory where the Expo project was exported",
66
+ default: "dist",
67
+ })
68
+ .option("prod", {
69
+ type: "boolean",
70
+ description: "Shorthand for --channel production",
71
+ default: false,
72
+ })
73
+ .example("$0 update --channel production", "Deploy to production")
74
+ .example("$0 update --prod", "Deploy to production (EAS-style)")
75
+ .example("$0 update -c staging --skip-build", "Deploy existing build"),
76
+ async handler(argv) {
77
+ const args = argv as unknown as IArgs;
78
+ const logger = new Logger();
79
+
80
+ let channel = args.channel;
81
+ if (!channel) {
82
+ channel = mapEnvironmentToChannel(args.environment, args.prod);
83
+ }
84
+
85
+ if (!channel) {
86
+ console.error(chalk.red("Error: Channel is required"));
87
+ console.log("Use one of the following:");
88
+ console.log(" easc update --channel production");
89
+ console.log(" easc update --prod");
90
+ console.log(" easc update --environment production");
91
+ process.exit(1);
92
+ }
93
+
94
+ const validation = validateConfig(channel);
95
+ if (!validation.valid) {
96
+ validation.errors.forEach((error) => logger.error(error));
97
+ process.exit(1);
98
+ }
99
+
100
+ const config = getConfig(channel);
101
+
102
+ if (!isGitClean()) {
103
+ logger.warn("Working directory has uncommitted changes");
104
+ }
105
+
106
+ if (!args.skipBuild) {
107
+ logger.startSpinner("Building app bundles...");
108
+
109
+ execSync(
110
+ args.exportDir !== "dist"
111
+ ? `npx expo export --output-dir ${args.exportDir}`
112
+ : "npx expo export",
113
+ {
114
+ cwd: process.cwd(),
115
+ stdio: "ignore",
116
+ }
117
+ );
118
+
119
+ logger.succeedSpinner("Build completed");
120
+ } else {
121
+ logger.info(
122
+ `Skipping build (using existing export from ${args.exportDir})`
123
+ );
124
+ }
125
+
126
+ const exportDir = checkExportDirectory(args.exportDir);
127
+ const appJson = readAppJson();
128
+ const metadata = readMetadata(exportDir);
129
+ const runtimeVersion = resolveRuntimeVersion(appJson);
130
+ const platforms = getPlatforms(appJson);
131
+ const commitHash = getCommitHash();
132
+ const shortCommit = getShortCommitHash();
133
+
134
+ logger.section("📤 Deployment Info");
135
+ logger.table([
136
+ ["Server", config.otaServer],
137
+ ["Runtime", runtimeVersion],
138
+ ["Commit", shortCommit || ""],
139
+ ["Export Dir", args.exportDir],
140
+ ["Channel", channel],
141
+ ]);
142
+
143
+ const results: {
144
+ platform: PlatformType;
145
+ status: "dry_run" | "uploaded" | "failed";
146
+ bundle_size: number;
147
+ asset_count: number;
148
+ error?: string;
149
+ }[] = [];
150
+
151
+ for (const platform of platforms) {
152
+ logger.section(platform.toUpperCase());
153
+
154
+ try {
155
+ const bundlePath = findBundleFile(exportDir, platform);
156
+ const assetPaths = getAssetFiles(exportDir, metadata, platform);
157
+
158
+ if (args.dryRun) {
159
+ const summary = createDryRunSummary({
160
+ platform,
161
+ bundlePath,
162
+ assetPaths,
163
+ channel,
164
+ runtimeVersion,
165
+ commitHash,
166
+ });
167
+
168
+ logger.box(summary);
169
+ logger.success(`${platform} (dry run)`);
170
+
171
+ results.push({
172
+ platform,
173
+ status: "dry_run",
174
+ bundle_size: fs.statSync(bundlePath).size,
175
+ asset_count: assetPaths.length,
176
+ });
177
+ } else {
178
+ logger.startSpinner(`Uploading ${platform}...`);
179
+
180
+ await uploadBundle({
181
+ platform,
182
+ channel,
183
+ runtimeVersion,
184
+ commitHash,
185
+ bundlePath,
186
+ assetPaths,
187
+ expoConfig: appJson.expo,
188
+ metadata,
189
+ config,
190
+ });
191
+
192
+ logger.succeedSpinner(`${platform} uploaded`);
193
+
194
+ results.push({
195
+ platform,
196
+ status: "uploaded",
197
+ bundle_size: fs.statSync(bundlePath).size,
198
+ asset_count: assetPaths.length,
199
+ });
200
+ }
201
+ } catch (error) {
202
+ logger.failSpinner(`${platform} failed`);
203
+ results.push({
204
+ platform,
205
+ status: "failed",
206
+ bundle_size: 0,
207
+ asset_count: 0,
208
+ error: error instanceof Error ? error.message : String(error),
209
+ });
210
+ throw error;
211
+ }
212
+ }
213
+
214
+ logger.section("");
215
+ if (args.dryRun) {
216
+ logger.success("Dry run completed successfully!");
217
+ logger.info("Run without --dry-run to perform actual upload");
218
+ } else {
219
+ logger.success("✨ Updates published successfully!");
220
+ }
221
+ },
222
+ };
package/src/utils/cli.ts DELETED
@@ -1,132 +0,0 @@
1
- import yargs from "yargs";
2
- import { hideBin } from "yargs/helpers";
3
- import chalk from "chalk";
4
-
5
- export interface ICliOptions {
6
- channel?: string | undefined;
7
- skipBuild: boolean;
8
- dryRun: boolean;
9
- environment?: "development" | "preview" | "production" | undefined;
10
- exportDir: string;
11
- prod: boolean;
12
- help?: boolean | undefined;
13
- }
14
-
15
- /**
16
- * Map EAS environment to channel
17
- */
18
- function mapEnvironmentToChannel(
19
- environment?: string,
20
- isShorthandProd?: boolean
21
- ): string | undefined {
22
- if (environment === "production" || isShorthandProd) return "production";
23
- if (environment === "preview") return "staging";
24
- if (environment === "development") return "dev";
25
- return undefined;
26
- }
27
-
28
- /**
29
- * Parse command line arguments
30
- */
31
- export function parseArguments(argv: string[] = process.argv): ICliOptions {
32
- const args = yargs(hideBin(argv))
33
- .scriptName("easc")
34
- .usage("$0 <command> [options]")
35
- .command(
36
- "update",
37
- "Deploy an OTA update to the specified channel",
38
- (yargs) => {
39
- return yargs
40
- .option("channel", {
41
- alias: "c",
42
- type: "string",
43
- description: "Deployment channel (e.g., production, staging)",
44
- })
45
- .option("skip-build", {
46
- type: "boolean",
47
- description: "Skip running 'expo export' (use existing build)",
48
- default: false,
49
- })
50
- .option("dry-run", {
51
- type: "boolean",
52
- description:
53
- "Outputs deployment info instead of uploading (preview what would be deployed)",
54
- default: false,
55
- })
56
- .option("environment", {
57
- type: "string",
58
- choices: ["development", "preview", "production"],
59
- description: "Environment variable's environment",
60
- })
61
- .option("export-dir", {
62
- type: "string",
63
- description: "Directory where the Expo project was exported",
64
- default: "dist",
65
- })
66
- .option("prod", {
67
- type: "boolean",
68
- description:
69
- "Create a new production deployment (shorthand for --channel production)",
70
- default: false,
71
- })
72
- .example(
73
- "$0 update --channel production",
74
- "Deploy to production channel"
75
- )
76
- .example("$0 update --prod", "Deploy to production (EAS-style)")
77
- .example(
78
- "$0 update --environment preview",
79
- "Deploy to preview environment"
80
- )
81
- .example(
82
- "$0 update -c staging --skip-build",
83
- "Deploy existing build to staging"
84
- )
85
- .example(
86
- "$0 update --dry-run --export-dir ./out",
87
- "Dry run with custom export directory"
88
- );
89
- }
90
- )
91
- .demandCommand(1, "")
92
- .showHelpOnFail(true)
93
- .help()
94
- .alias("help", "h")
95
- .alias("version", "V")
96
- .strict()
97
- .parseSync();
98
-
99
- // Map EAS-style flags to our channel system
100
- let channel = args["channel"] as string | undefined;
101
-
102
- // If no channel specified, try to derive from EAS flags
103
- if (!channel) {
104
- channel = mapEnvironmentToChannel(
105
- args["environment"] as string,
106
- args["prod"] as boolean
107
- );
108
- }
109
-
110
- if (!channel && !args["help"]) {
111
- console.error(chalk.red("Error: Channel is required"));
112
- console.log("Use one of the following:");
113
- console.log(" easc update --channel production");
114
- console.log(" easc update --prod");
115
- console.log(" easc update --environment production");
116
- process.exit(1);
117
- }
118
-
119
- return {
120
- channel,
121
- skipBuild: args["skipBuild"] as boolean,
122
- dryRun: args["dryRun"] as boolean,
123
- environment: args["environment"] as
124
- | "development"
125
- | "preview"
126
- | "production"
127
- | undefined,
128
- exportDir: args["exportDir"] as string,
129
- prod: args["prod"] as boolean,
130
- help: args["help"] as boolean | undefined,
131
- };
132
- }