我有这个应用程序文件夹结构:
project root
|
+- controllers/
|
+- models/
|
+- node_modules/
|
+- utils/
|
+- tests/
|
+- package.json
我在文件夹中有一些共享功能utils,我想在里面的文件和文件夹中使用models这些controllers功能tests。
我想引用utils模块var utils = require('utils');,我想将它存储在应用程序存储库中。
我不想写类似的东西var utils = require('../../utils');,看起来很难看。我不想将utils文件夹放入其中node_modules,因为node_modules存储由安装的第三方依赖项npm install并且不受版本控制,并且我不想混合私有代码和第三方代码。
有什么解决办法吗?
UPD:我知道的唯一方法是通过某种安装脚本在文件夹中创建指向文件node_modules夹的符号链接。utils还有其他想法吗?