diff --git a/README.md b/README.md index c6e0e58..eea4f80 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,10 @@ ## Getting Started +### Installation Script + +An automated version of this installation process is available to you. To launch it, run './install' from the root directory. + ### Install Dependencies From within the root directory: @@ -83,49 +87,65 @@ Import all decks in document/decks/ directory, be careful, it still imports if d ### Tasks -#### build +#### Build ```sh $ npm run build ``` Builds the entire application to `dist/`. See `package.json` to set environment variables. -#### server-prod +#### Server-prod ```sh $ npm run server-prod ``` Starts the server in production mode. See `package.json` to set environment variables. -#### watch-server +#### Watch-server ```sh $ npm run watch-server ``` Builds and watches server files for changes. Builds to `dev/`. -#### watch-client +#### Watch-client ```sh $ npm run watch-client ``` Builds and watches client files for changes. Builds to `dev/`. -#### run server (development) +### Load Sample Data + +From within root directory, import all decks in 'document/decks/': + +```sh +npm run import:all +``` + +Optionally, import only one deck at a time. Note: Running both import commands, or running the same import command more than once, will result in repeat document-entries. + +```sh +npm run import math.md +``` + +Deck files MUST be within documentation/decks/ directory for data to import successfully. + +#### Run server (development) ```sh $ npm run server-dev ``` Starts the server in development mode (runs from `localhost:3000`). -#### test +#### Test ```sh $ npm run test ``` > **Runs unit tests and coverage report. Ensure `mongod` and the application is built and the server is running.** -#### coverage +#### cCverage ```sh $ npm run coverage diff --git a/install b/install new file mode 100755 index 0000000..9e6a224 --- /dev/null +++ b/install @@ -0,0 +1,16 @@ +#!/bin/bash +#This script installs dependencies and imports data. Instructions for manually handling this process can be found in '/README.md'. + +echo "Installing production and development dependencies..." +npm install + +echo "Building production server..." +npm run build + +echo "Importing all decks..." +npm run import:all + +echo "Running npm test..." +npm run test + +echo "Done! Please see npm test results to resolve installation errors. To build and run development, production, or watch servers, type 'npm run server-dev', 'npm run server-prod', or 'npm run watch-server', respectively." \ No newline at end of file diff --git a/src/client/components/CreateAccount.js b/src/client/components/CreateAccount.js index 50881c8..cf38b9b 100644 --- a/src/client/components/CreateAccount.js +++ b/src/client/components/CreateAccount.js @@ -42,7 +42,7 @@ class CreateAccount extends React.Component { } handleError(err) { - Materialize.toast(`Failed to create account: ${err.responseJSON.message}`, 4000); + console.error(err); } createAccount(event) { diff --git a/src/client/components/SignIn.js b/src/client/components/SignIn.js index 66990e5..44d78e4 100644 --- a/src/client/components/SignIn.js +++ b/src/client/components/SignIn.js @@ -27,7 +27,8 @@ class SignIn extends React.Component { handleError(err) { // TODO: don't use global - Materialize.toast(err.responseJSON.message, 5000); + // Materialize.toast(err.responseJSON.message, 5000); + console.error(err); } signIn(e) { diff --git a/src/server/services/DeckProgress.js b/src/server/services/DeckProgress.js index 7a4e782..79b1023 100644 --- a/src/server/services/DeckProgress.js +++ b/src/server/services/DeckProgress.js @@ -15,7 +15,7 @@ const getRandom = { }, }; -// given a deck id, retrieve a card +// given a deck id and a user id, retrieve a card const getCard = (deckId, userId) => ( // get the deck queryDb().getDeck(deckId).then(deck => {