easc 0.0.10 → 0.0.11
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/package.json +1 -1
- package/src/commands/build.ts +9 -7
- package/src/commands/update.ts +5 -8
- package/src/utils/runx.ts +17 -0
package/package.json
CHANGED
package/src/commands/build.ts
CHANGED
|
@@ -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
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
129
|
+
runx(
|
|
128
130
|
`eas submit --platform ${platform} --path "${artifactPath}" --non-interactive`,
|
|
129
131
|
{ cwd: process.cwd(), stdio: "inherit" }
|
|
130
132
|
);
|
package/src/commands/update.ts
CHANGED
|
@@ -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
|
-
|
|
109
|
+
runx(
|
|
110
110
|
args.exportDir !== "dist"
|
|
111
|
-
? `
|
|
112
|
-
:
|
|
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,17 @@
|
|
|
1
|
+
import { execSync, ExecSyncOptions } from "child_process";
|
|
2
|
+
|
|
3
|
+
declare const Bun: unknown;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Execute a command using the appropriate package runner (bunx or npx)
|
|
7
|
+
* based on the current runtime environment.
|
|
8
|
+
*/
|
|
9
|
+
export function runx(
|
|
10
|
+
command: string,
|
|
11
|
+
options?: ExecSyncOptions
|
|
12
|
+
): Buffer | string {
|
|
13
|
+
const isBun = typeof Bun !== "undefined";
|
|
14
|
+
const packageRunner = isBun ? "bunx" : "npx";
|
|
15
|
+
|
|
16
|
+
return execSync(`${packageRunner} ${command}`, options);
|
|
17
|
+
}
|