forked from opennpm/Appstack-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·51 lines (30 loc) · 1.23 KB
/
index.js
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
#!/usr/bin/env node
const inquirer = require('./lib/utils/inquirer');
const { exec } = require('child_process');
const { stderr, stdout } = require('process');
const { async } = require('rxjs/internal/scheduler/async');
const directory = require('./lib/utils/files/directory');
const { spawn } = require( 'child_process' );
const chalk = require('chalk');
var projectname;
var expressname;
const name = async () => {
const res= await inquirer.askProjectName();
projectname = res.appName;
return projectname;
}
const run = async () => {
console.log(chalk.yellow("Generating Express Backend : "));
await name();
const dir =await directory.createDir(projectname);
// console.log(dir);
const changesDir =await directory.changeWorkingDir(projectname);
// console.log(changesDir);
// console.log(`Generating Express Backend: ${expressname}`);
const res= await inquirer.askExpressAppName();
expressname = res.appName;
require( "child_process" ).spawnSync( "sh", [ "-c", `express ${expressname}` ], { stdio: "inherit", stdin: "inherit" } );
console.log(chalk.yellow(`Generating Angular Frontend : `));
require( "child_process" ).spawnSync( "sh", [ "-c", "ng new" ], { stdio: "inherit", stdin: "inherit" } );
}
run()