Skip to content

[6.x] Rename @craftcms/cp to @craftcms/ui#19260

Draft
brianjhanson wants to merge 12 commits into
6.xfrom
feature/rename-craftcms-cp
Draft

[6.x] Rename @craftcms/cp to @craftcms/ui#19260
brianjhanson wants to merge 12 commits into
6.xfrom
feature/rename-craftcms-cp

Conversation

@brianjhanson

Copy link
Copy Markdown
Contributor

When we started this journey, I thought the @craftcms/cp package would carry more code than it has been. This renames the package to @craftcms/ui to better reflect the actual purpose. The @craftcms/ui package will be responsible for UI related code, mostly the web components, while the resources folder holds code that's more specific to the CP itself.

Part of this change is relocating the few services from @craftcms/cp into the resources folder.

brianjhanson and others added 9 commits July 17, 2026 09:29
Package directory moves from packages/craftcms-cp to packages/craftcms-ui;
npm scripts dev:cp/build:cp/test:cp/storybook:cp become dev:ui/build:ui/
test:ui/storybook:ui. package-lock.json is path-renamed rather than
re-resolved, so dependency versions are unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The root test script and resources/js tests use vitest but relied on npm
hoisting it from workspace packages. The garnish and ui workspaces had
drifted to different vitest patch versions, which (because vitest's
sibling packages peer-pin exact versions) forced nested per-workspace
copies and made root hoisting fragile. Everything now pins ^4.1.10 so a
single copy hoists cleanly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The Font Awesome kit no longer includes several custom icons that core
depends on (c-debug, c-outline, craft-cms, craft-partners,
craft-stack-exchange, default-plugin, plus the custom variants of
grip-dots, image-slash, and language). custom-icons/ is the only icons
directory tracked by git for exactly this reason, but copyicons.php still
assumed the kit was the source of truth, so wiping and regenerating the
icons directory silently lost them - and a stale grip-dots style override
wrote a 0-byte SVG that ended up committed.

copyicons.php now skips empty kit SVG content instead of writing it,
drops the stale grip-dots override, and fails with restore instructions
if any repo-owned custom icon is missing or empty after a run. Also
restores the real grip-dots.svg artwork.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- badge story asserted the old fill contract; craft-indicator now receives
  the raw color name and resolves the loud-tone CSS variable itself
- input-color's picker set aria-controls to the slotted text input's id,
  but ARIA references cannot cross the shadow boundary, so the reference
  never resolved (axe aria-valid-attr-value)
- indicator story tables used an empty <th> for the corner cell
- chip thumbnail story img was missing alt text

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The package's vitest suite (including the storybook browser tests) was
not run by any workflow, so failures went unnoticed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
QueueService and the queue types are Control Panel application code, not
reusable UI-library material, so they move from @craftcms/ui to
resources/js/common (services/Queue.ts, types/queue.ts). The CpServices
global interface moves with them since it types the app-bootstrapped
$queue/$config globals.

The moved service keeps relative/bare-package imports only, because the
legacy webpack bundle (CP.js) also compiles it and doesn't know Vite's @/
alias. Its test now runs under the root vitest suite.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Follows the shared module pattern (like listbox): the service moves to
resources/js/modules/queue/queue.ts with its types and test alongside,
and a new index.ts assigns Craft.QueueService for legacy/plugin callers.
Both entrypoints load the shim.

CP.js keeps importing the service directly rather than using the global,
because the webpack bundle instantiates it while still evaluating -
before Vite's module scripts have assigned Craft.QueueService.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CP.js's QueueService prototype property becomes a lazy getter that reads
Craft.QueueService (assigned by the modules/queue shim), so the webpack
bundle no longer compiles in its own copy of the service. This also ends
the split-brain singleton: legacy delegates like Craft.cp.runQueue() now
drive the same initialized instance the Vue surfaces listen to.

The getter is safe because the shim's deferred module scripts run before
DOMContentLoaded, and every CP.js queue call fires on user interaction or
later; only the old eager initializer ran at bundle-eval time.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

brianjhanson and others added 3 commits July 17, 2026 12:51
CraftAuthChallengeForm is an app auth feature (it posts through
actionClient), not library UI, and was the only component coupled to the
package's HTTP layer. It now lives with its sibling auth custom elements
in resources/js/modules/auth/components, and is exposed as
Craft.AuthChallengeForm for plugin auth methods - extending a bundled
copy from an import would give plugins a separate, useless method
registry, so the global is the correct extension surface.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Laravel's File::deleteDirectory() follows a top-level symlink: is_dir()
and FilesystemIterator both resolve it, so deletePublishedAssets() would
recurse into the link target and empty it, while the trailing @rmdir
fails silently and leaves the symlink in place to strike again. With the
common dev setup that symlinks public/vendor/craft straight at the
cms-assets resources, every craft:setup:publish run wiped the source
tree - including the git-tracked custom icons (the recurring "icons keep
getting lost" incidents).

setup:publish now detects the symlink, warns, and skips deleting and
publishing assets entirely; a symlinked target is already serving the
source directly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant