Created
February 2, 2017 20:48
-
-
Save mattrothenberg/fddbd52296a93a17da5f308cdd8c2aad to your computer and use it in GitHub Desktop.
Runway CLI Step #3
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 program = require('commander'); | |
var colors = require('colors'); | |
var Spinner = require('cli-spinner').Spinner; | |
var spinner = new Spinner('Hot damn, those are some nice styles! Hang tight while we set up your styleguide... %s'); | |
spinner.setSpinnerString('|/-\\'); | |
program | |
.command('new-styleguide <stylesheet>') | |
.description('Creates a new Runway styleguide, given a .CSS or .SCSS file. Returns the URL to your styleguide.') | |
.action(newStyleguide); | |
function generateRandomNumber(min, max) { | |
return Math.floor(Math.random() * (max - min) + min); | |
} | |
function newStyleguide(cmd) { | |
var randomStyleguideId = generateRandomNumber(1000, 2000); | |
var styleguideUrl = `http://runway-app.cfapps.io/styleguide/${randomStyleguideId}`; | |
spinner.start(); | |
setTimeout(function() { | |
spinner.stop(); | |
console.log('\n' + 'Success!'.green); | |
console.log(styleguideUrl.underline); | |
}, 2000); | |
} | |
program.parse(process.argv); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment