CodeVetter · Repo Unpack · System map
react/create-react-app
The published surface is a Lerna/Yarn workspaces monorepo under packages/. Users invoke the create-react-app binary, which delegates project creation to react-scripts/scripts/init.js and then leaves the app running on react-scripts start/build/test. Runtime boundaries are Node for the CLI and scripts, webpack-dev-server for development, Jest for tests, and static file output for production. Docs live in docusaurus/website and deploy via Netlify. CI is GitHub Actions (build-and-test, lint, e2e).
- Root package.json names the monorepo create-react-app, marks it private, requires Node >=14, and uses Yarn workspaces for packages/*. Scripts include create-react-app (node tasks/cra.js), build (node tasks/build.js), test (tasks/e2e-simple.sh), e2e (tasks/e2e-simple.sh + tasks/e2e-behavior.sh), e2e:docker (tasks/e2e-docker.sh), eslint, format, and prettier.
- lerna.json pins Lerna 3.22.1 with version 5.1.0, npmClient yarn, and useWorkspaces true, so package publishes are version-locked together rather than independently versioned at publish time.
- The user-facing CLI entry is packages/create-react-app/index.js. It checks Node >=14 via semver, validates the project directory with createApp, then spawns react-scripts/scripts/init.js through executeNodeScript, passing root, appName, verbose, originalDirectory, and template.
- create-react-app's bin is create-react-app -> index.js and its only runtime dependency is react-scripts. CLI flags include --scripts-version, --template, --use-pnp, --verbose, and --info (which delegates to envinfo).
- react-scripts is the toolchain package (bin react-scripts -> bin/react-scripts.js). Its dependencies include webpack 5, webpack-dev-server 4, babel-loader, @babel/core, Jest 27, eslint 8, css-minimizer-webpack-plugin, postcss-loader, sass-loader, workbox-webpack-plugin, and html-webpack-plugin.
- react-scripts bin switches on process.argv[2]: start, build, and test require the matching scripts/* module; eject runs scripts/eject. Unknown commands print a hint that CRA commands are start, build, test, and eject.
- Webpack configs are three modules under packages/react-scripts/config: webpack.config.js (shared factory), webpackDevServer.config.js, and an env loader (env.js) plus paths.js and modules.js. babel-preset-react-app and eslint-config-react-app are sibling packages consumed by those configs.
- Docs site package cra-docs (docusaurus/website) is a Docusaurus 2 app. Scripts are start (docusaurus start), build, deploy, and swizzle. netlify.toml publishes docusaurus/website/build with NODE_VERSION 16.8.0 and a docs redirect from / to /docs/getting-started.
- CI workflow build-and-test.yml runs on push to main and on pull_request. Jobs include a build job and an e2e-docker job that calls the reusable workflow e2e-base.yml. lint.yml runs separately.
- The default app template is packages/cra-template (template.json + template/public and template/src). TypeScript variant is packages/cra-template-typescript. Templates declare package.json dependencies (react, react-dom, react-scripts, web-vitals, testing-library) and scripts start/build/test/eject.
- react-dev-utils is the shared Node library for the CLI and scripts: WebpackDevServerUtils, createCompiler, FileSizeReporter, InterpolateHtmlPlugin, ModuleScopePlugin, eslintFormatter, and browsersHelper. react-error-overlay is a separate iframe overlay package built with its own webpack config.
- There is no application database. Persistence is the generated project directory on disk (files copied from the template, package.json written by init, yarn.lock or package-lock from the installer) plus webpack's in-memory dev middleware and the build/ output folder.
- External integrations at runtime are the npm registry (template and dependency install), browserslist/caniuse via react-dev-utils/browsersHelper, optional Sentry-unrelated envinfo for --info, and Google Fonts only inside the docs site CSS — not the generated app. Workbox is bundled for optional PWA service workers when src/service-worker.js exists.