Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 123
Expand file tree
/
Copy pathnode.js
More file actions
Latest commit
executable file
·65 lines (55 loc) · 1.47 KB
/
Copy pathnode.js
File metadata and controls
executable file
·65 lines (55 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env node
varwordwrap=require('wordwrap')
varinquirer=require('inquirer')
varminimist=require('minimist')
varopener=require('opener')
varchalk=require('chalk')
console.error()
console.error(chalk.yellow(' =============================='))
console.error(chalk.yellow(' = ~~~~~ ')+'webgl-workshop'+chalk.yellow(' ~~~~~ ='))
console.error(chalk.yellow(' =============================='))
console.error()
varargv=minimist(process.argv.slice(2),{
boolean: ['o','y']
,default: {o: true}
,alias: {
o: 'open'
,y: 'yes'
}
})
if(argv.yes){
boot()
}else{
prompt()
}
functionprompt(){
inquirer.prompt([{
'type': 'confirm'
,'name': 'ok'
,'default': true
,'message': wordwrap(4,80)(
"We're about to populate this directory with some code for you to "+
"use for your answers. If they've already been created then don't worry, "+
"they won't be replaced. Continue?"
).replace(/^\s+/,'')
}],function(result){
if(!result.ok)returnprocess.exit(1)
console.error()
boot()
})
}
functionboot(){
require('@workshop/server')({},function(err,address){
if(err)throwerr
if(argv.open){
console.error('Done! Booting up the workshop in your browser in just a second...')
}
console.error('Workshop running on: '+chalk.blue(address))
console.error()
if(argv.open){
setTimeout(function(){
opener(address)
},1000)
}
})
}