我们希望在多个项目中使用相同的构建系统。我有一个可以在git子模块中放入的早午餐配置文件,以便可以在多个项目中引用该子模块,并且可以轻松传播更改(比复制和粘贴时脆弱,并且可以设置brunch-config.js的权威来源) 。
虽然将brunch-config.js放在git子模块中,但会导致我的文件夹结构最终如下所示:
WebApp // git root
|---Brunch-Build-System // git submodule
| |---brunch-config.js
|---node_modules
|---source // all the source code I want compiled
Brunch的运行假设brunch-config.js的级别与正在编译的源代码相同或更高。在这种情况下,情况并非如此。我尝试修改brunch-config.js以使用相对路径无济于事。这是我当前使用的Brunch配置的
files
块,没有任何相对路径尝试:files: {
javascripts: {
joinTo: {
'js/lib.js': /^(?!source\/)/
},
entryPoints: {
'source/scripts/app.jsx': {
'js/app.js': /^source\//
},
}
},
stylesheets: {joinTo: 'css/core.css'}
}
给定上面所需的文件夹结构,我该如何修改它以使用相对路径?这有可能吗?
最佳答案
子模块需要与父仓库中的根文件夹相关联: gitlink (a special entry in the main repo index)记录 check out 该子模块的SHA1。
在您的情况下,最好在post-checkout hook中使用脚本,以确保以下位置之间存在符号链接(symbolic link):
brunch-config.js
和Brunch-Build-System / brunch-config.js
包含在钩子(Hook)中的线将类似于
#!/bin/bash
if [ ! -e /correct/path/for/brunch-config.js ]; then
ln -s /correct/path/for/brunch-config.js Brunch-Build-System/brunch-config.js
fi
尽管OP在Windows上: