From 5412b6d034a638506be2cc05c50517175e4e2291 Mon Sep 17 00:00:00 2001 From: Evan Langlais Date: Fri, 25 Jan 2019 16:26:28 -0500 Subject: [PATCH 1/5] Update README.md --- README.md | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 0e8d974..dc313e8 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,18 @@ -# Frontend +# PowerPanel Frontend This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.2.4. -## Development server +## Installation +1. Ensure you have npm installed +2. Clone repository into new folder +3. In terminal / CMD run npm install -Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. - -## Code scaffolding - -Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. - -## Build +## Development -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. +When developing, ensure you are on a different branch (NOT working on master). -## Running unit tests +Once you have a local instance that seems ready to merge into master, create a pull request. -Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). +## Local development server -## Running end-to-end tests - -Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). - -## Further help - -To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). +Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. From 6e874cc41a99c86ae37b0b89e1408d88db519c83 Mon Sep 17 00:00:00 2001 From: Evan Langlais Date: Wed, 6 Feb 2019 15:47:56 -0500 Subject: [PATCH 2/5] Adding new jenkinsfile and modifying output path --- Jenkinsfile | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ angular.json | 4 ++-- 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..22898cd --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,52 @@ +#!groovy + +properties( + [ + [$class: 'BuildDiscarderProperty', strategy: + [$class: 'LogRotator', artifactDaysToKeepStr: '14', artifactNumToKeepStr: '5', daysToKeepStr: '30', numToKeepStr: '60']], + pipelineTriggers( + [ + pollSCM('H/1 * * * *'), + // cron('@daily'), + ] + ) + ] +) +node { + stage('Checkout') { + //disable to recycle workspace data to save time/bandwidth + deleteDir() + checkout scm + + //enable for commit id in build number + //env.git_commit_id = sh returnStdout: true, script: 'git rev-parse HEAD' + //env.git_commit_id_short = env.git_commit_id.take(7) + //currentBuild.displayName = "#${currentBuild.number}-${env.git_commit_id_short}" + } + + stage('NPM Install') { + withEnv(["NPM_CONFIG_LOGLEVEL=warn"]) { + sh 'npm install' + } + } + + stage('Lint') { + sh 'ng lint' + } + + stage('Build') { + milestone() + sh 'ng build --prod --aot --progress=false' + } + + stage('Archive') { + sh 'tar -cvzf dist.tar.gz --strip-components=1 dist' + archive 'dist.tar.gz' + } + + stage('Deploy') { + milestone() + echo "Deploying..." + sh 'cp -r dist/. /var/www/html/master/' + } +} diff --git a/angular.json b/angular.json index 2115b9a..277517d 100644 --- a/angular.json +++ b/angular.json @@ -13,7 +13,7 @@ "build": { "builder": "@angular-devkit/build-angular:browser", "options": { - "outputPath": "dist/frontend", + "outputPath": "dist", "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", @@ -130,4 +130,4 @@ } }, "defaultProject": "frontend" -} \ No newline at end of file +} From ae9db1e0d73b6a283d81c58f952403d7719f1670 Mon Sep 17 00:00:00 2001 From: Evan Langlais Date: Wed, 6 Feb 2019 16:11:41 -0500 Subject: [PATCH 3/5] Modifying Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 22898cd..a758a1b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -47,6 +47,6 @@ node { stage('Deploy') { milestone() echo "Deploying..." - sh 'cp -r dist/. /var/www/html/master/' + sh 'cp -r dist/. /var/www/html/' + env.BRANCH_NAME + '/' } } From 3b6be017c87ee18baf909bac54ac7bfa15025237 Mon Sep 17 00:00:00 2001 From: Evan Langlais Date: Wed, 6 Feb 2019 16:54:32 -0500 Subject: [PATCH 4/5] Modifying Jenkinsfile --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a758a1b..5a2dfb8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -47,6 +47,7 @@ node { stage('Deploy') { milestone() echo "Deploying..." - sh 'cp -r dist/. /var/www/html/' + env.BRANCH_NAME + '/' + sh 'rm -r /var/www/html/*' + sh 'cp -r dist/. /var/www/html/' } } From faa47498ef4ff34493da518459ddf0983f96dc48 Mon Sep 17 00:00:00 2001 From: Evan Langlais Date: Wed, 6 Feb 2019 17:06:39 -0500 Subject: [PATCH 5/5] Adding htaccess --- .htaccess | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .htaccess diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..a192448 --- /dev/null +++ b/.htaccess @@ -0,0 +1,7 @@ +RewriteEngine On + # If an existing asset or directory is requested go to it as it is + RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR] + RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d + RewriteRule ^ - [L] + # If the requested resource doesn't exist, use index.html +RewriteRule ^ /index.html