easc 0.0.10 → 0.0.12

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/bin/easc.js CHANGED
@@ -17,7 +17,7 @@ const envArgs = existsSync(envPath) ? ["--env-file", envPath] : [];
17
17
  const scriptArgs = [indexPath, ...process.argv.slice(2)];
18
18
 
19
19
  function getRuntime() {
20
- const runtime = typeof Bun !== "undefined" ? Runtime.BUN : Runtime.NODE;
20
+ const runtime = !!process.versions.bun ? Runtime.BUN : Runtime.NODE;
21
21
 
22
22
  switch (runtime) {
23
23
  case Runtime.BUN:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easc",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
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",
@@ -1,10 +1,10 @@
1
- import { execSync } from "child_process";
2
1
  import fs from "fs";
3
2
  import path from "path";
4
3
  import chalk from "chalk";
5
4
  import type { CommandModule } from "yargs";
6
5
  import { Logger } from "../utils/logger";
7
6
  import { Platform, PlatformType } from "../enums/platform";
7
+ import { runx } from "../utils/runx";
8
8
 
9
9
  interface IArgs {
10
10
  platform: PlatformType | "all";
@@ -23,9 +23,11 @@ function findBuildArtifact(pattern: string): string | null {
23
23
 
24
24
  if (files.length === 0) return null;
25
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;
26
+ return (
27
+ files
28
+ .map((f) => ({ name: f, mtime: fs.statSync(path.join(cwd, f)).mtime }))
29
+ .sort((a, b) => b.mtime.getTime() - a.mtime.getTime())[0]?.name ?? null
30
+ );
29
31
  }
30
32
 
31
33
  export const build: CommandModule = {
@@ -81,7 +83,7 @@ export const build: CommandModule = {
81
83
 
82
84
  if (args.clearCache) {
83
85
  logger.startSpinner(`Running prebuild for ${platformName}...`);
84
- execSync(`npx expo prebuild --platform ${platform} --clean`, {
86
+ runx(`expo prebuild --platform ${platform} --clean`, {
85
87
  cwd: process.cwd(),
86
88
  stdio: "ignore",
87
89
  });
@@ -101,7 +103,7 @@ export const build: CommandModule = {
101
103
  .filter(Boolean)
102
104
  .join(" ");
103
105
 
104
- execSync(`eas build ${buildFlags}`, {
106
+ runx(`expo eas ${buildFlags}`, {
105
107
  cwd: process.cwd(),
106
108
  stdio: "inherit",
107
109
  });
@@ -124,7 +126,7 @@ export const build: CommandModule = {
124
126
 
125
127
  logger.info(`Found artifact: ${artifactPath}`);
126
128
 
127
- execSync(
129
+ runx(
128
130
  `eas submit --platform ${platform} --path "${artifactPath}" --non-interactive`,
129
131
  { cwd: process.cwd(), stdio: "inherit" }
130
132
  );
@@ -1,4 +1,3 @@
1
- import { execSync } from "child_process";
2
1
  import fs from "fs";
3
2
  import chalk from "chalk";
4
3
  import type { CommandModule } from "yargs";
@@ -15,6 +14,7 @@ import {
15
14
  import { uploadBundle, createDryRunSummary } from "../utils/upload";
16
15
  import { Logger } from "../utils/logger";
17
16
  import { PlatformType } from "../enums/platform";
17
+ import { runx } from "../utils/runx";
18
18
 
19
19
  interface IArgs {
20
20
  channel?: string;
@@ -106,14 +106,11 @@ export const update: CommandModule = {
106
106
  if (!args.skipBuild) {
107
107
  logger.startSpinner("Building app bundles...");
108
108
 
109
- execSync(
109
+ runx(
110
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
- }
111
+ ? `expo export --output-dir ${args.exportDir}`
112
+ : `expo export`,
113
+ { cwd: process.cwd(), stdio: "ignore" }
117
114
  );
118
115
 
119
116
  logger.succeedSpinner("Build completed");
@@ -0,0 +1,14 @@
1
+ import { execSync, ExecSyncOptions } from "child_process";
2
+
3
+ /**
4
+ * Execute a command using the appropriate package runner (bunx or npx)
5
+ * based on the current runtime environment.
6
+ */
7
+ export function runx(
8
+ command: string,
9
+ options?: ExecSyncOptions
10
+ ): Buffer | string {
11
+ const packageRunner = !!process.versions.bun ? "bunx" : "npx";
12
+
13
+ return execSync(`${packageRunner} ${command}`, options);
14
+ }