Skip to content

Commit

Permalink
C3: Change default project type to hello world worker (#4442)
Browse files Browse the repository at this point in the history
* C3: Change default project type to

* avoid yarn cache corruption during CI e3e tests
  • Loading branch information
jculvey authored Nov 22, 2023
1 parent 382ef8f commit 5f54f72
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/itchy-days-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-cloudflare": minor
---

Change the default project type to the hello world worker script.
4 changes: 2 additions & 2 deletions packages/create-cloudflare/e2e-tests/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe.skipIf(frameworkToTest || isQuarantineMode())(
promptHandlers: [
{
matcher: /What type of application do you want to create/,
input: [keys.down, keys.enter],
input: [keys.enter],
},
{
matcher: /Do you want to use TypeScript/,
Expand Down Expand Up @@ -130,7 +130,7 @@ describe.skipIf(frameworkToTest || isQuarantineMode())(
promptHandlers: [
{
matcher: /What type of application do you want to create/,
input: [keys.down, keys.enter],
input: [keys.enter],
},
{
matcher: /Do you want to use git for version control/,
Expand Down
2 changes: 1 addition & 1 deletion packages/create-cloudflare/src/helpers/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function openInBrowser(url: string): Promise<void> {

export const C3_DEFAULTS = {
projectName: new Haikunator().haikunate({ tokenHex: true }),
type: "webFramework",
type: "hello-world",
framework: "angular",
autoUpdate: true,
deploy: true,
Expand Down
10 changes: 9 additions & 1 deletion packages/create-cloudflare/src/helpers/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,15 @@ const needsPackageManagerReset = (ctx: PagesGeneratorContext) => {
export const npmInstall = async () => {
const { npm } = detectPackageManager();

await runCommand(`${npm} install`, {
const installCmd = [npm, "install"];

if (npm === "yarn" && process.env.VITEST) {
// Yarn can corrupt the cache if more than one instance is running at once,
// which is what we do in our tests.
installCmd.push("--mutex", "network");
}

await runCommand(installCmd, {
silent: true,
startText: "Installing dependencies",
doneText: `${brandColor("installed")} ${dim(`via \`${npm} install\``)}`,
Expand Down
8 changes: 4 additions & 4 deletions packages/create-cloudflare/src/templateMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ type TemplateConfig = {
};

export const templateMap: Record<string, TemplateConfig> = {
webFramework: {
label: "Website or web app",
handler: runPagesGenerator,
},
"hello-world": {
label: `"Hello World" Worker`,
handler: runWorkersGenerator,
},
webFramework: {
label: "Website or web app",
handler: runPagesGenerator,
},
common: {
label: "Example router & proxy Worker",
handler: runWorkersGenerator,
Expand Down

0 comments on commit 5f54f72

Please sign in to comment.