expo-template-default 52.0.63 → 52.0.65

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "expo-template-default",
3
3
  "license": "0BSD",
4
4
  "main": "expo-router/entry",
5
- "version": "52.0.63",
5
+ "version": "52.0.65",
6
6
  "scripts": {
7
7
  "start": "expo start",
8
8
  "reset-project": "node ./scripts/reset-project.js",
@@ -19,7 +19,7 @@
19
19
  "@expo/vector-icons": "^14.0.2",
20
20
  "@react-navigation/bottom-tabs": "^7.2.0",
21
21
  "@react-navigation/native": "^7.0.14",
22
- "expo": "~52.0.31",
22
+ "expo": "~52.0.32",
23
23
  "expo-blur": "~14.0.3",
24
24
  "expo-constants": "~17.0.5",
25
25
  "expo-font": "~13.0.3",
@@ -2,18 +2,19 @@
2
2
 
3
3
  /**
4
4
  * This script is used to reset the project to a blank state.
5
- * It moves the /app, /components, /hooks, /scripts, and /constants directories to /app-example and creates a new /app directory with an index.tsx and _layout.tsx file.
5
+ * It deletes or moves the /app, /components, /hooks, /scripts, and /constants directories to /app-example based on user input and creates a new /app directory with an index.tsx and _layout.tsx file.
6
6
  * You can remove the `reset-project` script from package.json and safely delete this file after running it.
7
7
  */
8
8
 
9
9
  const fs = require("fs");
10
10
  const path = require("path");
11
+ const readline = require("readline");
11
12
 
12
13
  const root = process.cwd();
13
14
  const oldDirs = ["app", "components", "hooks", "constants", "scripts"];
14
- const newDir = "app-example";
15
+ const exampleDir = "app-example";
15
16
  const newAppDir = "app";
16
- const newDirPath = path.join(root, newDir);
17
+ const exampleDirPath = path.join(root, exampleDir);
17
18
 
18
19
  const indexContent = `import { Text, View } from "react-native";
19
20
 
@@ -39,19 +40,31 @@ export default function RootLayout() {
39
40
  }
40
41
  `;
41
42
 
42
- const moveDirectories = async () => {
43
+ const rl = readline.createInterface({
44
+ input: process.stdin,
45
+ output: process.stdout,
46
+ });
47
+
48
+ const moveDirectories = async (userInput) => {
43
49
  try {
44
- // Create the app-example directory
45
- await fs.promises.mkdir(newDirPath, { recursive: true });
46
- console.log(`šŸ“ /${newDir} directory created.`);
50
+ if (userInput === "y") {
51
+ // Create the app-example directory
52
+ await fs.promises.mkdir(exampleDirPath, { recursive: true });
53
+ console.log(`šŸ“ /${exampleDir} directory created.`);
54
+ }
47
55
 
48
- // Move old directories to new app-example directory
56
+ // Move old directories to new app-example directory or delete them
49
57
  for (const dir of oldDirs) {
50
58
  const oldDirPath = path.join(root, dir);
51
- const newDirPath = path.join(root, newDir, dir);
52
59
  if (fs.existsSync(oldDirPath)) {
53
- await fs.promises.rename(oldDirPath, newDirPath);
54
- console.log(`āž”ļø /${dir} moved to /${newDir}/${dir}.`);
60
+ if (userInput === "y") {
61
+ const newDirPath = path.join(root, exampleDir, dir);
62
+ await fs.promises.rename(oldDirPath, newDirPath);
63
+ console.log(`āž”ļø /${dir} moved to /${exampleDir}/${dir}.`);
64
+ } else {
65
+ await fs.promises.rm(oldDirPath, { recursive: true, force: true });
66
+ console.log(`āŒ /${dir} deleted.`);
67
+ }
55
68
  } else {
56
69
  console.log(`āž”ļø /${dir} does not exist, skipping.`);
57
70
  }
@@ -74,11 +87,26 @@ const moveDirectories = async () => {
74
87
 
75
88
  console.log("\nāœ… Project reset complete. Next steps:");
76
89
  console.log(
77
- "1. Run `npx expo start` to start a development server.\n2. Edit app/index.tsx to edit the main screen.\n3. Delete the /app-example directory when you're done referencing it."
90
+ `1. Run \`npx expo start\` to start a development server.\n2. Edit app/index.tsx to edit the main screen.${
91
+ userInput === "y"
92
+ ? `\n3. Delete the /${exampleDir} directory when you're done referencing it.`
93
+ : ""
94
+ }`
78
95
  );
79
96
  } catch (error) {
80
- console.error(`Error during script execution: ${error}`);
97
+ console.error(`āŒ Error during script execution: ${error.message}`);
81
98
  }
82
99
  };
83
100
 
84
- moveDirectories();
101
+ rl.question(
102
+ "Do you want to move existing files to /app-example instead of deleting them? (Y/n): ",
103
+ (answer) => {
104
+ const userInput = answer.trim().toLowerCase() || "y";
105
+ if (userInput === "y" || userInput === "n") {
106
+ moveDirectories(userInput).finally(() => rl.close());
107
+ } else {
108
+ console.log("āŒ Invalid input. Please enter 'Y' or 'N'.");
109
+ rl.close();
110
+ }
111
+ }
112
+ );