From c430619ed84c5462823d5ae70a8a009c29d60952 Mon Sep 17 00:00:00 2001 From: Xinyu Liu Date: Tue, 29 Jan 2019 23:00:37 +0800 Subject: [PATCH 1/4] chore($core): layout typo in load-theme --- packages/@vuepress/core/lib/prepare/loadTheme.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@vuepress/core/lib/prepare/loadTheme.js b/packages/@vuepress/core/lib/prepare/loadTheme.js index 33a412ecf1..2d68254f61 100644 --- a/packages/@vuepress/core/lib/prepare/loadTheme.js +++ b/packages/@vuepress/core/lib/prepare/loadTheme.js @@ -124,14 +124,14 @@ module.exports = async function loadTheme (ctx) { const layoutComponentMap = layoutDirs .map( - layourDir => readdirSync(layourDir) + layoutDir => readdirSync(layoutDir) .filter(filename => filename.endsWith('.vue')) .map(filename => { const componentName = getComponentName(filename) return { filename, componentName, isInternal: isInternal(componentName), - path: path.resolve(layourDir, filename) + path: path.resolve(layoutDir, filename) } }) ) From 61f5736bd68824d8afa7ac39be2aab6251876437 Mon Sep 17 00:00:00 2001 From: Xinyu Liu Date: Tue, 29 Jan 2019 23:13:55 +0800 Subject: [PATCH 2/4] fix($core): never throw error if layout does not exist --- packages/@vuepress/core/lib/prepare/loadTheme.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/@vuepress/core/lib/prepare/loadTheme.js b/packages/@vuepress/core/lib/prepare/loadTheme.js index 2d68254f61..cbd8f644ca 100644 --- a/packages/@vuepress/core/lib/prepare/loadTheme.js +++ b/packages/@vuepress/core/lib/prepare/loadTheme.js @@ -148,7 +148,8 @@ module.exports = async function loadTheme (ctx) { const { Layout = {}, NotFound = {}} = layoutComponentMap - if (!Layout && !fs.existsSync(Layout.path)) { + // layout component does not exist. + if (!Layout || !fs.existsSync(Layout.path)) { throw new Error(`[vuepress] Cannot resolve Layout.vue file in \n ${Layout.path}`) } From 1b991c4c2bedd4ffb348e60bd219c188e6697aba Mon Sep 17 00:00:00 2001 From: Xinyu Liu Date: Tue, 29 Jan 2019 23:18:56 +0800 Subject: [PATCH 3/4] fix($core): default notfound component filename --- packages/@vuepress/core/lib/prepare/loadTheme.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@vuepress/core/lib/prepare/loadTheme.js b/packages/@vuepress/core/lib/prepare/loadTheme.js index cbd8f644ca..7fdc846f62 100644 --- a/packages/@vuepress/core/lib/prepare/loadTheme.js +++ b/packages/@vuepress/core/lib/prepare/loadTheme.js @@ -156,7 +156,7 @@ module.exports = async function loadTheme (ctx) { // use default 404 component. if (!NotFound || !fs.existsSync(NotFound.path)) { layoutComponentMap.NotFound = { - filename: 'Layout.vue', + filename: 'NotFound.vue', componentName: 'NotFound', path: path.resolve(__dirname, '../app/components/NotFound.vue'), isInternal: true From 7e45e77100ff5e415d38ee7b7c19bcf715f01693 Mon Sep 17 00:00:00 2001 From: Xinyu Liu Date: Tue, 29 Jan 2019 23:19:30 +0800 Subject: [PATCH 4/4] chore($core): new line for each property --- packages/@vuepress/core/lib/prepare/loadTheme.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/@vuepress/core/lib/prepare/loadTheme.js b/packages/@vuepress/core/lib/prepare/loadTheme.js index 7fdc846f62..dcede9eb96 100644 --- a/packages/@vuepress/core/lib/prepare/loadTheme.js +++ b/packages/@vuepress/core/lib/prepare/loadTheme.js @@ -129,7 +129,8 @@ module.exports = async function loadTheme (ctx) { .map(filename => { const componentName = getComponentName(filename) return { - filename, componentName, + filename, + componentName, isInternal: isInternal(componentName), path: path.resolve(layoutDir, filename) }