Skip to content

Instantly share code, notes, and snippets.

@ValeriaVG
Last active April 16, 2019 23:44
Show Gist options
  • Save ValeriaVG/cc9d8c76623abdc22a33bb66dc33675f to your computer and use it in GitHub Desktop.
Save ValeriaVG/cc9d8c76623abdc22a33bb66dc33675f to your computer and use it in GitHub Desktop.
create-hybrids-app: `npx [this gist url] [folder name]`
#!/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);
});
#!/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"
{"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