我们已经使用 pact 为我们的 Angular JS 前端和 java 后端实现了合同测试。
我注意到 node_modules/@pact-foundation 目录非常大(pact-node v 4.3.2)
du -sh node_modules/@pact-foundation/
741M node_modules/@pact-foundation/
JS UI 始终只是消费者,但依赖项似乎需要以下内容
ls node_modules/@pact-foundation/
pact-mock-service pact-node pact-provider-verifier-linux-x64
pact-mock-service-linux-x64 pact-provider-verifier
有没有办法引入一组较小的依赖项?
编辑 - 似乎原因如下
du -sh pact-node/node_modules/@pact-foundation/pact-mock-service/build/*
1.9M pact-node/node_modules/@pact-foundation/pact-mock-service/build/pact-mock_service-0.8.2
8.9M pact-node/node_modules/@pact-foundation/pact-mock-service/build/pact-mock-service-0.8.2-1-linux-x86_64.tar.gz
8.5M pact-node/node_modules/@pact-foundation/pact-mock-service/build/pact-mock-service-0.8.2-1-linux-x86.tar.gz
9.2M pact-node/node_modules/@pact-foundation/pact-mock-service/build/pact-mock-service-0.8.2-1-osx.tar.gz
12M pact-node/node_modules/@pact-foundation/pact-mock-service/build/pact-mock-service-0.8.2-1-win32.zip
50M pact-node/node_modules/@pact-foundation/pact-mock-service/build/pact-mock-service-darwin
48M pact-node/node_modules/@pact-foundation/pact-mock-service/build/pact-mock-service-linux-ia32
50M pact-node/node_modules/@pact-foundation/pact-mock-service/build/pact-mock-service-linux-x64
51M pact-node/node_modules/@pact-foundation/pact-mock-service/build/pact-mock-service-win32
pact-node 依赖于 pact-mock-service 并且捆绑的依赖项包括所有操作系统的模拟服务。
编辑 2 -
将我的依赖项更改为以下
"@pact-foundation/pact-node": "6.9.0",
并添加一个分辨率(我使用的是纱线而不是 npm)
"resolutions": {
"@pact-foundation/pact-node": "6.9.0"
}
将依赖项的总大小降低到
du -sh node_modules/@pact-foundation/*
1.7M node_modules/@pact-foundation/pact-node
170M node_modules/@pact-foundation/pact-standalone
干杯谢恩