expo-desktop 0.1.33 → 0.1.34

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.
@@ -135,6 +135,9 @@ export function packageManagerExec(packageManager) {
135
135
  command = "npx";
136
136
  args.push("--yes");
137
137
  break;
138
+ case "yarn":
139
+ command = "yarn";
140
+ break;
138
141
  case "pnpm":
139
142
  command = "pnpm";
140
143
  args.push("exec");
@@ -51,6 +51,7 @@ export async function newExpoDesktopProject(args) {
51
51
  },
52
52
  { value: "bun", label: `Bun${platform === "darwin" ? " (recommended)" : ""}` },
53
53
  { value: "pnpm", label: `pnpm${platform === "win32" ? " (recommended)" : ""}` },
54
+ { value: "yarn", label: "yarn" },
54
55
  ],
55
56
  initialValue: platform === "darwin" ? "bun" : platform === "win32" ? "pnpm" : "npm",
56
57
  });
@@ -103,6 +103,7 @@ export async function createExpoDesktopApp({ localDev, name, packageManager, tem
103
103
  await improveMetroConfig({ projectPath });
104
104
  title("Adding Expo support to the Babel config…", { spacing: 1 });
105
105
  await writeBabelConfig({ projectPath });
106
+ logProjectReady({ cdPath: name.filesafeName, packageManager });
106
107
  }
107
108
  async function getBundleEntryFileCandidates({ projectPath }) {
108
109
  try {
@@ -148,8 +149,13 @@ async function createExpoApp({ localDev, name, packageManager, versions, }) {
148
149
  // create-expo-app for non-interactive template selection; set `CI=true` in the
149
150
  // child env so git-init inside an existing repo is skipped too.
150
151
  const command = packageManager === "npm" ? "npx" : packageManager;
152
+ let packageManagerArgs = ["create", "expo-app@latest"];
153
+ if (packageManager === "npm")
154
+ packageManagerArgs = ["--yes", "create-expo-app@latest"];
155
+ if (packageManager === "yarn")
156
+ packageManagerArgs = ["create", "expo-app"];
151
157
  const args = [
152
- ...(packageManager === "npm" ? ["--yes", "create-expo-app"] : ["create", "expo-app"]),
158
+ ...packageManagerArgs,
153
159
  name.filesafeName,
154
160
  "--yes",
155
161
  "--template",
@@ -322,13 +328,40 @@ async function updatePackageJson({ localDev, name, projectPath, task, versions,
322
328
  if (!packageJson.overrides) {
323
329
  packageJson.overrides = {};
324
330
  }
325
- // react-native-macos and react-native-windows may declare conflicting peer
326
- // dependency ranges to what the Expo template provides.
327
- if (packageJson.dependencies.react) {
328
- packageJson.overrides.react = packageJson.dependencies.react;
331
+ // The "react" version in expo-template-blank-typescript for SDK 54 is
332
+ // 19.1.0, but it needs to be 19.1.4 to satisfy react-native-macos and
333
+ // react-native-windows. We find that the React Native HelloWorld template
334
+ // is more reliable as a source of truth for the best "react" and
335
+ // "react-native" versions to satisfy them, but it's still a best of a bad
336
+ // job.
337
+ let facebookDeps;
338
+ try {
339
+ const packageJson = (await getReactNativePackageJson(versions.minor));
340
+ facebookDeps = {
341
+ react: packageJson.dependencies.react,
342
+ "react-native": packageJson.dependencies["react-native"],
343
+ };
344
+ }
345
+ catch (error) {
346
+ // It's totally possible to get rate-limited by the GitHub API, so we'll
347
+ // avoid failing the entire command just for a bad fetch here.
348
+ console.warn(`Unable to get the ideal dependency versions for "react" and "react-native" from the official React Native HelloWorld template, so will use the ones from the Expo template as-is.`, error);
329
349
  }
330
- if (packageJson.dependencies["react-native"]) {
331
- packageJson.overrides["react-native"] = packageJson.dependencies["react-native"];
350
+ if (facebookDeps) {
351
+ packageJson.dependencies.react = facebookDeps.react;
352
+ packageJson.overrides.react = facebookDeps.react;
353
+ packageJson.dependencies["react-native"] = facebookDeps["react-native"];
354
+ packageJson.overrides["react-native"] = facebookDeps["react-native"];
355
+ }
356
+ else {
357
+ // react-native-macos and react-native-windows may declare conflicting
358
+ // peer dependency ranges to what the Expo template provides.
359
+ if (packageJson.dependencies.react) {
360
+ packageJson.overrides.react = packageJson.dependencies.react;
361
+ }
362
+ if (packageJson.dependencies["react-native"]) {
363
+ packageJson.overrides["react-native"] = packageJson.dependencies["react-native"];
364
+ }
332
365
  }
333
366
  }
334
367
  try {
@@ -340,6 +373,10 @@ async function updatePackageJson({ localDev, name, projectPath, task, versions,
340
373
  console.log(`${green("◆")} Altered package.json.\n`);
341
374
  return { name: nameBefore };
342
375
  }
376
+ async function getReactNativePackageJson(minor) {
377
+ const response = await fetch(`https://raw.githubusercontent.com/facebook/react-native/refs/heads/0.${minor}-stable/private/helloworld/package.json`);
378
+ return await response.json();
379
+ }
343
380
  async function npmInstall({ asNewWorkspace, cwd, packageManager, }) {
344
381
  const command = packageManager;
345
382
  const args = ["install"];
@@ -696,3 +733,36 @@ async function applyConfigPlugins(options) {
696
733
  await applyConfigPlugins(info);
697
734
  `.trim() + "\n", "utf-8");
698
735
  }
736
+ function logProjectReady({ cdPath, packageManager, }) {
737
+ const lines = [
738
+ "✅ Your project is ready!",
739
+ "",
740
+ "To run your project, first navigate to the directory and start up the packager:",
741
+ "",
742
+ `- cd ${cdPath}`,
743
+ `- ${formatRunCommand(packageManager, "start")}`,
744
+ "",
745
+ "… and then run the target platform of your choice:",
746
+ "",
747
+ `- ${formatRunCommand(packageManager, "android")}`,
748
+ `- ${formatRunCommand(packageManager, "ios")}`,
749
+ `- ${formatRunCommand(packageManager, "web")}`,
750
+ `- ${formatRunCommand(packageManager, "macos")}`,
751
+ `- ${formatRunCommand(packageManager, "windows")}`,
752
+ "",
753
+ ];
754
+ log.success(lines.join("\n"), { withGuide: false });
755
+ }
756
+ export function formatRunCommand(packageManager, cmd) {
757
+ switch (packageManager) {
758
+ case "pnpm":
759
+ return `pnpm run ${cmd}`;
760
+ case "yarn":
761
+ return `yarn ${cmd}`;
762
+ case "bun":
763
+ return `bun run ${cmd}`;
764
+ case "npm":
765
+ default:
766
+ return `npm run ${cmd}`;
767
+ }
768
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-desktop",
3
- "version": "0.1.33",
3
+ "version": "0.1.34",
4
4
  "description": "Best-effort desktop support for Expo",
5
5
  "keywords": [
6
6
  "android",
@@ -37,8 +37,8 @@
37
37
  "@clack/prompts": "^1.2.0",
38
38
  "arktype": "^2.2.0",
39
39
  "citty": "^0.2.2",
40
- "expo-desktop-config-plugins": "^1.1.30",
41
- "expo-desktop-prebuild-config": "^1.0.16",
40
+ "expo-desktop-config-plugins": "^1.1.31",
41
+ "expo-desktop-prebuild-config": "^1.0.17",
42
42
  "glob": "^10.5.0",
43
43
  "kleur": "^4.1.5",
44
44
  "mustache": "^4.2.0",