create-cloudflare 0.0.0-9d8509e0 → 0.0.0-a5e7c0be
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 +90 -16
- package/package.json +9 -5
package/dist/cli.js
CHANGED
|
@@ -60737,7 +60737,44 @@ var Yargs = YargsFactory(esm_default);
|
|
|
60737
60737
|
var yargs_default = Yargs;
|
|
60738
60738
|
|
|
60739
60739
|
// package.json
|
|
60740
|
-
var version = "0.0.0-
|
|
60740
|
+
var version = "0.0.0-a5e7c0be";
|
|
60741
|
+
var devDependencies = {
|
|
60742
|
+
"@babel/parser": "^7.21.3",
|
|
60743
|
+
"@babel/types": "^7.21.4",
|
|
60744
|
+
"@clack/prompts": "^0.6.3",
|
|
60745
|
+
"@cloudflare/eslint-config-worker": "*",
|
|
60746
|
+
"@cloudflare/workers-tsconfig": "*",
|
|
60747
|
+
"@cloudflare/workers-types": "^4.20230419.0",
|
|
60748
|
+
"@types/command-exists": "^1.2.0",
|
|
60749
|
+
"@types/cross-spawn": "^6.0.2",
|
|
60750
|
+
"@types/dns2": "^2.0.3",
|
|
60751
|
+
"@types/esprima": "^4.0.3",
|
|
60752
|
+
"@types/node": "^18.15.3",
|
|
60753
|
+
"@types/which-pm-runs": "^1.0.0",
|
|
60754
|
+
"@types/yargs": "^17.0.22",
|
|
60755
|
+
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
|
60756
|
+
"@typescript-eslint/parser": "^5.55.0",
|
|
60757
|
+
chalk: "^5.2.0",
|
|
60758
|
+
"command-exists": "^1.2.9",
|
|
60759
|
+
"cross-spawn": "^7.0.3",
|
|
60760
|
+
dns2: "^2.1.0",
|
|
60761
|
+
esbuild: "^0.17.12",
|
|
60762
|
+
execa: "^7.1.1",
|
|
60763
|
+
haikunator: "^2.1.2",
|
|
60764
|
+
"log-update": "^5.0.1",
|
|
60765
|
+
open: "^8.4.0",
|
|
60766
|
+
pnpm: "^8.6.11",
|
|
60767
|
+
recast: "^0.22.0",
|
|
60768
|
+
semver: "^7.5.1",
|
|
60769
|
+
typescript: "^5.0.2",
|
|
60770
|
+
undici: "5.20.0",
|
|
60771
|
+
"vite-tsconfig-paths": "^4.0.8",
|
|
60772
|
+
vitest: "^0.30.0",
|
|
60773
|
+
"which-pm-runs": "^1.1.0",
|
|
60774
|
+
wrangler: "*",
|
|
60775
|
+
yargs: "^17.7.1",
|
|
60776
|
+
yarn: "^1.22.19"
|
|
60777
|
+
};
|
|
60741
60778
|
|
|
60742
60779
|
// src/common.ts
|
|
60743
60780
|
var import_fs6 = require("fs");
|
|
@@ -60753,7 +60790,19 @@ var import_cross_spawn = __toESM(require_cross_spawn());
|
|
|
60753
60790
|
var import_semver = __toESM(require_semver2());
|
|
60754
60791
|
var import_which_pm_runs = __toESM(require_which_pm_runs());
|
|
60755
60792
|
var detectPackageManager = () => {
|
|
60756
|
-
|
|
60793
|
+
let { name, version: version2 } = (0, import_which_pm_runs.default)() ?? { name: "npm", version: "0.0.0" };
|
|
60794
|
+
if (process.env.TEST_PM) {
|
|
60795
|
+
switch (process.env.TEST_PM) {
|
|
60796
|
+
case "pnpm":
|
|
60797
|
+
name = "pnpm";
|
|
60798
|
+
version2 = devDependencies["pnpm"].replace("^", "");
|
|
60799
|
+
break;
|
|
60800
|
+
case "yarn":
|
|
60801
|
+
name = "yarn";
|
|
60802
|
+
version2 = devDependencies["yarn"].replace("^", "");
|
|
60803
|
+
break;
|
|
60804
|
+
}
|
|
60805
|
+
}
|
|
60757
60806
|
switch (name) {
|
|
60758
60807
|
case "pnpm":
|
|
60759
60808
|
if (import_semver.default.gt(version2, "6.0.0")) {
|
|
@@ -60934,6 +60983,21 @@ var npmInstall = async () => {
|
|
|
60934
60983
|
doneText: `${brandColor("installed")} ${dim(`via \`${npm12} install\``)}`
|
|
60935
60984
|
});
|
|
60936
60985
|
};
|
|
60986
|
+
var resetPackageManager = async (ctx) => {
|
|
60987
|
+
const { npm: npm12 } = detectPackageManager();
|
|
60988
|
+
if (npm12 === "npm")
|
|
60989
|
+
return;
|
|
60990
|
+
const nodeModulesPath = import_path5.default.join(ctx.project.path, "node_modules");
|
|
60991
|
+
(0, import_fs5.rmSync)(nodeModulesPath, { recursive: true });
|
|
60992
|
+
const lockfilePath = import_path5.default.join(ctx.project.path, "package-lock.json");
|
|
60993
|
+
(0, import_fs5.rmSync)(lockfilePath);
|
|
60994
|
+
await runCommand(`${npm12} install`, {
|
|
60995
|
+
silent: true,
|
|
60996
|
+
cwd: ctx.project.path,
|
|
60997
|
+
startText: "Installing dependencies",
|
|
60998
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm12} install\``)}`
|
|
60999
|
+
});
|
|
61000
|
+
};
|
|
60937
61001
|
var installWrangler = async () => {
|
|
60938
61002
|
const { npm: npm12 } = detectPackageManager();
|
|
60939
61003
|
if ((0, import_fs5.existsSync)(import_path5.default.resolve("node_modules", "wrangler"))) {
|
|
@@ -61206,7 +61270,7 @@ var printSummary = async (ctx) => {
|
|
|
61206
61270
|
],
|
|
61207
61271
|
[
|
|
61208
61272
|
`Read the documentation`,
|
|
61209
|
-
`https://developers.cloudflare.com/${ctx.framework ? "pages" : "workers"}`
|
|
61273
|
+
`https://developers.cloudflare.com/${ctx.framework ? ctx.framework.config.type === "workers" ? "workers" : "pages" : "workers"}`
|
|
61210
61274
|
],
|
|
61211
61275
|
[`Stuck? Join us at`, `https://discord.gg/cloudflaredev`]
|
|
61212
61276
|
];
|
|
@@ -61243,6 +61307,7 @@ var printSummary = async (ctx) => {
|
|
|
61243
61307
|
}
|
|
61244
61308
|
}
|
|
61245
61309
|
endSection("See you again soon!");
|
|
61310
|
+
process.exit(0);
|
|
61246
61311
|
};
|
|
61247
61312
|
var offerGit = async (ctx) => {
|
|
61248
61313
|
const gitInstalled = await isGitInstalled();
|
|
@@ -61617,7 +61682,7 @@ var generate5 = async (ctx) => {
|
|
|
61617
61682
|
const version2 = getFrameworkVersion(ctx);
|
|
61618
61683
|
await runFrameworkGenerator(
|
|
61619
61684
|
ctx,
|
|
61620
|
-
`${dlx5} create-hono@${version2} ${ctx.project.name} --template cloudflare-
|
|
61685
|
+
`${dlx5} create-hono@${version2} ${ctx.project.name} --template cloudflare-workers`
|
|
61621
61686
|
);
|
|
61622
61687
|
logRaw("");
|
|
61623
61688
|
};
|
|
@@ -61626,7 +61691,8 @@ var config5 = {
|
|
|
61626
61691
|
displayName: "Hono",
|
|
61627
61692
|
packageScripts: {},
|
|
61628
61693
|
deployCommand: "deploy",
|
|
61629
|
-
devCommand: "dev"
|
|
61694
|
+
devCommand: "dev",
|
|
61695
|
+
type: "workers"
|
|
61630
61696
|
};
|
|
61631
61697
|
var hono_default = config5;
|
|
61632
61698
|
|
|
@@ -61767,7 +61833,7 @@ var config6 = {
|
|
|
61767
61833
|
configure: configure3,
|
|
61768
61834
|
displayName: "Next",
|
|
61769
61835
|
packageScripts: {
|
|
61770
|
-
"pages:build": `${
|
|
61836
|
+
"pages:build": `${dlx6} @cloudflare/next-on-pages@1`,
|
|
61771
61837
|
"pages:deploy": `${npm5} run pages:build && wrangler pages deploy .vercel/output/static`,
|
|
61772
61838
|
"pages:watch": `${npx3} @cloudflare/next-on-pages@1 --watch`,
|
|
61773
61839
|
"pages:dev": `${npx3} wrangler pages dev .vercel/output/static --compatibility-flag=nodejs_compat`
|
|
@@ -61850,8 +61916,12 @@ var generate9 = async (ctx) => {
|
|
|
61850
61916
|
);
|
|
61851
61917
|
logRaw("");
|
|
61852
61918
|
};
|
|
61919
|
+
var configure6 = async (ctx) => {
|
|
61920
|
+
await resetPackageManager(ctx);
|
|
61921
|
+
};
|
|
61853
61922
|
var config9 = {
|
|
61854
61923
|
generate: generate9,
|
|
61924
|
+
configure: configure6,
|
|
61855
61925
|
displayName: "React",
|
|
61856
61926
|
packageScripts: {
|
|
61857
61927
|
"pages:dev": `wrangler pages dev ${compatDateFlag()} --port 3000 -- ${npm7} start`,
|
|
@@ -61904,7 +61974,7 @@ var generate11 = async (ctx) => {
|
|
|
61904
61974
|
await runFrameworkGenerator(ctx, `${dlx11} create-solid@${version2}`);
|
|
61905
61975
|
logRaw("");
|
|
61906
61976
|
};
|
|
61907
|
-
var
|
|
61977
|
+
var configure7 = async () => {
|
|
61908
61978
|
const pkg = "solid-start-cloudflare-pages";
|
|
61909
61979
|
await installPackages([pkg], {
|
|
61910
61980
|
dev: true,
|
|
@@ -61919,7 +61989,7 @@ var configure6 = async () => {
|
|
|
61919
61989
|
};
|
|
61920
61990
|
var config11 = {
|
|
61921
61991
|
generate: generate11,
|
|
61922
|
-
configure:
|
|
61992
|
+
configure: configure7,
|
|
61923
61993
|
displayName: "Solid",
|
|
61924
61994
|
packageScripts: {
|
|
61925
61995
|
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 3000 -- ${npm9} run dev`,
|
|
@@ -61984,7 +62054,7 @@ var generate12 = async (ctx) => {
|
|
|
61984
62054
|
);
|
|
61985
62055
|
logRaw("");
|
|
61986
62056
|
};
|
|
61987
|
-
var
|
|
62057
|
+
var configure8 = async (ctx) => {
|
|
61988
62058
|
process.chdir(ctx.project.path);
|
|
61989
62059
|
await npmInstall();
|
|
61990
62060
|
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
@@ -62019,7 +62089,7 @@ var configure7 = async (ctx) => {
|
|
|
62019
62089
|
};
|
|
62020
62090
|
var config12 = {
|
|
62021
62091
|
generate: generate12,
|
|
62022
|
-
configure:
|
|
62092
|
+
configure: configure8,
|
|
62023
62093
|
displayName: "Svelte",
|
|
62024
62094
|
packageScripts: {
|
|
62025
62095
|
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 5173 -- ${npm10} run dev`,
|
|
@@ -62037,7 +62107,7 @@ var versionMap_default = {
|
|
|
62037
62107
|
hono: "0.2.6",
|
|
62038
62108
|
next: "13.4.2",
|
|
62039
62109
|
nuxt: "3.4.2",
|
|
62040
|
-
qwik: "1.
|
|
62110
|
+
qwik: "1.2.7",
|
|
62041
62111
|
react: "5.0.1",
|
|
62042
62112
|
remix: "1.16.0",
|
|
62043
62113
|
solid: "0.2.26",
|
|
@@ -62117,11 +62187,11 @@ var runPagesGenerator = async (args) => {
|
|
|
62117
62187
|
},
|
|
62118
62188
|
args
|
|
62119
62189
|
};
|
|
62120
|
-
const { generate: generate14, configure:
|
|
62190
|
+
const { generate: generate14, configure: configure9 } = FrameworkMap[framework];
|
|
62121
62191
|
await generate14({ ...ctx });
|
|
62122
62192
|
startSection("Configuring your application for Cloudflare", "Step 2 of 3");
|
|
62123
|
-
if (
|
|
62124
|
-
await
|
|
62193
|
+
if (configure9) {
|
|
62194
|
+
await configure9({ ...ctx });
|
|
62125
62195
|
}
|
|
62126
62196
|
await updatePackageScripts(ctx);
|
|
62127
62197
|
await offerGit(ctx);
|
|
@@ -62189,6 +62259,8 @@ var updatePackageScripts = async (ctx) => {
|
|
|
62189
62259
|
var createProject = async (ctx) => {
|
|
62190
62260
|
if (ctx.args.deploy === false)
|
|
62191
62261
|
return;
|
|
62262
|
+
if (ctx.framework?.config.type === "workers")
|
|
62263
|
+
return;
|
|
62192
62264
|
if (!ctx.account?.id) {
|
|
62193
62265
|
crash("Failed to read Cloudflare account.");
|
|
62194
62266
|
return;
|
|
@@ -62202,7 +62274,9 @@ var createProject = async (ctx) => {
|
|
|
62202
62274
|
await retry(
|
|
62203
62275
|
CREATE_PROJECT_RETRIES,
|
|
62204
62276
|
async () => runCommand(cmd, {
|
|
62205
|
-
|
|
62277
|
+
// Make this command more verbose in test mode to aid
|
|
62278
|
+
// troubleshooting API errors
|
|
62279
|
+
silent: process.env.VITEST == void 0,
|
|
62206
62280
|
cwd: ctx.project.path,
|
|
62207
62281
|
env: { CLOUDFLARE_ACCOUNT_ID },
|
|
62208
62282
|
startText: "Creating Pages project",
|
|
@@ -62210,7 +62284,7 @@ var createProject = async (ctx) => {
|
|
|
62210
62284
|
})
|
|
62211
62285
|
);
|
|
62212
62286
|
} catch (error) {
|
|
62213
|
-
crash("Failed to create pages
|
|
62287
|
+
crash("Failed to create pages project. See output above.");
|
|
62214
62288
|
}
|
|
62215
62289
|
};
|
|
62216
62290
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-cloudflare",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-a5e7c0be",
|
|
4
4
|
"description": "A CLI for creating and deploying new applications to Cloudflare.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -26,14 +26,16 @@
|
|
|
26
26
|
"templates"
|
|
27
27
|
],
|
|
28
28
|
"scripts": {
|
|
29
|
-
"build": "node scripts/build.
|
|
29
|
+
"build": "node -r esbuild-register scripts/build.ts",
|
|
30
30
|
"check:lint": "eslint .",
|
|
31
31
|
"check:type": "tsc",
|
|
32
32
|
"lint": "eslint",
|
|
33
33
|
"prepublishOnly": "npm run build",
|
|
34
|
-
"test:e2e": "
|
|
34
|
+
"test:e2e:cleanup": "node -r esbuild-register scripts/e2eCleanup.ts",
|
|
35
|
+
"test:e2e:npm": "npm run build && TEST_PM=npm vitest run --config ./vitest-e2e.config.ts",
|
|
36
|
+
"test:e2e:pnpm": "npm run build && TEST_PM=pnpm vitest run --config ./vitest-e2e.config.ts",
|
|
35
37
|
"test:unit": "vitest run --config ./vitest.config.ts",
|
|
36
|
-
"watch": "node scripts/build.
|
|
38
|
+
"watch": "node -r esbuild-register scripts/build.ts --watch"
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|
|
39
41
|
"@babel/parser": "^7.21.3",
|
|
@@ -60,6 +62,7 @@
|
|
|
60
62
|
"haikunator": "^2.1.2",
|
|
61
63
|
"log-update": "^5.0.1",
|
|
62
64
|
"open": "^8.4.0",
|
|
65
|
+
"pnpm": "^8.6.11",
|
|
63
66
|
"recast": "^0.22.0",
|
|
64
67
|
"semver": "^7.5.1",
|
|
65
68
|
"typescript": "^5.0.2",
|
|
@@ -68,7 +71,8 @@
|
|
|
68
71
|
"vitest": "^0.30.0",
|
|
69
72
|
"which-pm-runs": "^1.1.0",
|
|
70
73
|
"wrangler": "*",
|
|
71
|
-
"yargs": "^17.7.1"
|
|
74
|
+
"yargs": "^17.7.1",
|
|
75
|
+
"yarn": "^1.22.19"
|
|
72
76
|
},
|
|
73
77
|
"engines": {
|
|
74
78
|
"node": ">=16.13.0"
|