@0xproject/monorepo-scripts 中文文档教程
Mono repo scripts
此存储库包含一些有用的脚本,用于处理此单声道存储库。
Scripts
yarn deps_versions
:由于我们是 Yarn workspaces monorepo,monorepo 中包之间的共享依赖关系被提升到顶级 node_modules
目录。 但是,如果两个包使用相同依赖项的不同版本,则两者都会安装。 为了避免安装多个版本的依赖项,我们尝试在 monorepo 中的包中保持依赖项版本相同。 该脚本将列出我们安装了多个版本的所有依赖项。 然后我们可以遍历它们并尝试尽可能合并到一个版本。
yarn find_unused_deps
:有时我们不小心将不再使用的依赖项列在 package.json
中。 此脚本查找可能不再使用的潜在依赖项。 请在删除之前确认它不再使用,我们在后台使用的 depcheck
包不能完美地处理一些 TS 怪癖。
yarn test:publish
:执行发布脚本的测试运行。 这个试运行实际上不会发布,也不会向 Github 提交/推送任何内容。
Usage
Dependency versions
为了减小这个 repo 的大小,我们尝试在包之间使用相同版本的依赖项。 为了更容易发现包之间的版本差异,您可以运行:
yarn scripts:deps_versions
这将列出包之间版本不同的任何依赖项。
Contributing
我们欢迎来自更广泛社区的改进和修复! 要报告此包中的错误,请在此存储库中创建一个问题。
请在开始之前阅读我们的贡献指南。
Install dependencies
如果您没有启用 yarn workspaces (Yarn < v1.0) - 启用它们:
yarn config set workspaces-experimental true
然后安装依赖
yarn install
Build
项 要构建此包和它所依赖的所有其他 monorepo 包,请从 monorepo 根目录运行以下命令:
PKG=@0xproject/monorepo-scripts yarn build
或持续重建关于改变:
PKG=@0xproject/monorepo-scripts yarn watch
Clean
yarn clean
Lint
yarn lint
Run Tests
yarn test
Mono repo scripts
This repository contains a few helpful scripts for working with this mono repo.
Scripts
yarn deps_versions
: Since we are a Yarn workspaces monorepo, shared dependencies between packages in the monorepo get hoisted to a top-level node_modules
directory. If two packages use different versions of the same dependency however, both get installed. To avoid having many versions of a dependency installed, we try to keep dependency versions the same across packages in the monorepo. This script will list any dependencies for which we have multiple versions installed. We can then go through them and try to consolidate to a single version where possible.
yarn find_unused_deps
: Sometimes we accidentally leave dependencies listed in package.json
that are no longer being used. This script finds potential dependencies that might no longer be in use. Please verify that it is no longer in use before removing, the depcheck
package we use under-the-hood doesn't handle some TS quirks perfectly.
yarn test:publish
: Execute a test-run of the publish script. This dry run won't actually publish, nor will it commit/push anything to Github.
Usage
Dependency versions
In order to reduce the size of this repo, we try and use the same versions of dependencies between packages. To make it easier to discover version discrepancies between packages, you can run:
yarn scripts:deps_versions
This will list out any dependencies that differ in versions between packages.
Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our contribution guidelines before getting started.
Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
yarn config set workspaces-experimental true
Then install dependencies
yarn install
Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
PKG=@0xproject/monorepo-scripts yarn build
Or continuously rebuild on change:
PKG=@0xproject/monorepo-scripts yarn watch
Clean
yarn clean
Lint
yarn lint
Run Tests
yarn test