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 1e3b1481ae..271b8eb30d 100644 --- a/lib/hexo/validate_config.js +++ b/lib/hexo/validate_config.js @@ -27,10 +27,5 @@ module.exports = ctx => { if (typeof config.use_date_for_updated === 'boolean') { log.warn('Deprecated config detected: "use_date_for_updated" is deprecated, please use "updated_option" instead. See https://hexo.io/docs/configuration for more details.'); } - - // 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 30622f345f..a86c2b6dc7 100644 --- a/test/scripts/hexo/validate_config.js +++ b/test/scripts/hexo/validate_config.js @@ -109,13 +109,4 @@ describe('Validate config', () => { logSpy.calledOnce.should.be.true; logSpy.calledWith('Deprecated config detected: "use_date_for_updated" is deprecated, please use "updated_option" instead. See https://hexo.io/docs/configuration for more details.').should.be.true; }); - - 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; - }); });