Last active
September 17, 2016 02:24
Star
You must be signed in to star a gist
Download a version of the "node-lambda-babel-template".
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
import { get } from 'gh-got'; | |
// curl -o- https://ribjyr1g9l.execute-api.us-east-1.amazonaws.com/nodelambdababeltemplate/latest | bash | |
export default async (event, context, callback) => { | |
const repo = 'node-lambda-babel-template'; | |
const tarball = `https://api.github.com/repos/flesch/${repo}/tarball`; | |
let { version = 'latest' } = event.params; | |
if (version === 'latest') { | |
let { body } = await get(`repos/flesch/${repo}/releases/latest`); | |
version = body.tag_name; | |
} | |
callback(null, `mkdir -p ${repo} && curl -L -o- ${tarball}/${version} | tar zxf - --directory ${repo} --strip-components=1 && cd ${repo}`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment