hot-updater 0.14.0 → 0.15.1

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.
@@ -1,10 +1,11 @@
1
1
  import { type Platform } from "@hot-updater/plugin-core";
2
2
  export interface DeployOptions {
3
- targetAppVersion?: string;
4
- platform?: Platform;
3
+ bundleOutputPath?: string;
4
+ channel: string;
5
5
  forceUpdate: boolean;
6
6
  interactive: boolean;
7
- channel: string;
8
7
  message?: string;
8
+ platform?: Platform;
9
+ targetAppVersion?: string;
9
10
  }
10
11
  export declare const deploy: (options: DeployOptions) => Promise<void>;
package/dist/index.cjs CHANGED
@@ -13798,6 +13798,7 @@ var __webpack_exports__ = {};
13798
13798
  if (!valid_default()(value)) return "Invalid semver format (e.g. 1.0.0, 1.x.x)";
13799
13799
  }
13800
13800
  }) : null);
13801
+ const outputPath = options.bundleOutputPath ?? cwd;
13801
13802
  if (prompts_namespaceObject.isCancel(targetAppVersion)) return;
13802
13803
  if (!targetAppVersion) {
13803
13804
  prompts_namespaceObject.log.error("Target app version not found. -t <targetAppVersion> semver format (e.g. 1.0.0, 1.x.x)");
@@ -13805,8 +13806,9 @@ var __webpack_exports__ = {};
13805
13806
  }
13806
13807
  prompts_namespaceObject.log.info(`Target app version: ${valid_default()(targetAppVersion)}`);
13807
13808
  let bundleId = null;
13808
- let bundlePath;
13809
13809
  let fileHash;
