diff --git a/scripts/patch-modules.js b/scripts/patch-modules.js new file mode 100644 index 00000000..e3137a37 --- /dev/null +++ b/scripts/patch-modules.js @@ -0,0 +1,19 @@ +const shell = require('shelljs'); +const path = require('path'); + +console.log('Patch react-devtools-core'); + +const rdStandalone = path.join( + __dirname, + '../dist/node_modules/react-devtools-core/dist/standalone.js' +); + +// Make react-devtools-core to auto detect theme +// We still use this patch because patch-package to patch js bundle is not very ideal +shell.sed( + '-i', + // eslint-disable-next-line + /bridge:e,browserTheme:t="light"/, + 'bridge:e,browserTheme:t="auto"', + rdStandalone +); diff --git a/scripts/postinstall.js b/scripts/postinstall.js index 6ee28a05..659b5217 100755 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -15,6 +15,8 @@ async function run() { '-rf', 'node_modules/apollo-client-devtools/{assets,build,development,shells/dev,src}' ); + // eslint-disable-next-line + require('./patch-modules'); } run();