
diff --git a/.gitignore b/.gitignore index 2ac8067..b4c3068 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ public/javascripts/*.map public/javascripts/*.js public/javascripts/**/*.map public/javascripts/**/*.js + +node_modules diff --git a/README.md b/README.md index d39e398..9d4d2e3 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,6 @@ This project is a webapp-based implementation of the Energy in Schools hub that ## Feature Request and Issue Tracking Please add an issue if you wish for any additional features or discover any issues using this project. Tracking changes will keep things organised. -## Local Server -This WebBridge will require an install of the latest version of NodeJS. - **Note: WebUSB is only available via a secure HTTPS connection or ``localhost`` for development.** ### Running @@ -18,35 +15,34 @@ npm install npm start ``` -By default, this application is hosted on port 3000 at ``http://localhost:3000/``. This is intended for development as WebUSB requires a secure HTTPs connection, or localhost for development. -This can be changed by heading into the ``bin\ServerConfig.js`` and modifying the configurations. +By default, this application is hosted on port 3000 at ``http://localhost:8080/``. This is intended for development as WebUSB requires a secure HTTPs connection, or localhost for development. ### Building -Modifications to any of the TypeScript files found in ``public\javascript`` must be compiled into JavaScript and further bundled together using Browserify and minified using uglify. - ``` -cd public\javascript -browserify WebBridge.js > WebBridge.bundle.js +npm run build // translation localhost:4000 +npm run build:staging // translations staging +npm run build:production // translatinos production ``` -Upon deploying to production, run this process through uglifyjs to remove comments and minify the bundled output. +### Local development +For local development setup you might be interested in launching chrome without internet security with disabled CORS +`npm run chrome-without-web-security` +### Deploying to S3 +To deploy built version on S3 bucket you need to install [s3deploy](https://github.com/bep/s3deploy) tool. +After installation use these commands to build and then deploy to S3 +```npm +npm run deploy:staging +npm run deploy:prod ``` -cd public\javascript -browserify WebBridge.js | uglifyjs -c > WebBridge.bundle.js -``` + +Deploy configuration is inside `deployConfig` section of `package.json` file. Also refer to [s3deploy](https://github.com/bep/s3deploy) +tool configuration for more details. ### Node Modules (DAPjs) At the moment, this repo has not been cleaned up and may contain a load of potentially useless (for this project) node modules. That being said, this project relies on the [DAPjs](https://github.com/ARMmbed/dapjs) JavaScript interface for the main serial communication between the webapp and the bridging micro:bit. To install the required node modules, be sure to run ``npm install`` before running the server. -## Project Notes -As JavaScript/TypeScript aren't my strongest language, and my knowledge of NodeJS was lacking, I decided to start with a simple, yet useful project to allow serial communication via the WebUSB standard. This was then improved upon to create a bridge between micro:bits and the internet. - -I built this project using WebStorm's brilliant Node.JS Express App generator and utilised the features provided. With the division of business logic and views, modifying the look and feel of the page while maintaining the technical stuff was made very simple. The rendering is achieved via Jade and CSS located in the ``views`` and ``public\stylesheets`` folders, while the logic uses TypeScript found throughout the repo. - -**Note: This project is a bit messy at the minute. There are some files within this project that are there purely for local testing purposes and will be removed once complete.** - ## Repos [DAPjs](https://github.com/ARMmbed/dapjs) JavaScript interface to CMSIS-DAP diff --git a/debug.json b/debug.json deleted file mode 100644 index e69de29..0000000 diff --git a/public/favicon.ico b/dist/favicon.ico similarity index 100% rename from public/favicon.ico rename to dist/favicon.ico diff --git a/public/images/microbit.png b/dist/images/microbit.png similarity index 100% rename from public/images/microbit.png rename to dist/images/microbit.png diff --git a/dist/index.html b/dist/index.html new file mode 100644 index 0000000..58bc6c8 --- /dev/null +++ b/dist/index.html @@ -0,0 +1 @@ +