diff --git a/lib/hexo/load_config.js b/lib/hexo/load_config.js index c8c6f49425..81528e765c 100644 --- a/lib/hexo/load_config.js +++ b/lib/hexo/load_config.js @@ -8,7 +8,6 @@ const { exists, readdir } = require('hexo-fs'); const { magenta } = require('picocolors'); const { deepMerge } = require('hexo-util'); const validateConfig = require('./validate_config'); -const { external_link: externalLinkDefaultCfg } = require('./default_config'); module.exports = async ctx => { if (!ctx.env.init) return; @@ -42,14 +41,6 @@ module.exports = async ctx => { // Remove any trailing '/' config.url = config.url.replace(/\/+$/, ''); - // Deprecated: config.external_link boolean option will be removed in future - if (typeof config.external_link === 'boolean') { - config.external_link = { - ...externalLinkDefaultCfg, - enable: config.external_link - }; - } - ctx.public_dir = resolve(baseDir, config.public_dir) + sep; ctx.source_dir = resolve(baseDir, config.source_dir) + sep; ctx.source = new Source(ctx); diff --git a/lib/hexo/validate_config.js b/lib/hexo/validate_config.js index 5ebe67ebc2..347feea886 100644 --- a/lib/hexo/validate_config.js +++ b/lib/hexo/validate_config.js @@ -22,10 +22,5 @@ module.exports = ctx => { if (config.root.trim().length <= 0) { throw new TypeError('Invalid config detected: "root" should not be empty!'); } - - // Soft deprecate external_link Boolean - if (typeof config.external_link === 'boolean') { - log.warn('Deprecated config detected: "external_link" with a Boolean value is deprecated. See https://hexo.io/docs/configuration for more details.'); - } }; diff --git a/test/scripts/hexo/load_config.js b/test/scripts/hexo/load_config.js index a985db11ff..1d6d20f6c0 100644 --- a/test/scripts/hexo/load_config.js +++ b/test/scripts/hexo/load_config.js @@ -127,51 +127,6 @@ describe('Load config', () => { } }); - // Deprecated: config.external_link boolean option will be removed in future - it('migrate external_link config from boolean to object - true', async () => { - const content = 'external_link: true'; - - try { - await writeFile(hexo.config_path, content); - await loadConfig(hexo); - hexo.config.external_link.should.eql({ - enable: true, - field: 'site', - exclude: '' - }); - } finally { - await unlink(hexo.config_path); - } - }); - - it('migrate external_link config from boolean to object - false', async () => { - const content = 'external_link: false'; - - try { - await writeFile(hexo.config_path, content); - await loadConfig(hexo); - hexo.config.external_link.should.eql({ - enable: false, - field: 'site', - exclude: '' - }); - } finally { - await unlink(hexo.config_path); - } - }); - - it('migrate external_link config from boolean to object - undefined', async () => { - try { - // Test undefined - await writeFile(hexo.config_path, ''); - - await loadConfig(hexo); - hexo.config.external_link.should.eql(defaultConfig.external_link); - } finally { - await unlink(hexo.config_path); - } - }); - it('custom public_dir', async () => { try { await writeFile(hexo.config_path, 'public_dir: foo'); diff --git a/test/scripts/hexo/validate_config.js b/test/scripts/hexo/validate_config.js index 60a785c06d..3f2b80b903 100644 --- a/test/scripts/hexo/validate_config.js +++ b/test/scripts/hexo/validate_config.js @@ -100,13 +100,4 @@ describe('Validate config', () => { e.message.should.eql('Invalid config detected: "root" should not be empty!'); } }); - - it('config.external_link - depreacte Boolean value', () => { - hexo.config.external_link = false; - - validateConfig(hexo); - - logSpy.calledOnce.should.be.true; - logSpy.calledWith('Deprecated config detected: "external_link" with a Boolean value is deprecated. See https://hexo.io/docs/configuration for more details.').should.be.true; - }); });