Skip to content

RC #287#288

Merged
rmenner merged 7 commits into
mainfrom
rc/287
May 6, 2026
Merged

RC #287#288
rmenner merged 7 commits into
mainfrom
rc/287

Conversation

@rmenner

@rmenner rmenner commented May 6, 2026

Copy link
Copy Markdown
Collaborator

Alaska Airlines Pull Request

Release candidate pull request. See issue #287 for details.

Checklist:

  • My update follows the CONTRIBUTING guidelines of this project
  • I have performed a self-review of my own update

By submitting this Pull Request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Pull Requests will be evaluated by their quality of update and whether it is consistent with the goals and values of this project. Any submission is to be considered a conversation between the submitter and the maintainers of this project and may require changes to your submission.

Thank you for your submission!

-- Auro Design System Team

rmenner and others added 6 commits May 6, 2026 14:42
…command

- Add compileDemoScss to build/dev paths for consistent demo SCSS handling
- Copy processed README.md to demo directory as readme.md after docs build
- Add --watch flag to docs command with chokidar file watcher
- Add dedicated demo SCSS watcher in dev watch mode (separate from rollup)
- Fix feedback loops by pausing watcher during rebuilds and ignoring output files
- Add .min.css to output ignore patterns across all watchers

Co-authored-by: Copilot <copilot@github.com>
- Add -r, --readme-template flag to docs/dev/build commands for custom README template
- Support both URLs and local file paths for README template input
- Extract copyReadmeToDemo to shared util
- Extract MODULE_DIRS to shared paths.js
- Unify SIGINT shutdown handlers via shared shutdown utility

Co-authored-by: Copilot <copilot@github.com>
- Add exports field resolution to Sass node_modules importer
- Add loadPaths for monorepo node_modules directory traversal
- Properly resolve bare specifiers like @aurodesignsystem/config/demo-styles
  via the package's exports map instead of hardcoded src/ lookup
Port formkit docProcessor enhancements to auro-cli:
- Resolve second-pass AURO-GENERATED-CONTENT tags from inlined partials
- Replace template variables in nested partial content
- Convert markdown code fences to HTML pre/code blocks
- Normalize whitespace for marked.js compatibility
…ars support

Co-authored-by: Copilot <copilot@github.com>
@rmenner
rmenner requested a review from a team as a code owner May 6, 2026 21:44
@sourcery-ai

sourcery-ai Bot commented May 6, 2026

Copy link
Copy Markdown

Reviewer's Guide

Extends the docs build and dev tooling to better support monorepo setups, richer README templating, demo asset compilation, and watch-mode workflows, while improving dev server handling of node_modules assets and CommonJS modules.

Sequence diagram for watch mode docs rebuild workflow

sequenceDiagram
  actor Dev as Developer
  participant CLI as docs_command
  participant Docs as watchDocs
  participant FS as chokidar_watcher
  participant Build as runDefaultDocsBuild
  participant Copy as copyReadmeToDemo
  participant Scss as compileDemoScss
  participant Bundle as buildDemoBundle
  participant Shutdown as shutdown_utils

  Dev->>CLI: run docs --watch --readme-template
  CLI->>Docs: watchDocs(options)
  Docs->>FS: chokidar.watch(watchPaths, ignored)
  Docs->>Shutdown: registerWatcher(watcher)
  Docs->>Shutdown: installShutdownHandler()
  FS-->>Docs: ready (watching)

  FS-->>Docs: file change event
  Docs->>Docs: debounce rebuild timer
  Docs->>Docs: rebuild(triggerPath)

  Docs->>Build: runDefaultDocsBuild(options)
  Build-->>Docs: docs markdown and README generated
  Docs->>Copy: copyReadmeToDemo()
  Copy-->>Docs: demo/readme.md updated
  Docs->>Scss: compileDemoScss()
  Scss-->>Docs: demo .scss -> .min.css
  Docs->>Bundle: buildDemoBundle(options)
  Bundle-->>Docs: demo JS bundle updated
  Docs-->>CLI: rebuild complete

  Dev-->>CLI: SIGINT (Ctrl+C)
  CLI->>Shutdown: SIGINT handler invoked
  Shutdown->>FS: watcher.close()
  Shutdown-->>Dev: "All done! See you next time."
Loading

Class diagram for updated docs, build, and utility modules

