Node.js 安装我的NPM软件包时将文件移动到根目录
我目前正在进行回购。它是一个NPM发布的包,名为Node.js 安装我的NPM软件包时将文件移动到根目录,node.js,npm,node-modules,package.json,Node.js,Npm,Node Modules,Package.json,我目前正在进行回购。它是一个NPM发布的包,名为blossom ui 我的问题是,在安装软件包时,是否有办法将文件从node\u modules/blossom ui移动到node\u modules外部文件夹的根目录中 所以看起来像是 blossui css/ styl/ 字体/ js/ node\u模块 … 如果您使用grunt,一个简单的任务将使其如下所示: copy: { vendor: { files: [{ expand: tru
blossom ui
我的问题是,在安装软件包时,是否有办法将文件从node\u modules/blossom ui
移动到node\u modules
外部文件夹的根目录中
所以看起来像是
blossui
/css
/styl
/字体
/js
node\u模块
…
grunt
,一个简单的任务将使其如下所示:
copy: {
vendor: {
files: [{
expand: true,
cwd: 'node_modules/bootstrap/',
src: ['js/**', 'less/**'],
dest: 'public/vendor/bootstrap/'
}]
}
}
.....
grunt.registerTask('build', ['copy:vendor']);
例如,使用它将引导和主干复制到上面的/public/vendor
。如果你检查一下它
请记住,如果从
节点\u模块
复制,则目标文件夹必须存在于.gitignore
中,这可以在npm中的安装后脚本中完成
每次npm安装完成时,npm都会自动执行postinstall
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"postinstall": "cp node_modules/blossom-ui ."
},
更多信息:.节点模块
目录的整个要点就是依赖关系所在。为什么您的包需要放在其他地方?我想将编译的文件(例如CSS&JS)移出node\u modules
以便它们可以成为目标easilyI仍然希望将源文件保留在node\u modules
中,以便稍后构建build
script。