@hot-updater/cloudflare 0.35.7 → 0.35.9

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.cjs CHANGED
@@ -6958,13 +6958,14 @@ createExeca(mapScriptAsync, {}, deepScriptOptions, setScriptSync);
6958
6958
  const { sendMessage, getOneMessage, getEachMessage, getCancelSignal } = getIpcExport();
6959
6959
  //#endregion
6960
6960
  //#region src/utils/createWrangler.ts
6961
- const createWrangler = ({ stdio, accountId, cloudflareApiToken, cwd }) => {
6961
+ const createWrangler = ({ stdio, accountId, cloudflareApiToken, cwd, nonInteractive }) => {
6962
6962
  const $ = execa({
6963
6963
  stdio,
6964
6964
  extendsEnv: true,
6965
- shell: stdio === "inherit",
6965
+ shell: false,
6966
6966
  cwd,
6967
6967
  env: {
6968
+ ...nonInteractive ? { CI: "true" } : {},
6968
6969
  CLOUDFLARE_ACCOUNT_ID: accountId,
6969
6970
  CLOUDFLARE_API_TOKEN: cloudflareApiToken
6970
6971
  }
package/dist/index.mjs CHANGED
@@ -6953,13 +6953,14 @@ createExeca(mapScriptAsync, {}, deepScriptOptions, setScriptSync);
6953
6953
  const { sendMessage, getOneMessage, getEachMessage, getCancelSignal } = getIpcExport();
6954
6954
  //#endregion
6955
6955
  //#region src/utils/createWrangler.ts
6956
- const createWrangler = ({ stdio, accountId, cloudflareApiToken, cwd }) => {
6956
+ const createWrangler = ({ stdio, accountId, cloudflareApiToken, cwd, nonInteractive }) => {
6957
6957
  const $ = execa({
6958
6958
  stdio,
6959
6959
  extendsEnv: true,
6960
- shell: stdio === "inherit",
6960
+ shell: false,
6961
6961
  cwd,
6962
6962
  env: {
6963
+ ...nonInteractive ? { CI: "true" } : {},
6963
6964
  CLOUDFLARE_ACCOUNT_ID: accountId,
6964
6965
  CLOUDFLARE_API_TOKEN: cloudflareApiToken
6965
6966
  }
@@ -0,0 +1,87 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region iac/init/index.ts
3
+ const initProvider = {
4
+ label: "Cloudflare D1 + R2 + Worker",
5
+ inputs: {
6
+ accountId: {
7
+ envKey: "HOT_UPDATER_CLOUDFLARE_ACCOUNT_ID",
8
+ help: "Cloudflare account ID",
9
+ prompt: {
10
+ message: "Account List",
11
+ type: "select"
12
+ }
13
+ },
14
+ apiToken: {
15
+ envKey: "HOT_UPDATER_CLOUDFLARE_API_TOKEN",
16
+ help: "API token with D1 edit permission",
17
+ persistence: "with-consent",
18
+ prompt: {
19
+ message: "Enter the Cloudflare D1 API Token",
20
+ type: "password"
21
+ }
22
+ },
23
+ bucketName: {
24
+ envKey: "HOT_UPDATER_CLOUDFLARE_R2_BUCKET_NAME",
25
+ help: "R2 bucket name",
26
+ prompt: {
27
+ defaultValue: "hot-updater-storage",
28
+ message: "Enter the name of the new R2 Bucket",
29
+ placeholder: "hot-updater-storage",
30
+ type: "text"
31
+ }
32
+ },
33
+ accessKeyId: {
34
+ envKey: "HOT_UPDATER_CLOUDFLARE_R2_ACCESS_KEY_ID",
35
+ help: "R2 access key ID",
36
+ persistence: "with-consent",
37
+ prompt: {
38
+ message: "Enter the R2 Access Key ID",
39
+ type: "password"
40
+ }
41
+ },
42
+ secretAccessKey: {
43
+ envKey: "HOT_UPDATER_CLOUDFLARE_R2_SECRET_ACCESS_KEY",
44
+ help: "R2 secret access key",
45
+ persistence: "with-consent",
46
+ prompt: {
47
+ message: "Enter the R2 Secret Access Key",
48
+ type: "password"
49
+ }
50
+ },
51
+ workerName: {
52
+ envKey: "HOT_UPDATER_CLOUDFLARE_WORKER_NAME",
53
+ help: "Worker name",
54
+ prompt: {
55
+ defaultValue: "hot-updater",
56
+ message: "Enter the name of the worker",
57
+ placeholder: "hot-updater",
58
+ type: "text"
59
+ }
60
+ },
61
+ d1DatabaseId: {
62
+ envKey: "HOT_UPDATER_CLOUDFLARE_D1_DATABASE_ID",
63
+ help: "D1 database ID"
64
+ },
65
+ d1DatabaseName: {
66
+ envKey: "HOT_UPDATER_CLOUDFLARE_D1_DATABASE_NAME",
67
+ help: "D1 database name",
68
+ prompt: {
69
+ defaultValue: "hot-updater",
70
+ message: "Enter the name of the new D1 Database",
71
+ placeholder: "hot-updater",
72
+ type: "text"
73
+ }
74
+ },
75
+ r2Private: {
76
+ envKey: "HOT_UPDATER_CLOUDFLARE_R2_PRIVATE",
77
+ help: "Whether the R2 bucket is private (true or false)",
78
+ prompt: {
79
+ message: "Make R2 bucket private?",
80
+ type: "confirm"
81
+ },
82
+ validate: (value) => value === "true" || value === "false"
83
+ }
84
+ }
85
+ };
86
+ //#endregion
87
+ exports.initProvider = initProvider;
@@ -0,0 +1,86 @@
1
+ //#region iac/init/index.d.ts
2
+ declare const initProvider: {
3
+ readonly label: "Cloudflare D1 + R2 + Worker";
4
+ readonly inputs: {
5
+ readonly accountId: {
6
+ readonly envKey: "HOT_UPDATER_CLOUDFLARE_ACCOUNT_ID";
7
+ readonly help: "Cloudflare account ID";
8
+ readonly prompt: {
9
+ readonly message: "Account List";
10
+ readonly type: "select";
11
+ };
12
+ };
13
+ readonly apiToken: {
14
+ readonly envKey: "HOT_UPDATER_CLOUDFLARE_API_TOKEN";
15
+ readonly help: "API token with D1 edit permission";
16
+ readonly persistence: "with-consent";
17
+ readonly prompt: {
18
+ readonly message: "Enter the Cloudflare D1 API Token";
19
+ readonly type: "password";
20
+ };
21
+ };
22
+ readonly bucketName: {
23
+ readonly envKey: "HOT_UPDATER_CLOUDFLARE_R2_BUCKET_NAME";
24
+ readonly help: "R2 bucket name";
25
+ readonly prompt: {
26
+ readonly defaultValue: "hot-updater-storage";
27
+ readonly message: "Enter the name of the new R2 Bucket";
28
+ readonly placeholder: "hot-updater-storage";
29
+ readonly type: "text";
30
+ };
31
+ };
32
+ readonly accessKeyId: {
33
+ readonly envKey: "HOT_UPDATER_CLOUDFLARE_R2_ACCESS_KEY_ID";
34
+ readonly help: "R2 access key ID";
35
+ readonly persistence: "with-consent";
36
+ readonly prompt: {
37
+ readonly message: "Enter the R2 Access Key ID";
38
+ readonly type: "password";
39
+ };
40
+ };
41
+ readonly secretAccessKey: {
42
+ readonly envKey: "HOT_UPDATER_CLOUDFLARE_R2_SECRET_ACCESS_KEY";
43
+ readonly help: "R2 secret access key";
44
+ readonly persistence: "with-consent";
45
+ readonly prompt: {
46
+ readonly message: "Enter the R2 Secret Access Key";
47
+ readonly type: "password";
48
+ };
49
+ };
50
+ readonly workerName: {
51
+ readonly envKey: "HOT_UPDATER_CLOUDFLARE_WORKER_NAME";
52
+ readonly help: "Worker name";
53
+ readonly prompt: {
54
+ readonly defaultValue: "hot-updater";
55
+ readonly message: "Enter the name of the worker";
56
+ readonly placeholder: "hot-updater";
57
+ readonly type: "text";
58
+ };
59
+ };
60
+ readonly d1DatabaseId: {
61
+ readonly envKey: "HOT_UPDATER_CLOUDFLARE_D1_DATABASE_ID";
62
+ readonly help: "D1 database ID";
63
+ };
64
+ readonly d1DatabaseName: {
65
+ readonly envKey: "HOT_UPDATER_CLOUDFLARE_D1_DATABASE_NAME";
66
+ readonly help: "D1 database name";
67
+ readonly prompt: {
68
+ readonly defaultValue: "hot-updater";
69
+ readonly message: "Enter the name of the new D1 Database";
70
+ readonly placeholder: "hot-updater";
71
+ readonly type: "text";
72
+ };
73
+ };
74
+ readonly r2Private: {
75
+ readonly envKey: "HOT_UPDATER_CLOUDFLARE_R2_PRIVATE";
76
+ readonly help: "Whether the R2 bucket is private (true or false)";
77
+ readonly prompt: {
78
+ readonly message: "Make R2 bucket private?";
79
+ readonly type: "confirm";
80
+ };
81
+ readonly validate: (value: string | undefined) => value is "true" | "false";
82
+ };
83
+ };
84
+ };
85
+ //#endregion
86
+ export { initProvider };
@@ -0,0 +1,86 @@
1
+ //#region iac/init/index.d.ts
2
+ declare const initProvider: {
3
+ readonly label: "Cloudflare D1 + R2 + Worker";
4
+ readonly inputs: {
5
+ readonly accountId: {
6
+ readonly envKey: "HOT_UPDATER_CLOUDFLARE_ACCOUNT_ID";
7
+ readonly help: "Cloudflare account ID";
8
+ readonly prompt: {
9
+ readonly message: "Account List";
10
+ readonly type: "select";
11
+ };
12
+ };
13
+ readonly apiToken: {
14
+ readonly envKey: "HOT_UPDATER_CLOUDFLARE_API_TOKEN";
15
+ readonly help: "API token with D1 edit permission";
16
+ readonly persistence: "with-consent";
17
+ readonly prompt: {
18
+ readonly message: "Enter the Cloudflare D1 API Token";
19
+ readonly type: "password";
20
+ };
21
+ };
22
+ readonly bucketName: {
23
+ readonly envKey: "HOT_UPDATER_CLOUDFLARE_R2_BUCKET_NAME";
24
+ readonly help: "R2 bucket name";
25
+ readonly prompt: {
26
+ readonly defaultValue: "hot-updater-storage";
27
+ readonly message: "Enter the name of the new R2 Bucket";
28
+ readonly placeholder: "hot-updater-storage";
29
+ readonly type: "text";
30
+ };
31
+ };
32
+ readonly accessKeyId: {
33
+ readonly envKey: "HOT_UPDATER_CLOUDFLARE_R2_ACCESS_KEY_ID";
34
+ readonly help: "R2 access key ID";
35
+ readonly persistence: "with-consent";
36
+ readonly prompt: {
37
+ readonly message: "Enter the R2 Access Key ID";
38
+ readonly type: "password";
39
+ };
40
+ };
41
+ readonly secretAccessKey: {
42
+ readonly envKey: "HOT_UPDATER_CLOUDFLARE_R2_SECRET_ACCESS_KEY";
43
+ readonly help: "R2 secret access key";
44
+ readonly persistence: "with-consent";
45
+ readonly prompt: {
46
+ readonly message: "Enter the R2 Secret Access Key";
47
+ readonly type: "password";
48
+ };
49
+ };
50
+ readonly workerName: {
51
+ readonly envKey: "HOT_UPDATER_CLOUDFLARE_WORKER_NAME";
52
+ readonly help: "Worker name";
53
+ readonly prompt: {
54
+ readonly defaultValue: "hot-updater";
55
+ readonly message: "Enter the name of the worker";
56
+ readonly placeholder: "hot-updater";
57
+ readonly type: "text";
58
+ };
59
+ };
60
+ readonly d1DatabaseId: {
61
+ readonly envKey: "HOT_UPDATER_CLOUDFLARE_D1_DATABASE_ID";
62
+ readonly help: "D1 database ID";
63
+ };
64
+ readonly d1DatabaseName: {
65
+ readonly envKey: "HOT_UPDATER_CLOUDFLARE_D1_DATABASE_NAME";
66
+ readonly help: "D1 database name";
67
+ readonly prompt: {
68
+ readonly defaultValue: "hot-updater";
69
+ readonly message: "Enter the name of the new D1 Database";
70
+ readonly placeholder: "hot-updater";
71
+ readonly type: "text";
72
+ };
73
+ };
74
+ readonly r2Private: {
75
+ readonly envKey: "HOT_UPDATER_CLOUDFLARE_R2_PRIVATE";
76
+ readonly help: "Whether the R2 bucket is private (true or false)";
77
+ readonly prompt: {
78
+ readonly message: "Make R2 bucket private?";
79
+ readonly type: "confirm";
80
+ };
81
+ readonly validate: (value: string | undefined) => value is "true" | "false";
82
+ };
83
+ };
84
+ };
85
+ //#endregion
86
+ export { initProvider };
@@ -0,0 +1,86 @@
1
+ //#region iac/init/index.ts
2
+ const initProvider = {
3
+ label: "Cloudflare D1 + R2 + Worker",
4
+ inputs: {
5
+ accountId: {
6
+ envKey: "HOT_UPDATER_CLOUDFLARE_ACCOUNT_ID",
7
+ help: "Cloudflare account ID",
8
+ prompt: {
9
+ message: "Account List",
10
+ type: "select"
11
+ }
12
+ },
13
+ apiToken: {
14
+ envKey: "HOT_UPDATER_CLOUDFLARE_API_TOKEN",
15
+ help: "API token with D1 edit permission",
16
+ persistence: "with-consent",
17
+ prompt: {
18
+ message: "Enter the Cloudflare D1 API Token",
19
+ type: "password"
20
+ }
21
+ },
22
+ bucketName: {
23
+ envKey: "HOT_UPDATER_CLOUDFLARE_R2_BUCKET_NAME",
24
+ help: "R2 bucket name",
25
+ prompt: {
26
+ defaultValue: "hot-updater-storage",
27
+ message: "Enter the name of the new R2 Bucket",
28
+ placeholder: "hot-updater-storage",
29
+ type: "text"
30
+ }
31
+ },
32
+ accessKeyId: {
33
+ envKey: "HOT_UPDATER_CLOUDFLARE_R2_ACCESS_KEY_ID",
34
+ help: "R2 access key ID",
35
+ persistence: "with-consent",
36
+ prompt: {
37
+ message: "Enter the R2 Access Key ID",
38
+ type: "password"
39
+ }
40
+ },
41
+ secretAccessKey: {
42
+ envKey: "HOT_UPDATER_CLOUDFLARE_R2_SECRET_ACCESS_KEY",
43
+ help: "R2 secret access key",
44
+ persistence: "with-consent",
45
+ prompt: {
46
+ message: "Enter the R2 Secret Access Key",
47
+ type: "password"
48
+ }
49
+ },
50
+ workerName: {
51
+ envKey: "HOT_UPDATER_CLOUDFLARE_WORKER_NAME",
52
+ help: "Worker name",
53
+ prompt: {
54
+ defaultValue: "hot-updater",
55
+ message: "Enter the name of the worker",
56
+ placeholder: "hot-updater",
57
+ type: "text"
58
+ }
59
+ },
60
+ d1DatabaseId: {
61
+ envKey: "HOT_UPDATER_CLOUDFLARE_D1_DATABASE_ID",
62
+ help: "D1 database ID"
63
+ },
64
+ d1DatabaseName: {
65
+ envKey: "HOT_UPDATER_CLOUDFLARE_D1_DATABASE_NAME",
66
+ help: "D1 database name",
67
+ prompt: {
68
+ defaultValue: "hot-updater",
69
+ message: "Enter the name of the new D1 Database",
70
+ placeholder: "hot-updater",
71
+ type: "text"
72
+ }
73
+ },
74
+ r2Private: {
75
+ envKey: "HOT_UPDATER_CLOUDFLARE_R2_PRIVATE",
76
+ help: "Whether the R2 bucket is private (true or false)",
77
+ prompt: {
78
+ message: "Make R2 bucket private?",
79
+ type: "confirm"
80
+ },
81
+ validate: (value) => value === "true" || value === "false"
82
+ }
83
+ }
84
+ };
85
+ //#endregion
86
+ export { initProvider };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/cloudflare",
3
3
  "type": "module",
4
- "version": "0.35.7",
4
+ "version": "0.35.9",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.mjs",
@@ -11,6 +11,11 @@
11
11
  "import": "./dist/index.mjs",
12
12
  "require": "./dist/index.cjs"
13
13
  },
14
+ "./init": {
15
+ "types": "./dist/init/index.d.cts",
16
+ "import": "./dist/init/index.mjs",
17
+ "require": "./dist/init/index.cjs"
18
+ },
14
19
  "./worker": {
15
20
  "types": "./dist/worker/index.d.cts",
16
21
  "import": "./dist/worker/index.mjs",
@@ -56,11 +61,11 @@
56
61
  "cloudflare": "4.2.0",
57
62
  "hono": "4.12.9",
58
63
  "uuidv7": "^1.0.2",
59
- "@hot-updater/cli-tools": "0.35.7",
60
- "@hot-updater/core": "0.35.7",
61
- "@hot-updater/js": "0.35.7",
62
- "@hot-updater/plugin-core": "0.35.7",
63
- "@hot-updater/server": "0.35.7"
64
+ "@hot-updater/cli-tools": "0.35.9",
65
+ "@hot-updater/core": "0.35.9",
66
+ "@hot-updater/js": "0.35.9",
67
+ "@hot-updater/server": "0.35.9",
68
+ "@hot-updater/plugin-core": "0.35.9"
64
69
  },
65
70
  "devDependencies": {
66
71
  "@cloudflare/vitest-pool-workers": "0.13.0",
@@ -73,11 +78,12 @@
73
78
  "pg-minify": "^1.6.5",
74
79
  "semver": "^7.6.3",
75
80
  "toml": "^3.0.0",
76
- "typescript": "^6.0.2",
81
+ "@typescript/native": "npm:typescript@^7.0.2",
82
+ "typescript": "npm:@typescript/typescript6@^6.0.2",
77
83
  "vitest": "4.1.4",
78
84
  "wrangler": "^4.5.0",
79
85
  "xdg-app-paths": "^8.3.0",
80
- "@hot-updater/test-utils": "0.35.7"
86
+ "@hot-updater/test-utils": "0.35.9"
81
87
  },
82
88
  "scripts": {
83
89
  "build": "tsdown && pnpm build:worker",
@@ -0,0 +1,75 @@
1
+ import { beforeEach, describe, expect, it, vi } from "vitest";
2
+
3
+ const mocks = vi.hoisted(() => ({
4
+ command: vi.fn(),
5
+ execa: vi.fn(),
6
+ }));
7
+
8
+ vi.mock("execa", () => ({
9
+ execa: mocks.execa,
10
+ }));
11
+
12
+ import { createWrangler } from "./createWrangler";
13
+
14
+ describe("createWrangler", () => {
15
+ beforeEach(() => {
16
+ vi.clearAllMocks();
17
+ mocks.execa.mockReturnValue(mocks.command);
18
+ mocks.command.mockResolvedValue({});
19
+ });
20
+
21
+ it("marks replay commands as CI so Wrangler skips nested prompts", async () => {
22
+ const wrangler = createWrangler({
23
+ accountId: "account-id",
24
+ cloudflareApiToken: "api-token",
25
+ cwd: "/tmp/cloudflare-init",
26
+ nonInteractive: true,
27
+ stdio: "inherit",
28
+ });
29
+
30
+ await wrangler("d1", "migrations", "apply", "hot-updater", "--remote");
31
+
32
+ expect(mocks.execa).toHaveBeenCalledWith({
33
+ cwd: "/tmp/cloudflare-init",
34
+ env: {
35
+ CI: "true",
36
+ CLOUDFLARE_ACCOUNT_ID: "account-id",
37
+ CLOUDFLARE_API_TOKEN: "api-token",
38
+ },
39
+ extendsEnv: true,
40
+ shell: false,
41
+ stdio: "inherit",
42
+ });
43
+ expect(mocks.command).toHaveBeenCalledWith("npx", [
44
+ "wrangler",
45
+ "d1",
46
+ "migrations",
47
+ "apply",
48
+ "hot-updater",
49
+ "--remote",
50
+ ]);
51
+ });
52
+
53
+ it("passes shell metacharacters as one argument", async () => {
54
+ const wrangler = createWrangler({
55
+ accountId: "account-id",
56
+ cloudflareApiToken: "api-token",
57
+ cwd: "/tmp/cloudflare-init",
58
+ stdio: "inherit",
59
+ });
60
+
61
+ await wrangler("deploy", "--name", "safe; printf INJECTED");
62
+
63
+ expect(mocks.execa).toHaveBeenCalledWith(
64
+ expect.objectContaining({
65
+ shell: false,
66
+ }),
67
+ );
68
+ expect(mocks.command).toHaveBeenCalledWith("npx", [
69
+ "wrangler",
70
+ "deploy",
71
+ "--name",
72
+ "safe; printf INJECTED",
73
+ ]);
74
+ });
75
+ });
@@ -3,21 +3,23 @@ import { execa } from "execa";
3
3
  export const createWrangler = ({
4
4
  stdio,
5
5
  accountId,
6
-
7
6
  cloudflareApiToken,
8
7
  cwd,
8
+ nonInteractive,
9
9
  }: {
10
10
  stdio?: "inherit" | "pipe" | "ignore" | "overlapped";
11
11
  accountId: string;
12
12
  cloudflareApiToken: string;
13
13
  cwd: string;
14
+ nonInteractive?: boolean;
14
15
  }) => {
15
16
  const $ = execa({
16
17
  stdio,
17
18
  extendsEnv: true,
18
- shell: stdio === "inherit",
19
+ shell: false,
19
20
  cwd,
20
21
  env: {
22
+ ...(nonInteractive ? { CI: "true" } : {}),
21
23
  CLOUDFLARE_ACCOUNT_ID: accountId,
22
24
  CLOUDFLARE_API_TOKEN: cloudflareApiToken,
23
25
  },
@@ -1 +1 @@
1
- This folder contains the built output assets for the worker "hot-updater" generated at 2026-07-25T16:46:45.127Z.
1
+ This folder contains the built output assets for the worker "hot-updater" generated at 2026-07-31T17:01:25.237Z.
@@ -3249,7 +3249,7 @@ init_performance2();
3249
3249
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
3250
3250
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
3251
3251
  init_performance2();
3252
- var version2 = "0.35.7";
3252
+ var version2 = "0.35.9";
3253
3253
 
3254
3254
  // ../../packages/server/dist/version.mjs
3255
3255
  var HOT_UPDATER_SERVER_VERSION = version2;