classDiagram
  class defaultDocsBuild_js {
    +ProcessorConfig defaultDocsProcessorConfig
    +fileConfigs(config, skipReadme)
    +processDocFiles(config, skipReadme)
    +runDefaultDocsBuild(options)
    -pathFromCwd(pathLike)
    -findMonorepoRoot(startDir)
    -postProcessMarkdownFile(outputPath, extraVars)
  }

  class bundleHandlers_js {
    +generateDocs(options)
    +compileDemoScss(demoDir)
    +buildDemoBundle(options)
    -createNodeModulesImporter()
  }

  class docs_index_ts {
    +docs(options)
    +serve(options)
    +api(options)
    +cem(options)
    +watchDocs(options)
  }

  class devServerUtils_js {
    +startDevelopmentServer(options)
    -nodeModulesCssPlugin()
    -cjsToEsmPlugin()
    -resolveWdsPath(urlPath, rootDir)
  }

  class watchModeHandlers_js {
    +handleWatcherEvents(options, onInitialBuildComplete)
    +setupWatchModeListeners(watcher, scssWatcher)
    -isOutputFile(filePath)
    -runBuildTask(type, fn)
  }

  class build_index_js {
    +runProductionBuild(options)
    +setupWatchMode(options)
  }

  class shutdown_js {
    +registerWatcher(watcher)
    +installShutdownHandler()
    -watchers
    -handlerInstalled
  }

  class copyReadmeToDemo_js {
    +copyReadmeToDemo()
  }

  class paths_js {
    +MODULE_DIRS
  }

  class configUtils_js {
    +getPluginsConfig(modulePaths, options)
    +getWatcherConfig(watchOptions)
  }

  class docs_command_ts {
    +docsCommand
  }

  defaultDocsBuild_js --> bundleHandlers_js : uses compileDemoScss
  defaultDocsBuild_js --> copyReadmeToDemo_js : uses copyReadmeToDemo

  bundleHandlers_js --> paths_js : uses MODULE_DIRS
  bundleHandlers_js --> shutdown_js : uses registerWatcher

  docs_index_ts --> defaultDocsBuild_js : uses runDefaultDocsBuild
  docs_index_ts --> bundleHandlers_js : uses compileDemoScss
  docs_index_ts --> bundleHandlers_js : uses buildDemoBundle
  docs_index_ts --> copyReadmeToDemo_js : uses copyReadmeToDemo
  docs_index_ts --> shutdown_js : uses registerWatcher

  devServerUtils_js --> paths_js : uses MODULE_DIRS

  watchModeHandlers_js --> bundleHandlers_js : uses generateDocs
  watchModeHandlers_js --> bundleHandlers_js : uses compileDemoScss
  watchModeHandlers_js --> shutdown_js : uses registerWatcher

  build_index_js --> bundleHandlers_js : uses generateDocs
  build_index_js --> bundleHandlers_js : uses compileDemoScss

  docs_command_ts --> docs_index_ts : invokes docs, serve, api, cem, watchDocs

  configUtils_js --> paths_js : uses DEFAULTS.moduleDirectories
Loading

Flow diagram for extended docs build pipeline with monorepo support

flowchart TD
  subgraph DocsBuild[runDefaultDocsBuild]
    A_opts["Options (readmeTemplate, skipReadme)"]
    A_proc[processDocFiles]
    A_readmeCfg["Determine README input (remote or local)"]
    A_monorepo[findMonorepoRoot]
    A_pkg["Read monorepo package.json"]
    A_vars["Build extraVars (monorepoName + config.extraVars)"]
    A_files[fileConfigs]
    A_loop{{"for each fileConfig"}}
    A_procFile[processContentForFile with extraVars]
    A_mdCheck{"output endsWith .md"}
    A_post[postProcessMarkdownFile]
    A_copy[copyReadmeToDemo]
    A_scss[compileDemoScss]
    A_js[buildDemoBundle]

    A_opts --> A_proc
    A_opts --> A_readmeCfg
    A_readmeCfg --> A_files

    A_proc --> A_monorepo
    A_monorepo --> A_pkg
    A_pkg --> A_vars
    A_vars --> A_files

    A_files --> A_loop
    A_loop --> A_procFile
    A_procFile --> A_mdCheck
    A_mdCheck -- yes --> A_post
    A_mdCheck -- no --> A_loop
    A_post --> A_loop

    A_loop -->|all files done| A_copy
    A_copy --> A_scss
    A_scss --> A_js
  end

  subgraph PostProcess[postProcessMarkdownFile]
    P_read["Read output .md"]
    P_tags["Resolve empty AURO-GENERATED-CONTENT tags from FILE/CODE src"]
    P_demoDir["Fallback to demo directory for src resolution"]
    P_tpl["templateFiller.replaceTemplateValues with extraVars"]
    P_fences["Convert ``` fences to <pre><code> blocks"]
    P_ws["Normalize whitespace for marked.js (pre code blocks)"]
    P_strip["Strip leading whitespace before HTML tags outside <pre>"]
    P_write["Write normalized .md"]

    P_read --> P_tags
    P_tags --> P_demoDir
    P_demoDir --> P_tpl
    P_tpl --> P_fences
    P_fences --> P_ws
    P_ws --> P_strip
    P_strip --> P_write
  end

  A_post --> PostProcess
Loading

File-Level Changes

Change Details Files
Enhance docs build pipeline with monorepo-aware templating, configurable README source, and markdown post-processing.
  • Add monorepoName and extraVars fields to the default docs processor config and derive monorepoName automatically from the nearest package.json with workspaces.
  • Allow runDefaultDocsBuild and fileConfigs to use either a remote README template URL or a local path provided via options.readmeTemplate.
  • Introduce postProcessMarkdownFile to perform a second pass on AURO-GENERATED-CONTENT tags, inline external file/code content with fallbacks, convert markdown code fences to HTML
     blocks, and normalize whitespace for marked.js compatibility.
  • Pass extraVars into processContentForFile and post-processing so template variables are resolved in nested partials.
