使用bash脚本修改javascript文件

使用bash脚本修改javascript文件,javascript,bash,Javascript,Bash,在Mac OSX 10的本地开发过程中,Meteor项目有一个ddp.js文件,其中包含如下行: //let abcConnection = DDP.connect('https://abc.com.au'); //push to cloud let abcConnection = DDP.connect('http://localhost:3000'); //local dev. 在运行bash脚本构建项目并将其推送到云端之前,我必须将行更改为: let abcConnection =

在Mac OSX 10的本地开发过程中,Meteor项目有一个
ddp.js
文件,其中包含如下行:

//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.

i、 e.注释并取消注释相关行。由于需要在不同项目中的多个文件上执行此操作,如何实现自动化?thx

为什么不在包文件中定义端点并运行本地或生产包?
# 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