easc 0.0.19 → 0.0.21

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
@@ -2,26 +2,25 @@
2
2
 
3
3
  **E**xpo **A**pp **S**ervices for **C**loudflare - CLI tool for deploying Expo OTA updates to Cloudflare Workers.
4
4
 
5
- ## Getting Started
5
+ ## Usage
6
6
 
7
- ### 1. Link for Local Testing
8
-
9
- To test the easc locally, you link the package to replace the published package with your local copy.
7
+ Run without arguments to enter interactive mode:
10
8
 
11
9
  ```bash
12
- # From this directory
13
- pnpm link --global
10
+ easc
11
+ ```
14
12
 
15
- # Now you can use 'easc' command globally
16
- easc --help
17
- easc update --help
13
+ Or run commands directly:
14
+
15
+ ```bash
16
+ easc build --platform ios --profile development
17
+ easc update --channel production
18
18
  ```
19
19
 
20
- Or can also run directly with tsx:
20
+ Use `--non-interactive` flag for CI environments:
21
21
 
22
22
  ```bash
23
- tsx index.ts --help
24
- tsx index.ts update --help
23
+ easc build --platform ios --profile production --non-interactive
25
24
  ```
26
25
 
27
26
  ## Commands
@@ -62,13 +61,28 @@ easc build:run --platform ios --profile preview # Use specific build profile
62
61
  easc build:run --platform ios --path ./build.tar.gz # Run existing artifact (skip build)
63
62
  ```
64
63
 
65
- ## Publishing
64
+ ## Development
66
65
 
67
- To publish this package to npm:
66
+ ### Local Testing
67
+
68
+ To test easc locally, link the package:
68
69
 
69
70
  ```bash
