我正在研究可共享的eslint配置,以推广自动化和内部最佳实践。因此,我将添加一些eslint插件和工具作为依赖项。
上下文
环境
$ node --version;
v8.2.1
$ npm --version
5.3.0本地包
为此,我使用下面的npm创建了一个本地package.json项目,eslint-config-company说
{
"name": "eslint-config-company",
"version": "0.0.1",
"main": "index.js",
"dependencies": {
"eslint": "4.x.x",
"eslint-plugin-ember-suave": "1.x.x",
"eslint-plugin-prettier": "2.x.x",
"prettier": "1.x.x"
},
"files": [
"index.js"
],
"keywords": [
"eslint",
"eslintconfig"
],
"repository": "company/eslint-config-company",
"private": true
}和档案:
index.js package.json README.md yarn.lock安装
然后,我将我的eslint-config-company包安装到另一个项目中来测试它:
npm install --save-dev --verbose ../eslint-config-company在node_modules/目录中,我获得了作为符号链接的eslint-config-company/:
$ ls node_modules/eslint-config-company -lah
lrwxrwxrwx 1 me me 29 Aug 17 22:02 node_modules/eslint-config-company -> ../../eslint-config-company/但是没有prettier和eslint-plugin-prettier的痕迹
$ ls node_modules/{prettier,eslint-plugin-prettier}
ls: cannot access 'node_modules/prettier': No such file or directory
ls: cannot access 'node_modules/eslint-plugin-prettier': No such file or directory注:因此,eslint和eslint-plugin-ember-suave已经是该项目的依赖项。
问题
dependencies将安装在npm install上,我是否错了?相关: 国家预防机制/国家预防机制问题
发布于 2019-05-19 23:00:24
eslint company的依赖项保存在该模块的node_modules文件夹中,因此它将能够通过符号链接找到它需要的代码(假设npm安装已经在eslint company模块文件夹上运行)。
当打包时- node_module文件夹也包括在内,所以它也翻译成交付时间。
发布于 2017-08-18 10:58:23
创建项目eslint-config-company的全局模块(在此模块文件夹中):
npm link并将全局安装目标链接到另一个项目中:
npm link eslint-config-companyhttps://stackoverflow.com/questions/45744183
复制相似问题