@hot-updater/cli-tools 1.0.0-rc.39 → 1.0.0-rc.41

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/dist/index.d.mts CHANGED
@@ -60,14 +60,16 @@ interface AppSetup {
60
60
  */
61
61
  declare const renderAppImports: (clientPlugins: readonly AppClientPlugin[]) => string[];
62
62
  /**
63
- * The App.tsx code init prints: `HotUpdater.init` with the server's URL,
64
- * the header that carries the client credential when the server takes one,
65
- * and the client plugins the server's plugins ask for.
63
+ * The app code init prints: `src/hotUpdater.ts`, which exports the instance
64
+ * `HotUpdater.init` returns with the server's URL, the header that carries
65
+ * the client credential when the server takes one, and the client plugins
66
+ * the server's plugins ask for; and `App.tsx`, which wraps the app's root
67
+ * with the instance's `wrap`.
66
68
  */
67
69
  declare const renderAppSetup: ({ baseURL, credential, clientPlugins }: AppSetup & {
68
70
  readonly baseURL: string;
69
71
  }) => string;
70
- /** Prints the App.tsx code, when the URL is known, and the app's credential. */
72
+ /** Prints the app code, when the URL is known, and the app's credential. */
71
73
  declare const printAppSetup: ({ baseURL, ...setup }: AppSetup & {
72
74
  readonly baseURL?: string;
73
75
  /** Required, so each init passes its server plugins' client plugins. */
package/dist/index.mjs CHANGED
@@ -22925,19 +22925,17 @@ const renderAppImports = (clientPlugins) => {
22925
22925
  return [...namesByModule].map(([module, names]) => `import { ${names.join(", ")} } from ${JSON.stringify(module)};`);
22926
22926
  };
22927
22927
  /**
22928
- * The App.tsx code init prints: `HotUpdater.init` with the server's URL,
22929
- * the header that carries the client credential when the server takes one,
22930
- * and the client plugins the server's plugins ask for.
22928
+ * The app code init prints: `src/hotUpdater.ts`, which exports the instance
22929
+ * `HotUpdater.init` returns with the server's URL, the header that carries
22930
+ * the client credential when the server takes one, and the client plugins
22931
+ * the server's plugins ask for; and `App.tsx`, which wraps the app's root
22932
+ * with the instance's `wrap`.
22931
22933
  */
22932
22934
  const renderAppSetup = ({ baseURL, credential, clientPlugins = [] }) => [
22933
- "// Add this to your App.tsx",
22935
+ "// src/hotUpdater.ts",
22934
22936
  ...renderAppImports(clientPlugins),
22935
22937
  "",
22936
- "function App() {",
22937
- " return null; // Replace with your app root.",
22938
- "}",
22939
- "",
22940
- "HotUpdater.init({",
22938
+ "export const hotUpdater = HotUpdater.init({",
22941
22939
  ` baseURL: ${JSON.stringify(baseURL)},`,
22942
22940
  ...credential === void 0 ? [] : [
22943
22941
  " requestHeaders: {",
@@ -22947,11 +22945,18 @@ const renderAppSetup = ({ baseURL, credential, clientPlugins = [] }) => [
22947
22945
  ...clientPlugins.length === 0 ? [] : [` plugins: [${clientPlugins.map(({ name }) => `${name}()`).join(", ")}],`],
22948
22946
  "});",
22949
22947
  "",
22950
- "// Call HotUpdater.checkForUpdate({ updateStrategy: \"appVersion\" })",
22951
- "// when your app is ready to check.",
22952
- "export default App;"
22948
+ "// App.tsx",
22949
+ "import { hotUpdater } from \"./src/hotUpdater\";",
22950
+ "",
22951
+ "function App() {",
22952
+ " return null; // Replace with your app root.",
22953
+ "}",
22954
+ "",
22955
+ "// Checks for an update when App mounts. For your own flow, call",
22956
+ "// hotUpdater.checkForUpdate() instead.",
22957
+ "export default hotUpdater.wrap({ updateStrategy: \"appVersion\" })(App);"
22953
22958
  ].join("\n");
22954
- /** Prints the App.tsx code, when the URL is known, and the app's credential. */
22959
+ /** Prints the app code, when the URL is known, and the app's credential. */
22955
22960
  const printAppSetup = ({ baseURL, ...setup }) => {
22956
22961
  if (baseURL !== void 0) p.note(renderAppSetup({
22957
22962
  baseURL,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/cli-tools",
3
- "version": "1.0.0-rc.39",
3
+ "version": "1.0.0-rc.41",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20.19.0"
@@ -49,9 +49,9 @@
49
49
  "oxc-parser": "0.141.0",
50
50
  "oxc-transform": "0.141.0",
51
51
  "unconfig": "7.5.0",
52
- "@hot-updater/protocol": "1.0.0-rc.39",
53
- "@hot-updater/plugin-core": "1.0.0-rc.39",
54
- "@hot-updater/server": "1.0.0-rc.39"
52
+ "@hot-updater/protocol": "1.0.0-rc.41",
53
+ "@hot-updater/plugin-core": "1.0.0-rc.41",
54
+ "@hot-updater/server": "1.0.0-rc.41"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@clack/prompts": "1.7.0",
@@ -65,7 +65,7 @@
65
65
  "tar": "^7.5.16",
66
66
  "verkit": "0.4.0",
67
67
  "workspace-tools": "^0.41.7",
68
- "@hot-updater/test-utils": "1.0.0-rc.39"
68
+ "@hot-updater/test-utils": "1.0.0-rc.41"
69
69
  },
70
70
  "inlinedDependencies": {
71
71
  "@babel/code-frame": "7.29.0",