Skip to content

Failed rendering under "vuepress build" produces exit code 0 #570

Closed
@avishnyakov

Description

@avishnyakov

Bug report

Seems that any errors during the rendering phase still reports exit code 0. Output won't have pages generated but vuepress reports exit code 0. Hard to detect issues and fail early under automated buids.

Version

0.10.0

Steps to reproduce

Put wrong, non-existing links to sidebar section in config.js to fail the rendering phase:

module.exports = {
    themeConfig = {
        sidebar: [ 
                {
                    title: 'Fail',
                    collapsable: false,
                    children: [ 
                        '/',
                        '/11',
                        '/hey-i-dont-exist',
                        'this-will-fail'    
                  ]
              }
        ]
   }
}

Let' run this:

vurpress build 
echo "Exit code:: $?"

Output:

.....
Rendering static HTML...
Rendering page: /[vuepress] No matching page found for sidebar item "/11"
[vuepress] No matching page found for sidebar item "/11"
[vuepress] No matching page found for sidebar item "/11"
Error rendering /:
TypeError: Cannot read property 'match' of undefined
    at getHash (tmp/vuepress-app/usr/local/lib/node_modules/vuepress/lib/default-theme/util.js:13:21)
    at util_isActive (tmp/vuepress-app/usr/local/lib/node_modules/vuepress/lib/default-theme/util.js:47:19)
    at server-bundle.js:6894:14
    at Array.some (<anonymous>)
    at resolveOpenGroupIndex (tmp/vuepress-app/usr/local/lib/node_modules/vuepress/lib/default-theme/Sidebar.vue:64:47)
    at VueComponent.refreshIndex (tmp/vuepress-app/usr/local/lib/node_modules/vuepress/lib/default-theme/Sidebar.vue:44:20)
    at VueComponent.created (tmp/vuepress-app/usr/local/lib/node_modules/vuepress/lib/default-theme/Sidebar.vue:35:9)
    at callHook (/usr/local/lib/node_modules/vuepress/node_modules/vue/dist/vue.runtime.common.js:2919:21)
    at VueComponent.Vue._init (/usr/local/lib/node_modules/vuepress/node_modules/vue/dist/vue.runtime.common.js:4628:5)
    at new VueComponent (/usr/local/lib/node_modules/vuepress/node_modules/vue/dist/vue.runtime.common.js:4796:12)
    at createComponentInstanceForVnode (/usr/local/lib/node_modules/vuepress/node_modules/vue-server-renderer/build.js:7342:10)
    at renderComponentInner (/usr/local/lib/node_modules/vuepress/node_modules/vue-server-renderer/build.js:7516:40)
    at renderComponent (/usr/local/lib/node_modules/vuepress/node_modules/vue-server-renderer/build.js:7491:5)
    at RenderContext.renderNode (/usr/local/lib/node_modules/vuepress/node_modules/vue-server-renderer/build.js:7407:5)
    at RenderContext.next (/usr/local/lib/node_modules/vuepress/node_modules/vue-server-renderer/build.js:2428:14)
    at cachedWrite (/usr/local/lib/node_modules/vuepress/node_modules/vue-server-renderer/build.js:2287:9)
Exit code: 0

What is expected?

vuepress build returns correct exit code on success/failure so that further automation is possible.

What is actually happening?

vuepress build returns incorrect exit code on success/failure so that further automation is not possible.

Other relevant information

  • win/macoks/docker
  • v9.5.0 on win / v9.11.1 on docker node:9.11.1-alpine
  • that's server side rendering on vuepress build
  • global install
  • npm

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: enhancementRequest to enhance an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions