2017-03-24 193 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