QuickTip – Command aliases with package.json for meteor projects.

Hello guys, this quick tip will show you how to create command aliases with package.json for meteor projects. Right now I’m working in a project that has different mup.json (Meteor up – mup) to deploy in different environments such production and homolog. We have different settings.json for each environment, settings for production are different from development so, to start the application, we need to use the flag –settings to point to the correct file. It looks like that

meteor --settings deploy/homol/settings.json

But we can create aliases for commands that need to be executed, to do that, just create a file called package.json in the root of your project and create your aliases under “scripts”.

{
  "scripts": {
    "start": "meteor --settings deploy/homol/settings.json",
    "homologacao": "cd deploy/homol; ./deploy.sh"
  }
}

And them to execute them

npm run <command>
npm run start

And, in this case, to deploy

npm run homologacao

Another cool thing about package.json is that instead of install global modules we can install them locally and pointing to a specific version, eg: If you do that.

npm install mup --save

You can see an new entry called “dependencies” in your package.json

{
  "scripts": {
    "start": "meteor --settings deploy/homol/settings.json",
    "homologacao": "cd deploy/homol; ./deploy.sh"
  },
  "dependencies": {
    "mup": "^0.11.3"
  }
}

Now if a new developer join the team, there is no risk of using the wrong mup version.

Allan de Queiroz

Allan de Queiroz
London based software engineer

XServer forward from Linux text mode for Headless purposes.

Hello, this post is about XServer forward from Linux text mode, **not ssh forward, anything related to VNC** or things like that.Recently...… Continue reading