Skip to content

feat: public generate-artifacts script#550

Merged
Brentlok merged 2 commits into
mainfrom
feat/public-build-css
May 26, 2026
Merged

feat: public generate-artifacts script#550
Brentlok merged 2 commits into
mainfrom
feat/public-build-css

Conversation

@Brentlok

@Brentlok Brentlok commented May 25, 2026

Copy link
Copy Markdown
Contributor

Fixes #544

Summary by CodeRabbit

  • New Features
    • Adds a command-line interface: run uniwind generate-artifacts to generate build artifacts with options for CSS file, repeated themes, optional TypeScript declarations, and built-in help.
    • Installs a runnable CLI executable for direct use.
    • Improves CLI output with clearer informational messages and user-friendly error reporting and exit behavior.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c1ede658-d9f7-4de0-8be7-f52dd6ee1395

📥 Commits

Reviewing files that changed from the base of the PR and between 7da4195 and 0c7e2aa.

📒 Files selected for processing (1)
  • packages/uniwind/src/bundler/cli/index.ts

📝 Walkthrough

Walkthrough

Adds a Node/ESM CLI command uniwind generate-artifacts, a CLI factory and info logger, and updates build/package config to bundle and expose the CLI executable.

Changes

CLI executable interface for uniwind

Layer / File(s) Summary
CLI bundler config and logger support
packages/uniwind/src/bundler/config.ts, packages/uniwind/src/bundler/logger.ts
UniwindBundlerConfig.fromCliConfig adds CLI-specific cssEntryFile validation and constructs a Web-targeted config. Logger.info logs blue info-prefixed messages with terminal reset.
CLI argument parsing and command execution
packages/uniwind/src/bundler/cli/index.ts
Node/ESM CLI implements generate-artifacts, parses --css (required), repeated --theme, optional --dts, and --help; resolves output path, builds config via fromCliConfig, calls generateArtifacts, logs completion, and exits with code 1 on errors.
Build configuration and package bin entry
packages/uniwind/build.config.ts, packages/uniwind/package.json
Rollup entries include src/bundler/cli/index.ts emitted as cli/index; package.json adds a bin.uniwind mapping to ./dist/cli/index.mjs.

Sequence Diagram(s)

sequenceDiagram
  participant UserCLI as uniwind (process)
  participant CLI_Script as src/bundler/cli/index.ts
  participant BundlerConfig as UniwindBundlerConfig
  participant Bundler as bundler.generateArtifacts
  participant FS as filesystem

  UserCLI->>CLI_Script: invoke generate-artifacts with args
  CLI_Script->>CLI_Script: parse args (--css, --theme, --dts)
  CLI_Script->>BundlerConfig: fromCliConfig(parsedArgs)
  BundlerConfig->>Bundler: generateArtifacts(cssArtifactPath)
  Bundler->>FS: write uniwind.css at cssArtifactPath
  Bundler->>CLI_Script: completion
  CLI_Script->>UserCLI: console.info "Artifacts generated"
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A tiny CLI hops into view,
Parsing flags as it scurries through,
It builds the config, writes the CSS,
Logs a cheer with blue finesse,
Artifacts born — a rabbit's bravo to you!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title accurately describes the main change: introducing a public generate-artifacts script/CLI for the uniwind package.
Linked Issues check ✅ Passed PR adds a public CLI interface for artifact generation (CSS file) via the generate-artifacts script, which addresses the requirement in issue #544 to provide a public way to generate CSS artifacts in CI.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing a public CLI for generating artifacts: CLI entrypoint, build config, package.json bin setup, and supporting utilities are all within scope.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/public-build-css

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/uniwind/src/bundler/cli/index.ts`:
- Around line 7-8: The dirname resolution using import.meta.dirname is fragile
on older Node versions; update the logic that sets dirname (used to compute
cssArtifactPath) to robustly derive the directory: check for a defined __dirname
first, otherwise convert import.meta.url to a file path via URL/fileURLToPath to
produce the directory, and then use that dirname to compute cssArtifactPath.
Locate the assignment to dirname and the cssArtifactPath computation in this
file (symbols: dirname, cssArtifactPath, import.meta.dirname) and replace the
current one-liner with the fallback approach so the CLI works on older Node
runtimes.
🪄 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: 260cd519-f273-4710-98fa-84bf8623fe50

📥 Commits

Reviewing files that changed from the base of the PR and between 6b6d1ef and 7da4195.

📒 Files selected for processing (5)
  • packages/uniwind/build.config.ts
  • packages/uniwind/package.json
  • packages/uniwind/src/bundler/cli/index.ts
  • packages/uniwind/src/bundler/config.ts
  • packages/uniwind/src/bundler/logger.ts

Comment thread packages/uniwind/src/bundler/cli/index.ts Outdated
@Brentlok Brentlok merged commit 8642b55 into main May 26, 2026
2 checks passed
@Brentlok Brentlok deleted the feat/public-build-css branch May 26, 2026 06:38
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

🚀 This pull request is included in v1.8.0. See Release v1.8.0 for release notes.

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.

Export buildCSS as public API

1 participant