Build & Develop & Deploy - Shanfang/SmartNote GitHub Wiki

Table of Contents

  1. Development
  2. Deploy
  3. Build
  4. Dependencies
  5. Testing

Development

  1. Before run our application, you need to install mongodb.
  • Open the Terminal app and type brew update.
  • After updating Homebrew brew install mongodb.
  • After downloading Mongo, create the “db” directory. This is where the Mongo data files will live. You can create the directory in the default location by running mkdir -p /data/db.
  • Make sure that the /data/db directory has the right permissions by running sudo chown -R `id -un` /data/db.
  1. Run mongod in the terminal to start the the Mongo daemon, this step starts the Mongo server.

  2. Before starting the application, you need to install some dependencies. Please reference the next section for details. Run npm run start to start the application. Navigate to http://localhost:4300/. The app will automatically reload if you change any of the source files.

  3. For Server part, go to folder ./server by cd server/. Run npm install and npm run dev.

  4. Exit mongo service:

  • To exit the Mongo shell run quit().
  • To quit the Mongo daemon, press Ctrl + C.
  1. Backend Testing:
  • To install Mocha and Chai using npm install -g mocha. npm install chai. npm install supertest --save-dev. And to run backend test in the folder /smartnote using mocha test.js .

Deploy

You can deploy the project on your server similar as we do on SmartNote.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the -prod flag for a production build.

Dependencies

For markdown directives, you need to install some libraries.

Install SimpleDEM and Highlight for markdown note features.

  1. navigate to app root directory(./smart-note), run npm install simplemde --save and npm install angular-highlightjs --save to install dependencies for markdown functionality.

  2. navigate to directory ./server, run npm install nodemon --save.

Testing

Running backend tests

Run mocha test.js to execute the backend tests via Mocha.

Running unit tests

Run ng test to execute the unit tests via Karma. Before that, you need to install dependencies of karma-coverage, please run npm install karma karma-coverage --save-dev.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor. Before running the tests make sure you are serving the app via ng serve.

⚠️ **GitHub.com Fallback** ⚠️