forked from philschatz/electron-init
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·44 lines (39 loc) · 1.02 KB
/
index.js
File metadata and controls
executable file
·44 lines (39 loc) · 1.02 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
#!/usr/bin/env node
"use strict";
var fs = require('fs');
var path = require('path');
var cpy = require('cpy');
var promzard = require('promzard');
var nomnom = require('nomnom');
var inputFile = require.resolve('./prompts');
var opts = nomnom
.option('coffee', {
abbr: 'c',
flag: true
})
.option('javascript', {
abbr: 'js',
flag: true
})
.parse();
var dest = process.cwd();
var copyTemplate = function(name) {
var src = path.join(__dirname, 'templates', name);
cpy([src + '/*'], dest, function(err) {
console.log('Initialized! run "npm install" to install dependencies and then "npm start" to start the app')
});
};
promzard(inputFile, {opts: opts}, function (err, args) {
if (err) { throw err; }
// Copy all the files in the appropriate template dir
switch (args.language) {
case 'coffee':
copyTemplate('coffee');
break;
case 'javascript':
copyTemplate('js');
break;
default:
throw new Error('Invalid language. choose "coffee" or "javascript"');
}
})