1 | const readlineSync = require('readline-sync');
|
2 | const utils = require('./utils');
|
3 |
|
4 | const initConfig = [{
|
5 | name: 'title',
|
6 | default: 'ydoc'
|
7 | }, {
|
8 | name: 'description',
|
9 | default: 'website description'
|
10 | }, {
|
11 | name: 'author',
|
12 | default: 'ymfe'
|
13 | }];
|
14 |
|
15 |
|
16 | function initYdoc() {
|
17 | utils.log.info(`This utility will walk you through creating a ydoc.json file.\nIt only covers the most common items, and tries to guess sensible defaults.\n\nPlease enter your document site config`);
|
18 | let config = {};
|
19 | initConfig.forEach((item) => {
|
20 | const input = readlineSync.question(`Your document ${item.name}: (${item.default}) `);
|
21 | if (input) {
|
22 | config[item.name] = input;
|
23 | }
|
24 | })
|
25 | return config;
|
26 | }
|
27 |
|
28 | module.exports = initYdoc;
|