秘诀
TypeScript + PnP 快速入门:
¥TypeScript + PnP quick start:
-
使用 Yarn 2 初始化 repo:
¥Initialize the repo using Yarn 2:
-
添加 typescript 并启用 VSCode 集成:
¥Add typescript and enable VSCode integration:
在指定目录中运行 Yarn CLI 命令:
¥Running a Yarn CLI command in the specified directory:
-
直接在 monorepo 中启动新库,而无需为其手动创建目录。
¥Starting a new library inside a monorepo directly, without manually creating directories for it.
yarn packages/my-new-lib init
-
在特定工作区内运行任意命令:
¥Running an arbitrary command inside a specific workspace:
yarn packages/app tsc --noEmit
混合 PnP + node_modules mono-repo:
¥Hybrid PnP + node_modules mono-repo:
有时,你可能只需要在工作区的一部分上使用 node_modules
(例如,如果你使用 React-Native)。