vas*_*ich 9 node.js npm package.json yarnpkg
我有package.json和yarn.lock文件.yarn.lock有版本锁定,我想同步,并锁定(没有^)yarn.lock中的所有版本,回到package.json.有没有简单的方法呢?
最后我想在我的package.json中没有"^",因为它会导致太多麻烦,我想特别升级包装,而不是在我运行新纱线安装时不知不觉.
是否有任何工具或方法可以快速替换package.json中的版本与yarn.lock中存在的那些版本?
vas*_*ich 11
我最终自己做了些什么:
它是一个很小的实用程序,可以将现有的package.json与yarn.lock同步.
将yarn.lock版本同步到现有package.json文件中,删除动态数字,例如使用^,保持静态版本不变.
yarn global add syncyarnlock
npm install -g syncyarnlock
Usage: syncyarnlock [options]
Sync `yarn.lock` package versions, into package.json
Options:
-V, --version output the version number
-d, --dir <path> directory path where the yarn.lock file is located (default to current directory)
-p, --dirPackageJson <path> directory of project with target package.json, if not set, -d will be used
-s, --save By default don't override the package.json file, make a new one instead package.json.yarn
-k, --keepUpArrow By default the ^ or any other dynamic numbers are removed and replaced with static ones.
-g, --keepGit By default direct git repositories are also replaced by the version written in yarn.
-l, --keepLink By default direct link: repositories are also replaced by the version written in yarn.
-a, --keepVariable <variable>By default everything is converted to yarn version, write a part of the type you wish not to convert, seperate by comma if more than one, to not replace git and link you would use +,link:
-h, --help output usage information
Transforms yarn.lock files to JSON
Examples:
//perform inside a directory with yarn.lock and package.json, will output package.json.yarn in the same directory.
syncyarnlock
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
875 次 |
| 最近记录: |