create-cloudflare 2.70.8 → 2.70.10
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
|
@@ -73650,7 +73650,7 @@ __export(cli_exports, {
|
|
|
73650
73650
|
setupProjectDirectory: () => setupProjectDirectory
|
|
73651
73651
|
});
|
|
73652
73652
|
module.exports = __toCommonJS(cli_exports);
|
|
73653
|
-
var
|
|
73653
|
+
var import_node_fs23 = require("node:fs");
|
|
73654
73654
|
var import_node_path26 = require("node:path");
|
|
73655
73655
|
var import_node_process14 = require("node:process");
|
|
73656
73656
|
|
|
@@ -97210,7 +97210,7 @@ var Yargs = YargsFactory(esm_default2);
|
|
|
97210
97210
|
var yargs_default = Yargs;
|
|
97211
97211
|
|
|
97212
97212
|
// package.json
|
|
97213
|
-
var version = "2.70.
|
|
97213
|
+
var version = "2.70.10";
|
|
97214
97214
|
|
|
97215
97215
|
// src/metrics.ts
|
|
97216
97216
|
var import_node_async_hooks = require("node:async_hooks");
|
|
@@ -97708,7 +97708,7 @@ var runTelemetryCommand = (action) => {
|
|
|
97708
97708
|
};
|
|
97709
97709
|
|
|
97710
97710
|
// src/templates.ts
|
|
97711
|
-
var
|
|
97711
|
+
var import_node_fs20 = require("node:fs");
|
|
97712
97712
|
var import_promises7 = require("node:fs/promises");
|
|
97713
97713
|
var import_node_os7 = require("node:os");
|
|
97714
97714
|
var import_node_path21 = require("node:path");
|
|
@@ -97719,10 +97719,11 @@ var import_degit = __toESM(require_dist());
|
|
|
97719
97719
|
var import_haikunator = __toESM(require_dist_web());
|
|
97720
97720
|
|
|
97721
97721
|
// src/helpers/packages.ts
|
|
97722
|
-
var
|
|
97722
|
+
var import_node_fs10 = require("node:fs");
|
|
97723
97723
|
var import_node_path10 = __toESM(require("node:path"));
|
|
97724
97724
|
|
|
97725
97725
|
// ../cli/dist/packages.mjs
|
|
97726
|
+
var import_node_fs7 = require("node:fs");
|
|
97726
97727
|
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
97727
97728
|
var import_node_assert4 = __toESM(require("node:assert"), 1);
|
|
97728
97729
|
var import_promises3 = require("node:fs/promises");
|
|
@@ -97814,23 +97815,31 @@ function getWorkspaceInstallRootFlag(packageManager, isWorkspaceRoot) {
|
|
|
97814
97815
|
}
|
|
97815
97816
|
}
|
|
97816
97817
|
async function installWrangler(packageManager, isWorkspaceRoot) {
|
|
97817
|
-
|
|
97818
|
+
const packages = [`wrangler@latest`];
|
|
97819
|
+
if (hasDependency("@cloudflare/workers-types")) packages.push("@cloudflare/workers-types@latest");
|
|
97820
|
+
await installPackages(packageManager, packages, {
|
|
97818
97821
|
dev: true,
|
|
97819
97822
|
isWorkspaceRoot,
|
|
97820
97823
|
startText: `Installing wrangler ${dim("A command line tool for building Cloudflare Workers")}`,
|
|
97821
97824
|
doneText: `${brandColor("installed")} ${dim(`via \`${packageManager} install wrangler --save-dev\``)}`
|
|
97822
97825
|
});
|
|
97823
97826
|
}
|
|
97827
|
+
function hasDependency(packageName) {
|
|
97828
|
+
const pkgJsonPath = import_node_path7.default.join(process.cwd(), "package.json");
|
|
97829
|
+
if (!(0, import_node_fs7.existsSync)(pkgJsonPath)) return false;
|
|
97830
|
+
const pkgJson = parsePackageJSON(readFileSync(pkgJsonPath), pkgJsonPath);
|
|
97831
|
+
return Boolean(pkgJson.dependencies?.[packageName] || pkgJson.devDependencies?.[packageName]);
|
|
97832
|
+
}
|
|
97824
97833
|
|
|
97825
97834
|
// src/helpers/packages.ts
|
|
97826
97835
|
var import_undici3 = __toESM(require_undici());
|
|
97827
97836
|
|
|
97828
97837
|
// src/helpers/pnpmBuildApprovals.ts
|
|
97829
|
-
var
|
|
97838
|
+
var import_node_fs9 = require("node:fs");
|
|
97830
97839
|
var import_node_path9 = require("node:path");
|
|
97831
97840
|
|
|
97832
97841
|
// src/helpers/files.ts
|
|
97833
|
-
var
|
|
97842
|
+
var import_node_fs8 = __toESM(require("node:fs"));
|
|
97834
97843
|
var import_node_path8 = require("node:path");
|
|
97835
97844
|
var import_comment_json = __toESM(require_src3());
|
|
97836
97845
|
|
|
@@ -98682,21 +98691,21 @@ var dist_default4 = { parse: parse4, stringify: stringify2, TomlDate: TomlDate2,
|
|
|
98682
98691
|
// src/helpers/files.ts
|
|
98683
98692
|
var writeFile3 = (path6, content) => {
|
|
98684
98693
|
try {
|
|
98685
|
-
|
|
98694
|
+
import_node_fs8.default.writeFileSync(path6, content);
|
|
98686
98695
|
} catch (error2) {
|
|
98687
98696
|
throw new Error(error2);
|
|
98688
98697
|
}
|
|
98689
98698
|
};
|
|
98690
98699
|
var readFile = (path6) => {
|
|
98691
98700
|
try {
|
|
98692
|
-
return
|
|
98701
|
+
return import_node_fs8.default.readFileSync(path6, "utf-8");
|
|
98693
98702
|
} catch (error2) {
|
|
98694
98703
|
throw new Error(error2);
|
|
98695
98704
|
}
|
|
98696
98705
|
};
|
|
98697
98706
|
var removeFile = (path6) => {
|
|
98698
98707
|
try {
|
|
98699
|
-
|
|
98708
|
+
import_node_fs8.default.rmSync(path6, { force: true });
|
|
98700
98709
|
} catch (error2) {
|
|
98701
98710
|
throw new Error(`Remove file failed: ${path6}`, { cause: error2 });
|
|
98702
98711
|
}
|
|
@@ -98712,7 +98721,7 @@ var usesTypescript = (ctx) => {
|
|
|
98712
98721
|
return hasTsConfig(ctx.project.path);
|
|
98713
98722
|
};
|
|
98714
98723
|
var hasTsConfig = (path6) => {
|
|
98715
|
-
return (0,
|
|
98724
|
+
return (0, import_node_fs8.existsSync)((0, import_node_path8.join)(`${path6}`, `tsconfig.json`));
|
|
98716
98725
|
};
|
|
98717
98726
|
|
|
98718
98727
|
// src/helpers/pnpmBuildApprovals.ts
|
|
@@ -98724,7 +98733,7 @@ var writePnpmBuildApprovals = (projectPath) => {
|
|
|
98724
98733
|
return;
|
|
98725
98734
|
}
|
|
98726
98735
|
const yamlPath = (0, import_node_path9.join)(projectPath, "pnpm-workspace.yaml");
|
|
98727
|
-
if (!(0,
|
|
98736
|
+
if (!(0, import_node_fs9.existsSync)(yamlPath)) {
|
|
98728
98737
|
writeFile3(yamlPath, freshWorkspaceYaml());
|
|
98729
98738
|
return;
|
|
98730
98739
|
}
|
|
@@ -98876,7 +98885,7 @@ async function installWrangler2() {
|
|
|
98876
98885
|
}
|
|
98877
98886
|
var npmInstall = async (ctx) => {
|
|
98878
98887
|
const nodeModulesPath = import_node_path10.default.join(ctx.project.path, "node_modules");
|
|
98879
|
-
if ((0,
|
|
98888
|
+
if ((0, import_node_fs10.existsSync)(nodeModulesPath)) {
|
|
98880
98889
|
return;
|
|
98881
98890
|
}
|
|
98882
98891
|
const { npm: npm24 } = detectPackageManager();
|
|
@@ -98999,17 +99008,17 @@ var import_promises4 = __toESM(require("node:fs/promises"), 1);
|
|
|
98999
99008
|
// ../../node_modules/.pnpm/is-wsl@3.1.0/node_modules/is-wsl/index.js
|
|
99000
99009
|
var import_node_process7 = __toESM(require("node:process"), 1);
|
|
99001
99010
|
var import_node_os5 = __toESM(require("node:os"), 1);
|
|
99002
|
-
var
|
|
99011
|
+
var import_node_fs13 = __toESM(require("node:fs"), 1);
|
|
99003
99012
|
|
|
99004
99013
|
// ../../node_modules/.pnpm/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
|
|
99005
|
-
var
|
|
99014
|
+
var import_node_fs12 = __toESM(require("node:fs"), 1);
|
|
99006
99015
|
|
|
99007
99016
|
// ../../node_modules/.pnpm/is-docker@3.0.0/node_modules/is-docker/index.js
|
|
99008
|
-
var
|
|
99017
|
+
var import_node_fs11 = __toESM(require("node:fs"), 1);
|
|
99009
99018
|
var isDockerCached;
|
|
99010
99019
|
function hasDockerEnv() {
|
|
99011
99020
|
try {
|
|
99012
|
-
|
|
99021
|
+
import_node_fs11.default.statSync("/.dockerenv");
|
|
99013
99022
|
return true;
|
|
99014
99023
|
} catch {
|
|
99015
99024
|
return false;
|
|
@@ -99017,7 +99026,7 @@ function hasDockerEnv() {
|
|
|
99017
99026
|
}
|
|
99018
99027
|
function hasDockerCGroup() {
|
|
99019
99028
|
try {
|
|
99020
|
-
return
|
|
99029
|
+
return import_node_fs11.default.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
99021
99030
|
} catch {
|
|
99022
99031
|
return false;
|
|
99023
99032
|
}
|
|
@@ -99033,7 +99042,7 @@ function isDocker() {
|
|
|
99033
99042
|
var cachedResult;
|
|
99034
99043
|
var hasContainerEnv = () => {
|
|
99035
99044
|
try {
|
|
99036
|
-
|
|
99045
|
+
import_node_fs12.default.statSync("/run/.containerenv");
|
|
99037
99046
|
return true;
|
|
99038
99047
|
} catch {
|
|
99039
99048
|
return false;
|
|
@@ -99058,7 +99067,7 @@ var isWsl = () => {
|
|
|
99058
99067
|
return true;
|
|
99059
99068
|
}
|
|
99060
99069
|
try {
|
|
99061
|
-
return
|
|
99070
|
+
return import_node_fs13.default.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft") ? !isInsideContainer() : false;
|
|
99062
99071
|
} catch {
|
|
99063
99072
|
return false;
|
|
99064
99073
|
}
|
|
@@ -99657,7 +99666,7 @@ var WRANGLER_DEFAULTS = {
|
|
|
99657
99666
|
};
|
|
99658
99667
|
|
|
99659
99668
|
// ../codemod/dist/index.mjs
|
|
99660
|
-
var
|
|
99669
|
+
var import_node_fs14 = require("node:fs");
|
|
99661
99670
|
var import_node_path12 = __toESM(require("node:path"), 1);
|
|
99662
99671
|
var recast = __toESM(require_main2(), 1);
|
|
99663
99672
|
var esprimaParser = __toESM(require_esprima3(), 1);
|
|
@@ -99686,7 +99695,7 @@ function parseFile(filePath) {
|
|
|
99686
99695
|
const lang = import_node_path12.default.extname(filePath).slice(1);
|
|
99687
99696
|
const parser2 = lang === "js" ? esprimaParser : typescriptParser;
|
|
99688
99697
|
try {
|
|
99689
|
-
const fileContents = (0,
|
|
99698
|
+
const fileContents = (0, import_node_fs14.readFileSync)(import_node_path12.default.resolve(filePath), "utf-8");
|
|
99690
99699
|
if (fileContents) {
|
|
99691
99700
|
return recast.parse(fileContents, { parser: parser2 }).program;
|
|
99692
99701
|
}
|
|
@@ -99700,7 +99709,7 @@ function transformFile(filePath, methods) {
|
|
|
99700
99709
|
const ast = parseFile(filePath);
|
|
99701
99710
|
if (ast) {
|
|
99702
99711
|
recast.visit(ast, methods);
|
|
99703
|
-
(0,
|
|
99712
|
+
(0, import_node_fs14.writeFileSync)(filePath, recast.print(ast).code);
|
|
99704
99713
|
}
|
|
99705
99714
|
}
|
|
99706
99715
|
__name2(transformFile, "transformFile");
|
|
@@ -99755,7 +99764,7 @@ var package_default = {
|
|
|
99755
99764
|
"create-waku": "0.12.5-1.0.0-alpha.10-0",
|
|
99756
99765
|
gatsby: "5.16.1",
|
|
99757
99766
|
nuxi: "3.36.1",
|
|
99758
|
-
sv: "0.
|
|
99767
|
+
sv: "0.16.1"
|
|
99759
99768
|
},
|
|
99760
99769
|
info: [
|
|
99761
99770
|
"This package.json is only used to keep track of the frameworks cli dependencies",
|
|
@@ -99790,7 +99799,7 @@ var runFrameworkGenerator = async (ctx, args) => {
|
|
|
99790
99799
|
};
|
|
99791
99800
|
|
|
99792
99801
|
// src/helpers/compatDate.ts
|
|
99793
|
-
var
|
|
99802
|
+
var import_node_fs15 = require("node:fs");
|
|
99794
99803
|
var import_node_path13 = require("node:path");
|
|
99795
99804
|
function getWorkerdCompatibilityDate(_projectPath) {
|
|
99796
99805
|
const s = spinner();
|
|
@@ -99807,7 +99816,7 @@ function getLatestTypesEntrypoint(ctx) {
|
|
|
99807
99816
|
"workers-types"
|
|
99808
99817
|
);
|
|
99809
99818
|
try {
|
|
99810
|
-
const entrypoints = (0,
|
|
99819
|
+
const entrypoints = (0, import_node_fs15.readdirSync)(workersTypesPath);
|
|
99811
99820
|
const sorted = entrypoints.filter((filename) => filename.match(/(\d{4})-(\d{2})-(\d{2})/)).sort().reverse();
|
|
99812
99821
|
if (sorted.length === 0) {
|
|
99813
99822
|
return null;
|
|
@@ -100870,7 +100879,7 @@ var config25 = {
|
|
|
100870
100879
|
var c3_default28 = config25;
|
|
100871
100880
|
|
|
100872
100881
|
// templates/pre-existing/c3.ts
|
|
100873
|
-
var
|
|
100882
|
+
var import_node_fs16 = require("node:fs");
|
|
100874
100883
|
var import_promises6 = require("node:fs/promises");
|
|
100875
100884
|
var import_node_os6 = require("node:os");
|
|
100876
100885
|
var import_node_path16 = require("node:path");
|
|
@@ -101034,7 +101043,7 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
101034
101043
|
let configFileCopied = false;
|
|
101035
101044
|
for (const configFile of configFiles) {
|
|
101036
101045
|
const sourcePath = (0, import_node_path16.join)(tempdir, ctx.args.existingScript, configFile);
|
|
101037
|
-
if ((0,
|
|
101046
|
+
if ((0, import_node_fs16.existsSync)(sourcePath)) {
|
|
101038
101047
|
await (0, import_promises6.cp)(sourcePath, (0, import_node_path16.join)(ctx.project.path, configFile));
|
|
101039
101048
|
configFileCopied = true;
|
|
101040
101049
|
break;
|
|
@@ -101106,15 +101115,15 @@ var config27 = {
|
|
|
101106
101115
|
var c3_default30 = config27;
|
|
101107
101116
|
|
|
101108
101117
|
// src/helpers/codemod.ts
|
|
101109
|
-
var
|
|
101118
|
+
var import_node_fs17 = require("node:fs");
|
|
101110
101119
|
var import_node_path17 = require("node:path");
|
|
101111
101120
|
var loadSnippets = (parentFolder) => {
|
|
101112
101121
|
const snippetsPath = (0, import_node_path17.join)(parentFolder, "snippets");
|
|
101113
|
-
if (!(0,
|
|
101122
|
+
if (!(0, import_node_fs17.lstatSync)(snippetsPath, { throwIfNoEntry: false })?.isDirectory()) {
|
|
101114
101123
|
return {};
|
|
101115
101124
|
}
|
|
101116
|
-
const files = (0,
|
|
101117
|
-
return files.filter((fileName) => (0,
|
|
101125
|
+
const files = (0, import_node_fs17.readdirSync)(snippetsPath);
|
|
101126
|
+
return files.filter((fileName) => (0, import_node_fs17.lstatSync)((0, import_node_path17.join)(snippetsPath, fileName)).isFile()).filter((fileName) => [".js", ".ts"].includes((0, import_node_path17.extname)(fileName))).reduce((acc, snippetPath) => {
|
|
101118
101127
|
const [file2, ext] = snippetPath.split(".");
|
|
101119
101128
|
const key = `${file2}${ext === "js" ? "Js" : "Ts"}`;
|
|
101120
101129
|
return {
|
|
@@ -101700,7 +101709,7 @@ var config37 = {
|
|
|
101700
101709
|
var c3_default40 = config37;
|
|
101701
101710
|
|
|
101702
101711
|
// templates/svelte/pages/c3.ts
|
|
101703
|
-
var
|
|
101712
|
+
var import_node_fs18 = require("node:fs");
|
|
101704
101713
|
var recast10 = __toESM(require_main2());
|
|
101705
101714
|
var { npm: npm17 } = detectPackageManager();
|
|
101706
101715
|
var generate23 = async (ctx) => {
|
|
@@ -101714,13 +101723,14 @@ var configure13 = async (ctx) => {
|
|
|
101714
101723
|
startText: "Adding the Cloudflare Pages adapter",
|
|
101715
101724
|
doneText: `${brandColor(`installed`)} ${dim(pkg)}`
|
|
101716
101725
|
});
|
|
101717
|
-
|
|
101726
|
+
updateViteConfig(ctx);
|
|
101718
101727
|
updatePlaywrightConfig(usesTypescript(ctx));
|
|
101719
101728
|
updateTypeDefinitions(ctx);
|
|
101720
101729
|
};
|
|
101721
|
-
var
|
|
101722
|
-
|
|
101723
|
-
|
|
101730
|
+
var updateViteConfig = (ctx) => {
|
|
101731
|
+
const configFile = usesTypescript(ctx) ? "vite.config.ts" : "vite.config.js";
|
|
101732
|
+
updateStatus(`Changing adapter in ${blue(configFile)}`);
|
|
101733
|
+
transformFile(configFile, {
|
|
101724
101734
|
visitImportDeclaration: function(n) {
|
|
101725
101735
|
const importSource = n.value.source;
|
|
101726
101736
|
if (importSource.value === "@sveltejs/adapter-auto") {
|
|
@@ -101732,7 +101742,7 @@ var updateSvelteConfig = () => {
|
|
|
101732
101742
|
};
|
|
101733
101743
|
var updatePlaywrightConfig = (shouldUseTypescript) => {
|
|
101734
101744
|
const filePath = `playwright.config.${shouldUseTypescript ? "ts" : "js"}`;
|
|
101735
|
-
if (!(0,
|
|
101745
|
+
if (!(0, import_node_fs18.existsSync)(filePath)) {
|
|
101736
101746
|
return;
|
|
101737
101747
|
}
|
|
101738
101748
|
updateStatus(`Changing webServer port in ${blue(filePath)}`);
|
|
@@ -101837,12 +101847,13 @@ var configure14 = async (ctx) => {
|
|
|
101837
101847
|
startText: "Adding the Cloudflare adapter",
|
|
101838
101848
|
doneText: `${brandColor(`installed`)} ${dim(pkg)}`
|
|
101839
101849
|
});
|
|
101840
|
-
|
|
101850
|
+
updateViteConfig2(ctx);
|
|
101841
101851
|
updateTypeDefinitions2(ctx);
|
|
101842
101852
|
};
|
|
101843
|
-
var
|
|
101844
|
-
|
|
101845
|
-
|
|
101853
|
+
var updateViteConfig2 = (ctx) => {
|
|
101854
|
+
const configFile = usesTypescript(ctx) ? "vite.config.ts" : "vite.config.js";
|
|
101855
|
+
updateStatus(`Changing adapter in ${blue(configFile)}`);
|
|
101856
|
+
transformFile(configFile, {
|
|
101846
101857
|
visitImportDeclaration: function(n) {
|
|
101847
101858
|
const importSource = n.value.source;
|
|
101848
101859
|
if (importSource.value === "@sveltejs/adapter-auto") {
|
|
@@ -102255,7 +102266,7 @@ If the application uses Durable Objects or Workflows, refer to the relevant best
|
|
|
102255
102266
|
var import_node_assert6 = __toESM(require("node:assert"));
|
|
102256
102267
|
|
|
102257
102268
|
// ../wrangler/package.json
|
|
102258
|
-
var version2 = "4.
|
|
102269
|
+
var version2 = "4.109.0";
|
|
102259
102270
|
|
|
102260
102271
|
// src/git.ts
|
|
102261
102272
|
var offerGit = async (ctx) => {
|
|
@@ -102443,7 +102454,7 @@ async function getProductionBranch(cwd) {
|
|
|
102443
102454
|
}
|
|
102444
102455
|
|
|
102445
102456
|
// src/validators.ts
|
|
102446
|
-
var
|
|
102457
|
+
var import_node_fs19 = require("node:fs");
|
|
102447
102458
|
var import_node_path20 = require("node:path");
|
|
102448
102459
|
var TEMPLATE_REGEX = /^(?:(?:https:\/\/)?(?<httpsUrl>[^:/]+\.[^:/]+)\/|git@(?<gitUrl>[^:/]+)[:/]|(?<shorthandUrl>[^/]+):)?(?<user>[^/\s]+)\/(?<repository>[^/\s#]+)(?:(?<subdirectoryPath>(?:\/[^/\s#]+)+))?(?:\/)?(?:#(?<tag>.+))?/;
|
|
102449
102460
|
var validateTemplateUrl = (value) => {
|
|
@@ -102453,9 +102464,9 @@ var validateTemplateUrl = (value) => {
|
|
|
102453
102464
|
};
|
|
102454
102465
|
var validateProjectDirectory = (relativePath, args) => {
|
|
102455
102466
|
const path6 = (0, import_node_path20.resolve)(relativePath);
|
|
102456
|
-
const existsAlready = (0,
|
|
102467
|
+
const existsAlready = (0, import_node_fs19.existsSync)(path6);
|
|
102457
102468
|
if (existsAlready) {
|
|
102458
|
-
for (const file2 of (0,
|
|
102469
|
+
for (const file2 of (0, import_node_fs19.readdirSync)(path6)) {
|
|
102459
102470
|
if (!isAllowedExistingFile(file2)) {
|
|
102460
102471
|
return `Directory \`${relativePath}\` already exists and contains files that might conflict. Please choose a new name.`;
|
|
102461
102472
|
}
|
|
@@ -102981,14 +102992,14 @@ async function copyTemplateFiles(ctx) {
|
|
|
102981
102992
|
s.start(`Copying template files`);
|
|
102982
102993
|
await (0, import_promises7.cp)(srcdir, destdir, { recursive: true, force: true });
|
|
102983
102994
|
const dummyGitIgnorePath = (0, import_node_path21.join)(destdir, "__dot__gitignore");
|
|
102984
|
-
if ((0,
|
|
102995
|
+
if ((0, import_node_fs20.existsSync)(dummyGitIgnorePath)) {
|
|
102985
102996
|
await (0, import_promises7.rename)(dummyGitIgnorePath, (0, import_node_path21.join)(destdir, ".gitignore"));
|
|
102986
102997
|
}
|
|
102987
102998
|
s.stop(`${brandColor("files")} ${dim("copied to project directory")}`);
|
|
102988
102999
|
}
|
|
102989
103000
|
function writeAgentsMd(projectPath) {
|
|
102990
103001
|
const agentsMdPath = (0, import_node_path21.join)(projectPath, "AGENTS.md");
|
|
102991
|
-
if ((0,
|
|
103002
|
+
if ((0, import_node_fs20.existsSync)(agentsMdPath)) {
|
|
102992
103003
|
return;
|
|
102993
103004
|
}
|
|
102994
103005
|
writeFile3(agentsMdPath, getAgentsMd());
|
|
@@ -103029,14 +103040,14 @@ var validateTemplateSrcDirectory = (path6, config49) => {
|
|
|
103029
103040
|
const wranglerTomlPath = (0, import_node_path21.resolve)(path6, "wrangler.toml");
|
|
103030
103041
|
const wranglerJsonPath = (0, import_node_path21.resolve)(path6, "wrangler.json");
|
|
103031
103042
|
const wranglerJsoncPath = (0, import_node_path21.resolve)(path6, "wrangler.jsonc");
|
|
103032
|
-
if (!(0,
|
|
103043
|
+
if (!(0, import_node_fs20.existsSync)(wranglerTomlPath) && !(0, import_node_fs20.existsSync)(wranglerJsonPath) && !(0, import_node_fs20.existsSync)(wranglerJsoncPath)) {
|
|
103033
103044
|
throw new Error(
|
|
103034
103045
|
`create-cloudflare templates must contain a "wrangler.toml" or "wrangler.json(c)" file.`
|
|
103035
103046
|
);
|
|
103036
103047
|
}
|
|
103037
103048
|
}
|
|
103038
103049
|
const pkgJsonPath = (0, import_node_path21.resolve)(path6, "package.json");
|
|
103039
|
-
if (!(0,
|
|
103050
|
+
if (!(0, import_node_fs20.existsSync)(pkgJsonPath)) {
|
|
103040
103051
|
throw new Error(
|
|
103041
103052
|
`create-cloudflare templates must contain a "package.json" file.`
|
|
103042
103053
|
);
|
|
@@ -103053,10 +103064,10 @@ var inferTemplateConfig = (path6) => {
|
|
|
103053
103064
|
};
|
|
103054
103065
|
var inferCopyFilesDefinition = (path6) => {
|
|
103055
103066
|
const variants = {};
|
|
103056
|
-
if ((0,
|
|
103067
|
+
if ((0, import_node_fs20.existsSync)((0, import_node_path21.join)(path6, "js"))) {
|
|
103057
103068
|
variants["js"] = { path: "./js" };
|
|
103058
103069
|
}
|
|
103059
|
-
if ((0,
|
|
103070
|
+
if ((0, import_node_fs20.existsSync)((0, import_node_path21.join)(path6, "ts"))) {
|
|
103060
103071
|
variants["ts"] = { path: "./ts" };
|
|
103061
103072
|
}
|
|
103062
103073
|
const copyFiles = Object.keys(variants).length !== 0 ? { variants } : { path: "." };
|
|
@@ -103101,7 +103112,7 @@ Use the format "github:<owner>/<repo>/sub/directory[#<branch>]" to clone a speci
|
|
|
103101
103112
|
}
|
|
103102
103113
|
function updatePythonPackageName(path6, projectName) {
|
|
103103
103114
|
const pyProjectFile = (0, import_node_path21.resolve)(path6, "pyproject.toml");
|
|
103104
|
-
if (!(0,
|
|
103115
|
+
if (!(0, import_node_fs20.existsSync)(pyProjectFile)) {
|
|
103105
103116
|
return;
|
|
103106
103117
|
}
|
|
103107
103118
|
const s = spinner();
|
|
@@ -103611,7 +103622,7 @@ function secondsSince(start) {
|
|
|
103611
103622
|
}
|
|
103612
103623
|
|
|
103613
103624
|
// src/wrangler/config.ts
|
|
103614
|
-
var
|
|
103625
|
+
var import_node_fs21 = require("node:fs");
|
|
103615
103626
|
var import_node_path22 = require("node:path");
|
|
103616
103627
|
|
|
103617
103628
|
// src/helpers/json.ts
|
|
@@ -103734,12 +103745,12 @@ var getWranglerJsoncPath = (ctx) => {
|
|
|
103734
103745
|
};
|
|
103735
103746
|
var wranglerTomlExists = (ctx) => {
|
|
103736
103747
|
const wranglerTomlPath = getWranglerTomlPath(ctx);
|
|
103737
|
-
return (0,
|
|
103748
|
+
return (0, import_node_fs21.existsSync)(wranglerTomlPath);
|
|
103738
103749
|
};
|
|
103739
103750
|
var wranglerJsonOrJsoncExists = (ctx) => {
|
|
103740
103751
|
const wranglerJsonPath = getWranglerJsonPath(ctx);
|
|
103741
103752
|
const wranglerJsoncPath = getWranglerJsoncPath(ctx);
|
|
103742
|
-
return (0,
|
|
103753
|
+
return (0, import_node_fs21.existsSync)(wranglerJsonPath) || (0, import_node_fs21.existsSync)(wranglerJsoncPath);
|
|
103743
103754
|
};
|
|
103744
103755
|
var readWranglerToml = (ctx) => {
|
|
103745
103756
|
const wranglerTomlPath = getWranglerTomlPath(ctx);
|
|
@@ -103747,7 +103758,7 @@ var readWranglerToml = (ctx) => {
|
|
|
103747
103758
|
};
|
|
103748
103759
|
var readWranglerJsonOrJsonc = (ctx, reviver) => {
|
|
103749
103760
|
const wranglerJsonPath = getWranglerJsonPath(ctx);
|
|
103750
|
-
if ((0,
|
|
103761
|
+
if ((0, import_node_fs21.existsSync)(wranglerJsonPath)) {
|
|
103751
103762
|
return readJSONWithComments(wranglerJsonPath, reviver);
|
|
103752
103763
|
}
|
|
103753
103764
|
const wranglerJsoncPath = getWranglerJsoncPath(ctx);
|
|
@@ -103759,7 +103770,7 @@ var writeWranglerToml = (ctx, contents) => {
|
|
|
103759
103770
|
};
|
|
103760
103771
|
var writeWranglerJsonOrJsonc = (ctx, config49) => {
|
|
103761
103772
|
const wranglerJsonPath = getWranglerJsonPath(ctx);
|
|
103762
|
-
if ((0,
|
|
103773
|
+
if ((0, import_node_fs21.existsSync)(wranglerJsonPath)) {
|
|
103763
103774
|
return writeJSONWithComments(wranglerJsonPath, config49);
|
|
103764
103775
|
}
|
|
103765
103776
|
const wranglerJsoncPath = getWranglerJsoncPath(ctx);
|
|
@@ -103767,10 +103778,10 @@ var writeWranglerJsonOrJsonc = (ctx, config49) => {
|
|
|
103767
103778
|
};
|
|
103768
103779
|
var addVscodeConfig = (ctx) => {
|
|
103769
103780
|
const settingsPath = `${ctx.project.path}/.vscode/settings.json`;
|
|
103770
|
-
if ((0,
|
|
103781
|
+
if ((0, import_node_fs21.existsSync)(settingsPath)) {
|
|
103771
103782
|
return;
|
|
103772
103783
|
}
|
|
103773
|
-
(0,
|
|
103784
|
+
(0, import_node_fs21.mkdirSync)(`${ctx.project.path}/.vscode`, { recursive: true });
|
|
103774
103785
|
writeJSON(settingsPath, {
|
|
103775
103786
|
"files.associations": {
|
|
103776
103787
|
"wrangler.json": "jsonc"
|
|
@@ -104510,7 +104521,7 @@ var createProject = async (ctx) => {
|
|
|
104510
104521
|
};
|
|
104511
104522
|
|
|
104512
104523
|
// src/workers.ts
|
|
104513
|
-
var
|
|
104524
|
+
var import_node_fs22 = require("node:fs");
|
|
104514
104525
|
var import_node_path25 = require("node:path");
|
|
104515
104526
|
|
|
104516
104527
|
// ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
@@ -105842,7 +105853,7 @@ async function addTypes(ctx) {
|
|
|
105842
105853
|
}
|
|
105843
105854
|
async function generateWorkersTypes(ctx, npm24) {
|
|
105844
105855
|
const packageJsonPath = (0, import_node_path25.join)(ctx.project.path, "package.json");
|
|
105845
|
-
if (!(0,
|
|
105856
|
+
if (!(0, import_node_fs22.existsSync)(packageJsonPath)) {
|
|
105846
105857
|
return;
|
|
105847
105858
|
}
|
|
105848
105859
|
const packageManifest = readJSON(packageJsonPath);
|
|
@@ -105882,7 +105893,7 @@ var maybeInstallNodeTypes = async (ctx, npm24) => {
|
|
|
105882
105893
|
};
|
|
105883
105894
|
async function updateTsConfig(ctx, { usesNodeCompat }) {
|
|
105884
105895
|
const tsconfigPath = (0, import_node_path25.join)(ctx.project.path, "tsconfig.json");
|
|
105885
|
-
if (!(0,
|
|
105896
|
+
if (!(0, import_node_fs22.existsSync)(tsconfigPath)) {
|
|
105886
105897
|
return;
|
|
105887
105898
|
}
|
|
105888
105899
|
const tsconfig = readFile(tsconfigPath);
|
|
@@ -105902,7 +105913,7 @@ async function updateTsConfig(ctx, { usesNodeCompat }) {
|
|
|
105902
105913
|
newTypes.delete("@cloudflare/workers-types");
|
|
105903
105914
|
if (entrypointVersion !== null) {
|
|
105904
105915
|
newTypes.add(`@cloudflare/workers-types/${entrypointVersion}`);
|
|
105905
|
-
} else if ((0,
|
|
105916
|
+
} else if ((0, import_node_fs22.existsSync)(
|
|
105906
105917
|
(0, import_node_path25.join)(
|
|
105907
105918
|
ctx.project.path,
|
|
105908
105919
|
"node_modules",
|
|
@@ -106017,7 +106028,7 @@ var setupProjectDirectory = (ctx) => {
|
|
|
106017
106028
|
throw new Error(err);
|
|
106018
106029
|
}
|
|
106019
106030
|
const directory = (0, import_node_path26.dirname)(path6);
|
|
106020
|
-
(0,
|
|
106031
|
+
(0, import_node_fs23.mkdirSync)(directory, { recursive: true });
|
|
106021
106032
|
(0, import_node_process14.chdir)(directory);
|
|
106022
106033
|
};
|
|
106023
106034
|
var create = async (ctx) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-cloudflare",
|
|
3
|
-
"version": "2.70.
|
|
3
|
+
"version": "2.70.10",
|
|
4
4
|
"description": "A CLI for creating and deploying new applications to Cloudflare.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@babel/parser": "^7.21.3",
|
|
32
32
|
"@babel/types": "^7.21.4",
|
|
33
33
|
"@clack/prompts": "^1.2.0",
|
|
34
|
-
"@cloudflare/workers-types": "^
|
|
34
|
+
"@cloudflare/workers-types": "^5.20260708.1",
|
|
35
35
|
"@types/command-exists": "^1.2.0",
|
|
36
36
|
"@types/cross-spawn": "^6.0.2",
|
|
37
37
|
"@types/deepmerge": "^2.2.0",
|
|
@@ -74,10 +74,10 @@
|
|
|
74
74
|
"@cloudflare/cli-shared-helpers": "0.1.12",
|
|
75
75
|
"@cloudflare/codemod": "1.1.0",
|
|
76
76
|
"@cloudflare/mock-npm-registry": "0.0.0",
|
|
77
|
-
"@cloudflare/vite-plugin": "1.43.
|
|
77
|
+
"@cloudflare/vite-plugin": "1.43.3",
|
|
78
78
|
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
79
79
|
"@cloudflare/workers-utils": "0.25.1",
|
|
80
|
-
"wrangler": "4.
|
|
80
|
+
"wrangler": "4.109.0"
|
|
81
81
|
},
|
|
82
82
|
"engines": {
|
|
83
83
|
"node": ">=22.0.0"
|
|
@@ -27,16 +27,19 @@ const configure = async (ctx: C3Context) => {
|
|
|
27
27
|
doneText: `${brandColor(`installed`)} ${dim(pkg)}`,
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
updateViteConfig(ctx);
|
|
31
31
|
updatePlaywrightConfig(usesTypescript(ctx));
|
|
32
32
|
updateTypeDefinitions(ctx);
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
const
|
|
36
|
-
//
|
|
37
|
-
|
|
35
|
+
const updateViteConfig = (ctx: C3Context) => {
|
|
36
|
+
// As of `sv` 0.16, the adapter is configured in the Vite config rather than
|
|
37
|
+
// in `svelte.config.js`, so all we need to do is change the adapter import
|
|
38
|
+
// statement there.
|
|
39
|
+
const configFile = usesTypescript(ctx) ? "vite.config.ts" : "vite.config.js";
|
|
40
|
+
updateStatus(`Changing adapter in ${blue(configFile)}`);
|
|
38
41
|
|
|
39
|
-
transformFile(
|
|
42
|
+
transformFile(configFile, {
|
|
40
43
|
visitImportDeclaration: function (n) {
|
|
41
44
|
// importSource is the `x` in `import y from "x"`
|
|
42
45
|
const importSource = n.value.source;
|
|
@@ -26,15 +26,18 @@ const configure = async (ctx: C3Context) => {
|
|
|
26
26
|
doneText: `${brandColor(`installed`)} ${dim(pkg)}`,
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
updateViteConfig(ctx);
|
|
30
30
|
updateTypeDefinitions(ctx);
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
const
|
|
34
|
-
//
|
|
35
|
-
|
|
33
|
+
const updateViteConfig = (ctx: C3Context) => {
|
|
34
|
+
// As of `sv` 0.16, the adapter is configured in the Vite config rather than
|
|
35
|
+
// in `svelte.config.js`, so all we need to do is change the adapter import
|
|
36
|
+
// statement there.
|
|
37
|
+
const configFile = usesTypescript(ctx) ? "vite.config.ts" : "vite.config.js";
|
|
38
|
+
updateStatus(`Changing adapter in ${blue(configFile)}`);
|
|
36
39
|
|
|
37
|
-
transformFile(
|
|
40
|
+
transformFile(configFile, {
|
|
38
41
|
visitImportDeclaration: function (n) {
|
|
39
42
|
// importSource is the `x` in `import y from "x"`
|
|
40
43
|
const importSource = n.value.source;
|