Skip to content

C3 update name prompt#3465

Merged
jculvey merged 6 commits intomainfrom
c3-update-name-prompt
Jun 20, 2023
Merged

C3 update name prompt#3465
jculvey merged 6 commits intomainfrom
c3-update-name-prompt

Conversation

@jculvey
Copy link
Copy Markdown
Contributor

@jculvey jculvey commented Jun 14, 2023

Fixes #3394.

What this PR solves / how to test:

This fixes a couple of things:

  1. Formats the project name as a directory and fixes an issue where leading spaces were rendered as - in some terminals.
  2. Fixes a bug where the default value of a project directory couldn't be selected in interactive mode
  3. Displays the default value for text prompts if the user deletes all input

Author has included the following, where applicable:

Reviewer is to perform the following, as applicable:

  • Checked for inclusion of relevant tests
  • Checked for inclusion of a relevant changeset
  • Checked for creation of associated docs updates
  • Manually pulled down the changes and spot-tested

@jculvey jculvey requested review from a team, RamIdeas and petebacondarwin as code owners June 14, 2023 19:33
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jun 14, 2023

🦋 Changeset detected

Latest commit: 849ca40

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
create-cloudflare Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jun 14, 2023

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/5327501920/npm-package-wrangler-3465

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/3465/npm-package-wrangler-3465

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/5327501920/npm-package-wrangler-3465 dev path/to/script.js
Additional artifacts:
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/5327501920/npm-package-cloudflare-pages-shared-3465

Note that these links will no longer work once the GitHub Actions artifact expires.

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 14, 2023

Codecov Report

Merging #3465 (849ca40) into main (fddffdf) will decrease coverage by 0.10%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3465      +/-   ##
==========================================
- Coverage   75.20%   75.10%   -0.10%     
==========================================
  Files         183      183              
  Lines       11064    11084      +20     
  Branches     2906     2918      +12     
==========================================
+ Hits         8321     8325       +4     
- Misses       2743     2759      +16     

see 3 files with indirect coverage changes

crash(
`Directory \`${relativePath}\` already exists and is not empty. Please choose a new name.`
);
if (relativePath && existsAlready && !isEmpty) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to check relativePath is truthy? If it is an empty string, existsAlready will be false

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do if we want to have validateProjectDirectory work with both the interactive prompt as well as setupProjectDirectory.

The issue is with the way the clack text prompt is handling user input. If you run c3 with current main and hit enter when prompted with the default project directory it will fail with Directory "" already exists and isn't empty. Clack handles empty string input by replacing it with defaultValue where supplied, but it only does so AFTER running the validator. When the validator doesn't allow empty string, it fails, and clack doesn't get a chance to default it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was fixed by @petebacondarwin in #3496

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, reverted this bit, but still returning error as string instead of crashing

@jculvey jculvey force-pushed the c3-update-name-prompt branch from d7553d7 to dd7558b Compare June 20, 2023 17:54
@jculvey jculvey merged commit 528cc0f into main Jun 20, 2023
@jculvey jculvey deleted the c3-update-name-prompt branch June 20, 2023 21:38
@github-actions github-actions bot mentioned this pull request Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚀 Feature Request: [C3] Can we rephrase "Where do you want to create your application"?

5 participants