Skip to content

Instantly share code, notes, and snippets.

@Uvacoder
Forked from DavidWells/auto-install-npm-deps.js
Created January 2, 2022 01:47
Show Gist options
  • Select an option

  • Save Uvacoder/5220a8553703b44aa87b92b05b4e47fb to your computer and use it in GitHub Desktop.

Select an option

Save Uvacoder/5220a8553703b44aa87b92b05b4e47fb to your computer and use it in GitHub Desktop.
Automatically install deps for any serverless project found
const path = require('path')
const globby = require('globby')
const execSync = require('child_process').execSync
globby(['*/serverless.yml']).then(paths => {
// Now run npm install
const command = `npm install`
paths.forEach((p) => {
var t = path.join(__dirname, p)
execSync(command, {
cwd: path.dirname(t),
stdio: [0, 1, 2]
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment