Skip to content

Commit

Permalink
chore: compatible to node 6
Browse files Browse the repository at this point in the history
Change-Id: If685ba99cb674f726047a155de16768cfcda4d67
  • Loading branch information
x-cold committed Dec 17, 2018
1 parent ba256ee commit 8f4c888
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
17 changes: 8 additions & 9 deletions bin/docsite.js
Expand Up @@ -4,24 +4,25 @@

const chalk = require('chalk');
const program = require('commander');
const init = require('../lib/init.js');
const start = require('../lib/start.js');
const build = require('../lib/build.js');
const co = require('co');
const init = require('../lib/init');
const start = require('../lib/start');
const build = require('../lib/build');
const version = require('../package.json').version;

async function main() {
co(function* main() {
program
.version(version)
.usage('<command> [options]')
.option('init', 'init [project]')
.option('init [project]', 'init project')
.option('start', 'start a local server')
.option('build', 'build assets')
.parse(process.argv);
const type = process.argv.slice(2)[0];
switch (type) {
case 'init': {
const dir = process.argv.slice(2)[1];
await init(dir);
yield init(dir);
break;
}
case 'start':
Expand All @@ -33,6 +34,4 @@ async function main() {
default:
console.log(chalk.red(`please input ${chalk.green('docsite -h')} for help`));
}
}

main();
});
4 changes: 2 additions & 2 deletions lib/init.js
Expand Up @@ -15,9 +15,9 @@ const questions = [
},
];

const init = async (dir = '') => {
const init = function* (dir = '') {
if (!dir) {
const answers = await inquirer.prompt(questions);
const answers = yield inquirer.prompt(questions);
dir = answers.dir;
}
dir = path.join(process.cwd(), dir);
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "docsite",
"version": "1.3.5",
"version": "1.3.6",
"description": "a tool for build static doc site(react)",
"bin": {
"docsite": "./bin/docsite.js"
Expand Down

0 comments on commit 8f4c888

Please sign in to comment.