diff --git a/renamer.js b/renamer.js new file mode 100644 index 0000000000000000000000000000000000000000..29bd469f2e037cc465bc8be8d632c5589e38d52e --- /dev/null +++ b/renamer.js @@ -0,0 +1,15 @@ +const fs = require('fs'); +const path = require('path'); + +const componentsDir = path.resolve(__dirname, 'src', 'core', 'renderers'); + +const components = fs.readdirSync(componentsDir); +for (const component of components) { + if (!fs.statSync(path.resolve(componentsDir, component)).isDirectory()) continue; + const newJs = path.resolve(componentsDir, component, 'index.js'); + fs.renameSync(path.resolve(componentsDir, component, 'index.jsx'), newJs); + const content = fs.readFileSync(newJs, { encoding: 'utf8' }); + fs.writeFileSync(newJs, content.replace('stylesheet.module.scss', `${component}.module.scss`), { encoding: 'utf8' }); + if (fs.existsSync(path.resolve(componentsDir, component, 'stylesheet.module.scss'))) fs.renameSync(path.resolve(componentsDir, component, 'stylesheet.module.scss'), path.resolve(componentsDir, component, `${component}.module.scss`)); +} +console.log(components); diff --git a/src/components/App/stylesheet.module.scss b/src/components/App/App.module.scss similarity index 100% rename from src/components/App/stylesheet.module.scss rename to src/components/App/App.module.scss diff --git a/src/components/App/index.jsx b/src/components/App/index.js similarity index 99% rename from src/components/App/index.jsx rename to src/components/App/index.js index e1397aef75e816e6be48496beef8c61e90ae1f4b..0a8919271a39dea62367a9a5690eb8f46fac34ec 100644 --- a/src/components/App/index.jsx +++ b/src/components/App/index.js @@ -19,7 +19,7 @@ import { actions } from 'reducers'; import { createUserFile, extension, refineGist } from 'common/util'; import { exts, languages } from 'common/config'; import { CONTRIBUTING_MD } from 'files'; -import styles from './stylesheet.module.scss'; +import styles from './App.module.scss'; class App extends BaseComponent { constructor(props) { diff --git a/src/components/BaseComponent/index.jsx b/src/components/BaseComponent/index.js similarity index 100% rename from src/components/BaseComponent/index.jsx rename to src/components/BaseComponent/index.js diff --git a/src/components/Button/stylesheet.module.scss b/src/components/Button/Button.module.scss similarity index 100% rename from src/components/Button/stylesheet.module.scss rename to src/components/Button/Button.module.scss diff --git a/src/components/Button/index.jsx b/src/components/Button/index.js similarity index 98% rename from src/components/Button/index.jsx rename to src/components/Button/index.js index bb6008a84fa48d21ea8c749ed0e758057892ebec..5d90f2e640d335b6cf7556dd57b24b7ee161532c 100644 --- a/src/components/Button/index.jsx +++ b/src/components/Button/index.js @@ -5,7 +5,7 @@ import faExclamationCircle from '@fortawesome/fontawesome-free-solid/faExclamati import faSpinner from '@fortawesome/fontawesome-free-solid/faSpinner'; import { classes } from 'common/util'; import { Ellipsis } from 'components'; -import styles from './stylesheet.module.scss'; +import styles from './Button.module.scss'; class Button extends React.Component { constructor(props) { diff --git a/src/components/CodeEditor/stylesheet.module.scss b/src/components/CodeEditor/CodeEditor.module.scss similarity index 100% rename from src/components/CodeEditor/stylesheet.module.scss rename to src/components/CodeEditor/CodeEditor.module.scss diff --git a/src/components/CodeEditor/index.jsx b/src/components/CodeEditor/index.js similarity index 98% rename from src/components/CodeEditor/index.jsx rename to src/components/CodeEditor/index.js index 1b398f35a6ab0cd2deedf223c471f1ae717e7038..e950e73d45d831e937dc5963057d1dd3e675c154 100644 --- a/src/components/CodeEditor/index.jsx +++ b/src/components/CodeEditor/index.js @@ -6,7 +6,7 @@ import { actions } from 'reducers'; import { connect } from 'react-redux'; import { languages } from 'common/config'; import { Button, Ellipsis, FoldableAceEditor } from 'components'; -import styles from './stylesheet.module.scss'; +import styles from './CodeEditor.module.scss'; class CodeEditor extends React.Component { constructor(props) { diff --git a/src/components/Divider/stylesheet.module.scss b/src/components/Divider/Divider.module.scss similarity index 100% rename from src/components/Divider/stylesheet.module.scss rename to src/components/Divider/Divider.module.scss diff --git a/src/components/Divider/index.jsx b/src/components/Divider/index.js similarity index 95% rename from src/components/Divider/index.jsx rename to src/components/Divider/index.js index bb015be2ffbde2953bef0297fe85847a1acbd095..78873ab7ece9edda9385867ba83eddf9e762b4f7 100644 --- a/src/components/Divider/index.jsx +++ b/src/components/Divider/index.js @@ -1,6 +1,6 @@ import React from 'react'; import { classes } from 'common/util'; -import styles from './stylesheet.module.scss'; +import styles from './Divider.module.scss'; class Divider extends React.Component { constructor(props) { diff --git a/src/components/Ellipsis/stylesheet.module.scss b/src/components/Ellipsis/Ellipsis.module.scss similarity index 100% rename from src/components/Ellipsis/stylesheet.module.scss rename to src/components/Ellipsis/Ellipsis.module.scss diff --git a/src/components/Ellipsis/index.jsx b/src/components/Ellipsis/index.js similarity index 87% rename from src/components/Ellipsis/index.jsx rename to src/components/Ellipsis/index.js index e832224cc242f3eaf783ccc585ffcd704c49f180..1be680ce410b4742c8f6b818b6737e1d9d72d6fa 100644 --- a/src/components/Ellipsis/index.jsx +++ b/src/components/Ellipsis/index.js @@ -1,5 +1,5 @@ import React from 'react'; -import styles from './stylesheet.module.scss'; +import styles from './Ellipsis.module.scss'; import { classes } from 'common/util'; class Ellipsis extends React.Component { diff --git a/src/components/ExpandableListItem/stylesheet.module.scss b/src/components/ExpandableListItem/ExpandableListItem.module.scss similarity index 100% rename from src/components/ExpandableListItem/stylesheet.module.scss rename to src/components/ExpandableListItem/ExpandableListItem.module.scss diff --git a/src/components/ExpandableListItem/index.jsx b/src/components/ExpandableListItem/index.js similarity index 94% rename from src/components/ExpandableListItem/index.jsx rename to src/components/ExpandableListItem/index.js index a95a4d81106ded20d506cea74bc058b21eeefd58..19ca396235adeed58bc52732eba46666d35e6875 100644 --- a/src/components/ExpandableListItem/index.jsx +++ b/src/components/ExpandableListItem/index.js @@ -2,7 +2,7 @@ import React from 'react'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import faCaretDown from '@fortawesome/fontawesome-free-solid/faCaretDown'; import faCaretRight from '@fortawesome/fontawesome-free-solid/faCaretRight'; -import styles from './stylesheet.module.scss'; +import styles from './ExpandableListItem.module.scss'; import { ListItem } from 'components'; import { classes } from 'common/util'; diff --git a/src/components/FoldableAceEditor/index.jsx b/src/components/FoldableAceEditor/index.js similarity index 100% rename from src/components/FoldableAceEditor/index.jsx rename to src/components/FoldableAceEditor/index.js diff --git a/src/components/Header/stylesheet.module.scss b/src/components/Header/Header.module.scss similarity index 100% rename from src/components/Header/stylesheet.module.scss rename to src/components/Header/Header.module.scss diff --git a/src/components/Header/index.jsx b/src/components/Header/index.js similarity index 99% rename from src/components/Header/index.jsx rename to src/components/Header/index.js index 6f0f7d0645bed02161d2f0752cfc945e7ba197fb..dc839ecbc3080ee552bd6b62d4ddfd120346d275 100644 --- a/src/components/Header/index.jsx +++ b/src/components/Header/index.js @@ -20,7 +20,7 @@ import { classes, refineGist } from 'common/util'; import { actions } from 'reducers'; import { languages } from 'common/config'; import { BaseComponent, Button, Ellipsis, ListItem, Player } from 'components'; -import styles from './stylesheet.module.scss'; +import styles from './Header.module.scss'; class Header extends BaseComponent { handleClickFullScreen() { diff --git a/src/components/ListItem/stylesheet.module.scss b/src/components/ListItem/ListItem.module.scss similarity index 100% rename from src/components/ListItem/stylesheet.module.scss rename to src/components/ListItem/ListItem.module.scss diff --git a/src/components/ListItem/index.jsx b/src/components/ListItem/index.js similarity index 91% rename from src/components/ListItem/index.jsx rename to src/components/ListItem/index.js index adc7795ec54e671feb30159108d25c92f22cfcd7..be7bdcc72297e6fff0cb25b132ca8835ad6c6206 100644 --- a/src/components/ListItem/index.jsx +++ b/src/components/ListItem/index.js @@ -1,5 +1,5 @@ import React from 'react'; -import styles from './stylesheet.module.scss'; +import styles from './ListItem.module.scss'; import { classes } from 'common/util'; import { Button, Ellipsis } from 'components'; diff --git a/src/components/Navigator/stylesheet.module.scss b/src/components/Navigator/Navigator.module.scss similarity index 100% rename from src/components/Navigator/stylesheet.module.scss rename to src/components/Navigator/Navigator.module.scss diff --git a/src/components/Navigator/index.jsx b/src/components/Navigator/index.js similarity index 99% rename from src/components/Navigator/index.jsx rename to src/components/Navigator/index.js index 34e68b69d2dbedbea366e4f9e236d095822b5649..774eb52501ba846b106f61b972039e84fc85462d 100644 --- a/src/components/Navigator/index.jsx +++ b/src/components/Navigator/index.js @@ -8,7 +8,7 @@ import faGithub from '@fortawesome/fontawesome-free-brands/faGithub'; import { ExpandableListItem, ListItem } from 'components'; import { classes } from 'common/util'; import { actions } from 'reducers'; -import styles from './stylesheet.module.scss'; +import styles from './Navigator.module.scss'; class Navigator extends React.Component { constructor(props) { diff --git a/src/components/Player/stylesheet.module.scss b/src/components/Player/Player.module.scss similarity index 100% rename from src/components/Player/stylesheet.module.scss rename to src/components/Player/Player.module.scss diff --git a/src/components/Player/index.jsx b/src/components/Player/index.js similarity index 99% rename from src/components/Player/index.jsx rename to src/components/Player/index.js index 20e791108cccd5449469dc4f68a9e5f8985937ad..cf97ce458112972bf1a7be9e305633ca688823c7 100644 --- a/src/components/Player/index.jsx +++ b/src/components/Player/index.js @@ -11,7 +11,7 @@ import { classes, extension } from 'common/util'; import { TracerApi } from 'apis'; import { actions } from 'reducers'; import { BaseComponent, Button, ProgressBar } from 'components'; -import styles from './stylesheet.module.scss'; +import styles from './Player.module.scss'; class Player extends BaseComponent { constructor(props) { diff --git a/src/components/ProgressBar/stylesheet.module.scss b/src/components/ProgressBar/ProgressBar.module.scss similarity index 100% rename from src/components/ProgressBar/stylesheet.module.scss rename to src/components/ProgressBar/ProgressBar.module.scss diff --git a/src/components/ProgressBar/index.jsx b/src/components/ProgressBar/index.js similarity index 96% rename from src/components/ProgressBar/index.jsx rename to src/components/ProgressBar/index.js index b3af20e7c4f60a6735a84de9879ea399ac808915..72e00066e5b86136557880f91a9de3f24431f695 100644 --- a/src/components/ProgressBar/index.jsx +++ b/src/components/ProgressBar/index.js @@ -1,6 +1,6 @@ import React from 'react'; import { classes } from 'common/util'; -import styles from './stylesheet.module.scss'; +import styles from './ProgressBar.module.scss'; class ProgressBar extends React.Component { constructor(props) { diff --git a/src/components/ResizableContainer/stylesheet.module.scss b/src/components/ResizableContainer/ResizableContainer.module.scss similarity index 100% rename from src/components/ResizableContainer/stylesheet.module.scss rename to src/components/ResizableContainer/ResizableContainer.module.scss diff --git a/src/components/ResizableContainer/index.jsx b/src/components/ResizableContainer/index.js similarity index 97% rename from src/components/ResizableContainer/index.jsx rename to src/components/ResizableContainer/index.js index 90baa5bae321b1188b8b3a9494f929a5c4e3e86a..2c8efad8df07af11d2e0b95cb5551f3725a889e6 100644 --- a/src/components/ResizableContainer/index.jsx +++ b/src/components/ResizableContainer/index.js @@ -1,7 +1,7 @@ import React from 'react'; import { classes } from 'common/util'; import { Divider } from 'components'; -import styles from './stylesheet.module.scss'; +import styles from './ResizableContainer.module.scss'; class ResizableContainer extends React.Component { handleResize(prevIndex, index, targetElement, clientX, clientY) { diff --git a/src/components/TabContainer/stylesheet.module.scss b/src/components/TabContainer/TabContainer.module.scss similarity index 100% rename from src/components/TabContainer/stylesheet.module.scss rename to src/components/TabContainer/TabContainer.module.scss diff --git a/src/components/TabContainer/index.jsx b/src/components/TabContainer/index.js similarity index 97% rename from src/components/TabContainer/index.jsx rename to src/components/TabContainer/index.js index ae3da15bb6e9a223efe268259fa23c3c442e812d..673f6e52333a56ab86febd941879f3c0b623568d 100644 --- a/src/components/TabContainer/index.jsx +++ b/src/components/TabContainer/index.js @@ -6,7 +6,7 @@ import faPlus from '@fortawesome/fontawesome-free-solid/faPlus'; import { classes } from 'common/util'; import { actions } from 'reducers'; import { languages } from 'common/config'; -import styles from './stylesheet.module.scss'; +import styles from './TabContainer.module.scss'; class TabContainer extends React.Component { handleAddFile() { diff --git a/src/components/ToastContainer/stylesheet.module.scss b/src/components/ToastContainer/ToastContainer.module.scss similarity index 100% rename from src/components/ToastContainer/stylesheet.module.scss rename to src/components/ToastContainer/ToastContainer.module.scss diff --git a/src/components/ToastContainer/index.jsx b/src/components/ToastContainer/index.js similarity index 94% rename from src/components/ToastContainer/index.jsx rename to src/components/ToastContainer/index.js index df4309967d01f196cec60d4320df56e5f24863cc..f05276bd97b2319242032b5dcf03b20e338f2af9 100644 --- a/src/components/ToastContainer/index.jsx +++ b/src/components/ToastContainer/index.js @@ -2,7 +2,7 @@ import React from 'react'; import { connect } from 'react-redux'; import { actions } from 'reducers'; import { classes } from 'common/util'; -import styles from './stylesheet.module.scss'; +import styles from './ToastContainer.module.scss'; class ToastContainer extends React.Component { componentWillReceiveProps(nextProps) { diff --git a/src/components/VisualizationViewer/stylesheet.module.scss b/src/components/VisualizationViewer/VisualizationViewer.module.scss similarity index 100% rename from src/components/VisualizationViewer/stylesheet.module.scss rename to src/components/VisualizationViewer/VisualizationViewer.module.scss diff --git a/src/components/VisualizationViewer/index.jsx b/src/components/VisualizationViewer/index.js similarity index 97% rename from src/components/VisualizationViewer/index.jsx rename to src/components/VisualizationViewer/index.js index 19753d9fbaab69e3ff5257afb5a1a5be366ad40f..2434438dc98bef8278c2c51994aa0e5f9845feb0 100644 --- a/src/components/VisualizationViewer/index.jsx +++ b/src/components/VisualizationViewer/index.js @@ -2,7 +2,7 @@ import React from 'react'; import { connect } from 'react-redux'; import { BaseComponent } from 'components'; import { actions } from 'reducers'; -import styles from './stylesheet.module.scss'; +import styles from './VisualizationViewer.module.scss'; import * as TracerClasses from 'core/tracers'; import * as LayoutClasses from 'core/layouts'; import { classes } from 'common/util'; diff --git a/src/core/layouts/Layout.jsx b/src/core/layouts/Layout.js similarity index 100% rename from src/core/layouts/Layout.jsx rename to src/core/layouts/Layout.js diff --git a/src/core/renderers/Array1DRenderer/stylesheet.module.scss b/src/core/renderers/Array1DRenderer/Array1DRenderer.module.scss similarity index 100% rename from src/core/renderers/Array1DRenderer/stylesheet.module.scss rename to src/core/renderers/Array1DRenderer/Array1DRenderer.module.scss diff --git a/src/core/renderers/Array1DRenderer/index.jsx b/src/core/renderers/Array1DRenderer/index.js similarity index 100% rename from src/core/renderers/Array1DRenderer/index.jsx rename to src/core/renderers/Array1DRenderer/index.js diff --git a/src/core/renderers/Array2DRenderer/stylesheet.module.scss b/src/core/renderers/Array2DRenderer/Array2DRenderer.module.scss similarity index 100% rename from src/core/renderers/Array2DRenderer/stylesheet.module.scss rename to src/core/renderers/Array2DRenderer/Array2DRenderer.module.scss diff --git a/src/core/renderers/Array2DRenderer/index.jsx b/src/core/renderers/Array2DRenderer/index.js similarity index 97% rename from src/core/renderers/Array2DRenderer/index.jsx rename to src/core/renderers/Array2DRenderer/index.js index e5aacf09bb9cceed55e03c6888e92df4c22ef9e7..13d14dc95cd08e9d9221505a8a0e4bb7fd5847b1 100644 --- a/src/core/renderers/Array2DRenderer/index.jsx +++ b/src/core/renderers/Array2DRenderer/index.js @@ -1,6 +1,6 @@ import React from 'react'; import { Array1DRenderer, Renderer } from 'core/renderers'; -import styles from './stylesheet.module.scss'; +import styles from './Array2DRenderer.module.scss'; import { classes } from 'common/util'; class Array2DRenderer extends Renderer { diff --git a/src/core/renderers/ChartRenderer/stylesheet.module.scss b/src/core/renderers/ChartRenderer/ChartRenderer.module.scss similarity index 100% rename from src/core/renderers/ChartRenderer/stylesheet.module.scss rename to src/core/renderers/ChartRenderer/ChartRenderer.module.scss diff --git a/src/core/renderers/ChartRenderer/index.jsx b/src/core/renderers/ChartRenderer/index.js similarity index 94% rename from src/core/renderers/ChartRenderer/index.jsx rename to src/core/renderers/ChartRenderer/index.js index e0f7fd16221650dc1afa2a6cb9c9e8f109823996..7131775b2be9499a2b72995af0b087b16dc654a5 100644 --- a/src/core/renderers/ChartRenderer/index.jsx +++ b/src/core/renderers/ChartRenderer/index.js @@ -1,7 +1,7 @@ import React from 'react'; import { Bar } from 'react-chartjs-2'; import { Array1DRenderer } from 'core/renderers'; -import styles from './stylesheet.module.scss'; +import styles from './ChartRenderer.module.scss'; class ChartRenderer extends Array1DRenderer { renderData() { diff --git a/src/core/renderers/GraphRenderer/stylesheet.module.scss b/src/core/renderers/GraphRenderer/GraphRenderer.module.scss similarity index 100% rename from src/core/renderers/GraphRenderer/stylesheet.module.scss rename to src/core/renderers/GraphRenderer/GraphRenderer.module.scss diff --git a/src/core/renderers/GraphRenderer/index.jsx b/src/core/renderers/GraphRenderer/index.js similarity index 98% rename from src/core/renderers/GraphRenderer/index.jsx rename to src/core/renderers/GraphRenderer/index.js index 31142550d51f2ea0793fe1b11c4cbcf7d4c7febb..34b8ac1e889442f80741a9799c9eac44ecd9ab27 100644 --- a/src/core/renderers/GraphRenderer/index.jsx +++ b/src/core/renderers/GraphRenderer/index.js @@ -1,7 +1,7 @@ import React from 'react'; import { Renderer } from 'core/renderers'; import { classes, distance } from 'common/util'; -import styles from './stylesheet.module.scss'; +import styles from './GraphRenderer.module.scss'; class GraphRenderer extends Renderer { constructor(props) { diff --git a/src/core/renderers/LogRenderer/stylesheet.module.scss b/src/core/renderers/LogRenderer/LogRenderer.module.scss similarity index 100% rename from src/core/renderers/LogRenderer/stylesheet.module.scss rename to src/core/renderers/LogRenderer/LogRenderer.module.scss diff --git a/src/core/renderers/LogRenderer/index.jsx b/src/core/renderers/LogRenderer/index.js similarity index 93% rename from src/core/renderers/LogRenderer/index.jsx rename to src/core/renderers/LogRenderer/index.js index 4d22f64be455f90841e88d3235c1b9df8829bacb..0bba071dd55969e02be41fe2409f53c073a44a2d 100644 --- a/src/core/renderers/LogRenderer/index.jsx +++ b/src/core/renderers/LogRenderer/index.js @@ -1,6 +1,6 @@ import React from 'react'; import { Renderer } from 'core/renderers'; -import styles from './stylesheet.module.scss'; +import styles from './LogRenderer.module.scss'; class LogRenderer extends Renderer { constructor(props) { diff --git a/src/core/renderers/MarkdownRenderer/stylesheet.module.scss b/src/core/renderers/MarkdownRenderer/MarkdownRenderer.module.scss similarity index 100% rename from src/core/renderers/MarkdownRenderer/stylesheet.module.scss rename to src/core/renderers/MarkdownRenderer/MarkdownRenderer.module.scss diff --git a/src/core/renderers/MarkdownRenderer/index.jsx b/src/core/renderers/MarkdownRenderer/index.js similarity index 97% rename from src/core/renderers/MarkdownRenderer/index.jsx rename to src/core/renderers/MarkdownRenderer/index.js index a3f890901fb4aac3d6102d2497b123aeee80965e..f9257ec0240ce2f394ade1a7a1d71851059ea1f1 100644 --- a/src/core/renderers/MarkdownRenderer/index.jsx +++ b/src/core/renderers/MarkdownRenderer/index.js @@ -1,6 +1,6 @@ import React from 'react'; import { Renderer } from 'core/renderers'; -import styles from './stylesheet.module.scss'; +import styles from './MarkdownRenderer.module.scss'; import ReactMarkdown from 'react-markdown'; class MarkdownRenderer extends Renderer { diff --git a/src/core/renderers/Renderer/stylesheet.module.scss b/src/core/renderers/Renderer/Renderer.module.scss similarity index 100% rename from src/core/renderers/Renderer/stylesheet.module.scss rename to src/core/renderers/Renderer/Renderer.module.scss diff --git a/src/core/renderers/Renderer/index.jsx b/src/core/renderers/Renderer/index.js similarity index 98% rename from src/core/renderers/Renderer/index.jsx rename to src/core/renderers/Renderer/index.js index e12e946fec1bc443bf331a86646692100f09669c..e782b832185a6b7db5c95e210e34377d9196abf6 100644 --- a/src/core/renderers/Renderer/index.jsx +++ b/src/core/renderers/Renderer/index.js @@ -1,5 +1,5 @@ import React from 'react'; -import styles from './stylesheet.module.scss'; +import styles from './Renderer.module.scss'; import { Ellipsis } from 'components'; import { classes } from 'common/util';