我有一个流星项目,我想在bundle.tgz的顶层目录中添加一些bash脚本。
我目前正在通过以下方式创建捆绑包:
meteor build bundle.tgz
有没有一种方法可以配置构建,使其在生成的tgz文件顶部包含这些bash脚本?
在项目的根目录中创建一个文件create_bundle.sh
,还将其他脚本添加到项目的根目录中。我已经使用了一个文件some_file.sh的示例,根据需要添加更多文件
create_bundle.sh
#!/bin/sh
rm -f bundle.tar.gz
rm -rf /tmp/bundle
meteor build /tmp/bundle
tar -xzf /tmp/bundle/*.tar.gz -C /tmp/bundle
## Add any more as needed
cp some_file.sh /tmp/bundle/bundle
rm /tmp/bundle/*.tar.gz
tar -cvzf bundle.tar.gz -C /tmp/bundle .
现在,如果您运行./create_bundle.sh
而不是运行meteor build bundle.tar.gz
它将:
cp
create_bundle.sh中的行以/tmp/bundle/
代替使用此行,将其移至根文件夹/tmp/bundle/bundle
一种选择是git克隆流星源
git clone http://github.com/meteor/meteor
编辑文件meteor / tools / bundler.js(此时:https : //github.com/meteor/meteor/blob/f59380a6cfb1d09a6d8ef9abda11646d37e37356/tools/bundler.js#L1910)
并添加您的批处理文件
builder.write('yourfile.sh', { data: new Buffer(
"#!/bin/sh
"echo 'hello world'\n", 'utf8')});
});
然后,您可以使用这种特殊的流星构建项目:
从项目目录(* nix):
/path/to/cloned_meteor_repo/meteor build yourfile.tar.gz
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句