diff --git a/packages/gasket-plugin-intl/lib/configure.js b/packages/gasket-plugin-intl/lib/configure.js index e6b65ecca..7c7962ad5 100644 --- a/packages/gasket-plugin-intl/lib/configure.js +++ b/packages/gasket-plugin-intl/lib/configure.js @@ -22,22 +22,6 @@ function getIntlConfig(gasket) { return intl; } -/** - * Destructure deprecated options as fallbacks and log warnings if used. - * - * @param {Gasket} gasket - Gasket API - * @param {object} intlConfig - User intl config - * @returns {object} config - */ -function deprecatedOptions(gasket, intlConfig) { - const { logger } = gasket; - const { languageMap, defaultLanguage, assetPrefix } = intlConfig; - if (isDefined(languageMap)) logger.warning('DEPRECATED intl config `languageMap` - use `localesMap`'); - if (isDefined(defaultLanguage)) logger.warning('DEPRECATED intl config `defaultLanguage` - use `defaultLocale`'); - if (isDefined(assetPrefix)) logger.warning('DEPRECATED intl config `assetPrefix` - use `basePath`'); - return { languageMap, defaultLanguage, assetPrefix }; -} - /** * Sets up the Intl config for the Gasket session and add process env variables * to access to certain config results where gasket.config is not accessible. @@ -50,14 +34,13 @@ module.exports = function configureHook(gasket, config) { const { root } = config; const intlConfig = { ...getIntlConfig({ config }) }; - const { languageMap, defaultLanguage, assetPrefix } = deprecatedOptions(gasket, intlConfig); const { nextConfig = {} } = config; // get user defined config and apply defaults const { defaultPath = '/locales', - defaultLocale = defaultLanguage || 'en', - localesMap = languageMap || {}, + defaultLocale = 'en', + localesMap = {}, localesDir, manifestFilename = 'locales-manifest.json', preloadLocales = false @@ -65,7 +48,7 @@ module.exports = function configureHook(gasket, config) { const fullLocalesDir = path.join(root, localesDir); - const basePath = [intlConfig.basePath, assetPrefix, + const basePath = [intlConfig.basePath, nextConfig.assetPrefix, nextConfig.basePath, config.basePath, ''].find(isDefined); diff --git a/packages/gasket-plugin-intl/test/configure.test.js b/packages/gasket-plugin-intl/test/configure.test.js index bcc498b36..42a6b5962 100644 --- a/packages/gasket-plugin-intl/test/configure.test.js +++ b/packages/gasket-plugin-intl/test/configure.test.js @@ -108,17 +108,6 @@ describe('configure', function () { ); }); - it('logs deprecation warnings', function () { - configure(mockGasket, { root, intl: { languageMap: { foo: 'bar' } } }); - expect(mockGasket.logger.warning).toHaveBeenCalledWith(expect.stringContaining('languageMap')); - - configure(mockGasket, { root, intl: { defaultLanguage: 'fake' } }); - expect(mockGasket.logger.warning).toHaveBeenCalledWith(expect.stringContaining('defaultLanguage')); - - configure(mockGasket, { root, intl: { assetPrefix: 'fake' } }); - expect(mockGasket.logger.warning).toHaveBeenCalledWith(expect.stringContaining('assetPrefix')); - }); - describe('getIntlConfig', function () { it('returns intl config from gasket.config.js', function () {