beever-create 0.1.0 → 0.1.2

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 (65) hide show
  1. package/dist/index.js +205 -28
  2. package/dist/index.js.map +1 -1
  3. package/package.json +2 -2
  4. package/templates/{web → common/web}/main.tsx +1 -1
  5. package/templates/common/web/vite.config.ts +8 -0
  6. package/templates/expo/app.config.js +1 -0
  7. package/templates/expo/mobile/app.config.js +11 -0
  8. package/templates/{package.json → expo/package.json} +5 -4
  9. package/templates/standalone/.eslintrc.js +4 -0
  10. package/templates/standalone/.prettierrc.js +5 -0
  11. package/templates/standalone/.watchmanconfig +1 -0
  12. package/templates/standalone/Gemfile +17 -0
  13. package/templates/standalone/android/app/build.gradle +119 -0
  14. package/templates/standalone/android/app/debug.keystore +0 -0
  15. package/templates/standalone/android/app/proguard-rules.pro +10 -0
  16. package/templates/standalone/android/app/src/main/AndroidManifest.xml +27 -0
  17. package/templates/standalone/android/app/src/main/java/com/beevernativetemplatetest/MainActivity.kt +22 -0
  18. package/templates/standalone/android/app/src/main/java/com/beevernativetemplatetest/MainApplication.kt +27 -0
  19. package/templates/standalone/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  20. package/templates/standalone/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  21. package/templates/standalone/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  22. package/templates/standalone/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  23. package/templates/standalone/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  24. package/templates/standalone/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  25. package/templates/standalone/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  26. package/templates/standalone/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  27. package/templates/standalone/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  28. package/templates/standalone/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  29. package/templates/standalone/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  30. package/templates/standalone/android/app/src/main/res/values/strings.xml +3 -0
  31. package/templates/standalone/android/app/src/main/res/values/styles.xml +9 -0
  32. package/templates/standalone/android/build.gradle +21 -0
  33. package/templates/standalone/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  34. package/templates/standalone/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  35. package/templates/standalone/android/gradle.properties +49 -0
  36. package/templates/standalone/android/gradlew +248 -0
  37. package/templates/standalone/android/gradlew.bat +98 -0
  38. package/templates/standalone/android/settings.gradle +6 -0
  39. package/templates/standalone/app.json +4 -0
  40. package/templates/standalone/babel.config.js +3 -0
  41. package/templates/standalone/index.js +9 -0
  42. package/templates/standalone/ios/.xcode.env +11 -0
  43. package/templates/standalone/ios/BeeverNativeTemplateTest/AppDelegate.swift +11 -0
  44. package/templates/standalone/ios/BeeverNativeTemplateTest/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  45. package/templates/standalone/ios/BeeverNativeTemplateTest/Images.xcassets/Contents.json +6 -0
  46. package/templates/standalone/ios/BeeverNativeTemplateTest/Info.plist +78 -0
  47. package/templates/standalone/ios/BeeverNativeTemplateTest/LaunchScreen.storyboard +47 -0
  48. package/templates/standalone/ios/BeeverNativeTemplateTest/PrivacyInfo.xcprivacy +37 -0
  49. package/templates/standalone/ios/BeeverNativeTemplateTest/SceneDelegate.swift +56 -0
  50. package/templates/standalone/ios/BeeverNativeTemplateTest.xcodeproj/project.pbxproj +479 -0
  51. package/templates/standalone/ios/BeeverNativeTemplateTest.xcodeproj/xcshareddata/xcschemes/BeeverNativeTemplateTest.xcscheme +76 -0
  52. package/templates/standalone/ios/Podfile +34 -0
  53. package/templates/standalone/jest.config.js +3 -0
  54. package/templates/standalone/metro.config.js +11 -0
  55. package/templates/standalone/package.json +47 -0
  56. package/templates/standalone/tsconfig.json +5 -0
  57. package/templates/mobile/app.json +0 -9
  58. /package/templates/{features → common/features}/welcome/index.ts +0 -0
  59. /package/templates/{features → common/features}/welcome/pages/WelcomePage.tsx +0 -0
  60. /package/templates/{features → common/features}/welcome/screens/WelcomeScreen.tsx +0 -0
  61. /package/templates/{mobile → common/mobile}/App.tsx +0 -0
  62. /package/templates/{shared → common/shared}/index.ts +0 -0
  63. /package/templates/{web → common/web}/index.html +0 -0
  64. /package/templates/{README.md → expo/README.md} +0 -0
  65. /package/templates/{mobile → expo/mobile}/index.ts +0 -0
package/dist/index.js CHANGED
@@ -3,17 +3,20 @@
3
3
  // src/index.ts
4
4
  import fs from "fs";
5
5
  import path from "path";
6
+ import { spawnSync } from "child_process";
6
7
  import { fileURLToPath } from "url";
8
+ import { createInterface } from "readline/promises";
9
+ import { stdin, stdout } from "process";
7
10
  var projectName = process.argv[2];
8
11
  if (!projectName) {
9
12
  console.log("Please provide a project name.");
10
13
  console.log("Usage: npx beever-create <project-name>");
11
14
  process.exit(1);
12
15
  }
13
- var validProjectName = /^[a-zA-Z0-9_-]+$/.test(projectName);
16
+ var validProjectName = /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(projectName);
14
17
  if (!validProjectName) {
15
18
  console.error(
16
- "Invalid project name. Use only letters, numbers, hyphens, and underscores."
19
+ "Invalid project name. Start with a letter or number and use only letters, numbers, hyphens, and underscores."
17
20
  );
18
21
  process.exit(1);
19
22
  }
