2017-03-24 150 views
0

在Mac OSX上10个地方发展修改JavaScript文件,该流星的项目有一个ddp.js文件,其中包含这样的线路:使用bash脚本

//let abcConnection = DDP.connect('https://abc.com.au'); //push to cloud 
let abcConnection = DDP.connect('http://localhost:3000'); //local dev. 

之前,我运行一个bash脚本来构建和推项目到云,我必须改变线路到这:

let abcConnection = DDP.connect('https://abc.com.au'); //push to cloud 
//let abcConnection = DDP.connect('http://localhost:3000'); //local dev. 

ie注释和取消注释相关的行。我如何自动执行此操作,因为它需要在不同项目中的多个文件上完成? thx

+0

为什么不在封装文件中定义端点并运行本地或生产包? https://guide.meteor.com/writing-atmosphere-packages.html#exporting https://guide.meteor.com/writing-atmosphere-packages.html#exporting – corn3lius

回答

1
# before 
sed -ie 's$http://localhost:3000$https://abc.com.au$g' ddp.js 

# Do deploy or build 

# after 
sed -ie 's$https://abc.com.au$http://localhost:3000$g' ddp.js