app-expo-cli 1.0.6 → 1.0.8

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
@@ -70,19 +70,25 @@ my-awesome-app/
70
70
 
71
71
  আপনার প্রজেক্টের সাথে এই প্রয়োজনীয় প্যাকেজগুলো অটোমেটিক কনফিগার হয়ে যাবে:
72
72
 
73
- State Management: @reduxjs/toolkit & react-redux
73
+ **- State Management: @reduxjs/toolkit এবং react-redux**
74
74
 
75
- Networking: axios
75
+ **- Networking: axios**
76
76
 
77
- Storage: @react-native-async-storage/async-storage
77
+ **- Storage: @react-native-async-storage/async-storage**
78
78
 
79
- Graphics: react-native-svg
79
+ **- Graphics & UI: react-native-svg, react-native-render-html, এবং react-native-webview**
80
+
81
+ **- Forms & Validation: formik এবং yup**
82
+
83
+ **- Features & Utilities: expo-image-picker ও react-native-otp-entry**
80
84
 
81
85
  ### 🤝 Contributing
82
86
 
83
87
  আপনি যদি এই টেমপ্লেটে কোনো পরিবর্তন বা নতুন ফিচার যোগ করতে চান, তবে অবশ্যই একটি Pull Request ওপেন করবেন।
84
88
 
85
- GitHub: https://github.com/arifbiswas/app-expo-cli
89
+ GitHub (CLI): https://github.com/arifbiswas/app-expo-cli
90
+
91
+ GitHub (Library): https://github.com/arifbiswas/lib
86
92
 
87
93
  ## 👤 Author
88
94
 
package/bun.lock CHANGED
@@ -9,6 +9,7 @@
9
9
  "degit": "^2.8.4",
10
10
  "execa": "^9.6.1",
11
11
  "fs-extra": "^11.3.3",
12
+ "simple-update-notifier": "^2.0.0",
12
13
  },
13
14
  },
14
15
  },
@@ -59,12 +60,16 @@
59
60
 
60
61
  "pretty-ms": ["pretty-ms@9.3.0", "", { "dependencies": { "parse-ms": "^4.0.0" } }, "sha512-gjVS5hOP+M3wMm5nmNOucbIrqudzs9v/57bWRHQWLYklXqoXKrVfYW2W9+glfGsqtPgpiz5WwyEEB+ksXIx3gQ=="],
61
62
 
63
+ "semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="],
64
+
62
65
  "shebang-command": ["shebang-command@2.0.0", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="],
63
66
 
64
67
  "shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="],
65
68
 
66
69
  "signal-exit": ["signal-exit@4.1.0", "", {}, "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw=="],
67
70
 
71
+ "simple-update-notifier": ["simple-update-notifier@2.0.0", "", { "dependencies": { "semver": "^7.5.3" } }, "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w=="],
72
+
68
73
  "sisteransi": ["sisteransi@1.0.5", "", {}, "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg=="],
69
74
 
70
75
  "strip-final-newline": ["strip-final-newline@4.0.0", "", {}, "sha512-aulFJcD6YK8V1G7iRB5tigAP4TsHBZZrOV8pjV++zdUwmeV8uzbY7yn6h9MswN62adStNZFuCIx4haBnRuMDaw=="],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "app-expo-cli",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "A powerful CLI to bootstrap Expo projects with professional architecture",
5
5
  "keywords": [
6
6
  "expo",
@@ -40,6 +40,7 @@
40
40
  "chalk": "^5.6.2",
41
41
  "degit": "^2.8.4",
42
42
  "execa": "^9.6.1",
43
- "fs-extra": "^11.3.3"
43
+ "fs-extra": "^11.3.3",
44
+ "simple-update-notifier": "^2.0.0"
44
45
  }
45
46
  }
package/src/index.js CHANGED
@@ -1,38 +1,130 @@
1
+ import chalk from "chalk";
1
2
  import fs from "fs-extra";
2
3
  import path from "path";
4
+ import updateNotifier from "simple-update-notifier";
3
5
  import { fileURLToPath } from "url";
4
6
  import { copyDefaultFiles } from "./copy-template.js";
5
7
  import { createExpoApp } from "./create-expo.js";
6
8
  import { installDependencies } from "./install-deps.js";
7
9
  import { logError } from "./utils/logger.js";
8
- const projectName = process.argv[2];
9
-
10
- if (!projectName) {
11
- logError("Please provide project name");
12
- process.exit(1);
13
- }
14
10
 
15
11
  // __dirname replacement for ESM
16
12
  const __filename = fileURLToPath(import.meta.url);
17
13
  const __dirname = path.dirname(__filename);
