@expo-harmony/cli 55.0.26-harmony.2 → 55.0.26-harmony.4

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
@@ -50,7 +50,9 @@ npx expo-harmony start --port 8082
50
50
  npx expo-harmony start --clear
51
51
  ```
52
52
 
53
- `start` 调用项目本地的 Expo CLI,以 `--dev-client` 模式启动 Metro,并自动设置 `EXPO_METRO_TARGET=harmony`。它只启动 JS 开发服务,不执行原生工程生成、构建、安装、应用启动或设备端口映射,也不要求 HarmonyOS SDK 和设备就绪。新启动的 Metro 在当前终端输出日志,按 Ctrl+C 退出。
53
+ 所有命令都会在 CLI 入口、读取应用配置之前设置 `EXPO_HARMONY=1` `EXPO_METRO_TARGET=harmony`。
54
+
55
+ `start` 调用项目本地的 Expo CLI,以 `--dev-client` 模式启动 Metro。它只启动 JS 开发服务,不执行原生工程生成、构建、安装、应用启动或设备端口映射,也不要求 HarmonyOS SDK 和设备就绪。新启动的 Metro 在当前终端输出日志,按 Ctrl+C 退出。
54
56
 
55
57
  支持 `--port <number>`(默认 `8081`)和 `--reset-cache`(别名 `--clear`、`-c`)。端口上已有 Metro 时提示并退出,不停止已有服务;此时缓存选项不会生效,需要先停止已有 Metro 后重新执行命令。端口被其他进程占用时会报错。
56
58
 
@@ -50,7 +50,6 @@ async function buildHarmonyUnlockedAsync(projectRoot, options = {}) {
50
50
  const buildEnv = {
51
51
  ...process.env,
52
52
  EXPO_HARMONY_NODE: process.env.EXPO_HARMONY_NODE || process.execPath,
53
- EXPO_METRO_TARGET: 'harmony',
54
53
  HERMES_V1_ENABLED: 'true',
55
54
  ...(normalizedOptions.variant === 'release' ? { EXPO_HARMONY_BUNDLE_PREBUILT: '1' } : {}),
56
55
  ...(toolchain.sdkHome && !process.env.DEVECO_SDK_HOME
package/build/cli.js CHANGED
@@ -78,6 +78,8 @@ function parseInvocation(argv) {
78
78
  return { command, parsed, projectRoot };
79
79
  }
80
80
  async function runAsync(argv = process.argv.slice(2), io = console) {
81
+ process.env.EXPO_HARMONY = '1';
82
+ process.env.EXPO_METRO_TARGET = 'harmony';
81
83
  const invocation = parseInvocation(argv);
82
84
  if (invocation.command === 'help') {
83
85
  io.log(Help);
@@ -59,19 +59,7 @@ async function validateMetroConfigAsync(projectRoot) {
59
59
  })();
60
60
  throw new Error(`metro-config ${version} does not expose resolveConfig().`);
61
61
  }
62
- const hadMetroTarget = Object.hasOwn(process.env, 'EXPO_METRO_TARGET');
63
- const previousMetroTarget = process.env.EXPO_METRO_TARGET;
64
- let resolved;
65
- try {
66
- process.env.EXPO_METRO_TARGET = 'harmony';
67
- resolved = await metroConfig.resolveConfig(undefined, projectRoot);
68
- }
69
- finally {
70
- if (hadMetroTarget)
71
- process.env.EXPO_METRO_TARGET = previousMetroTarget;
72
- else
73
- delete process.env.EXPO_METRO_TARGET;
74
- }
62
+ const resolved = await metroConfig.resolveConfig(undefined, projectRoot);
75
63
  const config = resolved?.config;
76
64
  const platforms = config?.resolver?.platforms;
77
65
  const conditions = config?.resolver?.unstable_conditionsByPlatform?.harmony;
@@ -65,7 +65,6 @@ async function exportEmbedUnlockedAsync(projectRoot, options = {}) {
65
65
  cwd: projectRoot,
66
66
  env: {
67
67
  ...process.env,
68
- EXPO_METRO_TARGET: 'harmony',
69
68
  HERMES_V1_ENABLED: 'true',
70
69
  NODE_ENV: 'production',
71
70
  },
@@ -88,7 +88,6 @@ async function startExpoMetroAsync(projectRoot, options) {
88
88
  cwd: projectRoot,
89
89
  env: {
90
90
  ...process.env,
91
- EXPO_METRO_TARGET: 'harmony',
92
91
  },
93
92
  operation: 'expo-metro',
94
93
  outputLimit: 1024 * 1024,
package/build/run/run.js CHANGED
@@ -80,7 +80,6 @@ async function runHarmonyUnlockedAsync(projectRoot, options = {}) {
80
80
  const buildEnv = {
81
81
  ...process.env,
82
82
  EXPO_HARMONY_NODE: process.env.EXPO_HARMONY_NODE || process.execPath,
83
- EXPO_METRO_TARGET: 'harmony',
84
83
  HERMES_V1_ENABLED: 'true',
85
84
  ...(normalizedOptions.variant === 'release' ? { EXPO_HARMONY_BUNDLE_PREBUILT: '1' } : {}),
86
85
  ...(toolchain.sdkHome && !process.env.DEVECO_SDK_HOME
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo-harmony/cli",
3
- "version": "55.0.26-harmony.2",
3
+ "version": "55.0.26-harmony.4",
4
4
  "keywords": [
5
5
  "react-native",
6
6
  "expo",
@@ -36,9 +36,9 @@
36
36
  "expo-harmony": "build/bin/expo-harmony.js"
37
37
  },
38
38
  "dependencies": {
39
- "@expo-harmony/config-plugins": "55.0.10-harmony.1",
40
- "@expo-harmony/expo-modules-autolinking": "55.0.25-harmony.1",
41
- "@expo-harmony/prebuild-config": "55.0.0-harmony.1",
39
+ "@expo-harmony/config-plugins": "55.0.10-harmony.2",
40
+ "@expo-harmony/expo-modules-autolinking": "55.0.25-harmony.2",
41
+ "@expo-harmony/prebuild-config": "55.0.0-harmony.3",
42
42
  "@expo/config": "55.0.17",
43
43
  "cross-spawn": "^7.0.6",
44
44
  "json5": "2.2.3"
package/src/cli.ts CHANGED
@@ -90,6 +90,9 @@ async function runAsync(
90
90
  argv: string[] = process.argv.slice(2),
91
91
  io: Pick<Console, 'error' | 'log' | 'warn'> = console
92
92
  ): Promise<number> {
93
+ process.env.EXPO_HARMONY = '1';
94
+ process.env.EXPO_METRO_TARGET = 'harmony';
95
+
93
96
  const invocation = parseInvocation(argv);
94
97
  if (invocation.command === 'help') {
95
98
  io.log(Help);