* fix(cli): handle interrupts in healthcheck prompt and harden generators
Replace the raw-stdin prompt in the healthcheck generator with the standard
enquirer confirm prompt so Ctrl+C correctly aborts the run instead of leaving
the generator running. Isolate each healthcheck so one throwing does not abort
the rest, and report registry fetch failures instead of throwing.
Make getImportAlias throw on a present-but-invalid config rather than silently
falling back to the default alias, guard against the coerce() NPE in
version-utils, and switch migrate-hlm to readJson. Add unit tests across these
paths and stub network access so the suite runs offline.
Closes#906
* fix(cli): guard version healthcheck fix against missing dependencies section
The fix writeback read packageJson.dependencies[dep] directly, which threw when
a package.json had no dependencies section and the dependency lived only in
devDependencies. Guard both sections with optional chaining so the writeback is
symmetrical and never touches an undefined section.
Remove the mis-cased `HlmBreadCrumbImports` alias in favour of the canonical
`HlmBreadcrumbImports`, dropping it before 1.0 rather than carrying it on the stable line. The
NgModule migration map is repointed to the canonical name so `nx g @spartan-ng/cli:migrate-module-
imports` still rewrites `HlmBreadCrumbModule` to an export that exists.
BrnAvatarImage/BrnAvatarFallback and their helm wrappers all used the same
unprefixed exportAs ('avatarImage'/'avatarFallback'). Since the helm directive
host-applies the brain one on the same <img>, a template ref was ambiguous, and
the names broke the brn*/hlm* convention every other exportAs follows. Rename to
brnAvatarImage/brnAvatarFallback and hlmAvatarImage/hlmAvatarFallback before the
exportAs surface is locked at 1.0. Regenerated the CLI avatar templates to match.
Drawer shipped as a helm lib with docs but was missing from the CLI, so
`nx g @spartan-ng/cli:ui drawer` failed. Register it in the Primitive union and
dependency map, generate its templates + supported-ui-libraries entry, and add a
drift-guard spec asserting the CLI primitive set equals the installable helm
components (with a generator template each) so this cannot recur.
The cli generator specs drive real nx generators, which log copiously
("Couldn't find .gitignore", "NX workspace root does not exist", etc.) - ~3k
lines across 142 specs, enough to truncate the CI log and bury the run summary,
making a passing suite look like it failed. tools has the same class of chatter.
Add `onConsoleLog: () => false` to both configs so that intercepted console
output is dropped (the specs assert on the generated tree and on console spies,
not on this logging; test failures are still reported by the reporter). cli's
output drops from ~3160 to ~530 lines and the summary is visible again.
Add reporters: ['default'] to the mcp, cli, tools, registry and cli-smoke vite
configs (brain and helm already had it). Without a default reporter the @nx/vitest
NxReporter is the only one attached, so these projects printed no summary in CI -
which is how mcp's silently-undiscovered specs stayed invisible. The counts are
now shown so test execution is verifiable at a glance.
The mcp vite config lacked `root: __dirname`, so the @nx/vitest executor (which
runs from the workspace root) resolved `src/**/*.spec.ts` against the workspace
root, found nothing, and `passWithNoTests` passed it silently - mcp's 19 tests
never ran.
Pin mcp's root, and drop `passWithNoTests` from every project that has specs
(mcp, cli, tools, brain, helm) so a future test-discovery break fails loudly
instead of going green. registry keeps the flag - it genuinely has no specs.
- base spec: replace hoisted vi.unmock + require with test-scoped vi.importActual
to load the real @nx/angular/generators for that one test without leaking mock
state across the file
- migrate-brain-accordion-trigger spec: remove a stray debug console.log
- refresh a stale jest-era comment on the @angular/core stub
Replace Jest with Vitest across the workspace. The brain and helm Angular suites
now run in a real browser (Playwright/Chromium via Vitest browser mode) so they
exercise real layout, focus, pointer events and computed styles that jsdom could
not. The cli, tools, mcp, registry and cli-smoke suites run on Vitest's node
environment.
- Add per-project vite configs and switch test targets to @nx/vitest:test
- Convert jest APIs to vi.* and jest module mocks to vi.mock with importOriginal
- Replace jest-axe with a browser-native axe-core helper and toHaveNoViolations
- Regenerate snapshots in vitest format (content unchanged, format-only)
- Remove all jest packages, configs, the preset and the @nx/jest target default
- Install Playwright Chromium in the CI unit job for the browser suites
Also fixes a brain avatar test that asserted inside a fire-and-forget setTimeout,
which passed vacuously under jsdom and only surfaced once a real browser loaded
the image.
* fix(cli): avoid @nx/workspace barrel import in migrate-helm-libraries
Import removeGenerator from its module directly instead of the @nx/workspace
barrel. The barrel eagerly evaluates convert-to-nx-project, whose output.js
crashes on nx 22 ("Cannot read properties of undefined (reading 'inverse')"),
so the generator threw before doing any work.
Add a regression test that runs the generator and asserts it does not throw.
* test(cli): tidy migrate-helm-libraries regression test
Assert the generator resolves to undefined instead of using the
resolves.not.toThrow matcher, which does not fit a Promise<void>, and
restore mocks after each test to keep the suite hermetic.
* test(sidebar): update generate-ui-docs snapshot for HlmSidebarTrigger
The HlmSidebarTrigger gained an `srOnlyText` input, but the generate-ui-docs
stable-output snapshot was never regenerated, so `tools:test` failed whenever
it ran uncached. Regenerate the snapshot to match the current component API.
spartan/ui is now Tailwind CSS v4 only. The v3 compatibility layer added
complexity across the brain preset, the CLI generators and the docs, all of
which is removed here.
Brain:
- Delete the v3 JavaScript preset (hlm-tailwind-preset.js) and its package
export; the v4 CSS preset (hlm-tailwind-preset.css) is now the only preset.
- Bump the tailwindcss peer dependency to >=4.0.0 and declare tw-animate-css
as a peer, since it is imported by the CSS preset.
CLI:
- Remove Tailwind version detection and the v3 confirmation prompt; the theme
generator always emits the v4 stylesheet (preset import plus OKLCH theme).
- Drop the legacy HSL theme table, the v3-only CDK overlay import branch, the
vestigial addCdkStyles option and the unused registryItemTailwindSchema.
Docs and tooling:
- Remove the Tailwind v3 installation and theming sections and snippets.
- Drop autoprefixer; Tailwind v4 handles vendor prefixing via @tailwindcss/postcss.
BREAKING CHANGE: Tailwind CSS v3 is no longer supported. The
@spartan-ng/brain/hlm-tailwind-preset (JS) package export has been removed; use
the @spartan-ng/brain/hlm-tailwind-preset.css preset with Tailwind CSS v4. The
tailwindcss peer dependency now requires >=4.0.0.
- Remove the acceptTailwindV3 flag from the theme and init generators. It was a leftover from
when the matrix covered Tailwind v3; the suite is v4-only and v3 support is being dropped.
- Publish packages via execFileSync with an argument array so the registry and npmrc values
are never interpreted by a shell.
- Drop the explanatory embla-carousel import comments from the carousel template and helm source.
- await the local-registry stop in global-teardown and the global-setup error
path, so verdaccio is fully stopped before the process exits
- restore the dist package.json byte-for-byte after publishing, so a local
`pnpm smoke` leaves the build artifacts untouched
- pass the nx affected args via execFileSync (no shell) so NX_BASE/NX_HEAD are
never shell-interpreted
- note that setupTailwindCss is an internal-only theme option
The generated scroll-area directive imports provideScrollbarOptions from
ngx-scrollbar, but the ui generator did not install it, so a fresh scroll-area
failed to compile (TS2307). Add it to the scroll-area peer dependencies.
embla-carousel-angular v22 no longer re-exports EmblaOptionsType,
EmblaEventType and EmblaPluginType, so a fresh carousel failed to compile
(TS2459). Import them from the base embla-carousel package, which exports them
in both v21 and v22, and add it as a peer dependency.
The generators assumed a tsconfig.base.json, so they failed on a standalone nx
workspace (single app, no base tsconfig) with "File not found:
tsconfig.base.json". Resolve the root tsconfig with getRootTsConfigPathInTree
instead, and stop tying the eslint-editing ts-morph Project to an on-disk
tsconfig that may not exist yet during generation.
Passing --theme opts the init and ui-theme generators into non-interactive
mode: the project is auto-selected when there is a single app, the styles
entry point is auto-detected, and the Tailwind v3 warning is skipped. This
lets the CLI be scripted in CI. Prompts are unchanged when no theme is passed.
Adds unit tests for the non-interactive paths.
Address review feedback on the PR. Wire the directive to ngx-scrollbar's
real CSS variables at shadcn's values (transparent 10px track, 7px
bg-border thumb) and default visibility to hover so the thumb only shows
on hover, scroll or focus like shadcn.
Move the container radius into the registry per style now that the demo
no longer hardcodes it: rounded-md for vega/nova/mira, square for lyra
via --radius 0, and rounded-2xl for maia/luma. Replace the dead
radix-era marker rules with a single spartan-scroll-area rule.
Declare ngx-scrollbar as a helm peer dependency since the directive now
imports from it, and mirror the changes in the CLI template.
Address review feedback on the style support. Set Lyra's --radius to 0
so the bordered container and handle render sharp like shadcn's Lyra
preset, and round the Lyra handle grip with the shared rounded-lg token
so the squaring comes from --radius rather than a special case.
Match shadcn's splitter focus ring by using ring-offset-background in
place of the fixed ring-offset-1 offset, in both the helm component and
the CLI template.
The nx 22 / angular 21 upgrade (#1430) switched the cli tsconfig to
`module: preserve` with `moduleResolution: bundler`. With `preserve`,
TypeScript keeps the ESM import/export syntax in the emitted .js files,
but the published package declares `"type": "commonjs"`. Node then loads
the generator files (e.g. compat.js) as CommonJS and throws
"Cannot use import statement outside a module", breaking every
`ng g @spartan-ng/cli:*` command from alpha.708 onwards.
Restore `module: commonjs` (with `moduleResolution: node`) so the build
output matches the package type again. The same harmless mismatch is
corrected in libs/tools for consistency; tools runs from source and is
never published, so it was not affected at runtime.
Closes#1451