app-expo-cli 1.1.2 → 1.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.
- package/package.json +1 -1
- package/src/index.js +34 -12
- package/template/src/redux/api-config/baseApi.ts +1 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import fs from "fs-extra";
|
|
3
3
|
import path from "path";
|
|
4
|
-
import updateNotifier from "simple-update-notifier";
|
|
5
4
|
import { fileURLToPath } from "url";
|
|
6
5
|
import { copyDefaultFiles } from "./copy-template.js";
|
|
7
6
|
import { createExpoApp } from "./create-expo.js";
|
|
@@ -39,23 +38,46 @@ async function init() {
|
|
|
39
38
|
|
|
40
39
|
// 2. Handle Update Flags (-u or --update)
|
|
41
40
|
if (args.includes("--update") || args.includes("-u")) {
|
|
42
|
-
|
|
41
|
+
console.log(chalk.blue("Checking for updates from npm..."));
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
`Update available: ${chalk.bold(notifier.update.latest)}. You have ${chalk.bold(pkg.version)}.`,
|
|
49
|
-
),
|
|
43
|
+
try {
|
|
44
|
+
// Fetch the latest version data directly from the official npm registry
|
|
45
|
+
const response = await fetch(
|
|
46
|
+
`https://registry.npmjs.org/${pkg.name}/latest`,
|
|
50
47
|
);
|
|
48
|
+
|
|
49
|
+
// Check if the response is valid
|
|
50
|
+
if (!response.ok) {
|
|
51
|
+
throw new Error("Network response was not ok");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const data = await response.json();
|
|
55
|
+
const latestVersion = data.version;
|
|
56
|
+
|
|
57
|
+
// Compare the local package.json version with the npm registry version
|
|
58
|
+
if (latestVersion && latestVersion !== pkg.version) {
|
|
59
|
+
console.log(
|
|
60
|
+
chalk.yellow(
|
|
61
|
+
`Update available: ${chalk.bold(latestVersion)}. You have ${chalk.bold(pkg.version)}.`,
|
|
62
|
+
),
|
|
63
|
+
);
|
|
64
|
+
console.log(
|
|
65
|
+
chalk.gray(
|
|
66
|
+
`Run ${chalk.cyan(`npm install -g ${pkg.name}@latest`)} to update.`,
|
|
67
|
+
),
|
|
68
|
+
);
|
|
69
|
+
} else {
|
|
70
|
+
console.log(chalk.green("You are using the latest version. ✅"));
|
|
71
|
+
}
|
|
72
|
+
} catch (error) {
|
|
73
|
+
// Handle cases where the user is offline or npm is down
|
|
51
74
|
console.log(
|
|
52
|
-
chalk.
|
|
53
|
-
|
|
75
|
+
chalk.red(
|
|
76
|
+
"Failed to check for updates. Please check your internet connection.",
|
|
54
77
|
),
|
|
55
78
|
);
|
|
56
|
-
} else {
|
|
57
|
-
console.log(chalk.green("You are using the latest version. ✅"));
|
|
58
79
|
}
|
|
80
|
+
|
|
59
81
|
process.exit(0);
|
|
60
82
|
}
|
|
61
83
|
|
|
@@ -5,7 +5,7 @@ import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
|
5
5
|
import { tagTypesList } from "../interface/tag-types";
|
|
6
6
|
|
|
7
7
|
// const BaseURl = "http://10.10.10.110:3000";
|
|
8
|
-
const BaseURl = "
|
|
8
|
+
const BaseURl = "place-your-backend-url-here";
|
|
9
9
|
|
|
10
10
|
interface BaseQueryArgs extends AxiosRequestConfig {
|
|
11
11
|
url: string;
|