Skip to content

Conversation

@abhakat
Copy link
Contributor

@abhakat abhakat commented Jan 26, 2026

What changed / motivation ?

Please include relevant motivation and context

Improved create-stylex-app CLI and fix example template dependencies.

CLI Changes:

  • Improve --help output to show templates in a formatted multi-line list
    with descriptions and "(recommended)" labels instead of a comma-separated string

Example Fixes:

  • example-react-router: Remove vite-plugin-devtools-json (incompatible with Vite 7)
  • example-redwoodsdk: Add missing capnweb peer dependency, align react-server-dom-webpack
    to canary version, update @cloudflare/workers-types for wrangler compatibility
  • example-storybook: Add example:dev script so generated project has npm run dev,
    upgrade Vitest from v3 to v4
  • example-rollup: Add missing @babel/preset-flow (required by babel.config.mjs but
    wasn't in package.json)

These fixes ensure all templates work out-of-the-box when users run create-stylex-app.

Linked PR/Issues

Fixes #1456

Additional Context

I installed dependencies and tested all of the templates which had npm run dev configs.

Testing process:

  • Built create-stylex-app locally
  • Created test projects for react-router, redwoodsdk, storybook, and rollup
  • Verified npm install succeeds without ERESOLVE errors
  • Verified npm run dev/build works for each template

Pre-flight checklist

Anay Bhakat added 6 commits January 25, 2026 22:48
Update the help display to show available frameworks in a formatted
multi-line list with descriptions and alignment, instead of a simple
comma-separated string.

The new format displays each template on its own line with:
- Template ID (left-aligned with consistent padding)
- Description of the template
- "(recommended)" label for recommended templates

Also simplify the --template option description to show only the
supported github:owner/repo/path format.
Remove vite-plugin-devtools-json as it does not support Vite 7.
The plugin only supports vite@^2.7.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0,
causing npm install to fail with ERESOLVE peer dependency conflicts.

This fix is required for create-stylex-app to work correctly, since
the CLI fetches templates from the main branch on GitHub. Without
this change, users selecting the react-router framework will get
a broken project that fails to install dependencies.

Changes:
- Remove vite-plugin-devtools-json from devDependencies
- Remove the import and devtoolsJson() plugin call from vite.config.ts
- Remove now-unnecessary @ts-expect-error comments
Fix multiple dependency issues that prevented npm install from succeeding
when using the redwoodsdk template with create-stylex-app.

Issues fixed:
1. react-server-dom-webpack version mismatch: Updated from 19.2.1 to
   19.3.0-canary-561ee24d-20251101 to align with react and react-dom
   versions. The old version required peer react@^19.2.1 which conflicted
   with the canary React version.

2. Missing capnweb peer dependency: Added capnweb@~0.2.0 which is required
   by rwsdk@1.0.0-beta.31 but was not installed.

3. @cloudflare/workers-types version: Updated from pinned 4.20251121.0 to
   ^4.20260120.0 to be compatible with wrangler@4.60.0 (the latest version
   that npm resolves from ^4.50.0).

Testing process:
1. Run: node .../create-stylex-app/lib/index.js test-redwoodsdk --framework redwoodsdk --no-install
2. Apply fixes manually to generated project (until merged to main)
3. Run: npm install (should succeed without ERESOLVE errors)
4. Run: npm run dev (should start the dev server)
Add example:dev script and upgrade Vitest dependencies to fix issues
when using the storybook template with create-stylex-app.

Changes:
1. Add example:dev script that runs the Storybook dev server. The CLI's
   normalizeScripts function strips the "example:" prefix, so the
   generated project will have a "dev" script. This fixes the "Next
   steps" output which previously showed "npm run dev" but no dev
   script existed.

2. Upgrade @vitest/browser and @vitest/coverage-v8 from ^3.2.4 to
   ^4.0.13 (major version upgrade to Vitest v4).

Testing:
1. Run: node .../create-stylex-app/lib/index.js test-storybook --framework storybook
2. Run: npm run dev (starts Storybook on port 6006)
The babel.config.mjs requires @babel/preset-flow but it was not listed
in package.json. This caused the build to fail with "Cannot find module
'@babel/preset-flow'" when users tried to build the project.

Testing:
1. Run: node .../create-stylex-app/lib/index.js test-rollup --framework rollup
2. Run: npm run dev (or npm run build)
3. Verify: Build succeeds with "created .build/bundle.js"
Regenerate yarn.lock to reflect dependency updates across examples:
- example-react-router: Removed vite-plugin-devtools-json
- example-redwoodsdk: Added capnweb, updated react-server-dom-webpack
  and @cloudflare/workers-types
- example-storybook: Upgraded @vitest/browser and @vitest/coverage-v8 to v4
- example-rollup: Added @babel/preset-flow
@vercel
Copy link

vercel bot commented Jan 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
stylex Skipped Skipped Jan 28, 2026 6:03pm

Request Review

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 26, 2026
@github-actions
Copy link

github-actions bot commented Jan 26, 2026

workflow: benchmarks/perf

Comparison of performance test results, measured in operations per second. Larger is better.
yarn workspace v1.22.22
yarn run v1.22.22
$ node ./compare.js /tmp/tmp.cdIQI3O2QL /tmp/tmp.4ntFWGxVga

Results Base Patch Ratio
babel-plugin: stylex.create
· basic create 476 534 1.12 !!
· complex create 59 65 1.10 !!
babel-plugin: stylex.createTheme
· basic themes 314 445 1.42 !!
· complex themes 30 35 1.17 !!
Done in 0.08s.
Done in 0.31s.
@github-actions
Copy link

github-actions bot commented Jan 26, 2026

workflow: benchmarks/size

Comparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better.
yarn workspace v1.22.22
yarn run v1.22.22
$ node ./compare.js /tmp/tmp.KtNHLi3cnl /tmp/tmp.Y6j0SRPlyK

Results Base Patch Ratio
@stylexjs/stylex/lib/cjs/stylex.js
· compressed 1,311 1,311 1.00
· minified 4,150 4,150 1.00
@stylexjs/stylex/lib/cjs/inject.js
· compressed 1,793 1,793 1.00
· minified 4,915 4,915 1.00
benchmarks/size/.build/bundle.js
· compressed 496,650 496,650 1.00
· minified 4,847,840 4,847,840 1.00
benchmarks/size/.build/stylex.css
· compressed 99,853 99,853 1.00
· minified 747,541 747,541 1.00
Done in 0.08s.
Done in 0.34s.
- Rename package to create-stylex-app for npx usage
- Remove private flag to allow publishing
- Add templates.json to published files
- Bump version to 0.1.0-alpha.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

2 participants