Skip to content

feat(build): add theme generation CLI and improve style resolution#18

Merged
cuikho210 merged 2 commits into
mainfrom
dev
Apr 15, 2026
Merged

feat(build): add theme generation CLI and improve style resolution#18
cuikho210 merged 2 commits into
mainfrom
dev

Conversation

@cuikho210

@cuikho210 cuikho210 commented Apr 15, 2026

Copy link
Copy Markdown
Owner
  • src/bin/gen-theme.ts and package.json: Added gen-theme as a bin command and removed it from the build script to decouple theme generation from the main build process.
  • package.json: Updated CSS exports to use explicit file mappings to ensure better package resolution for consumers.
  • src/lib/**/*.svelte and src/lib/**/*.css: Replaced $style/index.css references with the absolute package path @celar-ui/svelte/styles/index.css to resolve import errors in external projects.
  • CHANGELOG.md and package.json: Bumped version to 2.0.2.

Summary by CodeRabbit

  • New Features

    • Added gen-theme CLI command for theme generation.
  • Chores

    • Updated version to 2.0.2.
    • Reorganized CSS package exports and updated style reference paths across components.
    • Refactored build script to separate theme generation into a distinct process.

- `src/bin/gen-theme.ts` and `package.json`: Added `gen-theme` as a bin command and removed it from the build script to decouple theme generation from the main build process.
- `package.json`: Updated CSS exports to use explicit file mappings to ensure better package resolution for consumers.
- `src/lib/**/*.svelte` and `src/lib/**/*.css`: Replaced `$style/index.css` references with the absolute package path `@celar-ui/svelte/styles/index.css` to resolve import errors in external projects.
- `CHANGELOG.md` and `package.json`: Bumped version to 2.0.2.
@coderabbitai

coderabbitai Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@cuikho210 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 45 minutes and 32 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 45 minutes and 32 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e15cd97d-fbbd-4b35-a455-0203e14453b8

📥 Commits

Reviewing files that changed from the base of the PR and between 3e1354a and 7246544.

📒 Files selected for processing (1)
  • packages/svelte/package.json
📝 Walkthrough

Walkthrough

This PR refactors style references across 32+ component files, changing from local alias $style/index.css to absolute package path @celar-ui/svelte/styles/index.css. The build script was restructured to run theme generation separately, explicit CSS exports were added to package.json, and version was bumped to 2.0.2.

Changes

Cohort / File(s) Summary
Build & Package Configuration
packages/svelte/CHANGELOG.md, packages/svelte/package.json
Version bump to 2.0.2, removed gen-theme from build script, updated CSS exports from wildcards to explicit mappings, added bin field for gen-theme.ts CLI command.
Component Style References (Inputs)
packages/svelte/src/lib/inputs/Checkbox.svelte, ColorInput.svelte, FileInput.svelte, RadioItem.svelte, Slider.svelte, Switch.svelte, TagInput.svelte, TextInput.svelte
Updated PostCSS @reference paths from $style/index.css to @celar-ui/svelte/styles/index.css in all input components.
Component Style References (Navigation)
packages/svelte/src/lib/navigation/AdaptiveSidebar.svelte, AppBar.svelte, NavigationBar.svelte, NavigationBarButton.svelte
Updated PostCSS @reference paths from $style/index.css to @celar-ui/svelte/styles/index.css in all navigation components.
Component Style References (Misc & Containment)
packages/svelte/src/lib/misc/Badge.svelte, DuckSpinner.svelte, Gap.svelte, LinearProgressIndicator.svelte, packages/svelte/src/lib/containment/Spacer.svelte
Updated PostCSS @reference paths from $style/index.css to @celar-ui/svelte/styles/index.css in misc and containment components.
CSS Style Files (Containment)
packages/svelte/src/lib/containment/styles/avatar.css, breadcrumb.css, card.css, container.css, surface-container.css
Updated CSS @reference directives from $style/index.css to @celar-ui/svelte/styles/index.css in containment style files.
CSS Style Files (Inputs & Navigation)
packages/svelte/src/lib/buttons/styles/button_utils.css, packages/svelte/src/lib/inputs/styles/radio_group.css, packages/svelte/src/lib/navigation/styles/navigation_drawer.css
Updated CSS @reference directives from $style/index.css to @celar-ui/svelte/styles/index.css in utility and component style files.
CSS Style Files (Overlay)
packages/svelte/src/lib/overlay/styles/command.css, dialog.css, popover.css, surface-dialog.css
Updated CSS @reference directives from $style/index.css to @celar-ui/svelte/styles/index.css in overlay style files.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • PR #8: Modifies packages/svelte/src/lib/inputs/Slider.svelte to update component props alongside the style reference path change in this PR.
  • PR #11: Updates packages/svelte/src/lib/navigation/AdaptiveSidebar.svelte, directly overlapping with the same file modified in this PR's style reference refactor.
  • PR #17: Introduces theme CSS exports and gen-theme functionality that this PR's package.json changes (explicit CSS exports and bin field) directly reference and depend upon.

Poem

🐰✨ Hops through the codebase with glee
From $style to absolute paths so free!
Style references now point just right,
Theme generation runs separate, what a sight! 🌸
Organized exports in 2-0-2's delight!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(build): add theme generation CLI and improve style resolution' directly and clearly summarizes the main changes: adding a theme generation CLI tool and improving how styles are resolved in the package.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates @celar-ui/svelte to version 2.0.2, introducing a new CLI tool for theme generation and refactoring CSS exports and reference paths to use absolute package references. Feedback indicates several issues in package.json: the bin configuration uses a string which may cause naming conflicts and points to a TypeScript file that might not be included in the published package. Furthermore, removing theme generation from the build script risks publishing stale assets, and the breaking changes to style export paths suggest that a patch version bump is insufficient under Semantic Versioning.

Comment thread packages/svelte/package.json Outdated
Comment thread packages/svelte/package.json
Comment thread packages/svelte/package.json

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 4

🧹 Nitpick comments (1)
packages/svelte/src/lib/inputs/styles/radio_group.css (1)

1-1: Update Stylelint configuration to handle @reference directive.

Stylelint correctly flags @reference as an unknown at-rule since it's not part of standard CSS. If this is a valid custom PostCSS directive (pending verification in AdaptiveSidebar.svelte), update your Stylelint configuration to suppress this error.

📝 Suggested Stylelint configuration update

Add to your .stylelintrc or stylelint config:

{
  "rules": {
    "scss/at-rule-no-unknown": [
      true,
      {
        "ignoreAtRules": ["reference"]
      }
    ]
  }
}

Or if using at-rule-no-unknown directly:

{
  "rules": {
    "at-rule-no-unknown": [
      true,
      {
        "ignoreAtRules": ["reference"]
      }
    ]
  }
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/svelte/src/lib/inputs/styles/radio_group.css` at line 1, Stylelint
is flagging the custom PostCSS at-rule "@reference" in radio_group.css as an
unknown at-rule; update the project's Stylelint config (e.g., .stylelintrc) to
ignore "reference" by adding it to the ignoreAtRules list for
"scss/at-rule-no-unknown" or "at-rule-no-unknown", and confirm that the
"@reference" usage in AdaptiveSidebar.svelte is an intentional/valid directive
before suppressing the lint rule.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/svelte/CHANGELOG.md`:
- Line 8: Update the date on the changelog entry for version [2.0.2] from
2026-04-16 to the PR creation date 2026-04-15 (or to the intended release date
if this truly is a planned next-day release) so the header "## [2.0.2] -
2026-04-16" matches the PR timeline and avoids release tracking confusion.

In `@packages/svelte/package.json`:
- Line 48: The package.json uses a string-form "bin": "./src/bin/gen-theme.ts"
which causes npm to expose an executable named "svelte" and can collide with the
upstream CLI; change it to the object-form "bin" mapping a unique command name
to the existing script (e.g., map "celar-svelte-gen-theme" or another unique
identifier to "./src/bin/gen-theme.ts") so the package installs a uniquely named
CLI executable instead of overriding "svelte".

In `@packages/svelte/src/lib/overlay/styles/dialog.css`:
- Line 1: Stylelint is flagging the Tailwind v4 PostCSS `@reference` at-rule (seen
in the diff as "@reference '@celar-ui/svelte/styles/index.css';"); update the
Stylelint config by modifying the "scss/at-rule-no-unknown" rule to include
ignoreAtRules: ["reference"] (or alternatively configure a PostCSS-compatible
syntax parser) so that the `@reference` at-rule is allowed and the migrated files
no longer error.

In `@packages/svelte/src/lib/overlay/styles/popover.css`:
- Line 1: Add the `reference` at-rule to Stylelint's whitelist so `@reference`
usages (e.g., in packages/svelte/src/lib/overlay/styles/popover.css) stop
failing CI: update your Stylelint config file (.stylelintrc.json) to configure
the `scss/at-rule-no-unknown` rule to allow the "reference" at-rule (i.e.,
include "reference" in the ignoreAtRules array) so existing `@reference`
directives are treated as known.

---

Nitpick comments:
In `@packages/svelte/src/lib/inputs/styles/radio_group.css`:
- Line 1: Stylelint is flagging the custom PostCSS at-rule "@reference" in
radio_group.css as an unknown at-rule; update the project's Stylelint config
(e.g., .stylelintrc) to ignore "reference" by adding it to the ignoreAtRules
list for "scss/at-rule-no-unknown" or "at-rule-no-unknown", and confirm that the
"@reference" usage in AdaptiveSidebar.svelte is an intentional/valid directive
before suppressing the lint rule.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fc7b2e99-330f-45d6-8543-90200554ef31

📥 Commits

Reviewing files that changed from the base of the PR and between f851784 and 3e1354a.

📒 Files selected for processing (32)
  • packages/svelte/CHANGELOG.md
  • packages/svelte/package.json
  • packages/svelte/src/bin/gen-theme.ts
  • packages/svelte/src/lib/buttons/styles/button_utils.css
  • packages/svelte/src/lib/containment/Spacer.svelte
  • packages/svelte/src/lib/containment/styles/avatar.css
  • packages/svelte/src/lib/containment/styles/breadcrumb.css
  • packages/svelte/src/lib/containment/styles/card.css
  • packages/svelte/src/lib/containment/styles/container.css
  • packages/svelte/src/lib/containment/styles/surface-container.css
  • packages/svelte/src/lib/inputs/Checkbox.svelte
  • packages/svelte/src/lib/inputs/ColorInput.svelte
  • packages/svelte/src/lib/inputs/FileInput.svelte
  • packages/svelte/src/lib/inputs/RadioItem.svelte
  • packages/svelte/src/lib/inputs/Slider.svelte
  • packages/svelte/src/lib/inputs/Switch.svelte
  • packages/svelte/src/lib/inputs/TagInput.svelte
  • packages/svelte/src/lib/inputs/TextInput.svelte
  • packages/svelte/src/lib/inputs/styles/radio_group.css
  • packages/svelte/src/lib/misc/Badge.svelte
  • packages/svelte/src/lib/misc/DuckSpinner.svelte
  • packages/svelte/src/lib/misc/Gap.svelte
  • packages/svelte/src/lib/misc/LinearProgressIndicator.svelte
  • packages/svelte/src/lib/navigation/AdaptiveSidebar.svelte
  • packages/svelte/src/lib/navigation/AppBar.svelte
  • packages/svelte/src/lib/navigation/NavigationBar.svelte
  • packages/svelte/src/lib/navigation/NavigationBarButton.svelte
  • packages/svelte/src/lib/navigation/styles/navigation_drawer.css
  • packages/svelte/src/lib/overlay/styles/command.css
  • packages/svelte/src/lib/overlay/styles/dialog.css
  • packages/svelte/src/lib/overlay/styles/popover.css
  • packages/svelte/src/lib/overlay/styles/surface-dialog.css

Comment thread packages/svelte/CHANGELOG.md
Comment thread packages/svelte/package.json Outdated
Comment thread packages/svelte/src/lib/overlay/styles/dialog.css
Comment thread packages/svelte/src/lib/overlay/styles/popover.css
- Update `package.json` to change the `bin` field from a string to an object.
- Define the command name as `gen-theme` to ensure a consistent and clear CLI invocation.
@cuikho210 cuikho210 merged commit 874c728 into main Apr 15, 2026
1 check was pending
@cuikho210 cuikho210 deleted the dev branch April 15, 2026 18:14
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