From c8e56b535e188069500e69afa8ec54fff3d25823 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Fri, 16 Jun 2017 19:22:33 +0200 Subject: [PATCH] build: initial dashboard project (#5148) --- scripts/deploy/deploy-dashboard-functions.sh | 24 ------------ scripts/deploy/deploy-dashboard.sh | 34 ++++++++++++++++ tools/dashboard/.angular-cli.json | 37 ++++++++++++++++++ tools/dashboard/.gitignore | 4 ++ tools/dashboard/package.json | 37 ++++++++++++++++++ tools/dashboard/src/app/dashboard-app.css | 0 tools/dashboard/src/app/dashboard-app.html | 1 + tools/dashboard/src/app/dashboard-app.ts | 8 ++++ tools/dashboard/src/app/dashboard-module.ts | 15 +++++++ tools/dashboard/src/assets/.gitkeep | 0 .../src/environments/environment.prod.ts | 3 ++ .../dashboard/src/environments/environment.ts | 3 ++ tools/dashboard/src/favicon.ico | Bin 0 -> 5430 bytes tools/dashboard/src/index.html | 14 +++++++ tools/dashboard/src/main.ts | 11 ++++++ tools/dashboard/src/polyfills.ts | 3 ++ tools/dashboard/src/styles.css | 1 + tools/dashboard/src/tsconfig.json | 17 ++++++++ tools/dashboard/src/typings.d.ts | 5 +++ 19 files changed, 193 insertions(+), 24 deletions(-) delete mode 100755 scripts/deploy/deploy-dashboard-functions.sh create mode 100755 scripts/deploy/deploy-dashboard.sh create mode 100644 tools/dashboard/.angular-cli.json create mode 100644 tools/dashboard/.gitignore create mode 100644 tools/dashboard/package.json create mode 100644 tools/dashboard/src/app/dashboard-app.css create mode 100644 tools/dashboard/src/app/dashboard-app.html create mode 100644 tools/dashboard/src/app/dashboard-app.ts create mode 100644 tools/dashboard/src/app/dashboard-module.ts create mode 100644 tools/dashboard/src/assets/.gitkeep create mode 100644 tools/dashboard/src/environments/environment.prod.ts create mode 100644 tools/dashboard/src/environments/environment.ts create mode 100644 tools/dashboard/src/favicon.ico create mode 100644 tools/dashboard/src/index.html create mode 100644 tools/dashboard/src/main.ts create mode 100644 tools/dashboard/src/polyfills.ts create mode 100644 tools/dashboard/src/styles.css create mode 100644 tools/dashboard/src/tsconfig.json create mode 100644 tools/dashboard/src/typings.d.ts diff --git a/scripts/deploy/deploy-dashboard-functions.sh b/scripts/deploy/deploy-dashboard-functions.sh deleted file mode 100755 index b5948c5bdc5..00000000000 --- a/scripts/deploy/deploy-dashboard-functions.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -# Go to the project root directory -cd $(dirname ${0})/../.. - -# Paths to the dashboard and functions directories. -dashboardFolder=tools/dashboard - -# Go to the dashboard folder because otherwise the Firebase CLI tries to deploy the wrong project. -cd ${dashboardFolder} - -# Install node modules for dashboard functions. Firebase CLI needs to execute the functions -# before it can collect all functions and deploy them. -(cd functions; npm install) - -if [ -z ${MATERIAL2_BOARD_FIREBASE_DEPLOY_KEY} ]; then - echo "Error: No access token for firebase specified." \ - "Please set the environment variable 'MATERIAL2_DASHBOARD_ACCESS_TOKEN'." - exit 1 -fi - -# Deploy the dashboard functions to Firebase. For now only the functions will be deployed. -$(npm bin)/firebase deploy \ - --only functions --token ${MATERIAL2_BOARD_FIREBASE_DEPLOY_KEY} --project material2-board diff --git a/scripts/deploy/deploy-dashboard.sh b/scripts/deploy/deploy-dashboard.sh new file mode 100755 index 00000000000..4c32cd7910f --- /dev/null +++ b/scripts/deploy/deploy-dashboard.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# This script deploys the Dashboard App and their Cloud Functions to Firebase. +# Before the script installs all dependencies and builds the dashboard app in production. + +# Go to the project root directory +cd $(dirname ${0})/../.. + +# Paths to the dashboard and functions directories. +dashboardFolder=tools/dashboard + +# Go to the dashboard folder because otherwise the Firebase CLI tries to deploy the wrong project. +cd ${dashboardFolder} + +# Install node_modules for the dashboard and afterwards build the dashboard app in production. +(npm install; $(npm bin)/ng build --aot -prod) & + +# Install node modules for dashboard functions. Firebase CLI needs to execute the functions +# to collect all function names before it can deploy them. +(cd functions; npm install) & + +# The dashboard and function dependencies are installed concurrently. Also the dashboard app is +# build in production afterwards. Wait for all async tasks to finish before proceeding. +wait + +if [ -z ${MATERIAL2_BOARD_FIREBASE_DEPLOY_KEY} ]; then + echo "Error: No access token for firebase specified." \ + "Please set the environment variable 'MATERIAL2_DASHBOARD_ACCESS_TOKEN'." + exit 1 +fi + +# Deploy the dashboard to Firebase. Based on the current configuration hosting and functions +# will be deployed. +$(npm bin)/firebase deploy --token ${MATERIAL2_BOARD_FIREBASE_DEPLOY_KEY} --project material2-board diff --git a/tools/dashboard/.angular-cli.json b/tools/dashboard/.angular-cli.json new file mode 100644 index 00000000000..fbf7a67a925 --- /dev/null +++ b/tools/dashboard/.angular-cli.json @@ -0,0 +1,37 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "project": { + "name": "material2-board" + }, + "apps": [ + { + "root": "src", + "outDir": "./dist", + "assets": [ + "assets", + "favicon.ico" + ], + "index": "index.html", + "main": "main.ts", + "polyfills": "polyfills.ts", + "tsconfig": "tsconfig.json", + "prefix": "app", + "styles": [ + "styles.css" + ], + "scripts": [], + "environmentSource": "environments/environment.ts", + "environments": { + "dev": "environments/environment.ts", + "prod": "environments/environment.prod.ts" + } + } + ], + "e2e": {}, + "lint": [], + "test": {}, + "defaults": { + "styleExt": "css", + "component": {} + } +} diff --git a/tools/dashboard/.gitignore b/tools/dashboard/.gitignore new file mode 100644 index 00000000000..b672e5b1b42 --- /dev/null +++ b/tools/dashboard/.gitignore @@ -0,0 +1,4 @@ +# Sub Gitignore file for the Dashboard project. +dist/ +node_modules/ +package-lock.json diff --git a/tools/dashboard/package.json b/tools/dashboard/package.json new file mode 100644 index 00000000000..2a17ada9f4f --- /dev/null +++ b/tools/dashboard/package.json @@ -0,0 +1,37 @@ +{ + "name": "material2-board", + "version": "0.0.0", + "license": "MIT", + "scripts": { + "ng": "ng", + "start": "ng serve", + "build": "ng build", + "build-production": "ng build --aot -prod" + }, + "private": true, + "dependencies": { + "@angular/animations": "^4.2.2", + "@angular/common": "^4.2.2", + "@angular/compiler": "^4.2.2", + "@angular/core": "^4.2.2", + "@angular/forms": "^4.2.2", + "@angular/http": "^4.2.2", + "@angular/platform-browser": "^4.2.2", + "@angular/platform-browser-dynamic": "^4.2.2", + "@angular/router": "^4.2.2", + "core-js": "^2.4.1", + "rxjs": "^5.1.0", + "zone.js": "^0.8.12" + }, + "devDependencies": { + "@angular/cli": "1.1.1", + "@angular/compiler-cli": "^4.2.2", + "@angular/language-service": "^4.2.2", + "@types/jasmine": "2.5.45", + "@types/node": "~6.0.60", + "firebase-tools": "^3.9.1", + "ts-node": "~3.0.4", + "tslint": "~5.3.2", + "typescript": "~2.3.3" + } +} diff --git a/tools/dashboard/src/app/dashboard-app.css b/tools/dashboard/src/app/dashboard-app.css new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tools/dashboard/src/app/dashboard-app.html b/tools/dashboard/src/app/dashboard-app.html new file mode 100644 index 00000000000..57453e92c56 --- /dev/null +++ b/tools/dashboard/src/app/dashboard-app.html @@ -0,0 +1 @@ +

Angular Material - Board

diff --git a/tools/dashboard/src/app/dashboard-app.ts b/tools/dashboard/src/app/dashboard-app.ts new file mode 100644 index 00000000000..b359bc1b33e --- /dev/null +++ b/tools/dashboard/src/app/dashboard-app.ts @@ -0,0 +1,8 @@ +import {Component} from '@angular/core'; + +@Component({ + selector: 'dashboard-app', + templateUrl: './dashboard-app.html', + styleUrls: ['./dashboard-app.css'] +}) +export class DashboardApp {} diff --git a/tools/dashboard/src/app/dashboard-module.ts b/tools/dashboard/src/app/dashboard-module.ts new file mode 100644 index 00000000000..be219dc5e17 --- /dev/null +++ b/tools/dashboard/src/app/dashboard-module.ts @@ -0,0 +1,15 @@ +import {BrowserModule} from '@angular/platform-browser'; +import {NgModule} from '@angular/core'; +import {DashboardApp} from './dashboard-app'; + +@NgModule({ + declarations: [ + DashboardApp + ], + imports: [ + BrowserModule + ], + providers: [], + bootstrap: [DashboardApp] +}) +export class DashboardModule {} diff --git a/tools/dashboard/src/assets/.gitkeep b/tools/dashboard/src/assets/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tools/dashboard/src/environments/environment.prod.ts b/tools/dashboard/src/environments/environment.prod.ts new file mode 100644 index 00000000000..3612073bc31 --- /dev/null +++ b/tools/dashboard/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true +}; diff --git a/tools/dashboard/src/environments/environment.ts b/tools/dashboard/src/environments/environment.ts new file mode 100644 index 00000000000..ffe8aed7664 --- /dev/null +++ b/tools/dashboard/src/environments/environment.ts @@ -0,0 +1,3 @@ +export const environment = { + production: false +}; diff --git a/tools/dashboard/src/favicon.ico b/tools/dashboard/src/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..8081c7ceaf2be08bf59010158c586170d9d2d517 GIT binary patch literal 5430 zcmc(je{54#6vvCoAI3i*G5%$U7!sA3wtMZ$fH6V9C`=eXGJb@R1%(I_{vnZtpD{6n z5Pl{DmxzBDbrB>}`90e12m8T*36WoeDLA&SD_hw{H^wM!cl_RWcVA!I+x87ee975; z@4kD^=bYPn&pmG@(+JZ`rqQEKxW<}RzhW}I!|ulN=fmjVi@x{p$cC`)5$a!)X&U+blKNvN5tg=uLvuLnuqRM;Yc*swiexsoh#XPNu{9F#c`G zQLe{yWA(Y6(;>y|-efAy11k<09(@Oo1B2@0`PtZSkqK&${ zgEY}`W@t{%?9u5rF?}Y7OL{338l*JY#P!%MVQY@oqnItpZ}?s z!r?*kwuR{A@jg2Chlf0^{q*>8n5Ir~YWf*wmsh7B5&EpHfd5@xVaj&gqsdui^spyL zB|kUoblGoO7G(MuKTfa9?pGH0@QP^b#!lM1yHWLh*2iq#`C1TdrnO-d#?Oh@XV2HK zKA{`eo{--^K&MW66Lgsktfvn#cCAc*(}qsfhrvOjMGLE?`dHVipu1J3Kgr%g?cNa8 z)pkmC8DGH~fG+dlrp(5^-QBeEvkOvv#q7MBVLtm2oD^$lJZx--_=K&Ttd=-krx(Bb zcEoKJda@S!%%@`P-##$>*u%T*mh+QjV@)Qa=Mk1?#zLk+M4tIt%}wagT{5J%!tXAE;r{@=bb%nNVxvI+C+$t?!VJ@0d@HIyMJTI{vEw0Ul ze(ha!e&qANbTL1ZneNl45t=#Ot??C0MHjjgY8%*mGisN|S6%g3;Hlx#fMNcL<87MW zZ>6moo1YD?P!fJ#Jb(4)_cc50X5n0KoDYfdPoL^iV`k&o{LPyaoqMqk92wVM#_O0l z09$(A-D+gVIlq4TA&{1T@BsUH`Bm=r#l$Z51J-U&F32+hfUP-iLo=jg7Xmy+WLq6_tWv&`wDlz#`&)Jp~iQf zZP)tu>}pIIJKuw+$&t}GQuqMd%Z>0?t%&BM&Wo^4P^Y z)c6h^f2R>X8*}q|bblAF?@;%?2>$y+cMQbN{X$)^R>vtNq_5AB|0N5U*d^T?X9{xQnJYeU{ zoZL#obI;~Pp95f1`%X3D$Mh*4^?O?IT~7HqlWguezmg?Ybq|7>qQ(@pPHbE9V?f|( z+0xo!#m@Np9PljsyxBY-UA*{U*la#8Wz2sO|48_-5t8%_!n?S$zlGe+NA%?vmxjS- zHE5O3ZarU=X}$7>;Okp(UWXJxI%G_J-@IH;%5#Rt$(WUX?6*Ux!IRd$dLP6+SmPn= z8zjm4jGjN772R{FGkXwcNv8GBcZI#@Y2m{RNF_w8(Z%^A*!bS*!}s6sh*NnURytky humW;*g7R+&|Ledvc- + + + + Angular Material - Board + + + + + + + + + diff --git a/tools/dashboard/src/main.ts b/tools/dashboard/src/main.ts new file mode 100644 index 00000000000..d346095f7ca --- /dev/null +++ b/tools/dashboard/src/main.ts @@ -0,0 +1,11 @@ +import {enableProdMode} from '@angular/core'; +import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; + +import {environment} from './environments/environment'; +import {DashboardModule} from './app/dashboard-module'; + +if (environment.production) { + enableProdMode(); +} + +platformBrowserDynamic().bootstrapModule(DashboardModule); diff --git a/tools/dashboard/src/polyfills.ts b/tools/dashboard/src/polyfills.ts new file mode 100644 index 00000000000..2143ebfe511 --- /dev/null +++ b/tools/dashboard/src/polyfills.ts @@ -0,0 +1,3 @@ +import 'core-js/es6/reflect'; +import 'core-js/es7/reflect'; +import 'zone.js/dist/zone'; diff --git a/tools/dashboard/src/styles.css b/tools/dashboard/src/styles.css new file mode 100644 index 00000000000..90d4ee0072c --- /dev/null +++ b/tools/dashboard/src/styles.css @@ -0,0 +1 @@ +/* You can add global styles to this file, and also import other style files */ diff --git a/tools/dashboard/src/tsconfig.json b/tools/dashboard/src/tsconfig.json new file mode 100644 index 00000000000..860bdbd295e --- /dev/null +++ b/tools/dashboard/src/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "outDir": "../dist", + "baseUrl": ".", + "lib": ["es2016", "dom"], + "sourceMap": true, + "declaration": false, + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "noImplicitAny": true, + "target": "es5", + "module": "es2015", + "typeRoots": ["node_modules/@types"], + "types": [] + } +} diff --git a/tools/dashboard/src/typings.d.ts b/tools/dashboard/src/typings.d.ts new file mode 100644 index 00000000000..ef5c7bd6205 --- /dev/null +++ b/tools/dashboard/src/typings.d.ts @@ -0,0 +1,5 @@ +/* SystemJS module definition */ +declare var module: NodeModule; +interface NodeModule { + id: string; +}