cfpilot 0.30.2 → 0.33.6

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/cli.js CHANGED
@@ -87,7 +87,7 @@ var VERSION, NAME;
87
87
  var init_version = __esm({
88
88
  "src/shared/version.ts"() {
89
89
  "use strict";
90
- VERSION = "0.30.2";
90
+ VERSION = "0.33.6";
91
91
  NAME = "cfpilot";
92
92
  }
93
93
  });
@@ -2157,6 +2157,7 @@ var pages_deploy_exports = {};
2157
2157
  __export(pages_deploy_exports, {
2158
2158
  MANIFEST_KEY: () => MANIFEST_KEY,
2159
2159
  assertKvOwnership: () => assertKvOwnership,
2160
+ deployOnce: () => deployOnce,
2160
2161
  deployPagesSplit: () => deployPagesSplit,
2161
2162
  detachAllPagesDomains: () => detachAllPagesDomains,
2162
2163
  inspectKvOwnership: () => inspectKvOwnership,
@@ -2740,7 +2741,7 @@ async function deployPagesSplit(options) {
2740
2741
  await configureProject(client, options.accountId, dataName, "\u6570\u636E\u9762", result, options, log, warnings, effective);
2741
2742
  }
2742
2743
  }
2743
- const dataAttempt = await deployWithBlockRetry({
2744
+ const dataAttempt = await deployOnce({
2744
2745
  client,
2745
2746
  accountId: options.accountId,
2746
2747
  preferredName: dataName,
@@ -2755,7 +2756,11 @@ async function deployPagesSplit(options) {
2755
2756
  oldProject: previousDataProject,
2756
2757
  customDomain: dataCustomDomain
2757
2758
  });
2758
- if (dataAttempt) {
2759
+ if (!dataAttempt) {
2760
+ warnings.push("\u6570\u636E\u9762\u90E8\u7F72\u5931\u8D25\uFF0C\u5DF2\u4E2D\u6B62\u672C\u6B21\u90E8\u7F72\uFF08\u63A7\u5236\u9762\u4E0D\u518D\u90E8\u7F72\uFF09\u3002");
2761
+ return result;
2762
+ }
2763
+ {
2759
2764
  result.data.name = dataAttempt.project ?? options.dataProject;
2760
2765
  result.data.subdomain = dataAttempt.subdomain;
2761
2766
  if (modeSwitched && prevDataMode === "workers" && oldDataName) {
@@ -2799,7 +2804,7 @@ async function deployPagesSplit(options) {
2799
2804
  warnings.push(`\u540C\u6B65\u63A7\u5236\u9762 DATA_HOST \u5931\u8D25\uFF1A${err instanceof Error ? err.message : String(err)}`);
2800
2805
  }
2801
2806
  }
2802
- const controlAttempt = await deployWithBlockRetry({
2807
+ const controlAttempt = await deployOnce({
2803
2808
  client,
2804
2809
  accountId: options.accountId,
2805
2810
  preferredName: controlName,
@@ -2847,13 +2852,6 @@ async function deployPagesSplit(options) {
2847
2852
  }
2848
2853
  return result;
2849
2854
  }
2850
- function randomSuffix(length) {
2851
- const alphabet = "abcdefghijklmnopqrstuvwxyz0123456789";
2852
- const bytes = randomBytes2(length);
2853
- let out2 = "";
2854
- for (const byte of bytes) out2 += alphabet[byte % alphabet.length];
2855
- return out2;
2856
- }
2857
2855
  async function configureProject(client, accountId, project, label, result, options, log, warnings, effective) {
2858
2856
  const kvBindings = {
2859
2857
  KV: { namespace_id: options.kvNamespaceId },
@@ -2888,7 +2886,7 @@ async function configureProject(client, accountId, project, label, result, optio
2888
2886
  );
2889
2887
  }
2890
2888
  }
2891
- async function deployWithBlockRetry(params) {
2889
+ async function deployOnce(params) {
2892
2890
  const { client, accountId, preferredName, code, label, result, options, effective, wait, log, warnings } = params;
2893
2891
  if (!code) {
2894
2892
  warnings.push(`${label}\u4EA7\u7269\u4E3A\u7A7A\uFF0C\u8DF3\u8FC7\u90E8\u7F72`);
@@ -2923,11 +2921,9 @@ async function deployWithBlockRetry(params) {
2923
2921
  warnings.push(`\u5220\u9664\u65E7${label}\u9879\u76EE\u5931\u8D25\uFF08${oldName}\uFF09\uFF1A${err instanceof Error ? err.message : String(err)}`);
2924
2922
  }
2925
2923
  };
2926
- const candidates = [preferredName];
2927
- for (let i = 0; i < 2; i++) candidates.push(`${preferredName}-${randomSuffix(4)}`);
2928
- const SAME_PROJECT_ATTEMPTS = 3;
2929
- for (const [index, name] of candidates.entries()) {
2930
- for (let attempt = 1; attempt <= SAME_PROJECT_ATTEMPTS; attempt++) {
2924
+ const name = preferredName;
2925
+ {
2926
+ {
2931
2927
  try {
2932
2928
  const deployment = await client.deployPagesWorker(accountId, name, { code });
2933
2929
  slot.name = name;
@@ -2949,27 +2945,11 @@ async function deployWithBlockRetry(params) {
2949
2945
  } catch (err) {
2950
2946
  const message = err instanceof Error ? err.message : String(err);
2951
2947
  const blocked = /8000119|has been blocked/i.test(message);
2952
- const isLastAttempt = attempt === SAME_PROJECT_ATTEMPTS;
2953
- if (isLastAttempt && index < candidates.length - 1) {
2954
- log(`\u26A0 ${label}\u9879\u76EE ${name} \u8FDE\u7EED ${SAME_PROJECT_ATTEMPTS} \u6B21\u88AB\u5E73\u53F0\u62D2\u7EDD\u90E8\u7F72\uFF088000119\uFF09`);
2955
- log(` \u2192 \u6539\u7528\u54C1\u540D ${candidates[index + 1]} \u91CD\u65B0\u90E8\u7F72`);
2956
- try {
2957
- await client.createPagesProject(accountId, { name: candidates[index + 1], productionBranch: "main" });
2958
- await configureProject(client, accountId, candidates[index + 1], label, result, options, log, warnings, effective);
2959
- log(` \u2192 \u5DF2\u521B\u5EFA\u5E76\u914D\u7F6E ${candidates[index + 1]}`);
2960
- } catch (setupErr) {
2961
- warnings.push(`\u521B\u5EFA\u5907\u7528${label}\u9879\u76EE\u5931\u8D25\uFF1A${setupErr instanceof Error ? setupErr.message : String(setupErr)}`);
2962
- return null;
2963
- }
2964
- break;
2965
- }
2966
- if (!isLastAttempt) {
2967
- log(`\u26A0 ${label}\u9879\u76EE ${name} \u90E8\u7F72\u88AB\u62D2\uFF088000119\uFF09\uFF0C${SAME_PROJECT_ATTEMPTS - attempt} \u6B21\u540E\u91CD\u8BD5\u540C\u4E00\u9879\u76EE`);
2968
- log(" \u2192 \u8BE5\u5224\u5B9A\u662F\u95F4\u6B47\u6027\u7684\uFF0C\u540C\u540D\u91CD\u8BD5\u901A\u5E38\u5C31\u80FD\u6210\u529F");
2969
- continue;
2970
- }
2971
2948
  warnings.push(
2972
- `${label}\u90E8\u7F72\u5931\u8D25\uFF1A${message}` + (blocked ? "\uFF08\u5E73\u53F0\u5DF2\u62D2\u7EDD\u8BE5\u9879\u76EE\uFF1B\u5DF2\u91CD\u8BD5\u5E76\u5C1D\u8BD5\u66F4\u6362\u9879\u76EE\u540D\uFF0C\u53EF\u5728 Cloudflare \u63A7\u5236\u53F0\u67E5\u770B\u8BE6\u60C5\uFF09" : "")
2949
+ `${label}\u90E8\u7F72\u5931\u8D25\uFF1A${message}` + (blocked ? "\uFF08\u5E73\u53F0\u5DF2\u62D2\u7EDD\u8FD9\u6B21\u90E8\u7F72\uFF09" : "") + `
2950
+ \u2192 \u5DF2\u505C\u6B62\uFF0C\u4E0D\u518D\u91CD\u8BD5\uFF0C\u4E5F\u4E0D\u518D\u6362\u9879\u76EE\u540D\u91CD\u5EFA\u3002
2951
+ \u2192 \u8FDE\u7EED\u91CD\u8BD5\u4F1A\u7D2F\u79EF\u8D26\u53F7\u7684\u98CE\u63A7\u753B\u50CF\uFF0C\u53EF\u80FD\u5BFC\u81F4\u8D26\u53F7\u88AB\u5C01\u3002
2952
+ \u2192 \u8BF7\u5230 Cloudflare \u63A7\u5236\u53F0\u67E5\u770B\u8BE5\u9879\u76EE\u72B6\u6001\uFF1B\u82E5\u662F\u98CE\u63A7\u62E6\u622A\uFF0C\u7B49\u4E00\u6BB5\u65F6\u95F4\u540E\u624B\u52A8\u518D\u8BD5\u3002`
2973
2953
  );
2974
2954
  return null;
2975
2955
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cfpilot",
3
- "version": "0.30.2",
3
+ "version": "0.33.6",
4
4
  "description": "CFPilot —— Cloudflare Pages 代理部署与优选工具(交互菜单 + 子命令)",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-only",