简体   繁体   English

有没有一种方法可以将 object 与 package.json 项目的 ZD18B8624A0F5F721DA7B826 文件的依赖项分开?

[英]Is there a method to separate dependencies object from package.json file of an angular project?

Here is the scenario I have multiple angular applications which belong to the same project.这是我有多个属于同一个项目的 angular 应用程序的场景 When I needed to upgrade an npm package, I need to change all the package.json files in each application.当我需要升级npm package,我需要更改每个应用程序中的所有 package.Z466DEEC76ECDF54D564D8 文件I tried mono repo, but it does not apply to my project because npm scripts are not the same as all apps.我尝试了 mono 存储库,但它不适用于我的项目,因为npm scripts与所有应用程序都不相同。

So I want to separate the node dependencies from applications and keep npm scripts of the package.json files.因此,我想将节点依赖项与应用程序分开,并保留package.json文件的 npm 脚本。

Is there a way to separate only the dependencies object from the package.json file?有没有办法从 package.json 文件中仅分离依赖项 object ? OR any other suggestions?或任何其他建议?

If I understood well this could not be done with npm but seems like it can be achieved with yarn workspaces:如果我理解得很好,这不能用 npm 来完成,但似乎可以用纱线工作区来实现:

Guide for installing yarn:纱线安装指南:

Unfortunately npm do not support package.json inheritance.不幸的是 npm 不支持 package.json Z5FED3411FAF832174EF1F040028B2C21 See this link .请参阅此链接

On the other side why don't you customize your npm scripts?另一方面,您为什么不自定义 npm 脚本? create alias for every npm command.为每个 npm 命令创建别名。 eg例如

"test-app1": "ng test app1",
"test-app2": "ng test app2 --code-coverage --no-watch --no-progress --browsers ChromeHeadlessNoSandbox",

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM