fix: migrate Drupal presets to @helixui/tokens@3.x#202
Merged
Conversation
v0.9.2 deliberately left Drupal scaffolds pinned to @helixui/tokens@^0.2.0 with carve-outs in doctor + upgrade so they wouldn't push users onto an unverified 3.x contract. v0.9.3 finishes that work: - src/presets/loader.ts now imports HELIX_TOKENS_VERSION from helix-versions.ts — Drupal joins every framework template on the centralized pin (^3.9.1). The migration is safe because the Drupal scaffold's CSS consumes only `@helixui/tokens/tokens.css` (still exported by 3.x) and uses var(--hx-*, fallback) for every variable — namespace shifts between 0.x and 3.x degrade gracefully. - src/doctor.ts checkHelixDrift drops the @helixui/tokens Drupal-skip carve-out. Pre-v0.9.3 Drupal scaffolds on 0.x are now correctly reported as drift, with create-helix upgrade as the remediation. - src/commands/upgrade.ts drops the drupalTokensExcluded detect + note blocks. Drupal projects now upgrade @helixui/tokens uniformly. - Tests updated accordingly: drupal-theme-generator.test.ts pins via the constant, doctor-extended.test.ts asserts drift FAILS (not skips) on Drupal 0.x, upgrade.test.ts asserts the bump DOES happen for Drupal projects. - Verified: all 5 Drupal preset integration suites green (standard, blog, healthcare, intranet, ecommerce); full suite 3241 passing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
v0.9.3 — Wire
@helixui/tokens@3.xinto the Drupal scaffoldv0.9.2 left every Drupal preset pinned to
@helixui/tokens@^0.2.0with carve-outs indoctor+upgradebecause the Drupal preset surface wasn't verified against 3.x. Investigating that work for v0.9.3 surfaced a deeper latent bug: the Drupal scaffold had always declared@helixui/tokensas a dependency but never loaded its CSS, so everyvar(--hx-*, fallback)reference resolved to its inline fallback instead of the upstream brand token.What changed for fresh Drupal scaffolds
{theme}.libraries.ymlnow declares ahelix-tokenslibrary that loadscss/vendor/helix-tokens.cssatweight: -200, andglobaldepends on it. Tokens are in the cascade before any theme CSS that references them.scripts/add-shebang.mjsruns at every create-helix build and copies@helixui/tokens/dist/tokens.css→dist/assets/helix-tokens.css.scaffoldDrupalThemereads that bundled copy at scaffold time and writes it into the theme'scss/vendor/helix-tokens.css. Two consequences:cp -r theme/+drush theme:enable— the documented Drupal setup, which doesn't runnpm install.scripts/copy-helix-tokens.mjsruns onnpm installand re-vendors from whatever@helixui/tokensresolves in the theme's own tree. Resolved viacreateRequire+require.resolveof the package's exported CSS subpaths (not./package.json, which@helixui/tokens@3.x's exports map doesn't publish — that throwsERR_PACKAGE_PATH_NOT_EXPORTED). Works in hoisted/workspace installs.generateStyleCssnow uses--hx-body-font-family/--hx-body-color/--hx-body-bg/--hx-body-line-height(3.x's semantic body tokens — the pre-3.x--hx-font-family-baseetc. don't exist in 3.x).generateHelixOverridesCssexamples and the generated README customization snippet were updated to reference 3.x token names (--hx-color-primary-500,--hx-color-surface-default,--hx-color-surface-raised, etc.) so a user who uncomments them actually gets values that take effect.css/style.cssno longer@importsvendor/helix-tokens.css— the library system'sglobal → helix-tokensdependency loads it instead, avoiding duplicate fetch/parse on every page.src/presets/loader.tsnow importsHELIX_TOKENS_VERSION, joining every framework template on the same pin.create-helix's own@helixui/tokensdep is bumped to^3.9.1and both lockfiles refreshed so the build-time bundling picks up 3.9.1 bytes.Existing (pre-v0.9.3) Drupal scaffolds — explicitly deferred to v0.9.4
doctorandupgradecontinue to exempt@helixui/tokensfor any project declaring@helixui/drupal-starter. The runtime token layer for a Drupal theme iscss/vendor/helix-tokens.css, NOT the declared range. Bumping the pin alone (without also rewriting that vendored CSS plus, for pre-v0.9.3 themes, injecting the missing wiring files) would advance the declaration while the theme keeps serving stale bytes — a dishonest remediation. Task #86 makesrunUpgradeDrupal-theme-aware: re-vendor the CSS at upgrade time and, for pre-v0.9.3 themes, inject the wiring. At that point both skips drop.Verification
npm run verify(lint + format + type-check) — cleanRelease
Patch —
create-helix@0.9.3. Changeset included.