-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SDA-4544 Allow to load react dev tools chrome extension (#2145)
* SDA-4561 - SDA branch cut * SDA-4544 Allow to load react dev tools chrome extension --------- Co-authored-by: Kiran Niranjan <kiran.niranjan@symphony.com>
- Loading branch information
1 parent
1709479
commit e6cdae2
Showing
4 changed files
with
249 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import installExtension, { | ||
REACT_DEVELOPER_TOOLS, | ||
} from 'electron-devtools-installer'; | ||
|
||
import { Logger } from '../common/loggerBase'; | ||
import { getCommandLineArgs } from '../common/utils'; | ||
|
||
const isCommandLineArgEnabled = (name: string) => | ||
getCommandLineArgs(process.argv, `--${name}`, true) || | ||
getCommandLineArgs(process.argv, `--${name}=1`, true) || | ||
getCommandLineArgs(process.argv, `--${name}=true`, true); | ||
|
||
/** | ||
* Load React Dev Tools extension | ||
* @param logger | ||
* @returns Promise<void> | ||
*/ | ||
export const loadReactDevToolsExtension = async (logger: Logger) => { | ||
if (!isCommandLineArgEnabled('enableReactDevTools')) { | ||
return; | ||
} | ||
|
||
try { | ||
const name = await installExtension(REACT_DEVELOPER_TOOLS); | ||
logger.info(`main: Added Extension: ${name}`); | ||
} catch (error) { | ||
logger.error(`main: Error while loading ReactDevTool Extension: ${error}`); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters