expo-desktop 0.1.2 → 0.1.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.
Files changed (33) hide show
  1. package/{src/add-app/command.ts → build/add-app/command.js} +2 -3
  2. package/build/cli.js +86 -0
  3. package/build/common/app-config.js +44 -0
  4. package/build/common/app-json.js +32 -0
  5. package/build/common/apply-config-plugins.js +48 -0
  6. package/build/common/arktype.js +12 -0
  7. package/build/common/child-process.js +141 -0
  8. package/build/common/clack.js +9 -0
  9. package/build/common/define-config.js +42 -0
  10. package/build/common/npm.js +143 -0
  11. package/build/common/with-internal.js +13 -0
  12. package/build/create-app/command.js +124 -0
  13. package/build/create-app/create-expo-desktop-app.js +578 -0
  14. package/{src/create-app/preview-file-tree.ts → build/create-app/preview-file-tree.js} +8 -10
  15. package/build/create-app/prompt-for-version.js +330 -0
  16. package/build/prebuild/command.js +69 -0
  17. package/build/prebuild/resolve-options.js +18 -0
  18. package/package.json +9 -10
  19. package/src/cli.ts +0 -92
  20. package/src/common/app-config.ts +0 -114
  21. package/src/common/app-json.ts +0 -35
  22. package/src/common/apply-config-plugins.ts +0 -76
  23. package/src/common/arktype.ts +0 -19
  24. package/src/common/child-process.ts +0 -55
  25. package/src/common/clack.ts +0 -11
  26. package/src/common/define-config.ts +0 -51
  27. package/src/common/npm.ts +0 -199
  28. package/src/common/with-internal.ts +0 -19
  29. package/src/create-app/command.ts +0 -159
  30. package/src/create-app/create-expo-desktop-app.ts +0 -754
  31. package/src/create-app/prompt-for-version.ts +0 -465
  32. package/src/prebuild/command.ts +0 -99
  33. package/src/prebuild/resolve-options.ts +0 -34
@@ -0,0 +1,124 @@
1
+ import { confirm, isCancel, text, log, select } from "@clack/prompts";
2
+ import { default as kleur } from "kleur";
3
+ import { green, grey } from "kleur/colors";
4
+ import { title } from "../common/clack.js";
5
+ import { createExpoDesktopApp } from "./create-expo-desktop-app.js";
6
+ import { previewFileTree } from "./preview-file-tree.js";
7
+ import { promptForVersion } from "./prompt-for-version.js";
8
+ export async function newExpoDesktopProject(args) {
9
+ // A dev-time switch for skipping the questions
10
+ const skip = true;
11
+ if (skip) {
12
+ await createExpoDesktopApp({
13
+ name: {
14
+ displayName: "My App Display Name",
15
+ filesafeName: "MyApp6",
16
+ rdns: "com.example.my-app-123",
17
+ },
18
+ packageManager: "bun",
19
+ versions: {
20
+ expoMajor: 54,
21
+ expoBlankTypeScript: "54.0.45",
22
+ minor: 81,
23
+ mobile: "0.81.6",
24
+ windows: "0.81.15",
25
+ macos: "0.81.7",
26
+ },
27
+ });
28
+ return;
29
+ }
30
+ log.info(`🏎️ Running ${kleur.yellow("expo-desktop create-app")}. Let's create a new Expo Desktop app!`, { withGuide: false });
31
+ title("Configuring app name");
32
+ const name = await configureAppName(args);
33
+ title("Configuring installation");
34
+ const versions = await promptForVersion(args.version);
35
+ log.info(`Will use versions: ${green(`react-native@${versions.mobile}`)}, ${green(`react-native-macos@${versions.macos}`)}, and ${green(`react-native-windows@${versions.windows}`)}, with ${green(`Expo ${versions.expoMajor}`)}.`);
36
+ const packageManager = await select({
37
+ message: "What package manager shall we install with?",
38
+ options: [
39
+ { value: "npm", label: "npm" },
40
+ { value: "bun", label: "Bun (recommended)" },
41
+ { value: "pnpm", label: "pnpm" },
42
+ ],
43
+ initialValue: "bun",
44
+ });
45
+ if (isCancel(packageManager)) {
46
+ process.exit(0);
47
+ }
48
+ await createExpoDesktopApp({ name, packageManager, versions });
49
+ }
50
+ async function configureAppName(args) {
51
+ const { initialFilesafeName, initialDisplayName, initialRdns } = args;
52
+ // TODO: Upon any cancel, provide the CLI command to get back to the cancelled
53
+ // step.
54
+ let filesafeName = args["filesafe-name"];
55
+ if (!filesafeName) {
56
+ filesafeName = await text({
57
+ message: `Please provide the ${kleur.bold("filesafe name")} for the app in ${kleur.bold("alphanumeric")} format. ${grey("(Example: 'MyApp123')")}`,
58
+ placeholder: initialFilesafeName ?? "MyApp",
59
+ initialValue: initialFilesafeName ?? "MyApp",
60
+ validate(value) {
61
+ if (!value?.length) {
62
+ return "Must be at least one character long.";
63
+ }
64
+ },
65
+ });
66
+ }
67
+ if (isCancel(filesafeName)) {
68
+ process.exit(0);
69
+ }
70
+ let displayName = args["display-name"];
71
+ if (!displayName) {
72
+ displayName = await text({
73
+ message: `Please provide the ${kleur.bold("display name")} for the app. ${grey("(Examples: 'My App 123', '俺のアプリ')")}`,
74
+ placeholder: initialDisplayName ?? "My App",
75
+ initialValue: initialDisplayName ?? "My App",
76
+ validate(value) {
77
+ if (!value?.length) {
78
+ return "Must be at least one character long.";
79
+ }
80
+ },
81
+ });
82
+ }
83
+ if (isCancel(displayName)) {
84
+ process.exit(0);
85
+ }
86
+ let rdns = args.rdns;
87
+ if (!rdns) {
88
+ rdns = await text({
89
+ message: `Please provide the ${kleur.bold("reverse DNS")} for the app. ${grey("(Example: 'com.example.my-app-123')")}`,
90
+ placeholder: initialRdns ?? "com.example.my-app",
91
+ initialValue: initialRdns ?? "com.example.my-app",
92
+ validate(value) {
93
+ if (!value?.length) {
94
+ return "Must be at least one character long.";
95
+ }
96
+ },
97
+ });
98
+ }
99
+ if (isCancel(rdns)) {
100
+ process.exit(0);
101
+ }
102
+ const structureIsOkay = await confirm({
103
+ message: `Will create an Expo app with the following structure. Does this look okay?\n\n${previewFileTree({ filesafeName, rdns })}\n`,
104
+ initialValue: true,
105
+ });
106
+ if (isCancel(structureIsOkay)) {
107
+ process.exit(0);
108
+ }
109
+ if (!structureIsOkay) {
110
+ return await configureAppName({
111
+ "filesafe-name": undefined,
112
+ initialFilesafeName: filesafeName,
113
+ "display-name": undefined,
114
+ initialDisplayName: displayName,
115
+ rdns: undefined,
116
+ initialRdns: rdns,
117
+ });
118
+ }
119
+ return {
120
+ filesafeName,
121
+ displayName,
122
+ rdns,
123
+ };
124
+ }