From c051e50fbd30858a05eb29bcbc3b1246d25c6014 Mon Sep 17 00:00:00 2001 From: econdepe Date: Thu, 19 Dec 2019 16:09:31 +0100 Subject: [PATCH 1/5] use dark mode only with a feature flag --- containers/themes/ThemesSection.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/containers/themes/ThemesSection.js b/containers/themes/ThemesSection.js index 33266e481..c1cc9262c 100644 --- a/containers/themes/ThemesSection.js +++ b/containers/themes/ThemesSection.js @@ -14,11 +14,13 @@ import { } from 'react-components'; import { updateTheme } from 'proton-shared/lib/api/mailSettings'; import { getThemeIdentifier, stripThemeIdentifier } from 'proton-shared/lib/themes/helpers'; -import { DEFAULT_THEME, CUSTOM_THEME } from 'proton-shared/lib/themes/themes.js'; +import { DEFAULT_THEME, PROTON_THEMES, CUSTOM_THEME } from 'proton-shared/lib/themes/themes.js'; import CustomThemeModal from './CustomThemeModal.js'; -const availableThemes = [DEFAULT_THEME, CUSTOM_THEME]; +const availableThemes = [DEFAULT_THEME, FEATURE_FLAGS.includes('dark-mode') && PROTON_THEMES.DARK, CUSTOM_THEME].filter( + Boolean +); const ThemesSection = () => { const api = useApi(); From 8f0dc59624bfba8982a550b6763951a476a87c70 Mon Sep 17 00:00:00 2001 From: econdepe Date: Thu, 19 Dec 2019 16:18:01 +0100 Subject: [PATCH 2/5] rename dark mode feature flag --- containers/themes/ThemesSection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers/themes/ThemesSection.js b/containers/themes/ThemesSection.js index c1cc9262c..766d8c8f3 100644 --- a/containers/themes/ThemesSection.js +++ b/containers/themes/ThemesSection.js @@ -18,7 +18,7 @@ import { DEFAULT_THEME, PROTON_THEMES, CUSTOM_THEME } from 'proton-shared/lib/th import CustomThemeModal from './CustomThemeModal.js'; -const availableThemes = [DEFAULT_THEME, FEATURE_FLAGS.includes('dark-mode') && PROTON_THEMES.DARK, CUSTOM_THEME].filter( +const availableThemes = [DEFAULT_THEME, FEATURE_FLAGS.includes('darkmode') && PROTON_THEMES.DARK, CUSTOM_THEME].filter( Boolean ); From 04cbe3696483ec95996683160c85015d7588fa5f Mon Sep 17 00:00:00 2001 From: econdepe Date: Thu, 19 Dec 2019 17:09:33 +0100 Subject: [PATCH 3/5] use configs from proton-shared --- jest.config.js | 12 ++++-------- tsconfig.json | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/jest.config.js b/jest.config.js index 4bae7bcee..679c153c8 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,15 +1,11 @@ +import baseConfig from 'proton-shared/configs/jest.config.base'; + module.exports = { - setupFilesAfterEnv: ['./rtl.setup.js'], - verbose: true, - moduleDirectories: ['node_modules'], - transform: { - '^.+\\.(js|tsx?)$': 'babel-jest' - }, + ...baseConfig, moduleNameMapper: { '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)$': '/__mocks__/fileMock.js', '\\.(css|scss|less)$': '/__mocks__/styleMock.js', pmcrypto: '/__mocks__/pmcrypto.js', 'sieve.js': '/__mocks__/sieve.js' - }, - transformIgnorePatterns: ['node_modules/(?!(proton-shared)/)'] + } }; diff --git a/tsconfig.json b/tsconfig.json index a4c0501b8..6d4178fa0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,3 +1,3 @@ { - "extends": "proton-shared/tsconfig.base.json" + "extends": "proton-shared/configs/tsconfig.base.json" } From 2baa9d26ddf8f77c69164b75d8f75804af8f99b2 Mon Sep 17 00:00:00 2001 From: econdepe Date: Thu, 19 Dec 2019 17:28:47 +0100 Subject: [PATCH 4/5] use babel.config from proton-shared --- babel.config.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/babel.config.js b/babel.config.js index 1fa10050a..f659f7190 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,8 +1,6 @@ +import baseConfig from 'proton-shared/configs/babel.config.base'; + module.exports = { - presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'], - plugins: [ - '@babel/plugin-proposal-object-rest-spread', - '@babel/plugin-transform-runtime', - 'transform-require-context' - ] + presets: [...baseConfig.presets, '@babel/preset-react', '@babel/preset-typescript'], + plugins: [...baseConfig.plugins, 'transform-require-context'] }; From e44c67deb814a121897970534f377b9c84e8e657 Mon Sep 17 00:00:00 2001 From: econdepe Date: Thu, 19 Dec 2019 17:43:45 +0100 Subject: [PATCH 5/5] use require instead of import --- babel.config.js | 8 +++----- jest.config.js | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/babel.config.js b/babel.config.js index f659f7190..566df21ec 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,6 +1,4 @@ -import baseConfig from 'proton-shared/configs/babel.config.base'; +// eslint-disable-next-line @typescript-eslint/no-var-requires +const baseConfig = require('proton-shared/configs/babel.config.base'); -module.exports = { - presets: [...baseConfig.presets, '@babel/preset-react', '@babel/preset-typescript'], - plugins: [...baseConfig.plugins, 'transform-require-context'] -}; +module.exports = baseConfig; diff --git a/jest.config.js b/jest.config.js index 679c153c8..48b1cf850 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,4 +1,5 @@ -import baseConfig from 'proton-shared/configs/jest.config.base'; +// eslint-disable-next-line @typescript-eslint/no-var-requires +const baseConfig = require('proton-shared/configs/jest.config.base'); module.exports = { ...baseConfig,