fossasia / accounts.susi.ai

Accounts Service for SUSI.AI http://accounts.susi.ai
GNU Lesser General Public License v2.1
1.51k stars 94 forks source link

Refactoring code in index.js #669

Closed plxity closed 5 years ago

plxity commented 5 years ago

Actual Behaviour

Components are imported from there actual file locations

Expected Behaviour

Instead, create a new file where all components are imported and then exported.

import SignUp from './components/Auth/SignUp/SignUp.react'; import Logout from './components/Auth/Logout.react'; import ResetPassword from './components/Auth/ResetPassword/ResetPassword.react'; import DeleteAccount from './components/Auth/DeleteAccount/DeleteAccount.react'; import Settings from './components/Settings/Settings.react'; import Admin from './components/Admin/Admin.js'; import Users from './components/Admin/ListUser/ListUser.js'; import Skills from './components/Admin/ListSkills/ListSkills.js'; import SystemSettings from './components/Admin/SystemSettings/SystemSettings.js'; import SystemLogs from './components/Admin/SystemLogs/SystemLogs.js'; import VerifyAccount from './components/Auth/VerifyAccount/VerifyAccount.react'; import Login from './components/Auth/Login/Login.react'; import NotFound from './components/NotFound/NotFound.react'; export { SignUp, Logout, ResetPassword, DeleteAccount, Settings, Admin, Users, Skills, SystemLogs, SystemSettings, VerifyAccount, Login, NotFound, };

Would you like to work on the issue?

Yes, I would like to work on the issue.

Pipe-Runner commented 5 years ago

Ummm... I think you should ask the mentors before working on this. Coz we happen to be doing this for the other two repos anyway. See if they think it is necessary else your time would be wasted for nothing. @anshumanv

plxity commented 5 years ago

@AakashMallik Okay, I actually sent a PR for index.js. Let's see what mentors say.

anshumanv commented 5 years ago

Sure this can help us with import { ... } from './components' 🤔 👍

@akshatnitd you okay with this? Any negatives that you can think of?

akshatnitd commented 5 years ago

I do not suggest going with this approach. It will add too much dependency and overhead to update this file. We should use aliases. Read - https://github.com/facebook/create-react-app/issues/2188#issuecomment-302040874

We also think in the direction of ejecting the CRA created config and then configure the webpack aliases.

akshatnitd commented 5 years ago

Also, this module looks great - https://github.com/timarney/react-app-rewired. It will allow us to add aliases by overriding webpack config.