Best practices authoring projects and services
- Never rely on global dependencies
- Store everything within your
package.json
Imagine a deployment script for a serverless project.
#!/bin/bash
registry service pull-env -r $T_AWS_REGION $T_ENV
sls deploy
This is bad because:
- ✘ You are assuming
slsandregistryexist - ✘ You are assuming they are the right version
#!/bin/bash
yarn registry -- service pull-env -r $T_AWS_REGION $T_ENV
yarn sls -- deployWe're using yarn to run the binary from ./node_modules/.bin, thus the version of sls and registry are locked down to what we define.