在meteor构建中将文件添加到捆绑包
我有一个meteor项目,我想在bundle.tgz的顶层目录中添加一些bash脚本在meteor构建中将文件添加到捆绑包,meteor,Meteor,我有一个meteor项目,我想在bundle.tgz的顶层目录中添加一些bash脚本 我目前正在通过以下方式创建捆绑包: meteor build bundle.tgz 是否有一种方法可以配置构建,使其在生成的tgz文件顶部包含这些bash脚本?创建绑定脚本 在项目的根目录中创建一个文件,Create_bundle.sh,并将其他脚本添加到项目的根目录中。我使用了一个文件的示例,some_file.sh,根据需要添加更多文件 创建_bundle.sh #!/bin/sh rm -f bundle
我目前正在通过以下方式创建捆绑包:
meteor build bundle.tgz 是否有一种方法可以配置构建,使其在生成的tgz文件顶部包含这些bash脚本?创建绑定脚本 在项目的根目录中创建一个文件,
Create_bundle.sh
,并将其他脚本添加到项目的根目录中。我使用了一个文件的示例,some_file.sh,根据需要添加更多文件
创建_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
,它将:
- 在项目目录中创建bundle.tar.gz
- bundle.tar.gz也会在bundle文件夹中添加一些_file.sh。通过将create_bundle.sh中的
行更改为使用cp
而不是/tmp/bundle/
/tmp/bundle/bundle
git clone http://github.com/meteor/meteor
编辑meteor/tools/bundler.js文件(此时:)
并添加到批处理文件中
builder.write('yourfile.sh', { data: new Buffer(
"#!/bin/sh
"echo 'hello world'\n", 'utf8')});
});
然后,您可以使用meteor的这个特殊版本构建您的项目:
从项目目录(*nix)中:
这不是不必要的痛苦吗?为什么不编写一个进行构建的包装器脚本,然后将其他脚本手动添加到结果tgz中呢?我最终创建了一个绑定脚本。我还建议使用meteor build--directory。这样它就可以构建一个目录,而不需要提取tar.gzWoah,编辑meteor的源代码是一种不顾一切的解决方案!是的,我会考虑翻转那些,因为捆绑似乎更合适。
/path/to/cloned_meteor_repo/meteor build yourfile.tar.gz