create-cloudflare 2.47.2 → 2.48.0
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 +87 -66
- package/package.json +4 -4
- package/templates/hello-world-assets-only/templates/public/index.html +1 -0
- package/templates/hello-world-assets-only/templates/wrangler.jsonc +1 -0
- package/templates/hello-world-durable-object-with-assets/js/public/index.html +1 -0
- package/templates/hello-world-durable-object-with-assets/js/wrangler.jsonc +1 -1
- package/templates/hello-world-durable-object-with-assets/py/public/index.html +1 -0
- package/templates/hello-world-durable-object-with-assets/py/wrangler.jsonc +1 -1
- package/templates/hello-world-durable-object-with-assets/ts/public/index.html +1 -0
- package/templates/hello-world-durable-object-with-assets/ts/wrangler.jsonc +1 -1
- package/templates/hello-world-with-assets/js/public/index.html +1 -0
- package/templates/hello-world-with-assets/js/wrangler.jsonc +1 -1
- package/templates/hello-world-with-assets/py/public/index.html +1 -0
- package/templates/hello-world-with-assets/py/wrangler.jsonc +1 -1
- package/templates/hello-world-with-assets/ts/public/index.html +1 -0
- package/templates/hello-world-with-assets/ts/wrangler.jsonc +1 -2
- package/templates/hello-world-workflows/c3.ts +20 -0
- package/templates/hello-world-workflows/js/package.json +13 -0
- package/templates/hello-world-workflows/js/src/index.js +129 -0
- package/templates/hello-world-workflows/js/wrangler.jsonc +17 -0
- package/templates/hello-world-workflows/ts/package.json +15 -0
- package/templates/hello-world-workflows/ts/src/index.ts +111 -0
- package/templates/hello-world-workflows/ts/tsconfig.json +40 -0
- package/templates/hello-world-workflows/ts/wrangler.jsonc +17 -0
package/dist/cli.js
CHANGED
|
@@ -74560,7 +74560,7 @@ var Yargs = YargsFactory(esm_default);
|
|
|
74560
74560
|
var yargs_default = Yargs;
|
|
74561
74561
|
|
|
74562
74562
|
// package.json
|
|
74563
|
-
var version = "2.
|
|
74563
|
+
var version = "2.48.0";
|
|
74564
74564
|
|
|
74565
74565
|
// src/metrics.ts
|
|
74566
74566
|
var import_node_async_hooks = require("node:async_hooks");
|
|
@@ -75335,20 +75335,20 @@ var package_default = {
|
|
|
75335
75335
|
"so that we can use dependabot to update these dependencies automatically."
|
|
75336
75336
|
],
|
|
75337
75337
|
dependencies: {
|
|
75338
|
-
"create-astro": "4.
|
|
75338
|
+
"create-astro": "4.12.1",
|
|
75339
75339
|
"create-analog": "1.8.1",
|
|
75340
75340
|
"@angular/create": "19.2.12",
|
|
75341
|
-
"create-docusaurus": "3.
|
|
75341
|
+
"create-docusaurus": "3.8.0",
|
|
75342
75342
|
"create-hono": "0.19.1",
|
|
75343
|
-
"create-next-app": "15.3.
|
|
75344
|
-
"create-qwik": "1.
|
|
75343
|
+
"create-next-app": "15.3.3",
|
|
75344
|
+
"create-qwik": "1.14.1",
|
|
75345
75345
|
"create-vite": "6.5.0",
|
|
75346
75346
|
"create-remix": "2.16.6",
|
|
75347
|
-
"create-react-router": "7.6.
|
|
75347
|
+
"create-react-router": "7.6.1",
|
|
75348
75348
|
"create-solid": "0.6.2",
|
|
75349
75349
|
"create-vue": "3.16.4",
|
|
75350
75350
|
gatsby: "5.14.3",
|
|
75351
|
-
sv: "0.8.
|
|
75351
|
+
sv: "0.8.7",
|
|
75352
75352
|
nuxi: "3.25.1"
|
|
75353
75353
|
}
|
|
75354
75354
|
};
|
|
@@ -76271,10 +76271,29 @@ var config19 = {
|
|
|
76271
76271
|
};
|
|
76272
76272
|
var c3_default19 = config19;
|
|
76273
76273
|
|
|
76274
|
+
// templates/hello-world-workflows/c3.ts
|
|
76275
|
+
var c3_default20 = {
|
|
76276
|
+
configVersion: 1,
|
|
76277
|
+
id: "hello-world-workflows",
|
|
76278
|
+
displayName: "Workflow",
|
|
76279
|
+
description: "For multi-step applications that automatically retry, persist state, and run for minutes, hours, days or weeks",
|
|
76280
|
+
platform: "workers",
|
|
76281
|
+
copyFiles: {
|
|
76282
|
+
variants: {
|
|
76283
|
+
js: {
|
|
76284
|
+
path: "./js"
|
|
76285
|
+
},
|
|
76286
|
+
ts: {
|
|
76287
|
+
path: "./ts"
|
|
76288
|
+
}
|
|
76289
|
+
}
|
|
76290
|
+
}
|
|
76291
|
+
};
|
|
76292
|
+
|
|
76274
76293
|
// templates/hello-world/c3.ts
|
|
76275
76294
|
var import_promises2 = require("node:fs/promises");
|
|
76276
76295
|
var import_node_path5 = require("node:path");
|
|
76277
|
-
var
|
|
76296
|
+
var c3_default21 = {
|
|
76278
76297
|
configVersion: 1,
|
|
76279
76298
|
id: "hello-world",
|
|
76280
76299
|
displayName: "Worker only",
|
|
@@ -76344,7 +76363,7 @@ var config20 = {
|
|
|
76344
76363
|
previewScript: "preview",
|
|
76345
76364
|
envInterfaceName
|
|
76346
76365
|
};
|
|
76347
|
-
var
|
|
76366
|
+
var c3_default22 = config20;
|
|
76348
76367
|
|
|
76349
76368
|
// templates/hono/workers/c3.ts
|
|
76350
76369
|
var generate12 = async (ctx) => {
|
|
@@ -76381,14 +76400,14 @@ var config21 = {
|
|
|
76381
76400
|
previewScript: "dev",
|
|
76382
76401
|
envInterfaceName: envInterfaceName2
|
|
76383
76402
|
};
|
|
76384
|
-
var
|
|
76403
|
+
var c3_default23 = config21;
|
|
76385
76404
|
|
|
76386
76405
|
// templates/hono/c3.ts
|
|
76387
76406
|
var config22 = {
|
|
76388
76407
|
displayName: "Hono",
|
|
76389
|
-
platformVariants: { pages:
|
|
76408
|
+
platformVariants: { pages: c3_default22, workers: c3_default23 }
|
|
76390
76409
|
};
|
|
76391
|
-
var
|
|
76410
|
+
var c3_default24 = config22;
|
|
76392
76411
|
|
|
76393
76412
|
// templates/next/pages/c3.ts
|
|
76394
76413
|
var import_path10 = require("path");
|
|
@@ -76487,7 +76506,7 @@ var addDevDependencies = async (installEslintPlugin) => {
|
|
|
76487
76506
|
};
|
|
76488
76507
|
var envInterfaceName3 = "CloudflareEnv";
|
|
76489
76508
|
var typesPath = "./env.d.ts";
|
|
76490
|
-
var
|
|
76509
|
+
var c3_default25 = {
|
|
76491
76510
|
configVersion: 1,
|
|
76492
76511
|
id: "next",
|
|
76493
76512
|
frameworkCli: "create-next-app",
|
|
@@ -76580,7 +76599,7 @@ var updateNextConfig2 = (usesTs) => {
|
|
|
76580
76599
|
};
|
|
76581
76600
|
var envInterfaceName4 = "CloudflareEnv";
|
|
76582
76601
|
var typesPath2 = "./cloudflare-env.d.ts";
|
|
76583
|
-
var
|
|
76602
|
+
var c3_default26 = {
|
|
76584
76603
|
configVersion: 1,
|
|
76585
76604
|
id: "next",
|
|
76586
76605
|
frameworkCli: "create-next-app",
|
|
@@ -76609,9 +76628,9 @@ var c3_default25 = {
|
|
|
76609
76628
|
// templates/next/c3.ts
|
|
76610
76629
|
var config23 = {
|
|
76611
76630
|
displayName: "Next.js",
|
|
76612
|
-
platformVariants: { pages:
|
|
76631
|
+
platformVariants: { pages: c3_default25, workers: c3_default26 }
|
|
76613
76632
|
};
|
|
76614
|
-
var
|
|
76633
|
+
var c3_default27 = config23;
|
|
76615
76634
|
|
|
76616
76635
|
// templates/nuxt/pages/c3.ts
|
|
76617
76636
|
var recast6 = __toESM(require_main3());
|
|
@@ -76707,7 +76726,7 @@ var config24 = {
|
|
|
76707
76726
|
deployScript: "deploy",
|
|
76708
76727
|
previewScript: "preview"
|
|
76709
76728
|
};
|
|
76710
|
-
var
|
|
76729
|
+
var c3_default28 = config24;
|
|
76711
76730
|
|
|
76712
76731
|
// templates/nuxt/workers/c3.ts
|
|
76713
76732
|
var recast7 = __toESM(require_main3());
|
|
@@ -76802,14 +76821,14 @@ var config25 = {
|
|
|
76802
76821
|
deployScript: "deploy",
|
|
76803
76822
|
previewScript: "preview"
|
|
76804
76823
|
};
|
|
76805
|
-
var
|
|
76824
|
+
var c3_default29 = config25;
|
|
76806
76825
|
|
|
76807
76826
|
// templates/nuxt/c3.ts
|
|
76808
76827
|
var config26 = {
|
|
76809
76828
|
displayName: "Nuxt",
|
|
76810
|
-
platformVariants: { pages:
|
|
76829
|
+
platformVariants: { pages: c3_default28, workers: c3_default29 }
|
|
76811
76830
|
};
|
|
76812
|
-
var
|
|
76831
|
+
var c3_default30 = config26;
|
|
76813
76832
|
|
|
76814
76833
|
// templates/openapi/c3.ts
|
|
76815
76834
|
var config27 = {
|
|
@@ -76822,7 +76841,7 @@ var config27 = {
|
|
|
76822
76841
|
path: "./ts"
|
|
76823
76842
|
}
|
|
76824
76843
|
};
|
|
76825
|
-
var
|
|
76844
|
+
var c3_default31 = config27;
|
|
76826
76845
|
|
|
76827
76846
|
// templates/pre-existing/c3.ts
|
|
76828
76847
|
var import_promises3 = require("fs/promises");
|
|
@@ -76988,7 +77007,7 @@ var config28 = {
|
|
|
76988
77007
|
copyFiles: copyExistingWorkerFiles
|
|
76989
77008
|
})
|
|
76990
77009
|
};
|
|
76991
|
-
var
|
|
77010
|
+
var c3_default32 = config28;
|
|
76992
77011
|
function buildConfigure(params) {
|
|
76993
77012
|
return async function configure21(ctx) {
|
|
76994
77013
|
const loginSuccess = await params.login(ctx);
|
|
@@ -77029,7 +77048,7 @@ var config29 = {
|
|
|
77029
77048
|
]
|
|
77030
77049
|
}
|
|
77031
77050
|
};
|
|
77032
|
-
var
|
|
77051
|
+
var c3_default33 = config29;
|
|
77033
77052
|
|
|
77034
77053
|
// templates/qwik/pages/c3.ts
|
|
77035
77054
|
var recast8 = __toESM(require_main3());
|
|
@@ -77139,7 +77158,7 @@ var config30 = {
|
|
|
77139
77158
|
previewScript: "preview",
|
|
77140
77159
|
workersTypes: "installed"
|
|
77141
77160
|
};
|
|
77142
|
-
var
|
|
77161
|
+
var c3_default34 = config30;
|
|
77143
77162
|
|
|
77144
77163
|
// templates/qwik/workers/c3.ts
|
|
77145
77164
|
var recast9 = __toESM(require_main3());
|
|
@@ -77249,14 +77268,14 @@ var config31 = {
|
|
|
77249
77268
|
previewScript: "preview",
|
|
77250
77269
|
workersTypes: "installed"
|
|
77251
77270
|
};
|
|
77252
|
-
var
|
|
77271
|
+
var c3_default35 = config31;
|
|
77253
77272
|
|
|
77254
77273
|
// templates/qwik/c3.ts
|
|
77255
77274
|
var config32 = {
|
|
77256
77275
|
displayName: "Qwik",
|
|
77257
|
-
platformVariants: { pages:
|
|
77276
|
+
platformVariants: { pages: c3_default34, workers: c3_default35 }
|
|
77258
77277
|
};
|
|
77259
|
-
var
|
|
77278
|
+
var c3_default36 = config32;
|
|
77260
77279
|
|
|
77261
77280
|
// templates/react-router/c3.ts
|
|
77262
77281
|
var { npm: npm14 } = detectPackageManager();
|
|
@@ -77290,7 +77309,7 @@ var config33 = {
|
|
|
77290
77309
|
deployScript: "deploy",
|
|
77291
77310
|
previewScript: "preview"
|
|
77292
77311
|
};
|
|
77293
|
-
var
|
|
77312
|
+
var c3_default37 = config33;
|
|
77294
77313
|
|
|
77295
77314
|
// templates/react/pages/c3.ts
|
|
77296
77315
|
var { npm: npm15 } = detectPackageManager();
|
|
@@ -77345,7 +77364,7 @@ var config34 = {
|
|
|
77345
77364
|
deployScript: "deploy",
|
|
77346
77365
|
previewScript: "preview"
|
|
77347
77366
|
};
|
|
77348
|
-
var
|
|
77367
|
+
var c3_default38 = config34;
|
|
77349
77368
|
|
|
77350
77369
|
// templates/react/workers/c3.ts
|
|
77351
77370
|
var import_assert2 = __toESM(require("assert"));
|
|
@@ -77483,14 +77502,14 @@ var config35 = {
|
|
|
77483
77502
|
deployScript: "deploy",
|
|
77484
77503
|
previewScript: "preview"
|
|
77485
77504
|
};
|
|
77486
|
-
var
|
|
77505
|
+
var c3_default39 = config35;
|
|
77487
77506
|
|
|
77488
77507
|
// templates/react/c3.ts
|
|
77489
77508
|
var config36 = {
|
|
77490
77509
|
displayName: "React",
|
|
77491
|
-
platformVariants: { pages:
|
|
77510
|
+
platformVariants: { pages: c3_default38, workers: c3_default39 }
|
|
77492
77511
|
};
|
|
77493
|
-
var
|
|
77512
|
+
var c3_default40 = config36;
|
|
77494
77513
|
|
|
77495
77514
|
// templates/remix/pages/c3.ts
|
|
77496
77515
|
var { npm: npm17 } = detectPackageManager();
|
|
@@ -77542,7 +77561,7 @@ var config37 = {
|
|
|
77542
77561
|
previewScript: "preview",
|
|
77543
77562
|
workersTypes: "installed"
|
|
77544
77563
|
};
|
|
77545
|
-
var
|
|
77564
|
+
var c3_default41 = config37;
|
|
77546
77565
|
|
|
77547
77566
|
// templates/remix/workers/c3.ts
|
|
77548
77567
|
var { npm: npm18 } = detectPackageManager();
|
|
@@ -77585,15 +77604,15 @@ var config38 = {
|
|
|
77585
77604
|
previewScript: "preview",
|
|
77586
77605
|
workersTypes: "installed"
|
|
77587
77606
|
};
|
|
77588
|
-
var
|
|
77607
|
+
var c3_default42 = config38;
|
|
77589
77608
|
|
|
77590
77609
|
// templates/remix/c3.ts
|
|
77591
77610
|
var config39 = {
|
|
77592
77611
|
displayName: "Remix",
|
|
77593
|
-
platformVariants: { pages:
|
|
77612
|
+
platformVariants: { pages: c3_default41, workers: c3_default42 },
|
|
77594
77613
|
hidden: true
|
|
77595
77614
|
};
|
|
77596
|
-
var
|
|
77615
|
+
var c3_default43 = config39;
|
|
77597
77616
|
|
|
77598
77617
|
// templates/scheduled/c3.ts
|
|
77599
77618
|
var config40 = {
|
|
@@ -77613,7 +77632,7 @@ var config40 = {
|
|
|
77613
77632
|
}
|
|
77614
77633
|
}
|
|
77615
77634
|
};
|
|
77616
|
-
var
|
|
77635
|
+
var c3_default44 = config40;
|
|
77617
77636
|
|
|
77618
77637
|
// templates/solid/c3.ts
|
|
77619
77638
|
var recast11 = __toESM(require_main3());
|
|
@@ -77683,7 +77702,7 @@ var config41 = {
|
|
|
77683
77702
|
deployScript: "deploy",
|
|
77684
77703
|
previewScript: "preview"
|
|
77685
77704
|
};
|
|
77686
|
-
var
|
|
77705
|
+
var c3_default45 = config41;
|
|
77687
77706
|
|
|
77688
77707
|
// templates/svelte/pages/c3.ts
|
|
77689
77708
|
var import_node_fs3 = require("node:fs");
|
|
@@ -77807,7 +77826,7 @@ var config42 = {
|
|
|
77807
77826
|
previewScript: "preview",
|
|
77808
77827
|
typesPath: typesPath3
|
|
77809
77828
|
};
|
|
77810
|
-
var
|
|
77829
|
+
var c3_default46 = config42;
|
|
77811
77830
|
|
|
77812
77831
|
// templates/svelte/workers/c3.ts
|
|
77813
77832
|
var recast13 = __toESM(require_main3());
|
|
@@ -77906,14 +77925,14 @@ var config43 = {
|
|
|
77906
77925
|
previewScript: "preview",
|
|
77907
77926
|
typesPath: typesPath4
|
|
77908
77927
|
};
|
|
77909
|
-
var
|
|
77928
|
+
var c3_default47 = config43;
|
|
77910
77929
|
|
|
77911
77930
|
// templates/svelte/c3.ts
|
|
77912
77931
|
var config44 = {
|
|
77913
77932
|
displayName: "SvelteKit",
|
|
77914
|
-
platformVariants: { pages:
|
|
77933
|
+
platformVariants: { pages: c3_default46, workers: c3_default47 }
|
|
77915
77934
|
};
|
|
77916
|
-
var
|
|
77935
|
+
var c3_default48 = config44;
|
|
77917
77936
|
|
|
77918
77937
|
// templates/vue/pages/c3.ts
|
|
77919
77938
|
var { npm: npm22 } = detectPackageManager();
|
|
@@ -77941,7 +77960,7 @@ var config45 = {
|
|
|
77941
77960
|
deployScript: "deploy",
|
|
77942
77961
|
previewScript: "preview"
|
|
77943
77962
|
};
|
|
77944
|
-
var
|
|
77963
|
+
var c3_default49 = config45;
|
|
77945
77964
|
|
|
77946
77965
|
// templates/vue/workers/c3.ts
|
|
77947
77966
|
var { npm: npm23 } = detectPackageManager();
|
|
@@ -78016,20 +78035,20 @@ var config46 = {
|
|
|
78016
78035
|
deployScript: "deploy",
|
|
78017
78036
|
previewScript: "preview"
|
|
78018
78037
|
};
|
|
78019
|
-
var
|
|
78038
|
+
var c3_default50 = config46;
|
|
78020
78039
|
|
|
78021
78040
|
// templates/vue/c3.ts
|
|
78022
78041
|
var config47 = {
|
|
78023
78042
|
displayName: "Vue",
|
|
78024
|
-
platformVariants: { pages:
|
|
78043
|
+
platformVariants: { pages: c3_default49, workers: c3_default50 }
|
|
78025
78044
|
};
|
|
78026
|
-
var
|
|
78045
|
+
var c3_default51 = config47;
|
|
78027
78046
|
|
|
78028
78047
|
// src/git.ts
|
|
78029
78048
|
var import_node_assert = __toESM(require("node:assert"));
|
|
78030
78049
|
|
|
78031
78050
|
// ../wrangler/package.json
|
|
78032
|
-
var version2 = "4.
|
|
78051
|
+
var version2 = "4.19.0";
|
|
78033
78052
|
|
|
78034
78053
|
// src/git.ts
|
|
78035
78054
|
var offerGit = async (ctx) => {
|
|
@@ -78299,16 +78318,16 @@ function getFrameworkMap({ experimental = false }) {
|
|
|
78299
78318
|
astro: c3_default8,
|
|
78300
78319
|
docusaurus: c3_default12,
|
|
78301
78320
|
gatsby: c3_default15,
|
|
78302
|
-
hono:
|
|
78303
|
-
next:
|
|
78304
|
-
nuxt:
|
|
78305
|
-
qwik:
|
|
78306
|
-
react:
|
|
78307
|
-
"react-router":
|
|
78308
|
-
remix:
|
|
78309
|
-
solid:
|
|
78310
|
-
svelte:
|
|
78311
|
-
vue:
|
|
78321
|
+
hono: c3_default24,
|
|
78322
|
+
next: c3_default27,
|
|
78323
|
+
nuxt: c3_default30,
|
|
78324
|
+
qwik: c3_default36,
|
|
78325
|
+
react: c3_default40,
|
|
78326
|
+
"react-router": c3_default37,
|
|
78327
|
+
remix: c3_default43,
|
|
78328
|
+
solid: c3_default45,
|
|
78329
|
+
svelte: c3_default48,
|
|
78330
|
+
vue: c3_default51
|
|
78312
78331
|
};
|
|
78313
78332
|
}
|
|
78314
78333
|
}
|
|
@@ -78320,10 +78339,10 @@ function getOtherTemplateMap({
|
|
|
78320
78339
|
} else {
|
|
78321
78340
|
return {
|
|
78322
78341
|
common: c3_default9,
|
|
78323
|
-
scheduled:
|
|
78324
|
-
queues:
|
|
78325
|
-
openapi:
|
|
78326
|
-
"pre-existing":
|
|
78342
|
+
scheduled: c3_default44,
|
|
78343
|
+
queues: c3_default33,
|
|
78344
|
+
openapi: c3_default31,
|
|
78345
|
+
"pre-existing": c3_default32
|
|
78327
78346
|
};
|
|
78328
78347
|
}
|
|
78329
78348
|
}
|
|
@@ -78334,16 +78353,17 @@ function getHelloWorldTemplateMap({
|
|
|
78334
78353
|
return {};
|
|
78335
78354
|
} else {
|
|
78336
78355
|
return {
|
|
78337
|
-
"hello-world":
|
|
78356
|
+
"hello-world": c3_default21,
|
|
78338
78357
|
"hello-world-assets-only": c3_default16,
|
|
78339
78358
|
"hello-world-with-assets": c3_default19,
|
|
78340
78359
|
"hello-world-durable-object": c3_default18,
|
|
78341
78360
|
"hello-world-durable-object-with-assets": c3_default17,
|
|
78361
|
+
"hello-world-workflows": c3_default20,
|
|
78342
78362
|
common: c3_default9,
|
|
78343
|
-
scheduled:
|
|
78344
|
-
queues:
|
|
78345
|
-
openapi:
|
|
78346
|
-
"pre-existing":
|
|
78363
|
+
scheduled: c3_default44,
|
|
78364
|
+
queues: c3_default33,
|
|
78365
|
+
openapi: c3_default31,
|
|
78366
|
+
"pre-existing": c3_default32
|
|
78347
78367
|
};
|
|
78348
78368
|
}
|
|
78349
78369
|
}
|
|
@@ -78363,6 +78383,7 @@ var deriveCorrelatedArgs = (args) => {
|
|
|
78363
78383
|
switch (args.type) {
|
|
78364
78384
|
case "hello-world":
|
|
78365
78385
|
case "hello-world-durable-object":
|
|
78386
|
+
case "hello-world-workflows":
|
|
78366
78387
|
args.category ??= "hello-world";
|
|
78367
78388
|
break;
|
|
78368
78389
|
case "hello-world-python":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-cloudflare",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.48.0",
|
|
4
4
|
"description": "A CLI for creating and deploying new applications to Cloudflare.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@babel/parser": "^7.21.3",
|
|
31
31
|
"@babel/types": "^7.21.4",
|
|
32
32
|
"@clack/prompts": "^0.6.3",
|
|
33
|
-
"@cloudflare/workers-types": "^4.
|
|
33
|
+
"@cloudflare/workers-types": "^4.20250525.0",
|
|
34
34
|
"@iarna/toml": "^3.0.0",
|
|
35
35
|
"@types/command-exists": "^1.2.0",
|
|
36
36
|
"@types/cross-spawn": "^6.0.2",
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
"@cloudflare/cli": "1.1.1",
|
|
74
74
|
"@cloudflare/eslint-config-worker": "1.1.0",
|
|
75
75
|
"@cloudflare/mock-npm-registry": "0.0.0",
|
|
76
|
-
"@cloudflare/vite-plugin": "1.
|
|
76
|
+
"@cloudflare/vite-plugin": "1.4.0",
|
|
77
77
|
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
78
|
-
"wrangler": "4.
|
|
78
|
+
"wrangler": "4.19.0"
|
|
79
79
|
},
|
|
80
80
|
"engines": {
|
|
81
81
|
"node": ">=18.14.1"
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Hello, World!</title>
|
|
7
|
+
<p>This page comes from a static asset stored at `public/index.html` as configured in `wrangler.jsonc`.</p>
|
|
7
8
|
</head>
|
|
8
9
|
<body>
|
|
9
10
|
<h1 id="heading"></h1>
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
|
9
9
|
<h1 id="heading"></h1>
|
|
10
|
+
<p>This page comes from a static asset stored at `public/index.html` as configured in `wrangler.jsonc`.</p>
|
|
10
11
|
<button id="button" type="button">Fetch a random UUID</button>
|
|
11
12
|
<output id="random" for="button"></output>
|
|
12
13
|
<script>
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
|
9
9
|
<h1 id="heading"></h1>
|
|
10
|
+
<p>This page comes from a static asset stored at `public/index.html` as configured in `wrangler.jsonc`.</p>
|
|
10
11
|
<button id="button" type="button">Fetch a random UUID</button>
|
|
11
12
|
<output id="random" for="button"></output>
|
|
12
13
|
<script>
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
|
9
9
|
<h1 id="heading"></h1>
|
|
10
|
+
<p>This page comes from a static asset stored at `public/index.html` as configured in `wrangler.jsonc`.</p>
|
|
10
11
|
<button id="button" type="button">Fetch a random UUID</button>
|
|
11
12
|
<output id="random" for="button"></output>
|
|
12
13
|
<script>
|
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
"main": "src/index.ts",
|
|
4
4
|
"compatibility_date": "<TBD>",
|
|
5
5
|
"compatibility_flags": [
|
|
6
|
-
"nodejs_compat",
|
|
7
6
|
"global_fetch_strictly_public"
|
|
8
7
|
],
|
|
9
8
|
"assets": {
|
|
10
|
-
|
|
9
|
+
// The path to the directory containing the `index.html` file to be served at `/`
|
|
11
10
|
"directory": "./public"
|
|
12
11
|
},
|
|
13
12
|
"observability": {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TemplateConfig } from "../../src/templates";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
configVersion: 1,
|
|
5
|
+
id: "hello-world-workflows",
|
|
6
|
+
displayName: "Workflow",
|
|
7
|
+
description:
|
|
8
|
+
"For multi-step applications that automatically retry, persist state, and run for minutes, hours, days or weeks",
|
|
9
|
+
platform: "workers",
|
|
10
|
+
copyFiles: {
|
|
11
|
+
variants: {
|
|
12
|
+
js: {
|
|
13
|
+
path: "./js",
|
|
14
|
+
},
|
|
15
|
+
ts: {
|
|
16
|
+
path: "./ts",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
} satisfies TemplateConfig;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { WorkflowEntrypoint } from "cloudflare:workers";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Welcome to Cloudflare Workers! This is your first Workflows application.
|
|
5
|
+
*
|
|
6
|
+
* - Run `npm run dev` in your terminal to start a development server
|
|
7
|
+
* - Open a browser tab at http://localhost:8787/ to see your Workflow in action
|
|
8
|
+
* - Run `npm run deploy` to publish your application
|
|
9
|
+
*
|
|
10
|
+
* Learn more at https://developers.cloudflare.com/workflows
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {Object} Env
|
|
15
|
+
* @property {Workflow} MY_WORKFLOW
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {Object} Params
|
|
20
|
+
* @property {string} email
|
|
21
|
+
* @property {Record<string, string>} metadata
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export class MyWorkflow extends WorkflowEntrypoint {
|
|
25
|
+
/**
|
|
26
|
+
* @param {Env} env
|
|
27
|
+
*/
|
|
28
|
+
constructor(env) {
|
|
29
|
+
this.env = env;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @param {WorkflowEvent<Params>} event
|
|
34
|
+
* @param {WorkflowStep} step
|
|
35
|
+
*/
|
|
36
|
+
async run(event, step) {
|
|
37
|
+
// Can access bindings on `this.env`
|
|
38
|
+
// Can access params on `event.payload`
|
|
39
|
+
|
|
40
|
+
const files = await step.do("my first step", async () => {
|
|
41
|
+
// Fetch a list of files from $SOME_SERVICE
|
|
42
|
+
return {
|
|
43
|
+
inputParams: event,
|
|
44
|
+
files: [
|
|
45
|
+
"doc_7392_rev3.pdf",
|
|
46
|
+
"report_x29_final.pdf",
|
|
47
|
+
"memo_2024_05_12.pdf",
|
|
48
|
+
"file_089_update.pdf",
|
|
49
|
+
"proj_alpha_v2.pdf",
|
|
50
|
+
"data_analysis_q2.pdf",
|
|
51
|
+
"notes_meeting_52.pdf",
|
|
52
|
+
"summary_fy24_draft.pdf",
|
|
53
|
+
],
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// You can optionally have a Workflow wait for additional data,
|
|
58
|
+
// human approval or an external webhook or HTTP request before progressing.
|
|
59
|
+
// You can submit data via HTTP POST to /accounts/{account_id}/workflows/{workflow_name}/instances/{instance_id}/events/{eventName}
|
|
60
|
+
const waitForApproval = await step.waitForEvent("request-approval", {
|
|
61
|
+
type: "approval", // define an optional key to switch on
|
|
62
|
+
timeout: "1 minute", // keep it short for the example!
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const apiResponse = await step.do("some other step", async () => {
|
|
66
|
+
let resp = await fetch("https://api.cloudflare.com/client/v4/ips");
|
|
67
|
+
return await resp.json();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
await step.sleep("wait on something", "1 minute");
|
|
71
|
+
|
|
72
|
+
await step.do(
|
|
73
|
+
"make a call to write that could maybe, just might, fail",
|
|
74
|
+
// Define a retry strategy
|
|
75
|
+
/** @type {Object} */ ({
|
|
76
|
+
retries: {
|
|
77
|
+
limit: 5,
|
|
78
|
+
delay: "5 second",
|
|
79
|
+
backoff: "exponential",
|
|
80
|
+
},
|
|
81
|
+
timeout: "15 minutes",
|
|
82
|
+
}),
|
|
83
|
+
async () => {
|
|
84
|
+
// Do stuff here, with access to the state from our previous steps
|
|
85
|
+
if (Math.random() > 0.5) {
|
|
86
|
+
throw new Error("API call to $STORAGE_SYSTEM failed");
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export default {
|
|
94
|
+
/**
|
|
95
|
+
* @param {Request} req
|
|
96
|
+
* @param {Env} env
|
|
97
|
+
* @returns {Promise<Response>}
|
|
98
|
+
*/
|
|
99
|
+
async fetch(req, env) {
|
|
100
|
+
let url = new URL(req.url);
|
|
101
|
+
|
|
102
|
+
if (url.pathname.startsWith("/favicon")) {
|
|
103
|
+
return Response.json({}, { status: 404 });
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Get the status of an existing instance, if provided
|
|
107
|
+
// GET /?instanceId=<id here>
|
|
108
|
+
let id = url.searchParams.get("instanceId");
|
|
109
|
+
if (id) {
|
|
110
|
+
let instance = await env.MY_WORKFLOW.get(id);
|
|
111
|
+
return Response.json({
|
|
112
|
+
status: await instance.status(),
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Spawn a new instance and return the ID and status
|
|
117
|
+
let instance = await env.MY_WORKFLOW.create();
|
|
118
|
+
// You can also set the ID to match an ID in your own system
|
|
119
|
+
// and pass an optional payload to the Workflow
|
|
120
|
+
// let instance = await env.MY_WORKFLOW.create({
|
|
121
|
+
// id: 'id-from-your-system',
|
|
122
|
+
// params: { payload: 'to send' },
|
|
123
|
+
// });
|
|
124
|
+
return Response.json({
|
|
125
|
+
id: instance.id,
|
|
126
|
+
details: await instance.status(),
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<TBD>",
|
|
3
|
+
"main": "src/index.js",
|
|
4
|
+
"compatibility_date": "<TBD>",
|
|
5
|
+
|
|
6
|
+
"observability": {
|
|
7
|
+
"enabled": true,
|
|
8
|
+
"head_sampling_rate": 1,
|
|
9
|
+
},
|
|
10
|
+
"workflows": [
|
|
11
|
+
{
|
|
12
|
+
"name": "<TBD>",
|
|
13
|
+
"binding": "MY_WORKFLOW",
|
|
14
|
+
"class_name": "MyWorkflow",
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<TBD>",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"deploy": "wrangler deploy",
|
|
7
|
+
"start": "wrangler dev",
|
|
8
|
+
"dev": "wrangler dev",
|
|
9
|
+
"cf-typegen": "wrangler types"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"typescript": "^5.0.4",
|
|
13
|
+
"wrangler": "^4.6.0"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WorkflowEntrypoint,
|
|
3
|
+
WorkflowEvent,
|
|
4
|
+
WorkflowStep,
|
|
5
|
+
} from "cloudflare:workers";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Welcome to Cloudflare Workers! This is your first Workflows application.
|
|
9
|
+
*
|
|
10
|
+
* - Run `npm run dev` in your terminal to start a development server
|
|
11
|
+
* - Open a browser tab at http://localhost:8787/ to see your Workflow in action
|
|
12
|
+
* - Run `npm run deploy` to publish your application
|
|
13
|
+
*
|
|
14
|
+
* Learn more at https://developers.cloudflare.com/workflows
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// User-defined params passed to your Workflow
|
|
18
|
+
type Params = {
|
|
19
|
+
email: string;
|
|
20
|
+
metadata: Record<string, string>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export class MyWorkflow extends WorkflowEntrypoint<Env, Params> {
|
|
24
|
+
async run(event: WorkflowEvent<Params>, step: WorkflowStep) {
|
|
25
|
+
// Can access bindings on `this.env`
|
|
26
|
+
// Can access params on `event.payload`
|
|
27
|
+
|
|
28
|
+
const files = await step.do("my first step", async () => {
|
|
29
|
+
// Fetch a list of files from $SOME_SERVICE
|
|
30
|
+
return {
|
|
31
|
+
inputParams: event,
|
|
32
|
+
files: [
|
|
33
|
+
"doc_7392_rev3.pdf",
|
|
34
|
+
"report_x29_final.pdf",
|
|
35
|
+
"memo_2024_05_12.pdf",
|
|
36
|
+
"file_089_update.pdf",
|
|
37
|
+
"proj_alpha_v2.pdf",
|
|
38
|
+
"data_analysis_q2.pdf",
|
|
39
|
+
"notes_meeting_52.pdf",
|
|
40
|
+
"summary_fy24_draft.pdf",
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// You can optionally have a Workflow wait for additional data,
|
|
46
|
+
// human approval or an external webhook or HTTP request, before progressing.
|
|
47
|
+
// You can submit data via HTTP POST to /accounts/{account_id}/workflows/{workflow_name}/instances/{instance_id}/events/{eventName}
|
|
48
|
+
const waitForApproval = await step.waitForEvent("request-approval", {
|
|
49
|
+
type: "approval", // define an optional key to switch on
|
|
50
|
+
timeout: "1 minute", // keep it short for the example!
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const apiResponse = await step.do("some other step", async () => {
|
|
54
|
+
let resp = await fetch("https://api.cloudflare.com/client/v4/ips");
|
|
55
|
+
return await resp.json<any>();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
await step.sleep("wait on something", "1 minute");
|
|
59
|
+
|
|
60
|
+
await step.do(
|
|
61
|
+
"make a call to write that could maybe, just might, fail",
|
|
62
|
+
// Define a retry strategy
|
|
63
|
+
{
|
|
64
|
+
retries: {
|
|
65
|
+
limit: 5,
|
|
66
|
+
delay: "5 second",
|
|
67
|
+
backoff: "exponential",
|
|
68
|
+
},
|
|
69
|
+
timeout: "15 minutes",
|
|
70
|
+
},
|
|
71
|
+
async () => {
|
|
72
|
+
// Do stuff here, with access to the state from our previous steps
|
|
73
|
+
if (Math.random() > 0.5) {
|
|
74
|
+
throw new Error("API call to $STORAGE_SYSTEM failed");
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
export default {
|
|
81
|
+
async fetch(req: Request, env: Env): Promise<Response> {
|
|
82
|
+
let url = new URL(req.url);
|
|
83
|
+
|
|
84
|
+
if (url.pathname.startsWith("/favicon")) {
|
|
85
|
+
return Response.json({}, { status: 404 });
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Get the status of an existing instance, if provided
|
|
89
|
+
// GET /?instanceId=<id here>
|
|
90
|
+
let id = url.searchParams.get("instanceId");
|
|
91
|
+
if (id) {
|
|
92
|
+
let instance = await env.MY_WORKFLOW.get(id);
|
|
93
|
+
return Response.json({
|
|
94
|
+
status: await instance.status(),
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Spawn a new instance and return the ID and status
|
|
99
|
+
let instance = await env.MY_WORKFLOW.create();
|
|
100
|
+
// You can also set the ID to match an ID in your own system
|
|
101
|
+
// and pass an optional payload to the Workflow
|
|
102
|
+
// let instance = await env.MY_WORKFLOW.create({
|
|
103
|
+
// id: 'id-from-your-system',
|
|
104
|
+
// params: { payload: 'to send' },
|
|
105
|
+
// });
|
|
106
|
+
return Response.json({
|
|
107
|
+
id: instance.id,
|
|
108
|
+
details: await instance.status(),
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
6
|
+
"target": "es2021",
|
|
7
|
+
/* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
8
|
+
"lib": ["es2021"],
|
|
9
|
+
/* Specify what JSX code is generated. */
|
|
10
|
+
"jsx": "react-jsx",
|
|
11
|
+
|
|
12
|
+
/* Specify what module code is generated. */
|
|
13
|
+
"module": "es2022",
|
|
14
|
+
/* Specify how TypeScript looks up a file from a given module specifier. */
|
|
15
|
+
"moduleResolution": "node",
|
|
16
|
+
/* Enable importing .json files */
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
|
|
19
|
+
/* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
|
|
20
|
+
"allowJs": true,
|
|
21
|
+
/* Enable error reporting in type-checked JavaScript files. */
|
|
22
|
+
"checkJs": false,
|
|
23
|
+
|
|
24
|
+
/* Disable emitting files from a compilation. */
|
|
25
|
+
"noEmit": true,
|
|
26
|
+
|
|
27
|
+
/* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
28
|
+
"isolatedModules": true,
|
|
29
|
+
/* Allow 'import x from y' when a module doesn't have a default export. */
|
|
30
|
+
"allowSyntheticDefaultImports": true,
|
|
31
|
+
/* Ensure that casing is correct in imports. */
|
|
32
|
+
"forceConsistentCasingInFileNames": true,
|
|
33
|
+
|
|
34
|
+
/* Enable all strict type-checking options. */
|
|
35
|
+
"strict": true,
|
|
36
|
+
|
|
37
|
+
/* Skip type checking all .d.ts files. */
|
|
38
|
+
"skipLibCheck": true
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<TBD>",
|
|
3
|
+
"main": "src/index.ts",
|
|
4
|
+
"compatibility_date": "<TBD>",
|
|
5
|
+
|
|
6
|
+
"observability": {
|
|
7
|
+
"enabled": true,
|
|
8
|
+
"head_sampling_rate": 1,
|
|
9
|
+
},
|
|
10
|
+
"workflows": [
|
|
11
|
+
{
|
|
12
|
+
"name": "<TBD>",
|
|
13
|
+
"binding": "MY_WORKFLOW",
|
|
14
|
+
"class_name": "MyWorkflow",
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
}
|