diff --git a/packages/cli/src/cmd/init.js b/packages/cli/src/cmd/init.js index 95379f50ac..c2fbca1cee 100755 --- a/packages/cli/src/cmd/init.js +++ b/packages/cli/src/cmd/init.js @@ -18,22 +18,14 @@ function init(root, options) { const template = new Template(rootFolder, options.template); template.init() - .then(() => { + .then((templateConfig) => { logger.info('Initialization success.'); - }) - .then(() => { - if (options.convert) { - logger.info('Converting to MarkBind website.'); - const outputRoot = path.join(rootFolder, '_site'); - new Site(rootFolder, outputRoot).convert() - .then(() => { - logger.info('Conversion success.'); - }) - .catch((error) => { - logger.error(error.message); - process.exitCode = 1; - }); - } + const outputRoot = path.join(rootFolder, '_site'); + new Site(rootFolder, outputRoot).initSite(templateConfig, options.convert) + .catch((error) => { + logger.error(`Failed to generate template default with error: ${error.message}`); + process.exitCode = 1; + }); }) .catch((error) => { logger.error(`Failed to initialize site with given template with error: ${error.message}`); diff --git a/packages/cli/test/functional/test_site_convert/test_basic_convert/expected/404.html b/packages/cli/test/functional/test_site_convert/test_basic_convert/expected/404.html index a11b82c182..ccf34ece95 100644 --- a/packages/cli/test/functional/test_site_convert/test_basic_convert/expected/404.html +++ b/packages/cli/test/functional/test_site_convert/test_basic_convert/expected/404.html @@ -20,8 +20,6 @@ - - diff --git a/packages/cli/test/functional/test_site_convert/test_basic_convert/expected/404.page-vue-render.js b/packages/cli/test/functional/test_site_convert/test_basic_convert/expected/404.page-vue-render.js index 23d87aefdc..dda0206703 100644 --- a/packages/cli/test/functional/test_site_convert/test_basic_convert/expected/404.page-vue-render.js +++ b/packages/cli/test/functional/test_site_convert/test_basic_convert/expected/404.page-vue-render.js @@ -1,13 +1,10 @@ var pageVueRenderFn = function anonymous( ) { -with(this){return _c('div',{attrs:{"id":"app"}},[_c('header',{attrs:{"sticky":""}},[_c('navbar',{attrs:{"placement":"top","type":"dark"},scopedSlots:_u([{key:"brand",fn:function(){return [_c('a',{staticClass:"navbar-brand",attrs:{"href":"/index.html","title":"Home"}},[_c('i',{staticClass:"far fa-file-image"})])]},proxy:true},{key:"right",fn:function(){return [_c('li',[_c('form',{staticClass:"navbar-form"},[_c('searchbar',{attrs:{"data":searchData,"placeholder":"Search","on-hit":searchCallback,"menu-align-right":""}})],1)])]},proxy:true}])},[_v(" "),_c('li',[_c('a',{staticClass:"nav-link",attrs:{"href":"/index.html"}},[_v("HOME")])]),_v(" "),_c('li',[_c('a',{staticClass:"nav-link",attrs:{"href":"/about.html"}},[_v("ABOUT")])])])],1),_v(" "),_c('div',{attrs:{"id":"flex-body"}},[_c('overlay-source',{attrs:{"id":"site-nav","tag-name":"nav","to":"site-nav"}},[_c('div',{staticClass:"site-nav-top"},[_c('div',{staticClass:"fw-bold mb-2",staticStyle:{"font-size":"1.25rem"}},[_v("Contents")])]),_v(" "),_c('div',{staticClass:"nav-component slim-scroll"},[_c('site-nav',[_c('overlay-source',{staticClass:"site-nav-list site-nav-list-root",attrs:{"tag-name":"ul","to":"mb-site-nav"}},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-0"},[_v("[[Home]]")]),_v(" "),_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-0"},[_v("[[Page-1]]")])])],1)],1)]),_v(" "),_c('div',{attrs:{"id":"content-wrapper"}},[_c('breadcrumb'),_v(" "),_c('p'),_m(0),_v(" "),_m(1),_c('p')],1),_v(" "),_c('overlay-source',{attrs:{"id":"page-nav","tag-name":"nav","to":"page-nav"}},[_c('div',{staticClass:"nav-component slim-scroll"})]),_v(" "),_c('scroll-top-button')],1),_v(" "),_c('footer',[_v("\nCustom footer.\n")])])} +with(this){return _m(0)} }; var pageVueStaticRenderFns = [function anonymous( ) { -with(this){return _c('div',{staticClass:"text-center"},[_c('p',{staticStyle:{"font-size":"10rem"}},[_v("404")])])} -},function anonymous( -) { -with(this){return _c('div',{staticClass:"text-center"},[_c('p',{staticStyle:{"font-size":"1.5rem"}},[_v("File not found"),_c('br'),_v("Click "),_c('a',{attrs:{"href":"/"}},[_v("here")]),_v(" to go back to the home page.")])])} +with(this){return _c('div',{attrs:{"id":"app"}},[_c('div',[_c('p'),_c('div',{staticClass:"text-center"},[_c('p',{staticStyle:{"font-size":"10rem"}},[_v("404")])]),_v(" "),_c('div',{staticClass:"text-center"},[_c('p',{staticStyle:{"font-size":"1.5rem"}},[_v("File not found"),_c('br'),_v("Click "),_c('a',{attrs:{"href":"/"}},[_v("here")]),_v(" to go back to the home page.")])]),_c('p')])])} }]; \ No newline at end of file diff --git a/packages/cli/test/functional/test_site_convert/test_basic_convert/expected/Home.html b/packages/cli/test/functional/test_site_convert/test_basic_convert/expected/Home.html index 181c1d8455..f63c0fa7c9 100644 --- a/packages/cli/test/functional/test_site_convert/test_basic_convert/expected/Home.html +++ b/packages/cli/test/functional/test_site_convert/test_basic_convert/expected/Home.html @@ -29,11 +29,14 @@
- - -
  • HOME
  • -
  • ABOUT
  • + + +
  • Topic 1
  • +
  • Topic 2
  • + +
  • Topic 3a
  • +
  • Topic 3b
  • +