hot-updater 0.25.2 → 0.25.3

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 (3) hide show
  1. package/dist/index.cjs +393 -332
  2. package/dist/index.js +62 -1
  3. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import childProcess, { ChildProcess, execFile, spawn, spawnSync } from "node:chi
5
5
  import path from "node:path";
6
6
  import fs, { appendFileSync, createReadStream, createWriteStream, readFileSync, statSync, writeFileSync } from "node:fs";
7
7
  import process$1, { execArgv, execPath, hrtime, platform } from "node:process";
8
- import { banner, colors, createTarBrTargetFiles, createTarGzTargetFiles, createZipTargetFiles, ensureInstallPackages, getCwd, loadConfig, log, p, printBanner } from "@hot-updater/cli-tools";
8
+ import { banner, colors, createTarBrTargetFiles, createTarGzTargetFiles, createZipTargetFiles, ensureInstallPackages, getCwd, getPackageManager, loadConfig, log, p, printBanner } from "@hot-updater/cli-tools";
9
9
  import { fileURLToPath } from "node:url";
10
10
  import { StringDecoder } from "node:string_decoder";
11
11
  import { aborted, callbackify, debuglog, inspect, promisify, stripVTControlCharacters } from "node:util";
@@ -36017,6 +36017,64 @@ const init = async () => {
36017
36017
  if (appendOutputDirectoryIntoGitignore()) p.log.info(".gitignore has been modified");
36018
36018
  };
36019
36019
 
36020
+ //#endregion
36021
+ //#region src/utils/conflictDetection.ts
36022
+ /**
36023
+ * Checks if a package can be resolved using require.resolve.
36024
+ * Exported for testing purposes.
36025
+ * @param packagePath - The package path to resolve
36026
+ * @returns true if the package can be resolved
36027
+ */
36028
+ function hasPackage(packagePath) {
36029
+ try {
36030
+ __require.resolve(`${packagePath}/package.json`, { paths: [getCwd()] });
36031
+ return true;
36032
+ } catch {
36033
+ return false;
36034
+ }
36035
+ }
36036
+ /**
36037
+ * Checks if expo-updates is installed in the project.
36038
+ * Uses require.resolve() as the primary check with file reading as fallback.
36039
+ * @returns true if expo-updates is found in dependencies or devDependencies
36040
+ */
36041
+ function hasExpoUpdates() {
36042
+ if (hasPackage("expo-updates")) return true;
36043
+ const cwd = getCwd();
36044
+ const packageJsonPath = path$1.join(cwd, "package.json");
36045
+ if (!fs$1.existsSync(packageJsonPath)) return false;
36046
+ try {
36047
+ const packageJsonContent = fs$1.readFileSync(packageJsonPath, "utf-8");
36048
+ const packageJson = JSON.parse(packageJsonContent);
36049
+ const dependencies = packageJson.dependencies || {};
36050
+ const devDependencies = packageJson.devDependencies || {};
36051
+ return !!dependencies["expo-updates"] || !!devDependencies["expo-updates"];
36052
+ } catch (_e) {
36053
+ return false;
36054
+ }
36055
+ }
36056
+ /**
36057
+ * Checks for critical conflicts and exits the process if any are found.
36058
+ * Currently checks for:
36059
+ * - expo-updates (incompatible with hot-updater)
36060
+ */
36061
+ function ensureNoConflicts() {
36062
+ if (hasExpoUpdates()) {
36063
+ p.log.error(colors.bgRed(colors.white(colors.bold(" ⚠️ CRITICAL CONFLICT DETECTED ⚠️ "))));
36064
+ p.log.warn(colors.yellow("You have 'expo-updates' installed in your project."));
36065
+ p.log.warn(colors.yellow("Hot Updater is completely incompatible with expo-updates."));
36066
+ p.log.warn(colors.yellow("Both libraries attempt to control the update process, which will cause your app to crash or behave unpredictably."));
36067
+ console.log();
36068
+ p.log.error(colors.red(colors.bold("YOU MUST REMOVE expo-updates TO PROCEED.")));
36069
+ console.log();
36070
+ const pm = getPackageManager();
36071
+ const removeCmd = pm === "npm" ? "uninstall" : pm === "yarn" ? "remove" : "remove";
36072
+ p.log.info("Please run the following command to remove it:");
36073
+ p.log.info(colors.cyan(` ${pm} ${removeCmd} expo-updates`));
36074
+ process.exit(1);
36075
+ }
36076
+ }
36077
+
36020
36078
  //#endregion
36021
36079
  //#region ../../node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
36022
36080
  function isPlainObject(value) {
@@ -37975,6 +38033,9 @@ dbCommand.command("generate").description("Generate SQL migration file (does not
37975
38033
  if (process.env["NODE_ENV"] === "development") program.command("build:native").description("build a new native artifact and deploy").addOption(new Option("-p, --platform <platform>", "specify the platform").choices(["ios", "android"])).addOption(new Option("-o, --output-path <outputPath>", "the path where the artifacts will be generated")).addOption(interactiveCommandOption).addOption(new Option("-m, --message <message>", "Specify a custom message for this deployment. If not provided, the latest git commit message will be used as the deployment message")).action(async (options) => {
37976
38034
  await nativeBuild(options);
37977
38035
  });
38036
+ program.hook("preAction", () => {
38037
+ ensureNoConflicts();
38038
+ });
37978
38039
  program.parse(process.argv);
37979
38040
 
37980
38041
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hot-updater",
3
3
  "type": "module",
4
- "version": "0.25.2",
4
+ "version": "0.25.3",
5
5
  "bin": {
6
6
  "hot-updater": "./dist/index.js"
7
7
  },
@@ -55,11 +55,11 @@
55
55
  "kysely": "0.28.8",
56
56
  "sql-formatter": "15.6.10",
57
57
  "cosmiconfig-typescript-loader": "5.0.0",
58
- "@hot-updater/cli-tools": "0.25.2",
59
- "@hot-updater/console": "0.25.2",
60
- "@hot-updater/core": "0.25.2",
61
- "@hot-updater/plugin-core": "0.25.2",
62
- "@hot-updater/server": "0.25.2"
58
+ "@hot-updater/cli-tools": "0.25.3",
59
+ "@hot-updater/console": "0.25.3",
60
+ "@hot-updater/core": "0.25.3",
61
+ "@hot-updater/plugin-core": "0.25.3",
62
+ "@hot-updater/server": "0.25.3"
63
63
  },
64
64
  "devDependencies": {
65
65
  "semver": "^7.6.3",
@@ -89,12 +89,12 @@
89
89
  "plist": "^3.1.0",
90
90
  "read-package-up": "^11.0.0",
91
91
  "uuidv7": "^1.0.2",
92
- "@hot-updater/aws": "0.25.2",
93
- "@hot-updater/server": "0.25.2",
94
- "@hot-updater/cloudflare": "0.25.2",
95
- "@hot-updater/firebase": "0.25.2",
96
- "@hot-updater/test-utils": "0.25.2",
97
- "@hot-updater/supabase": "0.25.2"
92
+ "@hot-updater/aws": "0.25.3",
93
+ "@hot-updater/server": "0.25.3",
94
+ "@hot-updater/cloudflare": "0.25.3",
95
+ "@hot-updater/firebase": "0.25.3",
96
+ "@hot-updater/supabase": "0.25.3",
97
+ "@hot-updater/test-utils": "0.25.3"
98
98
  },
99
99
  "peerDependencies": {
100
100
  "@hot-updater/aws": "*",