18
14
 
15
+ // Correct path to package.json
16
+ const pkgPath = path.join(__dirname, "..", "package.json");
17
+
19
18
  async function init() {
19
+ // Read package.json
20
+ let pkg;
21
+ try {
22
+ pkg = await fs.readJson(pkgPath);
23
+ } catch (error) {
24
+ logError("Could not find package.json.");
25
+ process.exit(1);
26
+ }
27
+
28
+ const args = process.argv.slice(2);
29
+
30
+ // 1. Handle Version Flags
31
+ if (
32
+ args.includes("--version") ||
33
+ args.includes("-v") ||
34
+ args.includes("--v")
35
+ ) {
36
+ console.log(`${chalk.cyan(pkg.name)} version: ${chalk.green(pkg.version)}`);
37
+ process.exit(0);
38
+ }
39
+
40
+ // 2. Handle Update Flags (-u or --update)
41
+ if (args.includes("--update") || args.includes("-u")) {
42
+ const notifier = updateNotifier({ pkg });
43
+
44
+ // Check if update exists (notifier returns info if update is available)
45
+ if (notifier && notifier.update) {
46
+ console.log(
47
+ chalk.yellow(
48
+ `Update available: ${chalk.bold(notifier.update.latest)}. You have ${chalk.bold(pkg.version)}.`,
49
+ ),
50
+ );
51
+ console.log(
52
+ chalk.gray(
53
+ `Run ${chalk.cyan(`npm install -g ${pkg.name}`)} to update.`,
54
+ ),
55
+ );
56
+ } else {
57
+ console.log(chalk.green("You are using the latest version. ✅"));
58
+ }
59
+ process.exit(0);
60
+ }
61
+
62
+ // 3. Handle Help Flags (--help or -h)
63
+ if (args.includes("--help") || args.includes("-h")) {
64
+ console.log(`\n${chalk.bold.cyan(pkg.name.toUpperCase())} - CLI Tool\n`);
65
+ console.log(chalk.bold("Usage:"));
66
+ console.log(chalk.gray(` npx ${pkg.name} <project-name>\n`));
67
+ console.log(chalk.bold("Options:"));
68
+ console.log(` -v, --version ${chalk.gray("Show version number")}`);
69
+ console.log(` -u, --update ${chalk.gray("Check for updates")}`);
70
+ console.log(` -h, --help ${chalk.gray("Show help guide")}`);
71
+ process.exit(0);
72
+ }
73
+
74
+ // 4. Get Project Name (Argument check)
75
+ const projectName = args[0];
76
+
77
+ if (!projectName) {
78
+ logError(
79
+ `Please provide project name. Usage: npx ${pkg.name} <project-name>`,
80
+ );
81
+ process.exit(1);
82
+ }
83
+
84
+ if (projectName.startsWith("-")) {
85
+ logError("Project name cannot start with a hyphen (-)");
86
+ process.exit(1);
87
+ }
88
+
89
+ const namePattern = /^[a-z0-9-_]+$/;
90
+ if (!namePattern.test(projectName)) {
91
+ logError(
92
+ "Invalid project name! Use only lowercase letters, numbers, hyphens, and underscores.",
93
+ );
94
+ console.log(chalk.yellow("Example: my-new-app or expo_project_1"));
95
+ process.exit(1);
96
+ }
97
+
20
98
  try {
21
99
  const projectPath = path.join(process.cwd(), projectName);
22
100
 
23
101
  if (await fs.pathExists(projectPath)) {
24
- logError("Project already exists");
102
+ logError(`Directory "${projectName}" already exists.`);
25
103
  process.exit(1);
26
104
  }
27
105
 
106
+ console.log(
107
+ chalk.blue(
108
+ `\nCreating a new Expo project in ${chalk.bold(projectPath)}...`,
109
+ ),
110
+ );
111
+
112
+ // Step 1: Create Expo App
28
113
  await createExpoApp(projectName);
29
114
 
115
+ // Step 2: Copy Template Files
30
116
  await copyDefaultFiles(projectPath, __dirname);
117
+
118
+ // Step 3: Install Dependencies
31
119
  await installDependencies(projectPath);
32
120
 
33
- console.log("\n✅ Project ready 🚀");
121
+ console.log("\n" + chalk.green.bold("✅ Project ready 🚀"));
122
+ console.log(chalk.gray(`\nNext steps:`));
123
+ console.log(chalk.cyan(` cd ${projectName}`));
124
+ console.log(chalk.cyan(` bun start`));
34
125
  } catch (err) {
35
126
  logError(err.message);
127
+ process.exit(1);
36
128
  }
37
129
  }
38
130