@@ -24,47 +27,221 @@ if (fs.existsSync(projectPath)) {
24
27
  }
25
28
  var currentDirectory = path.dirname(fileURLToPath(import.meta.url));
26
29
  var templatesPath = path.resolve(currentDirectory, "../templates");
30
+ var commonTemplatePath = path.join(templatesPath, "common");
31
+ var expoTemplatePath = path.join(templatesPath, "expo");
32
+ var standaloneTemplatePath = path.join(templatesPath, "standalone");
27
33
  var packageName = projectName.toLowerCase().replace(/_/g, "-");
28
- function replaceProjectName(directory) {
34
+ var displayName = projectName.replace(/[-_]+/g, " ").trim();
35
+ var appNameParts = projectName.split(/[-_]+/).filter(Boolean);
36
+ var appName = appNameParts.map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
37
+ if (!appName || /^[0-9]/.test(appName)) {
38
+ appName = `App${appName}`;
39
+ }
40
+ var nativePackageName = projectName.toLowerCase().replace(/[^a-z0-9]/g, "");
41
+ var safeNativePackageName = /^[a-z]/.test(nativePackageName) ? nativePackageName : `app${nativePackageName}`;
42
+ var androidPackage = `com.beever.${safeNativePackageName}`;
43
+ var iosBundleIdentifier = `com.beever.${safeNativePackageName}`;
44
+ var textFileExtensions = /* @__PURE__ */ new Set([
45
+ ".json",
46
+ ".js",
47
+ ".jsx",
48
+ ".ts",
49
+ ".tsx",
50
+ ".gradle",
51
+ ".properties",
52
+ ".kt",
53
+ ".swift",
54
+ ".plist",
55
+ ".storyboard",
56
+ ".xcprivacy",
57
+ ".pbxproj",
58
+ ".xcscheme",
59
+ ".xml",
60
+ ".md",
61
+ ".txt",
62
+ ".html",
63
+ ".css",
64
+ ".scss",
65
+ ".yml",
66
+ ".yaml",
67
+ ".toml"
68
+ ]);
69
+ var placeholderValues = {
70
+ "{{projectName}}": packageName,
71
+ "{{packageName}}": packageName,
72
+ "{{displayName}}": displayName,
73
+ "{{appName}}": appName,
74
+ "{{androidPackage}}": androidPackage,
75
+ "{{iosBundleIdentifier}}": iosBundleIdentifier
76
+ };
77
+ function replaceTemplatePlaceholders(directory) {
29
78
  const entries = fs.readdirSync(directory, {
30
79
  withFileTypes: true
31
80
  });
32
81
  for (const entry of entries) {
33
82
  const entryPath = path.join(directory, entry.name);
34
83
  if (entry.isDirectory()) {
35
- replaceProjectName(entryPath);
84
+ replaceTemplatePlaceholders(entryPath);
36
85
  continue;
37
86
  }
38
- const content = fs.readFileSync(entryPath, "utf8");
39
- if (content.includes("{{projectName}}")) {
40
- fs.writeFileSync(
41
- entryPath,
42
- content.split("{{projectName}}").join(packageName),
43
- "utf8"
44
- );
87
+ const extension = path.extname(entry.name).toLowerCase();
88
+ const isPodfile = entry.name === "Podfile";
89
+ const isTextFile = isPodfile || textFileExtensions.has(extension);
90
+ if (!isTextFile) {
91
+ continue;
92
+ }
93
+ let content = fs.readFileSync(entryPath, "utf8");
94
+ for (const [placeholder, value] of Object.entries(placeholderValues)) {
95
+ content = content.split(placeholder).join(value);
45
96
  }
97
+ fs.writeFileSync(entryPath, content, "utf8");
46
98
  }
47
99
  }
48
- try {
49
- if (!fs.existsSync(templatesPath)) {
50
- throw new Error("Project templates directory not found.");
100
+ function renameStandaloneNativeDirectories() {
101
+ const androidPackageDirectory = path.join(
102
+ projectPath,
103
+ "android",
104
+ "app",
105
+ "src",
106
+ "main",
107
+ "java",
108
+ "com",
109
+ "beevernativetemplatetest"
110
+ );
111
+ const androidPackageParent = path.dirname(androidPackageDirectory);
112
+ const androidPackageTarget = path.join(
113
+ androidPackageParent,
114
+ "beever",
115
+ safeNativePackageName
116
+ );
117
+ if (fs.existsSync(androidPackageDirectory)) {
118
+ fs.mkdirSync(path.dirname(androidPackageTarget), {
119
+ recursive: true
120
+ });
121
+ fs.renameSync(androidPackageDirectory, androidPackageTarget);
122
+ }
123
+ const iosDirectory = path.join(projectPath, "ios");
124
+ const oldIosAppDirectory = path.join(
125
+ iosDirectory,
126
+ "BeeverNativeTemplateTest"
127
+ );
128
+ const newIosAppDirectory = path.join(iosDirectory, appName);
129
+ if (fs.existsSync(oldIosAppDirectory)) {
130
+ fs.renameSync(oldIosAppDirectory, newIosAppDirectory);
131
+ }
132
+ const oldXcodeProjectDirectory = path.join(
133
+ iosDirectory,
134
+ "BeeverNativeTemplateTest.xcodeproj"
135
+ );
136
+ const newXcodeProjectDirectory = path.join(
137
+ iosDirectory,
138
+ `${appName}.xcodeproj`
139
+ );
140
+ if (fs.existsSync(oldXcodeProjectDirectory)) {
141
+ fs.renameSync(oldXcodeProjectDirectory, newXcodeProjectDirectory);
142
+ }
143
+ const oldSchemeFile = path.join(
144
+ newXcodeProjectDirectory,
145
+ "xcshareddata",
146
+ "xcschemes",
147
+ "BeeverNativeTemplateTest.xcscheme"
148
+ );
149
+ const newSchemeFile = path.join(
150
+ newXcodeProjectDirectory,
151
+ "xcshareddata",
152
+ "xcschemes",
153
+ `${appName}.xcscheme`
154
+ );
155
+ if (fs.existsSync(oldSchemeFile)) {
156
+ fs.renameSync(oldSchemeFile, newSchemeFile);
51
157
  }
52
- fs.mkdirSync(projectPath);
53
- fs.cpSync(templatesPath, projectPath, {
54
- recursive: true
158
+ }
159
+ async function selectMobileProjectType() {
160
+ const rl = createInterface({
161
+ input: stdin,
162
+ output: stdout
55
163
  });
56
- replaceProjectName(projectPath);
57
- console.log("Beever project created successfully!");
58
- console.log(`Project location: ${projectPath}`);
59
- } catch (error) {
60
- console.error("Failed to create Beever project.");
61
- if (fs.existsSync(projectPath)) {
62
- fs.rmSync(projectPath, {
63
- recursive: true,
64
- force: true
164
+ try {
165
+ console.log("\nWhich mobile setup would you like?\n");
166
+ console.log(" 1. React Native Standalone");
167
+ console.log(" 2. React Native with Expo\n");
168
+ const answer = (await rl.question("Choose an option (1 or 2): ")).trim();
169
+ if (answer === "1") {
170
+ return "standalone";
171
+ }
172
+ if (answer === "2") {
173
+ return "expo";
174
+ }
175
+ throw new Error("Invalid selection. Please choose 1 or 2.");
176
+ } finally {
177
+ rl.close();
178
+ }
179
+ }
180
+ async function main() {
181
+ let mobileProjectType;
182
+ try {
183
+ mobileProjectType = await selectMobileProjectType();
184
+ } catch (error) {
185
+ console.error(error instanceof Error ? error.message : error);
186
+ process.exit(1);
187
+ }
188
+ const selectedTemplatePath = mobileProjectType === "standalone" ? standaloneTemplatePath : expoTemplatePath;
189
+ try {
190
+ if (!fs.existsSync(commonTemplatePath)) {
191
+ throw new Error("Common project template not found.");
192
+ }
193
+ if (!fs.existsSync(selectedTemplatePath)) {
194
+ throw new Error(
195
+ `The ${mobileProjectType} project template was not found.`
196
+ );
197
+ }
198
+ fs.mkdirSync(projectPath);
199
+ fs.cpSync(commonTemplatePath, projectPath, {
200
+ recursive: true
201
+ });
202
+ fs.cpSync(selectedTemplatePath, projectPath, {
203
+ recursive: true
65
204
  });
205
+ replaceTemplatePlaceholders(projectPath);
206
+ if (mobileProjectType === "standalone") {
207
+ renameStandaloneNativeDirectories();
208
+ }
209
+ } catch (error) {
210
+ console.error("\nFailed to create Beever project.");
211
+ if (fs.existsSync(projectPath)) {
212
+ fs.rmSync(projectPath, {
213
+ recursive: true,
214
+ force: true
215
+ });
216
+ }
217
+ console.error(error);
218
+ process.exit(1);
66
219
  }
67
- console.error(error);
68
- process.exit(1);
220
+ console.log("\nInstalling project dependencies...\n");
221
+ const installOptions = {
222
+ cwd: projectPath,
223
+ stdio: "inherit"
224
+ };
225
+ const installResult = process.platform === "win32" ? spawnSync(
226
+ process.env.ComSpec || "cmd.exe",
227
+ ["/d", "/s", "/c", "npm install"],
228
+ installOptions
229
+ ) : spawnSync("npm", ["install"], installOptions);
230
+ if (installResult.error || installResult.status !== 0) {
231
+ console.error("\nDependency installation failed.");
232
+ console.error(`Your project was created at: ${projectPath}`);
233
+ console.error("You can retry by running 'npm install' inside the project.");
234
+ process.exit(1);
235
+ }
236
+ console.log("\nBeever project created successfully!\n");
237
+ console.log("Your Beever project is ready for:");
238
+ console.log(" - Web");
239
+ if (mobileProjectType === "standalone") {
240
+ console.log(" - React Native Standalone");
241
+ } else {
242
+ console.log(" - React Native with Expo");
243
+ }
244
+ console.log("\nDependencies installed successfully!");
69
245
  }
246
+ await main();
70
247
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import fs from \"node:fs\";\r\nimport path from \"node:path\";\r\nimport { fileURLToPath } from \"node:url\";\r\n\r\nconst projectName = process.argv[2];\r\n\r\nif (!projectName) {\r\n console.log(\"Please provide a project name.\");\r\n console.log(\"Usage: npx beever-create <project-name>\");\r\n process.exit(1);\r\n}\r\n\r\nconst validProjectName = /^[a-zA-Z0-9_-]+$/.test(projectName);\r\n\r\nif (!validProjectName) {\r\n console.error(\r\n \"Invalid project name. Use only letters, numbers, hyphens, and underscores.\",\r\n );\r\n process.exit(1);\r\n}\r\n\r\nconst projectPath = path.resolve(process.cwd(), projectName);\r\n\r\nif (fs.existsSync(projectPath)) {\r\n console.error(`A folder named \"${projectName}\" already exists.`);\r\n process.exit(1);\r\n}\r\n\r\nconst currentDirectory = path.dirname(fileURLToPath(import.meta.url));\r\nconst templatesPath = path.resolve(currentDirectory, \"../templates\");\r\n\r\nconst packageName = projectName.toLowerCase().replace(/_/g, \"-\");\r\n\r\nfunction replaceProjectName(directory: string) {\r\n const entries = fs.readdirSync(directory, {\r\n withFileTypes: true,\r\n });\r\n\r\n for (const entry of entries) {\r\n const entryPath = path.join(directory, entry.name);\r\n\r\n if (entry.isDirectory()) {\r\n replaceProjectName(entryPath);\r\n continue;\r\n }\r\n\r\n const content = fs.readFileSync(entryPath, \"utf8\");\r\n\r\n if (content.includes(\"{{projectName}}\")) {\r\n fs.writeFileSync(\r\n entryPath,\r\n content.split(\"{{projectName}}\").join(packageName),\r\n \"utf8\",\r\n );\r\n }\r\n }\r\n}\r\n\r\ntry {\r\n if (!fs.existsSync(templatesPath)) {\r\n throw new Error(\"Project templates directory not found.\");\r\n }\r\n\r\n fs.mkdirSync(projectPath);\r\n\r\n fs.cpSync(templatesPath, projectPath, {\r\n recursive: true,\r\n });\r\n\r\n replaceProjectName(projectPath);\r\n\r\n console.log(\"Beever project created successfully!\");\r\n console.log(`Project location: ${projectPath}`);\r\n} catch (error) {\r\n console.error(\"Failed to create Beever project.\");\r\n\r\n if (fs.existsSync(projectPath)) {\r\n fs.rmSync(projectPath, {\r\n recursive: true,\r\n force: true,\r\n });\r\n }\r\n\r\n console.error(error);\r\n process.exit(1);\r\n}\r\n"],"mappings":";;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAE9B,IAAM,cAAc,QAAQ,KAAK,CAAC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AW;AAE9B,UAAQ,IAAI,sCAAsC;AAClD,UAAQ,IAAI,qBAAqB,WAAW,EAAE;AAChD,SAAS,OAAO;AACd,UAAQ,MAAM,kCAAkC;AAEhD,MAAI,GAAG,WAAW,WAAW,GAAG;AAC9B,OAAG,OAAO,aAAa;AAAA,MACrB,WAAW;AAAA,MACX,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AAEA,UAAQ,MAAM,KAAK;AACnB,UAAQ,KAAK,CAAC;AAChB;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import fs from \"node:fs\";\r\nimport path from \"node:path\";\r\nimport { spawnSync } from \"node:child_process\";\r\nimport { fileURLToPath } from \"node:url\";\r\nimport { createInterface } from \"node:readline/promises\";\r\nimport { stdin, stdout } from \"node:process\";\r\n\r\ntype MobileProjectType = \"standalone\" | \"expo\";\r\n\r\nconst projectName = process.argv[2];\r\n\r\nif (!projectName) {\r\n console.log(\"Please provide a project name.\");\r\n console.log(\"Usage: npx beever-create <project-name>\");\r\n process.exit(1);\r\n}\r\n\r\n// Validate the project name before creating anything.\r\nconst validProjectName = /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(projectName);\r\n\r\nif (!validProjectName) {\r\n console.error(\r\n \"Invalid project name. Start with a letter or number and use only letters, numbers, hyphens, and underscores.\",\r\n );\r\n process.exit(1);\r\n}\r\n\r\nconst projectPath = path.resolve(process.cwd(), projectName);\r\n\r\nif (fs.existsSync(projectPath)) {\r\n console.error(`A folder named \"${projectName}\" already exists.`);\r\n process.exit(1);\r\n}\r\n\r\n// Resolve template directories.\r\nconst currentDirectory = path.dirname(fileURLToPath(import.meta.url));\r\nconst templatesPath = path.resolve(currentDirectory, \"../templates\");\r\n\r\nconst commonTemplatePath = path.join(templatesPath, \"common\");\r\nconst expoTemplatePath = path.join(templatesPath, \"expo\");\r\nconst standaloneTemplatePath = path.join(templatesPath, \"standalone\");\r\n\r\n// Generate project identifiers.\r\nconst packageName = projectName.toLowerCase().replace(/_/g, \"-\");\r\n\r\nconst displayName = projectName.replace(/[-_]+/g, \" \").trim();\r\n\r\nconst appNameParts = projectName.split(/[-_]+/).filter(Boolean);\r\n\r\nlet appName = appNameParts\r\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\r\n .join(\"\");\r\n\r\nif (!appName || /^[0-9]/.test(appName)) {\r\n appName = `App${appName}`;\r\n}\r\n\r\nconst nativePackageName = projectName.toLowerCase().replace(/[^a-z0-9]/g, \"\");\r\n\r\nconst safeNativePackageName = /^[a-z]/.test(nativePackageName)\r\n ? nativePackageName\r\n : `app${nativePackageName}`;\r\n\r\nconst androidPackage = `com.beever.${safeNativePackageName}`;\r\nconst iosBundleIdentifier = `com.beever.${safeNativePackageName}`;\r\n\r\n// Only these files are processed as text.\r\n// Binary assets are deliberately excluded.\r\nconst textFileExtensions = new Set([\r\n \".json\",\r\n \".js\",\r\n \".jsx\",\r\n \".ts\",\r\n \".tsx\",\r\n \".gradle\",\r\n \".properties\",\r\n \".kt\",\r\n \".swift\",\r\n \".plist\",\r\n \".storyboard\",\r\n \".xcprivacy\",\r\n \".pbxproj\",\r\n \".xcscheme\",\r\n \".xml\",\r\n \".md\",\r\n \".txt\",\r\n \".html\",\r\n \".css\",\r\n \".scss\",\r\n \".yml\",\r\n \".yaml\",\r\n \".toml\",\r\n]);\r\n\r\nconst placeholderValues: Record<string, string> = {\r\n \"{{projectName}}\": packageName,\r\n \"{{packageName}}\": packageName,\r\n \"{{displayName}}\": displayName,\r\n \"{{appName}}\": appName,\r\n \"{{androidPackage}}\": androidPackage,\r\n \"{{iosBundleIdentifier}}\": iosBundleIdentifier,\r\n};\r\n\r\nfunction replaceTemplatePlaceholders(directory: string) {\r\n const entries = fs.readdirSync(directory, {\r\n withFileTypes: true,\r\n });\r\n\r\n for (const entry of entries) {\r\n const entryPath = path.join(directory, entry.name);\r\n\r\n if (entry.isDirectory()) {\r\n replaceTemplatePlaceholders(entryPath);\r\n continue;\r\n }\r\n\r\n const extension = path.extname(entry.name).toLowerCase();\r\n\r\n const isPodfile = entry.name === \"Podfile\";\r\n const isTextFile = isPodfile || textFileExtensions.has(extension);\r\n\r\n if (!isTextFile) {\r\n continue;\r\n }\r\n\r\n let content = fs.readFileSync(entryPath, \"utf8\");\r\n\r\n for (const [placeholder, value] of Object.entries(placeholderValues)) {\r\n content = content.split(placeholder).join(value);\r\n }\r\n\r\n fs.writeFileSync(entryPath, content, \"utf8\");\r\n }\r\n}\r\n\r\nfunction renameStandaloneNativeDirectories() {\r\n const androidPackageDirectory = path.join(\r\n projectPath,\r\n \"android\",\r\n \"app\",\r\n \"src\",\r\n \"main\",\r\n \"java\",\r\n \"com\",\r\n \"beevernativetemplatetest\",\r\n );\r\n\r\n const androidPackageParent = path.dirname(androidPackageDirectory);\r\n\r\n const androidPackageTarget = path.join(\r\n androidPackageParent,\r\n \"beever\",\r\n safeNativePackageName,\r\n );\r\n\r\n if (fs.existsSync(androidPackageDirectory)) {\r\n fs.mkdirSync(path.dirname(androidPackageTarget), {\r\n recursive: true,\r\n });\r\n\r\n fs.renameSync(androidPackageDirectory, androidPackageTarget);\r\n }\r\n\r\n const iosDirectory = path.join(projectPath, \"ios\");\r\n\r\n const oldIosAppDirectory = path.join(\r\n iosDirectory,\r\n \"BeeverNativeTemplateTest\",\r\n );\r\n\r\n const newIosAppDirectory = path.join(iosDirectory, appName);\r\n\r\n if (fs.existsSync(oldIosAppDirectory)) {\r\n fs.renameSync(oldIosAppDirectory, newIosAppDirectory);\r\n }\r\n\r\n const oldXcodeProjectDirectory = path.join(\r\n iosDirectory,\r\n \"BeeverNativeTemplateTest.xcodeproj\",\r\n );\r\n\r\n const newXcodeProjectDirectory = path.join(\r\n iosDirectory,\r\n `${appName}.xcodeproj`,\r\n );\r\n\r\n if (fs.existsSync(oldXcodeProjectDirectory)) {\r\n fs.renameSync(oldXcodeProjectDirectory, newXcodeProjectDirectory);\r\n }\r\n\r\n const oldSchemeFile = path.join(\r\n newXcodeProjectDirectory,\r\n \"xcshareddata\",\r\n \"xcschemes\",\r\n \"BeeverNativeTemplateTest.xcscheme\",\r\n );\r\n\r\n const newSchemeFile = path.join(\r\n newXcodeProjectDirectory,\r\n \"xcshareddata\",\r\n \"xcschemes\",\r\n `${appName}.xcscheme`,\r\n );\r\n\r\n if (fs.existsSync(oldSchemeFile)) {\r\n fs.renameSync(oldSchemeFile, newSchemeFile);\r\n }\r\n}\r\n\r\nasync function selectMobileProjectType(): Promise<MobileProjectType> {\r\n const rl = createInterface({\r\n input: stdin,\r\n output: stdout,\r\n });\r\n\r\n try {\r\n console.log(\"\\nWhich mobile setup would you like?\\n\");\r\n console.log(\" 1. React Native Standalone\");\r\n console.log(\" 2. React Native with Expo\\n\");\r\n\r\n const answer = (await rl.question(\"Choose an option (1 or 2): \")).trim();\r\n\r\n if (answer === \"1\") {\r\n return \"standalone\";\r\n }\r\n\r\n if (answer === \"2\") {\r\n return \"expo\";\r\n }\r\n\r\n throw new Error(\"Invalid selection. Please choose 1 or 2.\");\r\n } finally {\r\n rl.close();\r\n }\r\n}\r\n\r\nasync function main() {\r\n let mobileProjectType: MobileProjectType;\r\n\r\n try {\r\n mobileProjectType = await selectMobileProjectType();\r\n } catch (error) {\r\n console.error(error instanceof Error ? error.message : error);\r\n process.exit(1);\r\n }\r\n\r\n const selectedTemplatePath =\r\n mobileProjectType === \"standalone\"\r\n ? standaloneTemplatePath\r\n : expoTemplatePath;\r\n\r\n try {\r\n // Verify the required template directories.\r\n if (!fs.existsSync(commonTemplatePath)) {\r\n throw new Error(\"Common project template not found.\");\r\n }\r\n\r\n if (!fs.existsSync(selectedTemplatePath)) {\r\n throw new Error(\r\n `The ${mobileProjectType} project template was not found.`,\r\n );\r\n }\r\n\r\n // Create the project directory.\r\n fs.mkdirSync(projectPath);\r\n\r\n // Copy shared application code first.\r\n fs.cpSync(commonTemplatePath, projectPath, {\r\n recursive: true,\r\n });\r\n\r\n // Overlay the selected mobile project template.\r\n fs.cpSync(selectedTemplatePath, projectPath, {\r\n recursive: true,\r\n });\r\n\r\n // Replace template placeholders in text files.\r\n replaceTemplatePlaceholders(projectPath);\r\n\r\n // Rename native project directories for Standalone.\r\n if (mobileProjectType === \"standalone\") {\r\n renameStandaloneNativeDirectories();\r\n }\r\n } catch (error) {\r\n console.error(\"\\nFailed to create Beever project.\");\r\n\r\n if (fs.existsSync(projectPath)) {\r\n fs.rmSync(projectPath, {\r\n recursive: true,\r\n force: true,\r\n });\r\n }\r\n\r\n console.error(error);\r\n process.exit(1);\r\n }\r\n\r\n // Automatically install project dependencies.\r\n console.log(\"\\nInstalling project dependencies...\\n\");\r\n\r\n const installOptions = {\r\n cwd: projectPath,\r\n stdio: \"inherit\" as const,\r\n };\r\n\r\n const installResult =\r\n process.platform === \"win32\"\r\n ? spawnSync(\r\n process.env.ComSpec || \"cmd.exe\",\r\n [\"/d\", \"/s\", \"/c\", \"npm install\"],\r\n installOptions,\r\n )\r\n : spawnSync(\"npm\", [\"install\"], installOptions);\r\n\r\n if (installResult.error || installResult.status !== 0) {\r\n console.error(\"\\nDependency installation failed.\");\r\n console.error(`Your project was created at: ${projectPath}`);\r\n console.error(\"You can retry by running 'npm install' inside the project.\");\r\n process.exit(1);\r\n }\r\n\r\n // Display the appropriate success message.\r\n console.log(\"\\nBeever project created successfully!\\n\");\r\n console.log(\"Your Beever project is ready for:\");\r\n console.log(\" - Web\");\r\n\r\n if (mobileProjectType === \"standalone\") {\r\n console.log(\" - React Native Standalone\");\r\n } else {\r\n console.log(\" - React Native with Expo\");\r\n }\r\n\r\n console.log(\"\\nDependencies installed successfully!\");\r\n}\r\n\r\nawait main();\r\n"],"mappings":";;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,SAAS,OAAO,cAAc;AAI9B,IAAM,cAAc,QAAQ,KAAK,CAAC;AAElC,IAAI,CAAC,aAAa;AAChB,UAAQ,IAAI,gCAAgC;A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M,MAAM,aAAa;AAAA,IAChC;AAAA,EACF,IACA,UAAU,OAAO,CAAC,SAAS,GAAG,cAAc;AAElD,MAAI,cAAc,SAAS,cAAc,WAAW,GAAG;AACrD,YAAQ,MAAM,mCAAmC;AACjD,YAAQ,MAAM,gCAAgC,WAAW,EAAE;AAC3D,YAAQ,MAAM,4DAA4D;AAC1E,YAAQ,KAAK,CAAC;AAAA,EAChB;AAGA,UAAQ,IAAI,0CAA0C;AACtD,UAAQ,IAAI,mCAAmC;AAC/C,UAAQ,IAAI,SAAS;AAErB,MAAI,sBAAsB,cAAc;AACtC,YAAQ,IAAI,6BAA6B;AAAA,EAC3C,OAAO;AACL,YAAQ,IAAI,4BAA4B;AAAA,EAC1C;AAEA,UAAQ,IAAI,wCAAwC;AACtD;AAEA,MAAM,KAAK;","names":[]}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "beever-create",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "CLI tool for creating Beever projects.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "bin": {
8
- "beever-create": "./dist/index.js"
8
+ "beever-create": "dist/index.js"
9
9
  },
10
10
  "files": [
11
11
  "dist",
@@ -1,5 +1,5 @@
1
1
  import { createRoot } from "react-dom/client";
2
- import { WelcomePage } from "../features/welcome";
2
+ import { WelcomePage } from "../features/welcome/pages/WelcomePage";
3
3
 
4
4
  const rootElement = document.getElementById("root");
5
5
 
@@ -0,0 +1,8 @@
1
+ import { defineConfig } from "vite";
2
+
3
+ export default defineConfig({
4
+ esbuild: {
5
+ jsx: "automatic",
6
+ jsxImportSource: "react",
7
+ },
8
+ });
@@ -0,0 +1 @@
1
+ module.exports = require("./mobile/app.config.js").expo;
@@ -0,0 +1,11 @@
1
+ const projectName = "{{projectName}}";
2
+
3
+ module.exports = {
4
+ expo: {
5
+ name: projectName,
6
+ slug: projectName,
7
+ version: "1.0.0",
8
+ orientation: "portrait",
9
+ userInterfaceStyle: "automatic",
10
+ },
11
+ };
@@ -4,14 +4,15 @@
4
4
  "private": true,
5
5
  "main": "mobile/index.ts",
6
6
  "scripts": {
7
- "web": "vite --root web",
8
- "build:web": "vite build --root web",
9
- "mobile": "expo start --config mobile/app.json"
7
+ "web": "vite web --config web/vite.config.ts",
8
+ "build:web": "vite build web --config web/vite.config.ts",
9
+ "mobile": "expo start --dev-client"
10
10
  },
11
11
  "dependencies": {
12
12
  "@beever/web": "0.1.0",
13
13
  "@beever/mobile": "0.1.0",
14
14
  "expo": "~58.0.26",
15
+ "expo-dev-client": "~58.0.21",
15
16
  "react": "19.3.0",
16
17
  "react-dom": "19.3.0",
17
18
  "react-native": "0.88.1"
@@ -19,7 +20,7 @@
19
20
  "devDependencies": {
20
21
  "@types/react": "^19.3.0",
21
22
  "@types/react-dom": "^19.3.0",
22
- "typescript": "^5.9.3",
23
+ "typescript": "~6.0.3",
23
24
  "vite": "^7.3.8"
24
25
  }
25
26
  }
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: '@react-native',
4
+ };
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ arrowParens: 'avoid',
3
+ singleQuote: true,
4
+ trailingComma: 'all',
5
+ };
@@ -0,0 +1 @@
1
+ {}
@@ -0,0 +1,17 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4
+ ruby ">= 2.6.10"
5
+
6
+ # Exclude problematic versions of cocoapods and activesupport that causes build failures.
7
+ gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
8
+ gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
9
+ gem 'xcodeproj', '< 1.26.0'
10
+ gem 'concurrent-ruby', '< 1.3.4'
11
+
12
+ # Ruby 3.4.0 has removed some libraries from the standard library.
13
+ gem 'bigdecimal'
14
+ gem 'logger'
15
+ gem 'benchmark'
16
+ gem 'mutex_m'
17
+ gem 'nkf'
@@ -0,0 +1,119 @@
1
+ apply plugin: "com.android.application"
2
+ apply plugin: "org.jetbrains.kotlin.android"
3
+ apply plugin: "com.facebook.react"
4
+
5
+ /**
6
+ * This is the configuration block to customize your React Native Android app.
7
+ * By default you don't need to apply any configuration, just uncomment the lines you need.
8
+ */
9
+ react {
10
+ /* Folders */
11
+ // The root of your project, i.e. where "package.json" lives. Default is '../..'
12
+ // root = file("../../")
13
+ // The folder where the react-native NPM package is. Default is ../../node_modules/react-native
14
+ // reactNativeDir = file("../../node_modules/react-native")
15
+ // The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
16
+ // codegenDir = file("../../node_modules/@react-native/codegen")
17
+ // The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
18
+ // cliFile = file("../../node_modules/react-native/cli.js")
19
+
20
+ /* Variants */
21
+ // The list of variants to that are debuggable. For those we're going to
22
+ // skip the bundling of the JS bundle and the assets. Default is "debug", "debugOptimized".
23
+ // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
24
+ // debuggableVariants = ["liteDebug", "liteDebugOptimized", "prodDebug", "prodDebugOptimized"]
25
+
26
+ /* Bundling */
27
+ // A list containing the node command and its flags. Default is just 'node'.
28
+ // nodeExecutableAndArgs = ["node"]
29
+ //
30
+ // The command to run when bundling. By default is 'bundle'
31
+ // bundleCommand = "ram-bundle"
32
+ //
33
+ // The path to the CLI configuration file. Default is empty.
34
+ // bundleConfig = file(../rn-cli.config.js)
35
+ //
36
+ // The name of the generated asset file containing your JS bundle
37
+ // bundleAssetName = "MyApplication.android.bundle"
38
+ //
39
+ // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
40
+ // entryFile = file("../js/MyApplication.android.js")
41
+ //
42
+ // A list of extra flags to pass to the 'bundle' commands.
43
+ // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
44
+ // extraPackagerArgs = []
45
+
46
+ /* Hermes Commands */
47
+ // The hermes compiler command to run. By default it is 'hermesc'
48
+ // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
49
+ //
50
+ // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
51
+ // hermesFlags = ["-O", "-output-source-map"]
52
+
53
+ /* Autolinking */
54
+ autolinkLibrariesWithApp()
55
+ }
56
+
57
+ /**
58
+ * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
59
+ */
60
+ def enableProguardInReleaseBuilds = false
61
+
62
+ /**
63
+ * The preferred build flavor of JavaScriptCore (JSC)
64
+ *
65
+ * For example, to use the international variant, you can use:
66
+ * `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
67
+ *
68
+ * The international variant includes ICU i18n library and necessary data
69
+ * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
70
+ * give correct results when using with locales other than en-US. Note that
71
+ * this variant is about 6MiB larger per architecture than default.
72
+ */
73
+ def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
74
+
75
+ android {
76
+ ndkVersion rootProject.ext.ndkVersion
77
+ buildToolsVersion rootProject.ext.buildToolsVersion
78
+ compileSdk rootProject.ext.compileSdkVersion
79
+
80
+ namespace "{{androidPackage}}"
81
+ defaultConfig {
82
+ applicationId "{{androidPackage}}"
83
+ minSdkVersion rootProject.ext.minSdkVersion
84
+ targetSdkVersion rootProject.ext.targetSdkVersion
85
+ versionCode 1
86
+ versionName "1.0"
87
+ }
88
+ signingConfigs {
89
+ debug {
90
+ storeFile file('debug.keystore')
91
+ storePassword 'android'
92
+ keyAlias 'androiddebugkey'
93
+ keyPassword 'android'
94
+ }
95
+ }
96
+ buildTypes {
97
+ debug {
98
+ signingConfig signingConfigs.debug
99
+ }
100
+ release {
101
+ // Caution! In production, you need to generate your own keystore file.
102
+ // see https://reactnative.dev/docs/signed-apk-android.
103
+ signingConfig signingConfigs.debug
104
+ minifyEnabled enableProguardInReleaseBuilds
105
+ proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
106
+ }
107
+ }
108
+ }
109
+
110
+ dependencies {
111
+ // The version of react-native is set by the React Native Gradle Plugin
112
+ implementation("com.facebook.react:react-android")
113
+
114
+ if (hermesEnabled.toBoolean()) {
115
+ implementation("com.facebook.react:hermes-android")
116
+ } else {
117
+ implementation jscFlavor
118
+ }
119
+ }
@@ -0,0 +1,10 @@
1
+ # Add project specific ProGuard rules here.
2
+ # By default, the flags in this file are appended to flags specified
3
+ # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4
+ # You can edit the include path and order by changing the proguardFiles
5
+ # directive in build.gradle.
6
+ #
7
+ # For more details, see
8
+ # http://developer.android.com/guide/developing/tools/proguard.html
9
+
10
+ # Add any project specific keep options here:
@@ -0,0 +1,27 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+
3
+ <uses-permission android:name="android.permission.INTERNET" />
4
+
5
+ <application
6
+ android:name=".MainApplication"
7
+ android:label="@string/app_name"
8
+ android:icon="@mipmap/ic_launcher"
9
+ android:roundIcon="@mipmap/ic_launcher_round"
10
+ android:allowBackup="false"
11
+ android:theme="@style/AppTheme"
12
+ android:usesCleartextTraffic="${usesCleartextTraffic}"
13
+ android:supportsRtl="true">
14
+ <activity
15
+ android:name=".MainActivity"
16
+ android:label="@string/app_name"
17
+ android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
18
+ android:launchMode="singleTask"
19
+ android:windowSoftInputMode="adjustResize"
20
+ android:exported="true">
21
+ <intent-filter>
22
+ <action android:name="android.intent.action.MAIN" />
23
+ <category android:name="android.intent.category.LAUNCHER" />
24
+ </intent-filter>
25
+ </activity>
26
+ </application>
27
+ </manifest>
@@ -0,0 +1,22 @@
1
+ package {{androidPackage}}
2
+
3
+ import com.facebook.react.ReactActivity
4
+ import com.facebook.react.ReactActivityDelegate
5
+ import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
6
+ import com.facebook.react.defaults.DefaultReactActivityDelegate
7
+
8
+ class MainActivity : ReactActivity() {
9
+
10
+ /**
11
+ * Returns the name of the main component registered from JavaScript. This is used to schedule
12
+ * rendering of the component.
13
+ */
14
+ override fun getMainComponentName(): String = "{{appName}}"
15
+
16
+ /**
17
+ * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
18
+ * which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
19
+ */
20
+ override fun createReactActivityDelegate(): ReactActivityDelegate =
21
+ DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
22
+ }
@@ -0,0 +1,27 @@
1
+ package {{androidPackage}}
2
+
3
+ import android.app.Application
4
+ import com.facebook.react.PackageList
5
+ import com.facebook.react.ReactApplication
6
+ import com.facebook.react.ReactHost
7
+ import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
8
+ import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
9
+
10
+ class MainApplication : Application(), ReactApplication {
11
+
12
+ override val reactHost: ReactHost by lazy {
13
+ getDefaultReactHost(
14
+ context = applicationContext,
15
+ packageList =
16
+ PackageList(this).packages.apply {
17
+ // Packages that cannot be autolinked yet can be added manually here, for example:
18
+ // add(MyReactNativePackage())
19
+ },
20
+ )
21
+ }
22
+
23
+ override fun onCreate() {
24
+ super.onCreate()
25
+ loadReactNative(this)
26
+ }
27
+ }