diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..600ed8b --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +BASE_URL='http://localhost:1337/' +API_URL='http://localhost:3000/' +DEBUG=false \ No newline at end of file diff --git a/.eslintignore b/.eslintignore index ec21801..7aaa80e 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,5 @@ app/build/ app/dist/ webpack.config.*.js +webpack.config.js +config/ \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js index 22eba9b..1ee00a4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -11,13 +11,14 @@ module.exports = { "settings": { "import/resolver": { "webpack": { - "config": "webpack.config.babel.js" + "config": "webpack.config.js" } } }, "rules": { "func-names": 0, "eol-last": 0, + "react/no-unused-prop-types": 0, "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }], "react/jsx-no-bind": [ 2, { "ignoreRefs": false, @@ -30,6 +31,7 @@ module.exports = { }] }, "plugins": [ + "import", "react", "graphql", "jsx-a11y" diff --git a/.flowconfig b/.flowconfig index 22bc9b6..8d74d69 100644 --- a/.flowconfig +++ b/.flowconfig @@ -1,5 +1,6 @@ [ignore] .*/node_modules/.* +config/ [include] ./app/src/ @@ -15,7 +16,7 @@ suppress_comment=.*\\$FlowFixMe suppress_comment=.*\\$FlowInvalidInputTest module.name_mapper='\(react-redux\)' -> '/config/flow-typed/GeneralStub.js' module.name_mapper='\(redux\)' -> '/config/flow-typed/GeneralStub.js' -module.name_mapper='.*\(.scss\|.png\)' -> '/config/flow-typed/GeneralStub.js' +module.name_mapper='.*\(.scss\|.png\|.md\)' -> '/config/flow-typed/GeneralStub.js' module.name_mapper='^containers\/\(.*\)$' -> '/app/src/containers/\1' module.name_mapper='^containers$' -> '/app/src/containers' module.name_mapper='^components\/\(.*\)$' -> '/app/src/components/\1' diff --git a/.gitignore b/.gitignore index 6e4708d..5ef0bb3 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,9 @@ jspm_packages # Optional REPL history .node_repl_history +.env +.vscode +/server/public/**/*.js +/server/public/**/*.css +/server/public/**/*.map +/server/public/**/*.json diff --git a/app/src/apolloClient.js b/app/src/apolloClient.js index e318193..2445c79 100644 --- a/app/src/apolloClient.js +++ b/app/src/apolloClient.js @@ -2,9 +2,9 @@ import ApolloClient, { createNetworkInterface, addTypeName, } from 'apollo-client'; -import { BASE_URL } from 'config'; // eslint-disable-line -const url = `${BASE_URL}graphql`; +const baseUrl = process.env.API_URL || 'http://localhost:3000'; +const url = `${baseUrl}graphql`; const client = new ApolloClient({ networkInterface: createNetworkInterface({ diff --git a/app/src/components/About/index.js b/app/src/components/About/index.js index f9e76ab..8e58c10 100644 --- a/app/src/components/About/index.js +++ b/app/src/components/About/index.js @@ -1,62 +1,59 @@ -import React, { PropTypes } from 'react'; -import Box from 'grommet-udacity/components/Box'; -import Paragraph from 'grommet-udacity/components/Paragraph'; -import Article from 'grommet-udacity/components/Article'; -import Heading from 'grommet-udacity/components/Heading'; -import Markdown from 'grommet-udacity/components/Markdown'; -import Section from 'grommet-udacity/components/Section'; -import List from 'grommet-udacity/components/List'; -import ListItem from 'grommet-udacity/components/ListItem'; -import Anchor from 'grommet-udacity/components/Anchor'; +// @flow +import React from 'react'; +import Box from 'grommet/components/Box'; +import Paragraph from 'grommet/components/Paragraph'; +import Article from 'grommet/components/Article'; +import Heading from 'grommet/components/Heading'; +import Markdown from 'grommet/components/Markdown'; +import Section from 'grommet/components/Section'; +import List from 'grommet/components/List'; +import ListItem from 'grommet/components/ListItem'; +import Anchor from 'grommet/components/Anchor'; import { Divider } from 'components'; import readme from './_readme.md'; -const About = ({ - links, -}) => ( - -
-
- - Scalable React Boilerplate - - -
-
- - This project was created to give the Udacity Alumni development team an - incredibly optimized and easy to use React starter project. Included - below is the documentation for the project. - - - Since making this boilerplate, it has been used in dozens of projects. - - - - {links.map((link, i) => - - - {link.name} - - , - )} - - -
- {typeof readme === 'string' && - - } -
-
-); - -About.propTypes = { - links: PropTypes.arrayOf( - PropTypes.shape({ - name: PropTypes.string.isRequired, - url: PropTypes.string.isRequired, - }), - ), +type AboutLink = { + name: string, + url: string }; -export default About; +export default function About(props: { + links: AboutLink[], +}) { + return ( + +
+
+ + Scalable React Boilerplate + + +
+
+ + This project was created to give the Udacity Alumni development team an + incredibly optimized and easy to use React starter project. Included + below is the documentation for the project. + + + Since making this boilerplate, it has been used in dozens of projects. + + + + {props.links && props.links.map(link => + + + {link.name} + + , + )} + + +
+ {typeof readme === 'string' && + + } +
+
+ ); +} \ No newline at end of file diff --git a/app/src/components/About/tests/__snapshots__/index.test.js.snap b/app/src/components/About/tests/__snapshots__/index.test.js.snap index 4b7a2a7..61931d7 100644 --- a/app/src/components/About/tests/__snapshots__/index.test.js.snap +++ b/app/src/components/About/tests/__snapshots__/index.test.js.snap @@ -24,7 +24,7 @@ exports[` should render with default props 1`] = ` tag="h1"> Scalable React Boilerplate - +
should render with default props 1`] = ` separator="bottom"> Udacity Alumni Web App @@ -82,6 +83,7 @@ exports[` should render with default props 1`] = ` separator="bottom"> React Weekly diff --git a/app/src/components/AppFooter/index.js b/app/src/components/AppFooter/index.js index 9d1b524..38c9284 100644 --- a/app/src/components/AppFooter/index.js +++ b/app/src/components/AppFooter/index.js @@ -1,10 +1,10 @@ import React from 'react'; import cssModules from 'react-css-modules'; -import Footer from 'grommet-udacity/components/Footer'; -import Box from 'grommet-udacity/components/Box'; -import Heading from 'grommet-udacity/components/Heading'; -import SocialShare from 'grommet-udacity/components/SocialShare'; -import Anchor from 'grommet-udacity/components/Anchor'; +import Footer from 'grommet/components/Footer'; +import Box from 'grommet/components/Box'; +import Heading from 'grommet/components/Heading'; +import SocialShare from 'grommet/components/SocialShare'; +import Anchor from 'grommet/components/Anchor'; import styles from './index.module.scss'; const AppFooter = () => ( diff --git a/app/src/components/AppFooter/tests/__snapshots__/index.test.js.snap b/app/src/components/AppFooter/tests/__snapshots__/index.test.js.snap index dc8a232..b5e8057 100644 --- a/app/src/components/AppFooter/tests/__snapshots__/index.test.js.snap +++ b/app/src/components/AppFooter/tests/__snapshots__/index.test.js.snap @@ -1,5 +1,6 @@ exports[` should render with default props 1`] = `