From c0c336fa6da45239e4fce2be4303714bdcbf03ff Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Sun, 7 Apr 2019 10:27:54 +0800 Subject: [PATCH 1/4] Update App.js --- packages/@vuepress/core/lib/node/App.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/@vuepress/core/lib/node/App.js b/packages/@vuepress/core/lib/node/App.js index e1897bae7e..5fee0ff7d4 100755 --- a/packages/@vuepress/core/lib/node/App.js +++ b/packages/@vuepress/core/lib/node/App.js @@ -348,7 +348,12 @@ module.exports = class App { computed: new this.ClientComputedMixinConstructor(), enhancers: this.pluginAPI.getOption('extendPageData').items }) - this.pages.push(page) + const index = this.pages.findIndex(({ path }) => path === page.path) + if (index >= 0) { + this.pages.splice(index, 1, page) + } else { + this.pages.push(page) + } } /** From f5178fd89d78a4cfbff776843b31390ef55b364b Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Mon, 8 Apr 2019 01:13:29 +0800 Subject: [PATCH 2/4] Update App.js --- packages/@vuepress/core/lib/node/App.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/@vuepress/core/lib/node/App.js b/packages/@vuepress/core/lib/node/App.js index 5fee0ff7d4..0b1267b148 100755 --- a/packages/@vuepress/core/lib/node/App.js +++ b/packages/@vuepress/core/lib/node/App.js @@ -350,6 +350,10 @@ module.exports = class App { }) const index = this.pages.findIndex(({ path }) => path === page.path) if (index >= 0) { + // override a page if corresponding path already exists + if (!this.pages[index].overridable) { + logger.warn(`Override existing page ${chalk.yellow(page.path)}.`) + } this.pages.splice(index, 1, page) } else { this.pages.push(page) From 31bbb8cef6c98545bcf61a5137e1eda3b2e4e350 Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Sun, 14 Apr 2019 10:04:29 +0800 Subject: [PATCH 3/4] Update App.js --- packages/@vuepress/core/lib/node/App.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/@vuepress/core/lib/node/App.js b/packages/@vuepress/core/lib/node/App.js index 0b1267b148..12796ed25f 100755 --- a/packages/@vuepress/core/lib/node/App.js +++ b/packages/@vuepress/core/lib/node/App.js @@ -351,9 +351,7 @@ module.exports = class App { const index = this.pages.findIndex(({ path }) => path === page.path) if (index >= 0) { // override a page if corresponding path already exists - if (!this.pages[index].overridable) { - logger.warn(`Override existing page ${chalk.yellow(page.path)}.`) - } + logger.warn(`Override existing page ${chalk.yellow(page.path)}.`) this.pages.splice(index, 1, page) } else { this.pages.push(page) From 2a4ba9fef6634abae96c2d734d92b62a6620e555 Mon Sep 17 00:00:00 2001 From: ULIVZ <472590061@qq.com> Date: Mon, 15 Apr 2019 01:22:24 +0800 Subject: [PATCH 4/4] chore: tweaks --- packages/@vuepress/core/lib/node/App.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@vuepress/core/lib/node/App.js b/packages/@vuepress/core/lib/node/App.js index 12796ed25f..629763ba77 100755 --- a/packages/@vuepress/core/lib/node/App.js +++ b/packages/@vuepress/core/lib/node/App.js @@ -350,7 +350,7 @@ module.exports = class App { }) const index = this.pages.findIndex(({ path }) => path === page.path) if (index >= 0) { - // override a page if corresponding path already exists + // Override a page if corresponding path already exists logger.warn(`Override existing page ${chalk.yellow(page.path)}.`) this.pages.splice(index, 1, page) } else {