1.1.0 • Published 6 years ago

kt-gmail v1.1.0

Weekly downloads
4
License
-
Repository
github
Last release
6 years ago

KnowledgeTree for Gmail

A Chrome extension for creating shares from recommended content within Gmail.

See kt-manager repo for the API service.

Structure

The application structure is split between an Angular2 thick-client, a NodeJS backend, and a Chrome extension.

Most of the application code lives in the client. The backend is used primarily as a mechanism for serving the Angular2 client.

 +- kt-gmail
    +- ...
    +- client           // The Angular2 client code
       +- app           // Source and test code
    +- dist             // Distributable version of client-side code (git ignored)
    +- extension        // Chrome extension code
    +- reports          // Code coverage reports generated by Karma (git ignored)
    +- server           // NodeJS server-side code
    +- tasks            // Gulp (build) tasks
    +- node_modules     // All dependencies (git-ignored)

Prerequisites

  • NodeJS >= 4.2.3 (brew install nodejs)
  • Gulp >= 4.0.0 (npm install gulpjs/gulp-cli -g)

Develop

Most development should take place when running the client-only app while running the KT Manager service and the Chrome extension.

# Install all Dependencies
$ npm install
# Run a local server for development (with watchers)
$ npm start
# Package for distribution
$ npm run-script dist
# Run production server
$ npm run-script start-dist OR node server/index.js

The Node server serves HTTP on port 5003 and HTTPS on 5004.

Third-party Dependencies

Add a new third-party JavaScript dependency:

  1. Run npm install -D <package-name>
  2. Remove semantic versioning (tildes and carets) so that version is locked
  3. Add import <package-name> to vendor.js

Webpack will create a separate file with all of the dependencies concatenated.

Lodash and rxjs

These two libraries in particular are, in a word, large, and pulling them in wholesale would increase the size of our distributed vendor file considerably. Therefore, all new lodash and rxjs methods used should be added into lodash-operators.js and rxjs-operators.js, respectively.

Running the App / Extension

To test the extension, open Chrome to chrome://extensions and check the "Developer Mode" checkbox in the upper righthand corner. Then click on "Load Unpacked Extension" and point it to the directory of the extension. Next, open Gmail and stand in awe.

Extension changes are loaded by clicking on the Reload link in this extension's section within chrome://extensions and refreshing Gmail.

The Angular app is loaded by running the local development server and refreshing Gmail.

Chrome Store Listing

https://knowledgetree.atlassian.net/wiki/pages/viewpage.action?spaceKey=engineering&title=KnowledgeTree+for+Gmail

Environment Configuration

The extension defaults to production. To change the environment that you are using, locate the private Chrome Store listing that corresponds with the environment that you would like to run. The Node server returns the correct API hostname based on the NODE_ENV environment variable used to start the server through the /config route.

EnvironmentHost
devlocalhost:5004
unstablektgmail-unstable.knowledgetree.com
qaktgmail-qa.knowledgetree.com
testktgmail-test.knowledgetree.com
stagingktgmail-staging.knowledgetree.com
productionktgmail.knowledgetree.com