Skip to content

Commit cd95d4b

Browse files
committed
versioning error fix
1 parent fece2c6 commit cd95d4b

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

constants/root/packagejson.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ let data = require('./../data');
22

33
module.exports = `{
44
"name": "`+ data.projectName + `",
5-
"version": "`+ data.version + `",
5+
"version": "1.0.0",
66
"description": "`+ data.description + `",
77
"main": "`+ data.entry_point + `",
88
"scripts": {

generator/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ function createdirectory(dirName) {
2222
let suffix;
2323
while (true) {
2424
try {
25-
fs.mkdirSync(dirName + (suffix ? suffix : ''));
26-
process.chdir(dirName + (suffix ? suffix : ''));
25+
let projectName = dirName + (suffix ? suffix : '');
26+
fs.mkdirSync(projectName);
27+
process.chdir(projectName);
28+
data.projectName = projectName;
2729
} catch (err) {
2830
if (err.code === 'EEXIST') {
2931
suffix = suffix ? suffix + 1 : 1;

utils/dataFetcher.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ const readA = readline.createInterface({
1111

1212
module.exports = (cb) => {
1313
let q1 = () => readA.question('project name: (' + utils.getCurDirName() + ') ',
14-
(answer) => { if (answer) data.projectName = answer; q2(); });
14+
(answer) => { if (answer) data.projectName = answer; q3(); });
1515

16-
let q2 = () => readA.question('version: (1.0.0) ',
17-
(answer) => { if (answer) data.version = answer; q3(); });
16+
// let q2 = () => readA.question('version: (1.0.0) ',
17+
// (answer) => { if (answer) data.version = answer; q3(); });
1818

1919
let q3 = () => readA.question('description: (A simple node based API) ',
2020
(answer) => { if (answer) data.description = answer; q4(); });

utils/index.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict'
22

33
const path = require('path');
4+
const data = require('./../constants/data');
45
module.exports = {
56
getCurDirName: () => {
67
return process.cwd().split(path.sep).slice(-1);
@@ -13,11 +14,13 @@ module.exports = {
1314
detached: true
1415
});
1516
child.stdout.on('data', function (buffer) {
16-
console.log('\x1b[33m' + buffer.toString());
17+
console.log('\x1b[33m' + buffer.toString() + '\x1b[0m');
1718
});
1819

19-
20-
child.unref()
21-
console.log('\nRunning' + '\x1b[31m npm install\x1b[0m' + ' for you\n');
20+
child.stdout.on('close', function () {
21+
console.log('Your project ' + data.projectName + ' is ready.');
22+
console.log('Run command' + '\x1b[31m npm start\x1b[0m' + ' to start the project.');
23+
});
24+
console.log('\nRunning' + '\x1b[31m npm install\x1b[0m' + ' for you.\n');
2225
},
2326
}

0 commit comments

Comments
 (0)