Use module aliases

This commit is contained in:
Timothy Warren 2018-05-03 15:23:48 -04:00
parent 224c3fac19
commit cfc88ef5fc
22 changed files with 76 additions and 43 deletions

View File

@ -10,5 +10,13 @@
} }
}], }],
"inferno-app" "inferno-app"
],
"plugins": [
["module-resolver", {
"root": ["./src"],
"alias": {
"//": "./"
}
}]
] ]
} }

View File

@ -4,9 +4,6 @@
"description": "A cross-platform app to exit exif tags", "description": "A cross-platform app to exit exif tags",
"version": "0.2.0", "version": "0.2.0",
"private": true, "private": true,
"alias": {
"|": "./src/"
},
"dependencies": { "dependencies": {
"dotenv": "5.0.1", "dotenv": "5.0.1",
"dotenv-expand": "4.2.0", "dotenv-expand": "4.2.0",
@ -28,6 +25,7 @@
"babel-eslint": "^8.2.2", "babel-eslint": "^8.2.2",
"babel-jest": "^22.4.3", "babel-jest": "^22.4.3",
"babel-loader": "^7.1.4", "babel-loader": "^7.1.4",
"babel-plugin-module-resolver": "^3.1.1",
"babel-preset-env": "^1.6.1", "babel-preset-env": "^1.6.1",
"babel-preset-inferno-app": "^7.1.0", "babel-preset-inferno-app": "^7.1.0",
"babel-runtime": "6.26.0", "babel-runtime": "6.26.0",

View File

@ -1,15 +1,15 @@
import * as _ from 'lodash'; import * as _ from 'lodash';
import { Component } from 'inferno'; import { Component } from 'inferno';
import { BrowserRouter, Link, NavLink } from 'inferno-router'; import { BrowserRouter, Link, NavLink } from 'inferno-router';
import { Loader } from './components'; import { Loader } from '//components';
import { import {
Container, Container,
Nav, Nav,
Navbar, Navbar,
NavbarBrand, NavbarBrand,
NavItem, NavItem,
} from './components/Bootstrap'; } from '//components/Bootstrap';
import { Routes } from './Routes'; import { Routes } from '//Routes';
export class App extends Component { export class App extends Component {
constructor (props) { constructor (props) {
@ -43,7 +43,7 @@ export class App extends Component {
onWebSocketOpen () { onWebSocketOpen () {
this.setState({ this.setState({
webSocketLoaded: true, webSocketLoaded: true
}); });
window.clientWS.onmessage = message => { window.clientWS.onmessage = message => {

View File

@ -5,7 +5,7 @@ import {
FilmAddView, FilmAddView,
HomeView, HomeView,
OopsView, OopsView,
} from '~/src/views'; } from '//views';
export const Routes = (props) => ( export const Routes = (props) => (
<Switch> <Switch>

View File

@ -1,7 +1,7 @@
export * from './Bootstrap'; export * from '//components/Bootstrap/Bootstrap';
export * from './Card'; export * from '//components/Bootstrap/Card';
export * from './Form'; export * from '//components/Bootstrap/Form';
export * from './Grid'; export * from '//components/Bootstrap/Grid';
export * from './List'; export * from '//components/Bootstrap/List';
export * from './Modal'; export * from '//components/Bootstrap/Modal';
export * from './Navigation'; export * from '//components/Bootstrap/Navigation';

View File

@ -3,7 +3,7 @@ import {
FormGroup, FormGroup,
Input, Input,
Label, Label,
} from '../Bootstrap'; } from '//components/Bootstrap';
export const FormBlock = ({ export const FormBlock = ({
children, children,

View File

@ -1 +1 @@
export * from './FormBlock'; export * from '//components/Form/FormBlock';

View File

@ -1,3 +1,3 @@
export * from './Bootstrap'; export * from '//components/Bootstrap';
export * from './Form'; export * from '//components/Form';
export * from './Loader'; export * from '//components/Loader';

View File

@ -3,7 +3,7 @@
*/ */
import { combineReducers, createStore } from 'redux'; import { combineReducers, createStore } from 'redux';
import * as reducers from './reducers'; import * as reducers from '//reducers';
const configureStore = (defaultState = {}) => { const configureStore = (defaultState = {}) => {
return createStore(combineReducers({ return createStore(combineReducers({

View File

@ -1 +1 @@
export * from './redux-actions'; export * from '//constants/redux-actions';

View File

@ -1 +1 @@
export * from './web-socket'; export * from '//helpers/web-socket';

View File

@ -1,8 +1,8 @@
import { render } from 'inferno'; import { render } from 'inferno';
import { Provider } from 'inferno-redux'; import { Provider } from 'inferno-redux';
import configureStore from './configureStore'; import configureStore from '//configureStore';
import { App } from './App'; import { App } from '//App';
const store = configureStore(); const store = configureStore();

View File

@ -1,2 +1,2 @@
export * from './receiveReducer'; export * from '//reducers/receiveReducer';
export * from './sendReducer'; export * from '//reducers/sendReducer';

View File

@ -10,9 +10,9 @@ import {
Col, Col,
Form, Form,
Row, Row,
} from '../../components/Bootstrap'; } from '//components/Bootstrap';
import { FormBlock } from '../../components/Form'; import { FormBlock } from '//components/Form';
export class CameraAddView extends Component { export class CameraAddView extends Component {
constructor (props) { constructor (props) {

View File

@ -1,2 +1,2 @@
export * from './CameraAddView'; export * from '//views/Camera/CameraAddView';
export * from './CameraListView'; export * from '//views/Camera/CameraListView';

View File

@ -10,9 +10,9 @@ import {
Col, Col,
Form, Form,
Row, Row,
} from '../../components/Bootstrap'; } from '//components/Bootstrap';
import { FormBlock } from '../../components/Form'; import { FormBlock } from '//components/Form';
export class FilmAddView extends Component { export class FilmAddView extends Component {
constructor (props) { constructor (props) {

View File

@ -1 +1 @@
export * from './FilmAddView'; export * from '//views/Film/FilmAddView';

View File

@ -10,8 +10,8 @@ import {
ModalFooter, ModalFooter,
ModalHeader, ModalHeader,
Row, Row,
} from '../components/Bootstrap'; } from '//components/Bootstrap';
import { JSONMessage } from '../helpers/web-socket'; import { JSONMessage } from '//helpers/web-socket';
export class HomeView extends Component { export class HomeView extends Component {
constructor (props) { constructor (props) {

View File

@ -1 +1 @@
export * from './LensesListView'; export * from '//views/Lenses/LensesListView';

View File

@ -1,4 +1,4 @@
import { Alert, Row } from '../components/Bootstrap'; import { Alert, Row } from '//components/Bootstrap';
export const OopsView = (props) => ( export const OopsView = (props) => (
<Row className="align-items-center justify-content-center full-height"> <Row className="align-items-center justify-content-center full-height">

View File

@ -1,4 +1,4 @@
export * from './Camera'; export * from '//views/Camera';
export * from './Film'; export * from '//views/Film';
export * from './HomeView'; export * from '//views/HomeView';
export * from './OopsView'; export * from '//views/OopsView';

View File

@ -680,6 +680,16 @@ babel-plugin-jest-hoist@^22.4.3:
version "22.4.3" version "22.4.3"
resolved "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-22.4.3.tgz#7d8bcccadc2667f96a0dcc6afe1891875ee6c14a" resolved "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-22.4.3.tgz#7d8bcccadc2667f96a0dcc6afe1891875ee6c14a"
babel-plugin-module-resolver@^3.1.1:
version "3.1.1"
resolved "https://registry.npmjs.org/babel-plugin-module-resolver/-/babel-plugin-module-resolver-3.1.1.tgz#881cf67e3d4b8400d5eaaefc1be44d2dc1fe404f"
dependencies:
find-babel-config "^1.1.0"
glob "^7.1.2"
pkg-up "^2.0.0"
reselect "^3.0.1"
resolve "^1.4.0"
babel-plugin-syntax-async-functions@^6.8.0: babel-plugin-syntax-async-functions@^6.8.0:
version "6.13.0" version "6.13.0"
resolved "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz#cad9cad1191b5ad634bf30ae0872391e0647be95" resolved "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz#cad9cad1191b5ad634bf30ae0872391e0647be95"
@ -2945,6 +2955,13 @@ fill-range@^4.0.0:
repeat-string "^1.6.1" repeat-string "^1.6.1"
to-regex-range "^2.1.0" to-regex-range "^2.1.0"
find-babel-config@^1.1.0:
version "1.1.0"
resolved "https://registry.npmjs.org/find-babel-config/-/find-babel-config-1.1.0.tgz#acc01043a6749fec34429be6b64f542ebb5d6355"
dependencies:
json5 "^0.5.1"
path-exists "^3.0.0"
find-cache-dir@^0.1.1: find-cache-dir@^0.1.1:
version "0.1.1" version "0.1.1"
resolved "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-0.1.1.tgz#c8defae57c8a52a8a784f9e31c57c742e993a0b9" resolved "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-0.1.1.tgz#c8defae57c8a52a8a784f9e31c57c742e993a0b9"
@ -5475,6 +5492,12 @@ pkg-dir@^2.0.0:
dependencies: dependencies:
find-up "^2.1.0" find-up "^2.1.0"
pkg-up@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/pkg-up/-/pkg-up-2.0.0.tgz#c819ac728059a461cab1c3889a2be3c49a004d7f"
dependencies:
find-up "^2.1.0"
plist@^2.1.0: plist@^2.1.0:
version "2.1.0" version "2.1.0"
resolved "https://registry.npmjs.org/plist/-/plist-2.1.0.tgz#57ccdb7a0821df21831217a3cad54e3e146a1025" resolved "https://registry.npmjs.org/plist/-/plist-2.1.0.tgz#57ccdb7a0821df21831217a3cad54e3e146a1025"
@ -6188,6 +6211,10 @@ requires-port@1.0.x, requires-port@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" resolved "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
reselect@^3.0.1:
version "3.0.1"
resolved "https://registry.npmjs.org/reselect/-/reselect-3.0.1.tgz#efdaa98ea7451324d092b2b2163a6a1d7a9a2147"
resolve-cwd@^2.0.0: resolve-cwd@^2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a" resolved "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a"