src/scripts/build/defaultDocsBuild.js
Add SCSS compilation and demo JS bundling for demo assets, and integrate them into docs, build, and watch workflows.
  • Create createNodeModulesImporter and compileDemoScss to compile all demo SCSS files to minified CSS while resolving node_modules and hoisted dependencies.
  • Add buildDemoBundle to bundle demo JS via rollup using getDemoConfig, and wire it into docs generation and production builds.
  • Extend watch handlers to trigger SCSS compilation as a separate build task, including initial build sequencing and throttling, and watch demo SCSS files directly in setupWatchMode.
  • Ensure README is copied into the demo directory after docs builds via a shared copyReadmeToDemo utility.
src/scripts/build/bundleHandlers.js
src/scripts/docs/index.ts
src/scripts/build/index.js
src/scripts/build/watchModeHandlers.js
src/utils/copyReadmeToDemo.js
Improve dev server support for node_modules CSS and CommonJS modules, and centralize watcher shutdown handling.
  • Add nodeModulesCssPlugin to serve CSS files directly from node_modules based on bare package-style URLs used by CSS @import statements.
  • Add cjsToEsmPlugin to detect CommonJS modules in node_modules and transpile them on-the-fly to ESM using esbuild, avoiding browser require/module.exports issues.
  • Register both plugins with startDevelopmentServer and simplify server configuration comments.
  • Introduce a shared shutdown utility that registers watchers and installs a single SIGINT handler to close them cleanly with user feedback.
src/scripts/build/devServerUtils.js
src/utils/shutdown.js
Update CLI commands and build config to expose new options and ensure bundling compatibility.
  • Expose a --readme-template option on both build and docs commands and a --watch flag on docs to enable watchDocs mode, wiring docs command to new watchDocs function.
  • Integrate commonjs() into the default Rollup plugins config so CommonJS modules can be bundled correctly, and update watcher ignore patterns to skip generated demo CSS.
  • Add @rollup/plugin-commonjs as a dev dependency for the new bundling behavior.
src/scripts/docs/index.ts
src/commands/docs.ts
src/scripts/build/configUtils.js
src/commands/_sharedOptions.js
package.json
Add shared module resolution paths for node_modules to support monorepo/hoisted layouts.
  • Define MODULE_DIRS with common node_modules search paths and reuse it in Sass importer, dev server CSS resolution, and exports-based module resolution.
  • Use MODULE_DIRS for resolving packages in demo SCSS compilation and dev-server node_modules CSS handling.
src/scripts/build/paths.js
src/scripts/build/bundleHandlers.js
src/scripts/build/devServerUtils.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

jason-capsule42
jason-capsule42 previously approved these changes May 6, 2026
Comment thread src/scripts/build/defaultDocsBuild.js Dismissed
Comment thread src/scripts/build/defaultDocsBuild.js Dismissed

@sourcery-ai sourcery-ai 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.

Hey - I've left some high level feedback:

  • The docs command runs an initial docs() build and then watchDocs() immediately triggers another full runDefaultDocsBuild, so when --watch is used you might want to skip the second initial build in watchDocs (or skip the first one) to avoid redundant work and duplicated console noise.
  • In setupWatchModeListeners and watchDocs, the shutdown handling and watcher registration now use registerWatcher/installShutdownHandler; consider centralizing the SIGINT hook at a single entry point to avoid subtle differences in shutdown behavior between build and docs watch flows.
  • The postProcessMarkdownFile implementation currently reads and writes the same file up to three times per run; you could simplify and reduce I/O by chaining the AURO tag expansion, fence conversion, and whitespace normalization in-memory and writing the file once at the end.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `docs` command runs an initial `docs()` build and then `watchDocs()` immediately triggers another full `runDefaultDocsBuild`, so when `--watch` is used you might want to skip the second initial build in `watchDocs` (or skip the first one) to avoid redundant work and duplicated console noise.
- In `setupWatchModeListeners` and `watchDocs`, the shutdown handling and watcher registration now use `registerWatcher`/`installShutdownHandler`; consider centralizing the SIGINT hook at a single entry point to avoid subtle differences in shutdown behavior between build and docs watch flows.
- The `postProcessMarkdownFile` implementation currently reads and writes the same file up to three times per run; you could simplify and reduce I/O by chaining the AURO tag expansion, fence conversion, and whitespace normalization in-memory and writing the file once at the end.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Co-authored-by: Copilot <copilot@github.com>
@rmenner
rmenner merged commit c3c60a7 into main May 6, 2026
18 of 19 checks passed
@rmenner
rmenner deleted the rc/287 branch May 6, 2026 22:23
@jason-capsule42

Copy link
Copy Markdown
Member

🎉 This PR is included in version 3.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@jason-capsule42 jason-capsule42 added the released Completed work has been released label May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Completed work has been released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants