kt-gmail v1.1.0
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
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:
- Run
npm install -D <package-name>
- Remove semantic versioning (tildes and carets) so that version is locked
- Add
import <package-name>
tovendor.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
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.
Environment | Host |
---|---|
dev | localhost:5004 |
unstable | ktgmail-unstable.knowledgetree.com |
qa | ktgmail-qa.knowledgetree.com |
test | ktgmail-test.knowledgetree.com |
staging | ktgmail-staging.knowledgetree.com |
production | ktgmail.knowledgetree.com |
6 years ago