70
- cd apps/easc
71
- npm publish
71
+ # From this directory
72
+ pnpm link --global
73
+
74
+ # Now you can use 'easc' command globally
75
+ easc --help
72
76
  ```
73
77
 
74
- 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.
78
+ Or run directly with tsx:
79
+
80
+ ```bash
81
+ tsx index.ts --help
82
+ ```
83
+
84
+ ### Publishing
85
+
86
+ ```bash
87
+ pnpm version patch && pnpm publish
88
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easc",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
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",
@@ -34,7 +34,7 @@ function findBuildArtifact(pattern: string): string | null {
34
34
 
35
35
  export const build: CommandModule = {
36
36
  command: "build",
37
- describe: "Build the app locally",
37
+ describe: "Build the app locally and submit to the stores",
38
38
  builder: (yargs) =>
39
39
  yargs
40
40
  .option("platform", {
@@ -53,7 +53,7 @@ export const build: CommandModule = {
53
53
  alias: "s",
54
54
  type: "boolean",
55
55
  description: "Submit to app stores after building",
56
- default: false,
56
+ default: true,
57
57
  })
58
58
  .option("clear-cache", {
59
59
  type: "boolean",
@@ -99,7 +99,7 @@ export const update: CommandModule = {
99
99
  const commitHash = getCommitHash();
100
100
  const shortCommit = getShortCommitHash();
101
101
 
102
- logger.section("Deployment Info");
102
+ logger.section("📤 Deployment Info");
103
103
  logger.table([
104
104
  ["Server", config.otaServer],
105
105
  ["Runtime", runtimeVersion],
@@ -184,7 +184,7 @@ export const update: CommandModule = {
184
184
  logger.success("Dry run completed successfully!");
185
185
  logger.info("Run without --dry-run to perform actual upload");
186
186
  } else {
187
- logger.success("Updates published successfully!");
187
+ logger.success("✨ Updates published successfully!");
188
188
  }
189
189
  },
190
190
  };
package/src/utils/cli.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import yargs, { type Argv, type CommandModule, type Options } from "yargs";
2
2
  import { select } from "@inquirer/prompts";
3
+ import chalk from "chalk";
3
4
 
4
5
  interface CommandInfo {
5
6
  command: string;
@@ -18,28 +19,6 @@ class InteractiveCLI {
18
19
  this.yargsInstance = yargs(args);
19
20
  }
20
21
 
21
- private async promptForMissingArgs(
22
- argv: any,
23
- options: Record<string, Options>,
24
- ) {
25
- if (argv.nonInteractive || argv["non-interactive"]) return;
26
-
27
- for (const [key, opt] of Object.entries(options)) {
28
- const camelKey = key.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
29
- const value = argv[key] ?? argv[camelKey];
30
-
31
- if (value !== undefined) continue;
32
- if (opt.default !== undefined) continue;
33
- if (!opt.choices || !Array.isArray(opt.choices)) continue;
34
-
35
- argv[key] = await select({
36
- message: `Select ${key.replace(/-/g, " ")}:`,
37
- choices: opt.choices.map((c: string) => ({ name: c, value: c })),
38
- });
39
- argv[camelKey] = argv[key];
40
- }
41
- }
42
-
43
22
  scriptName(name: string): this {
44
23
  this.yargsInstance.scriptName(name);
45
24
  return this;
@@ -51,9 +30,8 @@ class InteractiveCLI {
51
30
  }
52
31
 
53
32
  command(cmd: CommandModule): this {
54
- const commandStr = typeof cmd.command === "string"
55
- ? cmd.command
56
- : cmd.command?.[0] ?? "";
33
+ const commandStr =
34
+ typeof cmd.command === "string" ? cmd.command : (cmd.command?.[0] ?? "");
57
35
  const commandName = commandStr.split(" ")[0] || "";
58
36
 
59
37
  let options: Record<string, Options> = {};
@@ -84,7 +62,7 @@ class InteractiveCLI {
84
62
  const wrappedCmd: CommandModule = {
85
63
  ...cmd,
86
64
  handler: async (argv: any) => {
87
- await this.promptForMissingArgs(argv, options);
65
+ await this._promptForMissingArgs(argv, options);
88
66
  return cmd.handler(argv);
89
67
  },
90
68
  };
@@ -118,7 +96,8 @@ class InteractiveCLI {
118
96
  }
119
97
 
120
98
  async parse(): Promise<void> {
121
- const needsCommandPrompt = this.args.length === 0 ||
99
+ const needsCommandPrompt =
100
+ this.args.length === 0 ||
122
101
  (this.args.length === 1 && this.args[0]?.startsWith("-"));
123
102
 
124
103
  if (!needsCommandPrompt) {
@@ -126,6 +105,8 @@ class InteractiveCLI {
126
105
  return;
127
106
  }
128
107
 
108
+ this._showWelcome();
109
+
129
110
  const command = await select({
130
111
  message: "Select a command:",
131
112
  choices: [
@@ -156,7 +137,7 @@ class InteractiveCLI {
156
137
  return y;
157
138
  },
158
139
  handler: async (argv: any) => {
159
- await this.promptForMissingArgs(argv, cmd.options);
140
+ await this._promptForMissingArgs(argv, cmd.options);
160
141
  return cmd.handler(argv);
161
142
  },
162
143
  });
@@ -164,6 +145,41 @@ class InteractiveCLI {
164
145
 
165
146
  this.yargsInstance.demandCommand(1, "").parse();
166
147
  }
148
+
149
+ private _showWelcome() {
150
+ console.clear();
151
+ console.log();
152
+ console.log(chalk.cyan(" ___ __ _ ___ ___ "));
153
+ console.log(chalk.cyan(" / _ \\/ _` / __|/ __|"));
154
+ console.log(chalk.blue("| __/ (_| \\__ \\ (__ "));
155
+ console.log(chalk.blue(" \\___|\\__,_|___/\\___|"));
156
+ console.log();
157
+ console.log(chalk.gray(" Expo App Services for Cloudflare"));
158
+ console.log(chalk.yellow("════════════════════════════════════"));
159
+ console.log();
160
+ }
161
+
162
+ private async _promptForMissingArgs(
163
+ argv: any,
164
+ options: Record<string, Options>,
165
+ ) {
166
+ if (argv.nonInteractive || argv["non-interactive"]) return;
167
+
168
+ for (const [key, opt] of Object.entries(options)) {
169
+ const camelKey = key.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
170
+ const value = argv[key] ?? argv[camelKey];
171
+
172
+ if (value !== undefined) continue;
173
+ if (opt.default !== undefined) continue;
174
+ if (!opt.choices || !Array.isArray(opt.choices)) continue;
175
+
176
+ argv[key] = await select({
177
+ message: `Select ${key.replace(/-/g, " ")}:`,
178
+ choices: opt.choices.map((c: string) => ({ name: c, value: c })),
179
+ });
180
+ argv[camelKey] = argv[key];
181
+ }
182
+ }
167
183
  }
168
184
 
169
185
  export function cli(args: string[]): InteractiveCLI {