create-cloudflare 0.0.0-528cc0fc → 0.0.0-6b859a45
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/angular/templates/tools/bundle.mjs +5 -2
- package/dist/cli.js +67 -35
- package/package.json +1 -1
- package/templates/chatgptPlugin/ts/README.md +1 -1
- package/templates/chatgptPlugin/ts/package.json +1 -1
- package/templates/chatgptPlugin/ts/wrangler.toml +2 -2
- package/templates/common/js/package.json +1 -1
- package/templates/common/js/wrangler.toml +1 -1
- package/templates/common/ts/package.json +1 -1
- package/templates/common/ts/wrangler.toml +1 -1
- package/templates/hello-world/js/package.json +1 -1
- package/templates/hello-world/js/wrangler.toml +1 -1
- package/templates/hello-world/ts/package.json +1 -1
- package/templates/hello-world/ts/wrangler.toml +1 -1
- package/templates/queues/js/package.json +1 -1
- package/templates/queues/js/wrangler.toml +1 -1
- package/templates/queues/ts/package.json +1 -1
- package/templates/queues/ts/wrangler.toml +1 -1
- package/templates/scheduled/js/package.json +1 -1
- package/templates/scheduled/js/wrangler.toml +1 -1
- package/templates/scheduled/ts/package.json +1 -1
|
@@ -37,7 +37,8 @@ async function bundleMain() {
|
|
|
37
37
|
],
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
// Store the original promise (before Angular/Zone.js replaces it) on the global scope.
|
|
41
|
+
let main = "globalThis.OGPromise = Promise;\n" + result.outputFiles[0].text;
|
|
41
42
|
|
|
42
43
|
// Patch any dynamic imports (converting `require()` calls to `import()` calls).
|
|
43
44
|
main = main.replace(
|
|
@@ -45,7 +46,9 @@ async function bundleMain() {
|
|
|
45
46
|
'promises.push(import("./" + __webpack_require__.u(chunkId)).then((mod) => installChunk(mod.default))'
|
|
46
47
|
);
|
|
47
48
|
// Export the fetch handler (grabbing it from the global).
|
|
48
|
-
|
|
49
|
+
// Also Cloudflare expects `fetch()` to return an original Promise (not a ZoneAwarePromise).
|
|
50
|
+
main +=
|
|
51
|
+
"\nexport default { fetch: (request, env) => globalThis.OGPromise.resolve(globalThis.__workerFetchHandler(request, env)) };";
|
|
49
52
|
|
|
50
53
|
await fs.writeFile(path.resolve(workerPath, "index.js"), main);
|
|
51
54
|
}
|
package/dist/cli.js
CHANGED
|
@@ -59419,7 +59419,7 @@ var Yargs = YargsFactory(esm_default);
|
|
|
59419
59419
|
var yargs_default = Yargs;
|
|
59420
59420
|
|
|
59421
59421
|
// package.json
|
|
59422
|
-
var version = "0.0.0-
|
|
59422
|
+
var version = "0.0.0-6b859a45";
|
|
59423
59423
|
|
|
59424
59424
|
// src/common.ts
|
|
59425
59425
|
var import_fs6 = require("fs");
|
|
@@ -59474,26 +59474,26 @@ var detectPackageManager = () => {
|
|
|
59474
59474
|
};
|
|
59475
59475
|
|
|
59476
59476
|
// src/helpers/command.ts
|
|
59477
|
-
var runCommand = async (command2, opts) => {
|
|
59477
|
+
var runCommand = async (command2, opts = {}) => {
|
|
59478
59478
|
if (typeof command2 === "string") {
|
|
59479
59479
|
command2 = command2.trim().replace(/\s+/g, ` `).split(" ");
|
|
59480
59480
|
}
|
|
59481
59481
|
return printAsyncStatus({
|
|
59482
|
-
useSpinner: opts
|
|
59483
|
-
startText: opts
|
|
59484
|
-
doneText: opts
|
|
59482
|
+
useSpinner: opts.useSpinner ?? opts.silent,
|
|
59483
|
+
startText: opts.startText || command2.join(" "),
|
|
59484
|
+
doneText: opts.doneText,
|
|
59485
59485
|
promise() {
|
|
59486
59486
|
const [executable, ...args] = command2;
|
|
59487
|
-
const squelch = opts
|
|
59487
|
+
const squelch = opts.silent || process.env.VITEST;
|
|
59488
59488
|
const cmd = (0, import_cross_spawn.spawn)(executable, [...args], {
|
|
59489
59489
|
// TODO: ideally inherit stderr, but npm install uses this for warnings
|
|
59490
59490
|
// stdio: [ioMode, ioMode, "inherit"],
|
|
59491
59491
|
stdio: squelch ? "pipe" : "inherit",
|
|
59492
59492
|
env: {
|
|
59493
59493
|
...process.env,
|
|
59494
|
-
...opts
|
|
59494
|
+
...opts.env
|
|
59495
59495
|
},
|
|
59496
|
-
cwd: opts
|
|
59496
|
+
cwd: opts.cwd
|
|
59497
59497
|
});
|
|
59498
59498
|
let output = ``;
|
|
59499
59499
|
if (opts?.captureOutput ?? squelch) {
|
|
@@ -59506,10 +59506,19 @@ var runCommand = async (command2, opts) => {
|
|
|
59506
59506
|
}
|
|
59507
59507
|
return new Promise((resolve9, reject) => {
|
|
59508
59508
|
cmd.on("close", (code) => {
|
|
59509
|
-
|
|
59510
|
-
|
|
59511
|
-
|
|
59512
|
-
|
|
59509
|
+
try {
|
|
59510
|
+
if (code !== 0) {
|
|
59511
|
+
throw new Error(output, { cause: code });
|
|
59512
|
+
}
|
|
59513
|
+
const transformOutput = opts.transformOutput ?? ((result) => result);
|
|
59514
|
+
const processedOutput = transformOutput(stripAnsi(output));
|
|
59515
|
+
resolve9(processedOutput);
|
|
59516
|
+
} catch (e) {
|
|
59517
|
+
if (opts.fallbackOutput) {
|
|
59518
|
+
resolve9(opts.fallbackOutput(e));
|
|
59519
|
+
} else {
|
|
59520
|
+
reject(new Error(output, { cause: e }));
|
|
59521
|
+
}
|
|
59513
59522
|
}
|
|
59514
59523
|
});
|
|
59515
59524
|
});
|
|
@@ -59522,9 +59531,11 @@ async function runCommands({ commands, ...opts }) {
|
|
|
59522
59531
|
startText: opts.startText,
|
|
59523
59532
|
doneText: opts.doneText,
|
|
59524
59533
|
async promise() {
|
|
59534
|
+
const results = [];
|
|
59525
59535
|
for (const command2 of commands) {
|
|
59526
|
-
await runCommand(command2, { ...opts, useSpinner: false });
|
|
59536
|
+
results.push(await runCommand(command2, { ...opts, useSpinner: false }));
|
|
59527
59537
|
}
|
|
59538
|
+
return results.join("\n");
|
|
59528
59539
|
}
|
|
59529
59540
|
});
|
|
59530
59541
|
}
|
|
@@ -59541,8 +59552,9 @@ var printAsyncStatus = async ({
|
|
|
59541
59552
|
promise = promise();
|
|
59542
59553
|
}
|
|
59543
59554
|
try {
|
|
59544
|
-
await promise;
|
|
59545
|
-
|
|
59555
|
+
const output = await promise;
|
|
59556
|
+
const doneText = typeof opts.doneText === "function" ? opts.doneText(output) : opts.doneText;
|
|
59557
|
+
s?.stop(doneText);
|
|
59546
59558
|
} catch (err) {
|
|
59547
59559
|
s?.stop(err.message);
|
|
59548
59560
|
} finally {
|
|
@@ -59655,6 +59667,24 @@ var listAccounts = async () => {
|
|
|
59655
59667
|
});
|
|
59656
59668
|
return accounts;
|
|
59657
59669
|
};
|
|
59670
|
+
async function getWorkerdCompatibilityDate() {
|
|
59671
|
+
const { npm: npm12 } = detectPackageManager();
|
|
59672
|
+
return runCommand(`${npm12} info workerd dist-tags.latest`, {
|
|
59673
|
+
silent: true,
|
|
59674
|
+
captureOutput: true,
|
|
59675
|
+
startText: "Retrieving current workerd compatibility date",
|
|
59676
|
+
transformOutput: (result) => {
|
|
59677
|
+
const match = result.match(/\d+\.(\d{4})(\d{2})(\d{2})\.\d+/);
|
|
59678
|
+
if (!match) {
|
|
59679
|
+
throw new Error("Could not find workerd date");
|
|
59680
|
+
}
|
|
59681
|
+
const [, year, month, date] = match;
|
|
59682
|
+
return `${year}-${month}-${date}`;
|
|
59683
|
+
},
|
|
59684
|
+
fallbackOutput: () => "2023-05-18",
|
|
59685
|
+
doneText: (output) => `${brandColor("compatibility date")} ${dim(output)}`
|
|
59686
|
+
});
|
|
59687
|
+
}
|
|
59658
59688
|
|
|
59659
59689
|
// src/helpers/poll.ts
|
|
59660
59690
|
var import_promises = require("node:dns/promises");
|
|
@@ -60025,10 +60055,10 @@ var config = {
|
|
|
60025
60055
|
displayName: "Angular",
|
|
60026
60056
|
packageScripts: {
|
|
60027
60057
|
process: "node ./tools/copy-worker-files.mjs && node ./tools/copy-client-files.mjs && node ./tools/bundle.mjs",
|
|
60028
|
-
prestart: `${npm2} run build:ssr &&
|
|
60058
|
+
prestart: `${npm2} run build:ssr && ${npm2} run process`,
|
|
60029
60059
|
start: "wrangler pages dev dist/cloudflare --compatibility-date=2021-09-20 --experimental-local",
|
|
60030
|
-
predeploy: `${npm2} run build:ssr &&
|
|
60031
|
-
deploy: "wrangler pages
|
|
60060
|
+
predeploy: `${npm2} run build:ssr && ${npm2} run process`,
|
|
60061
|
+
deploy: "wrangler pages deploy dist/cloudflare"
|
|
60032
60062
|
},
|
|
60033
60063
|
deployCommand: "deploy",
|
|
60034
60064
|
devCommand: "start"
|
|
@@ -60123,7 +60153,7 @@ var config2 = {
|
|
|
60123
60153
|
displayName: "Astro",
|
|
60124
60154
|
packageScripts: {
|
|
60125
60155
|
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 3000 -- astro dev`,
|
|
60126
|
-
"pages:deploy": `astro build && wrangler pages
|
|
60156
|
+
"pages:deploy": `astro build && wrangler pages deploy ./dist`
|
|
60127
60157
|
},
|
|
60128
60158
|
testFlags: [
|
|
60129
60159
|
"--skip-houston",
|
|
@@ -60152,7 +60182,7 @@ var config3 = {
|
|
|
60152
60182
|
displayName: "Docusaurus",
|
|
60153
60183
|
packageScripts: {
|
|
60154
60184
|
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 3000 -- ${npm3} run start`,
|
|
60155
|
-
"pages:deploy": `NODE_VERSION=16 ${npm3} run build && wrangler pages
|
|
60185
|
+
"pages:deploy": `NODE_VERSION=16 ${npm3} run build && wrangler pages deploy ./build`
|
|
60156
60186
|
}
|
|
60157
60187
|
};
|
|
60158
60188
|
var docusaurus_default = config3;
|
|
@@ -60193,7 +60223,7 @@ var config4 = {
|
|
|
60193
60223
|
displayName: "Gatsby",
|
|
60194
60224
|
packageScripts: {
|
|
60195
60225
|
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 8000 -- ${npm4} run develop`,
|
|
60196
|
-
"pages:deploy": `${npm4} run build && wrangler pages
|
|
60226
|
+
"pages:deploy": `${npm4} run build && wrangler pages deploy ./public`
|
|
60197
60227
|
}
|
|
60198
60228
|
};
|
|
60199
60229
|
var gatsby_default = config4;
|
|
@@ -60319,7 +60349,7 @@ var config6 = {
|
|
|
60319
60349
|
displayName: "Next",
|
|
60320
60350
|
packageScripts: {
|
|
60321
60351
|
"pages:build": `${npx3} @cloudflare/next-on-pages@1`,
|
|
60322
|
-
"pages:deploy": `${npm5} run pages:build && wrangler pages
|
|
60352
|
+
"pages:deploy": `${npm5} run pages:build && wrangler pages deploy .vercel/output/static`,
|
|
60323
60353
|
"pages:watch": `${npx3} @cloudflare/next-on-pages@1 --watch`,
|
|
60324
60354
|
"pages:dev": `${npx3} wrangler pages dev .vercel/output/static --compatibility-flag=nodejs_compat`
|
|
60325
60355
|
},
|
|
@@ -60357,7 +60387,7 @@ var config7 = {
|
|
|
60357
60387
|
displayName: "Nuxt",
|
|
60358
60388
|
packageScripts: {
|
|
60359
60389
|
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 3000 -- npm run dev`,
|
|
60360
|
-
"pages:deploy": `NODE_VERSION=17 npm run generate && wrangler pages
|
|
60390
|
+
"pages:deploy": `NODE_VERSION=17 npm run generate && wrangler pages deploy ./dist`
|
|
60361
60391
|
}
|
|
60362
60392
|
};
|
|
60363
60393
|
var nuxt_default = config7;
|
|
@@ -60404,7 +60434,7 @@ var config9 = {
|
|
|
60404
60434
|
displayName: "React",
|
|
60405
60435
|
packageScripts: {
|
|
60406
60436
|
"pages:dev": `wrangler pages dev ${compatDateFlag()} --port 3000 -- ${npm7} start`,
|
|
60407
|
-
"pages:deploy": `${npm7} run build && wrangler pages
|
|
60437
|
+
"pages:deploy": `${npm7} run build && wrangler pages deploy ./build`
|
|
60408
60438
|
}
|
|
60409
60439
|
};
|
|
60410
60440
|
var react_default = config9;
|
|
@@ -60423,7 +60453,7 @@ var config10 = {
|
|
|
60423
60453
|
generate: generate10,
|
|
60424
60454
|
displayName: "Remix",
|
|
60425
60455
|
packageScripts: {
|
|
60426
|
-
"pages:deploy": `${npm8} run build && wrangler pages
|
|
60456
|
+
"pages:deploy": `${npm8} run build && wrangler pages deploy ./public`
|
|
60427
60457
|
},
|
|
60428
60458
|
devCommand: "dev",
|
|
60429
60459
|
testFlags: ["--typescript", "--no-install"]
|
|
@@ -60472,7 +60502,7 @@ var config11 = {
|
|
|
60472
60502
|
displayName: "Solid",
|
|
60473
60503
|
packageScripts: {
|
|
60474
60504
|
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 3000 -- ${npm9} run dev`,
|
|
60475
|
-
"pages:deploy": `${npm9} run build build && wrangler pages
|
|
60505
|
+
"pages:deploy": `${npm9} run build build && wrangler pages deploy ./dist/public`
|
|
60476
60506
|
}
|
|
60477
60507
|
};
|
|
60478
60508
|
var solid_default = config11;
|
|
@@ -60572,7 +60602,7 @@ var config12 = {
|
|
|
60572
60602
|
displayName: "Svelte",
|
|
60573
60603
|
packageScripts: {
|
|
60574
60604
|
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 5173 -- ${npm10} run dev`,
|
|
60575
|
-
"pages:deploy": `NODE_VERSION=16 ${npm10} run build && wrangler pages
|
|
60605
|
+
"pages:deploy": `NODE_VERSION=16 ${npm10} run build && wrangler pages deploy .svelte-kit/cloudflare`
|
|
60576
60606
|
}
|
|
60577
60607
|
};
|
|
60578
60608
|
var svelte_default = config12;
|
|
@@ -60608,7 +60638,7 @@ var config13 = {
|
|
|
60608
60638
|
displayName: "Vue",
|
|
60609
60639
|
packageScripts: {
|
|
60610
60640
|
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 5173 -- ${npm11} run dev`,
|
|
60611
|
-
"pages:deploy": `${npm11} run build && wrangler pages
|
|
60641
|
+
"pages:deploy": `${npm11} run build && wrangler pages deploy ./dist`
|
|
60612
60642
|
},
|
|
60613
60643
|
testFlags: ["--ts"]
|
|
60614
60644
|
};
|
|
@@ -60849,10 +60879,12 @@ async function updateFiles(ctx) {
|
|
|
60849
60879
|
packagejson: JSON.parse(await (0, import_promises3.readFile)(paths.packagejson, "utf-8")),
|
|
60850
60880
|
wranglertoml: await (0, import_promises3.readFile)(paths.wranglertoml, "utf-8")
|
|
60851
60881
|
};
|
|
60852
|
-
contents.packagejson.name
|
|
60853
|
-
|
|
60854
|
-
|
|
60855
|
-
|
|
60882
|
+
if (contents.packagejson.name === "<TBD>") {
|
|
60883
|
+
contents.packagejson.name = ctx.project.name;
|
|
60884
|
+
}
|
|
60885
|
+
contents.wranglertoml = contents.wranglertoml.replace(/^name\s*=\s*"<TBD>"/m, `name = "${ctx.project.name}"`).replace(
|
|
60886
|
+
/^compatibility_date\s*=\s*"<TBD>"/m,
|
|
60887
|
+
`compatibility_date = "${await getWorkerdCompatibilityDate()}"`
|
|
60856
60888
|
);
|
|
60857
60889
|
await (0, import_promises3.writeFile)(
|
|
60858
60890
|
paths.packagejson,
|
|
@@ -60863,8 +60895,8 @@ async function updateFiles(ctx) {
|
|
|
60863
60895
|
|
|
60864
60896
|
// src/cli.ts
|
|
60865
60897
|
var main = async (argv) => {
|
|
60866
|
-
printBanner();
|
|
60867
60898
|
const args = await parseArgs(argv);
|
|
60899
|
+
printBanner();
|
|
60868
60900
|
const validatedArgs = {
|
|
60869
60901
|
...args,
|
|
60870
60902
|
projectName: await validateName(args.projectName, {
|
|
@@ -60891,7 +60923,7 @@ var parseArgs = async (argv) => {
|
|
|
60891
60923
|
}).option("existing-script", {
|
|
60892
60924
|
type: "string",
|
|
60893
60925
|
hidden: templateMap["pre-existing"].hidden
|
|
60894
|
-
}).option("wrangler-defaults", { type: "boolean", hidden: true }).help().argv;
|
|
60926
|
+
}).option("wrangler-defaults", { type: "boolean", hidden: true }).version(version).help().argv;
|
|
60895
60927
|
return {
|
|
60896
60928
|
projectName: args._[0],
|
|
60897
60929
|
...args
|
|
@@ -60900,7 +60932,7 @@ var parseArgs = async (argv) => {
|
|
|
60900
60932
|
var validateName = async (name, { acceptDefault = false } = {}) => {
|
|
60901
60933
|
const defaultValue = name ?? new import_haikunator.default().haikunate({ tokenHex: true });
|
|
60902
60934
|
return textInput({
|
|
60903
|
-
question: `
|
|
60935
|
+
question: `In which directory do you want to create your application?`,
|
|
60904
60936
|
helpText: "also used as application name",
|
|
60905
60937
|
renderSubmitted: (value) => {
|
|
60906
60938
|
return `${brandColor("dir")} ${dim(value)}`;
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ The sample plugin allows ChatGPT users to search for repositories using GitHub's
|
|
|
12
12
|
1. Install [wrangler](https://developers.cloudflare.com/workers/cli-wrangler/install-update), the Cloudflare Workers CLI
|
|
13
13
|
2. Clone this project and install dependencies with `npm install`
|
|
14
14
|
3. Run `wrangler login` to login to your Cloudflare account in wrangler
|
|
15
|
-
4. Run `wrangler
|
|
15
|
+
4. Run `wrangler deploy` to publish the plugin to Cloudflare Workers
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
name = "
|
|
1
|
+
name = "<TBD>"
|
|
2
2
|
main = "src/index.ts"
|
|
3
|
-
compatibility_date = "
|
|
3
|
+
compatibility_date = "<TBD>"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
name = "<TBD>"
|
|
2
2
|
main = "src/worker.js"
|
|
3
|
-
compatibility_date = "
|
|
3
|
+
compatibility_date = "<TBD>"
|
|
4
4
|
|
|
5
5
|
# Bind a Queue producer. Use this binding to schedule an arbitrary task that may be processed later by a Queue consumer.
|
|
6
6
|
# Docs: https://developers.cloudflare.com/queues/get-started
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
name = "<TBD>"
|
|
2
2
|
main = "src/worker.ts"
|
|
3
|
-
compatibility_date = "
|
|
3
|
+
compatibility_date = "<TBD>"
|
|
4
4
|
|
|
5
5
|
# Bind a Queue producer. Use this binding to schedule an arbitrary task that may be processed later by a Queue consumer.
|
|
6
6
|
# Docs: https://developers.cloudflare.com/queues/get-started
|