← All Learning Paths

Monorepo Engineer

Scale one repository across teams: workspace layout, dependency pinning, version skew, hoisting traps, lockfile discipline, and fan-out CI that stays fast.

roleintermediate6 nodes12.92h total

Path overview

单仓的收益是原子提交与统一工具链,代价是依赖与 CI 复杂度。本路径从工作区与依赖图讲起,覆盖钉扎、版本偏差与依赖混淆三类风险,再实战幽灵依赖、锁文件冲突与对等依赖风暴三大故障,收尾于矩阵 CI 与构建缓存。

Monorepos buy atomic commits and one toolchain at the price of dependency and CI complexity. This path covers workspaces, pinning, version skew, hoisting traps, lockfile failures, and matrix CI.

  1. Stand up "pnpm Monorepo Workspaces" from its CLI, then modify "pnpm create turbo my-monorepo" and show the documented behavior still holds.

    Completion criteria: Run "pnpm Monorepo Workspaces" once before and once after your modification and paste both outputs with the entry point unchanged.

    Next step: Fan Out CI with a GitHub Actions Matrix

    ⏱ 1.5h

  2. Execute "Fan Out CI with a GitHub Actions Matrix" end to end, then repeat the last step with one parameter changed and compare "Four jobs appear in the run, one per operating system and Node version.".

    Completion criteria: Deliver a transcript of "Fan Out CI with a GitHub Actions Matrix" with each step's command and observed state, ending at "Four jobs appear in the run, one per operating system and Node version.".

    Next step: Share a Docker Build Cache Across CI Runs

    ⏱ 0.5h

  3. Run "Build with the gha cache backend for both import and export." from "Share a Docker Build Cache Across CI Runs" and confirm the documented result "Each branch writes its own cache scope and does not overwrite the default branch cache.".

    Prerequisites: Fan Out CI with a GitHub Actions Matrix

    Completion criteria: Show the command for every step of "Share a Docker Build Cache Across CI Runs" and paste the output proving "Build with the gha cache backend for both import and export."; then note the step where "Each branch writes its own cache scope and does not overwrite the default branch cache." appears.

    Next step: Add a Dependency Lockfile Audit

    ⏱ 0.5h

  4. Apply "Add a Dependency Lockfile Audit" to a monorepo task, checking that "Trace each advisory to the package that introduced it and choose a direct dependency update" appears after the "The owner of the transitive dependency and the available fixed version are visible." step.

    Prerequisites: Share a Docker Build Cache Across CI Runs

    Completion criteria: Run the steps through "Trace each advisory to the package that introduced it and choose a direct dependency update", paste the command output, and mark the line that matches "The advisory is resolved and the application tests still pass."; then rerun with one parameter changed.

    Next step: Select Affected Packages for a Build

    ⏱ 0.5h

  5. Build "Select Affected Packages for a Build" for monorepo code and verify [api,web] against both samples.

    Prerequisites: Add a Dependency Lockfile Audit

    Completion criteria: Submit a solution for "Monorepo Engineer" that passes both samples ({changedFiles:[packages/api/src/handler.ts],packages:[{name: to [api,web]) and attach the failing case you fixed.

    Next step: Capstone: Monorepo Engineer

    ⏱ 0.42h

  6. Deliver the "Build a Mini Package Manager with Semver Resolution" blueprint with "Conflict detection when two ranges on one package have no intersecting version, with a path" working and "Tarball fetch from a local registry with SHA-256 integrity checking before extraction" recorded as evidence.

    Prerequisites: Add a Dependency Lockfile Audit, Select Affected Packages for a Build

    Completion criteria: Deliver "Conflict detection when two ranges on one package have no intersecting version, with a path" and paste the test output where the acceptance test passes; include the test name and command.

    Next step: Run the capstone's tests, publish the repository, and demo it to a reviewer.

    ⏱ 4h