jjzjj

javascript - 是否可以通过创建新的(未发布的) "sub"包来分解(发布的)包的依赖关系列表?

我维护了一个发布在npm注册表上的JavaScript库,它有很多依赖项。很难跟踪代码的哪一部分取决于外部包。不幸的是,lerna、yarn的工作区、npmlink或npm的本地路径依赖都没有申报帮助。(我在例子之后解释了原因。)我希望能够通过将一些依赖项提取到新的“子包”中来分解package.json中声明的dependencies列表。所以,不要有下面的依赖列表//~/code/example-lib/package.json{"name":"example-lib","dependencies":{"lodash":"*","request":"*","chalk":"*","

node.js - 与 npm 和 yarn 一起使用的 package.json 脚本?

我正在使用npmasabuildtool所以在我的package.json中,我的一些脚本依赖于其他脚本:{"test":"npmrunlint&&mocha"}这会将npm包管理器硬编码到package.json中。如何使这种表达依赖关系的方法同时适用于npm和yarn? 最佳答案 $npm_execpath环境变量指的是构建工具,所以只需将npm替换为$npm_execpath:{"test":"$npm_execpathrunlint&&mocha"}npmtest和yarntest都可以工作,并且会使用适当的构建工具。

node.js - 与 npm 和 yarn 一起使用的 package.json 脚本?

我正在使用npmasabuildtool所以在我的package.json中,我的一些脚本依赖于其他脚本:{"test":"npmrunlint&&mocha"}这会将npm包管理器硬编码到package.json中。如何使这种表达依赖关系的方法同时适用于npm和yarn? 最佳答案 $npm_execpath环境变量指的是构建工具,所以只需将npm替换为$npm_execpath:{"test":"$npm_execpathrunlint&&mocha"}npmtest和yarntest都可以工作,并且会使用适当的构建工具。

node.js - 为 Node 模块强制安装 yarn 而不是 npm install?

我想强制使用yarninstall而不是npminstall。我想在npminstall中引发错误。在package.json中应该做什么? 最佳答案 UPDATE:Alexander'sansweristhebettersolutionandusesthesametechniqueIdescribehere.Iamleavingmyanswerintactforposterity.Theoriginalpointofmyanswerwastoshowthatyoucanexecuteasmallnodescriptwhichsho

node.js - 为 Node 模块强制安装 yarn 而不是 npm install?

我想强制使用yarninstall而不是npminstall。我想在npminstall中引发错误。在package.json中应该做什么? 最佳答案 UPDATE:Alexander'sansweristhebettersolutionandusesthesametechniqueIdescribehere.Iamleavingmyanswerintactforposterity.Theoriginalpointofmyanswerwastoshowthatyoucanexecuteasmallnodescriptwhichsho

javascript - 不明白 Yarn check 警告

当我运行yarncheck时,我收到了这个警告:warning"\u001b[2mchokidar#\u001b[22mfsevents#node-pre-gyp@^0.6.29"couldbededupedfrom"0.6.32"to"node-pre-gyp@0.6.32"有人能帮我理解吗?我不知道deduped这个词是什么意思。为什么警告信息中有这么多垃圾字符?我应该怎么做才能解决这个警告?非常感谢! 最佳答案 您的yarn.lock文件似乎包含版本0.6.32的包node-pre-gyp的重复条目>.您可以执行以下步骤:删除

javascript - 不明白 Yarn check 警告

当我运行yarncheck时,我收到了这个警告:warning"\u001b[2mchokidar#\u001b[22mfsevents#node-pre-gyp@^0.6.29"couldbededupedfrom"0.6.32"to"node-pre-gyp@0.6.32"有人能帮我理解吗?我不知道deduped这个词是什么意思。为什么警告信息中有这么多垃圾字符?我应该怎么做才能解决这个警告?非常感谢! 最佳答案 您的yarn.lock文件似乎包含版本0.6.32的包node-pre-gyp的重复条目>.您可以执行以下步骤:删除

node.js - 如何使用 Yarn 安装 Bower 包?

来自项目的README:MultipleRegistries:InstallanypackagefromeithernpmorBowerandkeepyourpackageworkflowthesame.我假设这意味着我可以使用Yarn安装我的Bower包(在我的项目的bower.json中列出)。如果是这种情况,我将如何去做?我在documentation中没有看到任何提及Bower或使用单独注册表的内容。.但是,我确实看到了source中列出的Bower注册表。. 最佳答案 2016年11月4日更新:Yarn决定移除对Bower

node.js - 如何使用 Yarn 安装 Bower 包?

来自项目的README:MultipleRegistries:InstallanypackagefromeithernpmorBowerandkeepyourpackageworkflowthesame.我假设这意味着我可以使用Yarn安装我的Bower包(在我的项目的bower.json中列出)。如果是这种情况,我将如何去做?我在documentation中没有看到任何提及Bower或使用单独注册表的内容。.但是,我确实看到了source中列出的Bower注册表。. 最佳答案 2016年11月4日更新:Yarn决定移除对Bower

javascript - package.json 中的 Node 引擎 8.x 或 10.x

我尝试在package.json中指定Node引擎以同时接受8和10版本。我试着输入这个:"engines":{"node":"8.x|10.x"},但运行yarn会导致:Theengine"node"isincompatiblewiththismodule.Expectedversion"8.x|10.x"如果我替换为:"engines":{"node":"10.x"},...它可以工作(即没有错误)。有没有办法在package.json中接受两个版本的Node引擎? 最佳答案 您只需要双管道||而不是单管道。"engines":