Last active
April 16, 2019 23:44
-
-
Save ValeriaVG/cc9d8c76623abdc22a33bb66dc33675f to your computer and use it in GitHub Desktop.
create-hybrids-app: `npx [this gist url] [folder name]`
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
#!/usr/bin/env node | |
var util = require('util'), | |
spawn = require('child_process').spawn, | |
permissions = spawn('chmod',['+x',require('path').resolve(__dirname,'./index.sh')],{ stdio: [ | |
0, // Use parent's stdin for child | |
'pipe', // Pipe child's stdout to parent | |
'pipe' | |
]}) | |
cmd = spawn(require('path').resolve(__dirname,'./index.sh'), [process.argv[2]],{shell: true}); // the second arg is the command | |
// options | |
cmd.stdout.on('data', function (data) { // register one or more handlers | |
console.log(data.toString()); | |
}); | |
cmd.stderr.on('data', function (data) { | |
console.log(data.toString()); | |
}); | |
cmd.on('exit', function (code) { | |
if(code) console.log('child process exited with code ' + code); | |
}); |
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
#!/bin/bash | |
# Script pulls latest version of https://github.com/ValeriaVG/hybrids-starter-kit | |
# Renames the folder & installs dependencies | |
git clone https://github.com/ValeriaVG/hybrids-starter-kit $2 && \ | |
cd $2 && \ | |
yarn && \ | |
echo "$2 is ready" && \ | |
echo "cd $1 && yarn start" |
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
{"name": "create-hybrids-app", "version": "0.0.2", "bin": "./index.js"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment