From f369ba88cc535a9cfb59d1f3fb2bdfb839129b1d Mon Sep 17 00:00:00 2001 From: bill bittner <bittner.w@gmail.com> Date: Wed, 17 Jan 2018 15:00:03 -0800 Subject: [PATCH] reduced paths for imports --- react/actions/index.js | 2 +- react/components/PublishStatus.jsx | 4 ++-- react/containers/ChannelCreateForm/index.js | 4 ++-- react/containers/ChannelCreateForm/view.jsx | 6 +++--- react/containers/ChannelLoginForm/index.js | 4 ++-- react/containers/ChannelLoginForm/view.jsx | 6 +++--- react/containers/ChannelSelect/index.js | 2 +- react/containers/ChannelSelect/view.jsx | 5 +++-- react/containers/Dropzone/index.js | 4 ++-- react/containers/Dropzone/view.jsx | 4 ++-- react/containers/PublishForm/index.js | 4 ++-- react/containers/PublishForm/view.jsx | 16 ++++++++-------- react/containers/PublishMetadataInputs/index.js | 4 ++-- react/containers/PublishMetadataInputs/view.jsx | 9 --------- react/containers/PublishThumbnailInput/index.js | 4 ++-- react/containers/PublishTitleInput/index.js | 4 ++-- react/containers/PublishTool/index.js | 2 +- react/containers/PublishTool/view.jsx | 6 +++--- react/containers/PublishUrlInput/index.js | 4 ++-- react/containers/PublishUrlInput/view.jsx | 4 ++-- react/index.js | 8 ++++---- react/reducers/index.js | 2 +- webpack.config.js | 14 ++++++++++++-- 23 files changed, 62 insertions(+), 60 deletions(-) diff --git a/react/actions/index.js b/react/actions/index.js index 65884b48..9d5eeacc 100644 --- a/react/actions/index.js +++ b/react/actions/index.js @@ -1,4 +1,4 @@ -import * as actions from '../constants/action_types.js'; +import * as actions from 'constants/action_types'; // export action creators export function selectFile (file) { diff --git a/react/components/PublishStatus.jsx b/react/components/PublishStatus.jsx index 246fd255..c88b6c6b 100644 --- a/react/components/PublishStatus.jsx +++ b/react/components/PublishStatus.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; -import ProgressBar from '../components/ProgressBar.jsx'; -import * as publishStates from '../constants/publishing_states'; +import ProgressBar from 'components/ProgressBar'; +import * as publishStates from 'constants/publishing_states'; function PublishStatus ({ status, message }) { return ( diff --git a/react/containers/ChannelCreateForm/index.js b/react/containers/ChannelCreateForm/index.js index 78ae010e..1956f0ac 100644 --- a/react/containers/ChannelCreateForm/index.js +++ b/react/containers/ChannelCreateForm/index.js @@ -1,6 +1,6 @@ import { connect } from 'react-redux'; -import { updateLoggedInChannel } from '../../actions'; -import View from './view.jsx'; +import { updateLoggedInChannel } from 'actions'; +import View from './view'; const mapDispatchToProps = dispatch => { return { diff --git a/react/containers/ChannelCreateForm/view.jsx b/react/containers/ChannelCreateForm/view.jsx index 1999b872..7484dd41 100644 --- a/react/containers/ChannelCreateForm/view.jsx +++ b/react/containers/ChannelCreateForm/view.jsx @@ -1,7 +1,7 @@ import React from 'react'; -import { makeGetRequest, makePostRequest } from '../../utils/xhr.js'; -import { setUserCookies } from '../../utils/cookies.js'; -import { replaceChannelSelectionInNavBar } from '../../utils/page.js'; +import { makeGetRequest, makePostRequest } from 'utils/xhr'; +import { setUserCookies } from 'utils/cookies'; +import { replaceChannelSelectionInNavBar } from 'utils/page'; class ChannelCreateForm extends React.Component { constructor (props) { diff --git a/react/containers/ChannelLoginForm/index.js b/react/containers/ChannelLoginForm/index.js index 78ae010e..1956f0ac 100644 --- a/react/containers/ChannelLoginForm/index.js +++ b/react/containers/ChannelLoginForm/index.js @@ -1,6 +1,6 @@ import { connect } from 'react-redux'; -import { updateLoggedInChannel } from '../../actions'; -import View from './view.jsx'; +import { updateLoggedInChannel } from 'actions'; +import View from './view'; const mapDispatchToProps = dispatch => { return { diff --git a/react/containers/ChannelLoginForm/view.jsx b/react/containers/ChannelLoginForm/view.jsx index 6e4f5c07..ab90c649 100644 --- a/react/containers/ChannelLoginForm/view.jsx +++ b/react/containers/ChannelLoginForm/view.jsx @@ -1,7 +1,7 @@ import React from 'react'; -import { makePostRequest } from '../../utils/xhr.js'; -import { setUserCookies } from '../../utils/cookies.js'; -import { replaceChannelSelectionInNavBar } from '../../utils/page.js'; +import { makePostRequest } from 'utils/xhr'; +import { setUserCookies } from 'utils/cookies'; +import { replaceChannelSelectionInNavBar } from 'utils/page'; class ChannelLoginForm extends React.Component { constructor (props) { diff --git a/react/containers/ChannelSelect/index.js b/react/containers/ChannelSelect/index.js index 70553849..9c88135d 100644 --- a/react/containers/ChannelSelect/index.js +++ b/react/containers/ChannelSelect/index.js @@ -1,5 +1,5 @@ import {connect} from 'react-redux'; -import {setPublishInChannel} from '../../actions'; +import {setPublishInChannel} from 'actions'; import View from './view.jsx'; const mapStateToProps = state => { diff --git a/react/containers/ChannelSelect/view.jsx b/react/containers/ChannelSelect/view.jsx index e3b0ce43..ea0f3999 100644 --- a/react/containers/ChannelSelect/view.jsx +++ b/react/containers/ChannelSelect/view.jsx @@ -1,6 +1,7 @@ import React from 'react'; -import ChannelLoginForm from '../ChannelLoginForm'; -import ChannelCreateForm from '../ChannelCreateForm'; +import ChannelLoginForm from 'containers/ChannelLoginForm'; +import ChannelCreateForm from 'containers/ChannelCreateForm'; + const LOGIN = 'Existing'; const CREATE = 'New'; diff --git a/react/containers/Dropzone/index.js b/react/containers/Dropzone/index.js index 5fe6c63b..a9cbeb6d 100644 --- a/react/containers/Dropzone/index.js +++ b/react/containers/Dropzone/index.js @@ -1,6 +1,6 @@ import { connect } from 'react-redux'; -import { selectFile, updateError } from '../../actions'; -import View from './view.jsx'; +import { selectFile, updateError } from 'actions'; +import View from './view'; const mapStateToProps = state => { return { diff --git a/react/containers/Dropzone/view.jsx b/react/containers/Dropzone/view.jsx index b3b32836..90b7c2a4 100644 --- a/react/containers/Dropzone/view.jsx +++ b/react/containers/Dropzone/view.jsx @@ -1,6 +1,6 @@ import React from 'react'; -import { validateFile } from '../../utils/file.js'; -import Preview from '../../components/Preview.jsx'; +import { validateFile } from 'utils/file'; +import Preview from 'components/Preview'; class Dropzone extends React.Component { constructor (props) { diff --git a/react/containers/PublishForm/index.js b/react/containers/PublishForm/index.js index 24c0dc7f..32d7ace0 100644 --- a/react/containers/PublishForm/index.js +++ b/react/containers/PublishForm/index.js @@ -1,6 +1,6 @@ -import {clearFile, selectFile, updateError, updateLoggedInChannel, updatePublishStatus} from '../../actions'; import {connect} from 'react-redux'; -import View from './view.jsx'; +import {clearFile, selectFile, updateError, updateLoggedInChannel, updatePublishStatus} from 'actions'; +import View from './view'; const mapStateToProps = state => { return { diff --git a/react/containers/PublishForm/view.jsx b/react/containers/PublishForm/view.jsx index 8b7bf823..ada35635 100644 --- a/react/containers/PublishForm/view.jsx +++ b/react/containers/PublishForm/view.jsx @@ -1,12 +1,12 @@ import React from 'react'; -import {getCookie} from '../../utils/cookies.js'; -import Dropzone from '../Dropzone'; -import PublishTitleInput from '../PublishTitleInput'; -import PublishUrlInput from '../PublishUrlInput'; -import PublishThumbnailInput from '../PublishThumbnailInput'; -import PublishMetadataInputs from '../PublishMetadataInputs'; -import ChannelSelect from '../ChannelSelect'; -import * as publishStates from '../../constants/publishing_states'; +import {getCookie} from 'utils/cookies'; +import Dropzone from 'containers/Dropzone'; +import PublishTitleInput from 'containers/PublishTitleInput'; +import PublishUrlInput from 'containers/PublishUrlInput'; +import PublishThumbnailInput from 'containers/PublishThumbnailInput'; +import PublishMetadataInputs from 'containers/PublishMetadataInputs'; +import ChannelSelect from 'containers/ChannelSelect'; +import * as publishStates from 'constants/publishing_states'; class PublishForm extends React.Component { constructor (props) { diff --git a/react/containers/PublishMetadataInputs/index.js b/react/containers/PublishMetadataInputs/index.js index d2f18578..f1c2b524 100644 --- a/react/containers/PublishMetadataInputs/index.js +++ b/react/containers/PublishMetadataInputs/index.js @@ -1,6 +1,6 @@ import {connect} from 'react-redux'; -import {updateMetadata} from '../../actions'; -import View from './view.jsx'; +import {updateMetadata} from 'actions'; +import View from './view'; const mapStateToProps = state => { return { diff --git a/react/containers/PublishMetadataInputs/view.jsx b/react/containers/PublishMetadataInputs/view.jsx index 6d9c16ae..17098c0d 100644 --- a/react/containers/PublishMetadataInputs/view.jsx +++ b/react/containers/PublishMetadataInputs/view.jsx @@ -1,14 +1,5 @@ import React from 'react'; -/* - const textarea = document.getElementById('publish-description'); - const limit = 200; - textarea.oninput = () => { - textarea.style.height = ''; - textarea.style.height = Math.min(textarea.scrollHeight, limit) + 'px'; - } -*/ - class PublishMetadataInputs extends React.Component { constructor (props) { super(props); diff --git a/react/containers/PublishThumbnailInput/index.js b/react/containers/PublishThumbnailInput/index.js index 859b598f..4192c99f 100644 --- a/react/containers/PublishThumbnailInput/index.js +++ b/react/containers/PublishThumbnailInput/index.js @@ -1,6 +1,6 @@ import {connect} from 'react-redux'; -import {updateMetadata} from '../../actions'; -import View from './view.jsx'; +import {updateMetadata} from 'actions'; +import View from './view'; const mapStateToProps = state => { return { diff --git a/react/containers/PublishTitleInput/index.js b/react/containers/PublishTitleInput/index.js index d71e7a6b..62a2db79 100644 --- a/react/containers/PublishTitleInput/index.js +++ b/react/containers/PublishTitleInput/index.js @@ -1,6 +1,6 @@ import {connect} from 'react-redux'; -import {updateMetadata} from '../../actions'; -import View from './view.jsx'; +import {updateMetadata} from 'actions'; +import View from './view'; const mapStateToProps = state => { return { diff --git a/react/containers/PublishTool/index.js b/react/containers/PublishTool/index.js index 0b264093..0f9c9941 100644 --- a/react/containers/PublishTool/index.js +++ b/react/containers/PublishTool/index.js @@ -1,5 +1,5 @@ import {connect} from 'react-redux'; -import View from './view.jsx'; +import View from './view'; const mapStateToProps = state => { return { diff --git a/react/containers/PublishTool/view.jsx b/react/containers/PublishTool/view.jsx index b30f8b1c..30132bee 100644 --- a/react/containers/PublishTool/view.jsx +++ b/react/containers/PublishTool/view.jsx @@ -1,7 +1,7 @@ import React from 'react'; -import Dropzone from '../Dropzone'; -import PublishForm from '../PublishForm'; -import PublishStatus from '../../components/PublishStatus.jsx'; +import Dropzone from 'containers/Dropzone'; +import PublishForm from 'containers/PublishForm'; +import PublishStatus from 'components/PublishStatus'; class PublishTool extends React.Component { render () { diff --git a/react/containers/PublishUrlInput/index.js b/react/containers/PublishUrlInput/index.js index 635590a9..3a7d833b 100644 --- a/react/containers/PublishUrlInput/index.js +++ b/react/containers/PublishUrlInput/index.js @@ -1,6 +1,6 @@ -import {updateClaim, updateError} from '../../actions'; +import {updateClaim, updateError} from 'actions'; import {connect} from 'react-redux'; -import View from './view.jsx'; +import View from './view'; const mapStateToProps = state => { return { diff --git a/react/containers/PublishUrlInput/view.jsx b/react/containers/PublishUrlInput/view.jsx index 04bdc472..8bb1c22d 100644 --- a/react/containers/PublishUrlInput/view.jsx +++ b/react/containers/PublishUrlInput/view.jsx @@ -1,6 +1,6 @@ import React from 'react'; -import { makeGetRequest } from '../../utils/xhr.js'; -import UrlMiddle from '../../components/PublishUrlMiddle.jsx'; +import {makeGetRequest} from 'utils/xhr'; +import UrlMiddle from 'components/PublishUrlMiddle'; class PublishUrlInput extends React.Component { constructor (props) { diff --git a/react/index.js b/react/index.js index 2060ab54..99dcd27c 100644 --- a/react/index.js +++ b/react/index.js @@ -1,9 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import { Provider } from 'react-redux'; -import { createStore } from 'redux'; -import Reducers from './reducers'; -import PublishTool from './containers/PublishTool'; +import {Provider} from 'react-redux'; +import {createStore} from 'redux'; +import Reducers from 'reducers'; +import PublishTool from 'containers/PublishTool'; let store = createStore( Reducers, diff --git a/react/reducers/index.js b/react/reducers/index.js index 783a54fa..05279fdc 100644 --- a/react/reducers/index.js +++ b/react/reducers/index.js @@ -1,4 +1,4 @@ -import * as actions from '../constants/action_types'; +import * as actions from 'constants/action_types'; const initialState = { loggedInChannel: { diff --git a/webpack.config.js b/webpack.config.js index ce9501d7..b4c1fd15 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,9 +1,11 @@ -const path = require('path'); +const Path = require('path'); + +const REACT_ROOT = Path.resolve(__dirname, 'react/'); module.exports = { entry : './react/index.js', output: { - path : path.join(__dirname, '/public/bundle/'), + path : Path.join(__dirname, '/public/bundle/'), filename: 'bundle.js', }, watch : true, @@ -19,4 +21,12 @@ module.exports = { }, ], }, + resolve: { + modules: [ + REACT_ROOT, + 'node_modules', + __dirname, + ], + extensions: ['.js', '.jsx', '.scss'], + }, };