13810
+ const normalizeOutputPath = external_path_default().isAbsolute(outputPath) ? outputPath : external_path_default().join(cwd, outputPath);
13811
+ const bundlePath = external_path_default().join(normalizeOutputPath, "bundle.zip");
13810
13812
  const [buildPlugin, storagePlugin, databasePlugin] = await Promise.all([
13811
13813
  config.build({
13812
13814
  cwd
@@ -13831,7 +13833,9 @@ var __webpack_exports__ = {};
13831
13833
  platform: platform,
13832
13834
  channel
13833
13835
  });
13834
- bundlePath = external_path_default().join((0, plugin_core_namespaceObject.getCwd)(), "bundle.zip");
13836
+ await external_fs_default().promises.mkdir(normalizeOutputPath, {
13837
+ recursive: true
13838
+ });
13835
13839
  const buildPath = taskRef.buildResult?.buildPath;
13836
13840
  if (!buildPath) throw new Error("Build result not found");
13837
13841
  const files = await external_fs_default().promises.readdir(buildPath, {
@@ -13917,10 +13921,16 @@ var __webpack_exports__ = {};
13917
13921
  prompts_namespaceObject.outro("🚀 Deployment Successful");
13918
13922
  } catch (e) {
13919
13923
  await databasePlugin.onUnmount?.();
13924
+ await external_fs_default().promises.rm(bundlePath, {
13925
+ force: true
13926
+ });
13920
13927
  console.error(e);
13921
13928
  process.exit(1);
13922
13929
  } finally{
13923
13930
  await databasePlugin.onUnmount?.();
13931
+ await external_fs_default().promises.rm(bundlePath, {
13932
+ force: true
13933
+ });
13924
13934
  }
13925
13935
  };
13926
13936
  const getPackageManager = ()=>{
@@ -20119,7 +20129,7 @@ Instead, \`yield\` should either be called with a value, or not be called at all
20119
20129
  process.exit(1);
20120
20130
  }
20121
20131
  return value;
20122
- })).addOption(new external_commander_namespaceObject.Option("-f, --force-update", "force update the app").default(false)).addOption(new external_commander_namespaceObject.Option("-i, --interactive", "interactive mode").default(false)).addOption(new external_commander_namespaceObject.Option("-c, --channel <channel>", "specify the channel to deploy").default(DEFAULT_CHANNEL)).addOption(new external_commander_namespaceObject.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)=>{
20132
+ })).addOption(new external_commander_namespaceObject.Option("-f, --force-update", "force update the app").default(false)).addOption(new external_commander_namespaceObject.Option("-o, --bundle-output-path <bundleOutputPath>", "the path where the bundle.zip will be generated")).addOption(new external_commander_namespaceObject.Option("-i, --interactive", "interactive mode").default(false)).addOption(new external_commander_namespaceObject.Option("-c, --channel <channel>", "specify the channel to deploy").default(DEFAULT_CHANNEL)).addOption(new external_commander_namespaceObject.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)=>{
20123
20133
  deploy(options);
20124
20134
  });
20125
20135
  program.command("console").description("open the console").action(async ()=>{
package/dist/index.js CHANGED
@@ -13760,6 +13760,7 @@ const deploy = async (options)=>{
13760
13760
  if (!valid_default()(value)) return "Invalid semver format (e.g. 1.0.0, 1.x.x)";
13761
13761
  }
13762
13762
  }) : null);
13763
+ const outputPath = options.bundleOutputPath ?? cwd;
13763
13764
  if (__WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.isCancel(targetAppVersion)) return;
13764
13765
  if (!targetAppVersion) {
13765
13766
  __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.log.error("Target app version not found. -t <targetAppVersion> semver format (e.g. 1.0.0, 1.x.x)");
@@ -13767,8 +13768,9 @@ const deploy = async (options)=>{
13767
13768
  }
13768
13769
  __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.log.info(`Target app version: ${valid_default()(targetAppVersion)}`);
13769
13770
  let bundleId = null;
13770
- let bundlePath;
13771
13771
  let fileHash;
13772
+ const normalizeOutputPath = external_path_["default"].isAbsolute(outputPath) ? outputPath : external_path_["default"].join(cwd, outputPath);
13773
+ const bundlePath = external_path_["default"].join(normalizeOutputPath, "bundle.zip");
13772
13774
  const [buildPlugin, storagePlugin, databasePlugin] = await Promise.all([
13773
13775
  config.build({
13774
13776
  cwd
@@ -13793,7 +13795,9 @@ const deploy = async (options)=>{
13793
13795
  platform: platform,
13794
13796
  channel
13795
13797
  });
13796
- bundlePath = external_path_["default"].join((0, __WEBPACK_EXTERNAL_MODULE__hot_updater_plugin_core_40c1c502__.getCwd)(), "bundle.zip");
13798
+ await external_fs_["default"].promises.mkdir(normalizeOutputPath, {
13799
+ recursive: true
13800
+ });
13797
13801
  const buildPath = taskRef.buildResult?.buildPath;
13798
13802
  if (!buildPath) throw new Error("Build result not found");
13799
13803
  const files = await external_fs_["default"].promises.readdir(buildPath, {
@@ -13879,10 +13883,16 @@ const deploy = async (options)=>{
13879
13883
  __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.outro("🚀 Deployment Successful");
13880
13884
  } catch (e) {
13881
13885
  await databasePlugin.onUnmount?.();
13886
+ await external_fs_["default"].promises.rm(bundlePath, {
13887
+ force: true
13888
+ });
13882
13889
  console.error(e);
13883
13890
  process.exit(1);
13884
13891
  } finally{
13885
13892
  await databasePlugin.onUnmount?.();
13893
+ await external_fs_["default"].promises.rm(bundlePath, {
13894
+ force: true
13895
+ });
13886
13896
  }
13887
13897
  };
13888
13898
  const getPackageManager = ()=>{
@@ -20073,7 +20083,7 @@ program.command("deploy").description("deploy a new version").addOption(new __WE
20073
20083
  process.exit(1);
20074
20084
  }
20075
20085
  return value;
20076
- })).addOption(new __WEBPACK_EXTERNAL_MODULE_commander__.Option("-f, --force-update", "force update the app").default(false)).addOption(new __WEBPACK_EXTERNAL_MODULE_commander__.Option("-i, --interactive", "interactive mode").default(false)).addOption(new __WEBPACK_EXTERNAL_MODULE_commander__.Option("-c, --channel <channel>", "specify the channel to deploy").default(DEFAULT_CHANNEL)).addOption(new __WEBPACK_EXTERNAL_MODULE_commander__.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)=>{
20086
+ })).addOption(new __WEBPACK_EXTERNAL_MODULE_commander__.Option("-f, --force-update", "force update the app").default(false)).addOption(new __WEBPACK_EXTERNAL_MODULE_commander__.Option("-o, --bundle-output-path <bundleOutputPath>", "the path where the bundle.zip will be generated")).addOption(new __WEBPACK_EXTERNAL_MODULE_commander__.Option("-i, --interactive", "interactive mode").default(false)).addOption(new __WEBPACK_EXTERNAL_MODULE_commander__.Option("-c, --channel <channel>", "specify the channel to deploy").default(DEFAULT_CHANNEL)).addOption(new __WEBPACK_EXTERNAL_MODULE_commander__.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)=>{
20077
20087
  deploy(options);
20078
20088
  });
20079
20089
  program.command("console").description("open the console").action(async ()=>{
@@ -17167,6 +17167,8 @@ var __webpack_exports__ = {};
17167
17167
  return bundleId;
17168
17168
  };
17169
17169
  const getChannel = ()=>{
17170
+ const currentEnv = process.env["BABEL_ENV"] || process.env["NODE_ENV"];
17171
+ if ("development" === currentEnv) return null;
17170
17172
  const envChannel = process.env["HOT_UPDATER_CHANNEL"];
17171
17173
  if (envChannel) return envChannel;
17172
17174
  const { releaseChannel } = (0, plugin_core_namespaceObject.loadConfigSync)(null);
@@ -17188,7 +17190,7 @@ var __webpack_exports__ = {};
17188
17190
  name: "HotUpdater"
17189
17191
  }) && lib.isIdentifier(path.node.property, {
17190
17192
  name: "CHANNEL"
17191
- })) path.replaceWith(lib.stringLiteral(channel));
17193
+ })) path.replaceWith(channel ? lib.stringLiteral(channel) : lib.nullLiteral());
17192
17194
  }
17193
17195
  }
17194
17196
  };
@@ -1,3 +1,3 @@
1
1
  import type { PluginObj } from "@babel/core";
2
- export declare const getChannel: () => string;
2
+ export declare const getChannel: () => string | null;
3
3
  export default function replaceHotUpdaterBundleId(): PluginObj;
@@ -17062,6 +17062,8 @@ const getBundleId = ()=>{
17062
17062
  return bundleId;
17063
17063
  };
17064
17064
  const getChannel = ()=>{
17065
+ const currentEnv = process.env["BABEL_ENV"] || process.env["NODE_ENV"];
17066
+ if ("development" === currentEnv) return null;
17065
17067
  const envChannel = process.env["HOT_UPDATER_CHANNEL"];
17066
17068
  if (envChannel) return envChannel;
17067
17069
  const { releaseChannel } = (0, __WEBPACK_EXTERNAL_MODULE__hot_updater_plugin_core_40c1c502__.loadConfigSync)(null);
@@ -17083,7 +17085,7 @@ function replaceHotUpdaterBundleId() {
17083
17085
  name: "HotUpdater"
17084
17086
  }) && lib.isIdentifier(path.node.property, {
17085
17087
  name: "CHANNEL"
17086
- })) path.replaceWith(lib.stringLiteral(channel));
17088
+ })) path.replaceWith(channel ? lib.stringLiteral(channel) : lib.nullLiteral());
17087
17089
  }
17088
17090
  }
17089
17091
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hot-updater",
3
3
  "type": "module",
4
- "version": "0.14.0",
4
+ "version": "0.15.1",
5
5
  "bin": {
6
6
  "hot-updater": "./dist/index.js"
7
7
  },
@@ -49,13 +49,13 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@clack/prompts": "^0.10.0",
52
- "@hot-updater/console": "0.14.0",
53
- "@hot-updater/core": "0.14.0",
54
- "@hot-updater/plugin-core": "0.14.0",
52
+ "@hot-updater/console": "0.15.1",
53
+ "@hot-updater/core": "0.15.1",
54
+ "@hot-updater/plugin-core": "0.15.1",
55
55
  "commander": "^11.1.0",
56
56
  "cosmiconfig": "^9.0.0",
57
57
  "cosmiconfig-typescript-loader": "^5.0.0",
58
- "es-git": "^0.1.0"
58
+ "es-git": "^0.2.0"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@babel/core": "7.26.0",