Pages

Thursday, October 13, 2016

Inmadusa.com [Part 9]: Use npm scripts to simplify setup of developer environment

One rule of thumb to simplify the developer experience is to reduce dependencies on the configuration of the machine. Part of this is means stop relying on global packages that the developer has to install in order to work with your project.

For this code base it means moving away from the global 'gulp' package.

A simple solution is to use npm scripts instead, which have the ability to search for commands across all installed npm_modules. In my case, a simple script that starts gulp is sufficient:
{
  "name": "inmadusa.com",
  "version": "1.0.0",
  "scripts": {
    "dev": "gulp default"
  }
  ...
}

Anybody that wants to contribute to the project now needs to follow 3 steps:
1. Install node.
2. Run 'npm install' from the root of the repo.
3. Run 'npm run dev'.

No need to install anything else on the dev's machine. :)

You have reached the end of this series. As of this writing the website is not complete yet, the graphic designer and business owner are still working on it but my involvement is pretty much in maintenance mode. You can visit the live site or check the source code.

Federico

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.