Skip to content

fix(create-emdash): accept "." in the Project name? prompt#900

Merged
ascorbic merged 1 commit intoemdash-cms:mainfrom
mvanhorn:fix/cli-current-directory-894
May 5, 2026
Merged

fix(create-emdash): accept "." in the Project name? prompt#900
ascorbic merged 1 commit intoemdash-cms:mainfrom
mvanhorn:fix/cli-current-directory-894

Conversation

@mvanhorn
Copy link
Copy Markdown
Contributor

@mvanhorn mvanhorn commented May 3, 2026

What does this PR do?

Closes #894

The interactive Project name? prompt in create-emdash rejected . as a project name, even though the flag-positional path (e.g. npm create emdash@latest .) already accepted it via validateProjectName. Users who ran npm create emdash@latest without arguments had no way to scaffold into the current directory from the prompt.

The prompt validator now delegates to the same validateProjectName helper the flag path uses, and the prompt message gains a hint about .. Behavior on every other path (flag positional, --yes, --yes --force, non-empty cwd confirm) is unchanged -- the target === "." branch in resolveProjectLocation already handles current-directory scaffolding.

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes (packages/create-emdash)
  • pnpm lint passes -- diagnostic count unchanged (45 on main, 45 on this branch; all pre-existing)
  • pnpm test passes (103 passed in create-emdash)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation -- N/A, this is the CLI scaffolder, not the admin UI
  • I have added a changeset (if this PR changes a published package) -- .changeset/olive-loops-change.md, create-emdash: patch
  • New features link to an approved Discussion -- N/A (bug fix)

Tests

packages/create-emdash/tests/flags.test.ts already exercises validateProjectName(".") returning undefined ("returns undefined for . (current-dir sentinel)"). The fix is precisely "make the prompt validator call this same helper", so the existing test now also covers the prompt path's accept-of-. behavior. No new test was added because the validator is the unit under test and was already covered.

If reviewers prefer an explicit prompt-path test, happy to add one -- it would mock @clack/prompts.text and assert that validateProjectName is the validate fn.

AI-generated code disclosure

  • This PR includes AI-generated code -- model/tool: Claude Opus 4.7

Screenshots / test output

$ pnpm test
 ✓ tests/flags.test.ts (51 tests) 4ms
 ✓ tests/utils.test.ts (52 tests) 6ms
 Test Files  2 passed (2)
      Tests  103 passed (103)

…s#894)

The flag-positional path already accepted "." via validateProjectName,
but the prompt's inline regex check rejected it. Users running
`npm create emdash@latest` with no arguments could only install into a
new subdirectory.

Use validateProjectName from the prompt validator so both code paths
share the same rule, and surface the "." option in the prompt
message. The flag path's behavior is unchanged.

Closes emdash-cms#894
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 3, 2026

🦋 Changeset detected

Latest commit: 06bbb5f

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

This PR includes changesets to release 13 packages
Name Type
create-emdash Patch
emdash Patch
@emdash-cms/admin Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
@emdash-cms/cloudflare Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
@emdash-cms/fixture-perf-site Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site Patch
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds 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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 3, 2026

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@900

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@900

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@900

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@900

emdash

npm i https://pkg.pr.new/emdash@900

create-emdash

npm i https://pkg.pr.new/create-emdash@900

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@900

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@900

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@900

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@900

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@900

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@900

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@900

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@900

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@900

commit: 06bbb5f

@ascorbic
Copy link
Copy Markdown
Collaborator

ascorbic commented May 3, 2026

/review kimi

@ascorbic
Copy link
Copy Markdown
Collaborator

ascorbic commented May 3, 2026

This does highlight how confusing it is that it conflates project name with output directory

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented May 3, 2026

LGTM!

github run

@ascorbic ascorbic merged commit b3d1f40 into emdash-cms:main May 5, 2026
28 checks passed
@emdashbot emdashbot Bot mentioned this pull request May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI installer does not support current directory — forces new folder creation

2 participants