UNPKG

1.15 kBJavaScriptView Raw
1/**
2 *
3 * 2app
4 * 2016-03-23
5 *
6 * Haochuan Liu <haochuan.liu@gmail.com>
7 * http://haochuan.io
8 *
9 */
10var Promise = require("bluebird");
11var fs = Promise.promisifyAll(require('fs-extra'));
12var inquirer = require("inquirer");
13
14var root = __dirname.replace(/2app\/lib/,'2app/');
15
16var questions = [
17 // ask about the name of the app
18 {
19 type: 'input',
20 name: 'name',
21 message: "What's the name of your project?"
22 }
23];
24
25
26function create(){
27 inquirer.prompt( questions, function( answers ) {
28 return fs.copyAsync(root + 'template', answers.name, {clobber: true})
29 .then(function(err){
30 if (err) {
31 return console.error(err);
32 } else {
33 console.log('Successfully generated a electron project "' + answers.name + '" in current directory.');
34 }
35 })
36 // var opts = assign({dir: src}, answers);
37 // packager(opts, function done (err, appPath) {
38 // if (err) throw err;
39 // console.log("The app have been packaged successfully in: " + appPath);
40 // });
41 });
42
43}
44module.exports = create;
\No newline at end of file