Skip to content

Commit

Permalink
Merge branch 'master' into RDM-1893-FixedRadioList
Browse files Browse the repository at this point in the history
* master: (69 commits)
  RDM-3230 Release new 2.4.0 version - Up version of angular to fix Router bug angular/angular#26496 (#137)
  RDM-3230 Remove debug console logging and comments.
  RDM-3230 Up version of angular to fix Router bug angular/angular#26496
  RDM-3230 Relax versions in engines.
  RDM-3230 Relax engines for yarn and npm.
  RDM-3230 Update README.
  RDM-3230 Heroku Badge.
  RDM-3230 Push different heroku badge icon.
  RDM-3230 Release 2.2.0
  RDM-3230 Add badge. Improve shell script.
  RDM-3230 Update README
  RDM-3230 Simplify heroku script and update README.
  RDM-3230 Fix Heroku and improve build steps in package.json.
  RDM-3230 Replace copyfiles with cp
  RDM-3230 Swap build of lib with install of demo app.
  RDM-3230 Create dir for heroku before copying dist.
  RDM-3230 Fix heroku - use heroku-postbuild instead of postinstall
  RDM-3230 Downgrade yarn in travis CI.
  RDM-3230 Downgrade yarn.
  RDM-3230 Obfuscate gateway api urls.
  ...

# Conflicts:
#	src/shared/components/palette/palette.module.ts
  • Loading branch information
mohammedanas committed Nov 14, 2018
2 parents aaf2165 + 3d2ed48 commit bcc4378
Show file tree
Hide file tree
Showing 422 changed files with 16,257 additions and 1,543 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Expand Up @@ -46,4 +46,8 @@ tmp/*
.history/

# docs
docs/
docs/

# demo
demo/dist/
demo/node_modules
3 changes: 3 additions & 0 deletions .travis.yml
Expand Up @@ -5,6 +5,9 @@ node_js:
- "10.6.0" # Highest Azure 10.*
- "node" # Latest stable Node
cache: yarn
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.9.2
- export PATH="$HOME/.yarn/bin:$PATH"
install:
- npm install -g codecov
- npm install -g @angular/cli
Expand Down
7 changes: 7 additions & 0 deletions README.md
Expand Up @@ -59,6 +59,13 @@ yarn start

```

You can also look at an example usage of the UI Toolkit demo project by:
```bash
# start demo app and stub server in same process
yarn start
# Go to http://localhost:8080
```

# File Structure

```
Expand Down
26 changes: 26 additions & 0 deletions RELEASE-NOTES.md
@@ -1,8 +1,34 @@
## RELEASE NOTES
### Version 2.4.0 - November 12 2018
**RDM-3230** - Up version of angular to fix Router bug angular/angular#26496

### Version 2.3.0 - November 09 2018
**RDM-3230** - Relax versions for yarn and npm in engine section.

### Version 2.2.0 - November 09 2018
**RDM-3230** - Heroku publish script and simplifying deployment process. Fixing builds steps and removing postinstall which now is heroku-postbuild and does not affect pipeline or other teams now.

### Version 2.1.0 - November 08 2018
**RDM-3230** - Demo app published to Heroku. New library directory structure. Reorganising the code. Refactor old rxjs 5 syntax to 6. Fixes to the lib around how event trigger is being loaded and how router handles loading non existent pages.

### Version 2.0.0 - November 06 2018
**RDM-3064** - Case progression: Better component contract

### Version 1.2.32 - November 06 2018
**RDM-3230** - Fix to emit event id when submitting in case create or progress components. Updated stub. Updated styling of demo app.

### Version 1.2.31 - November 03 2018
**RDM-3230** - Fix alert error when going to first page if no page param or no fields or pages in data specified.

### Version 1.2.30 - November 03 2018
**RDM-3230** - Fix issue with routing to start page broken when non existent page is requested.

### Version 1.2.29 - October 31 2018
**RDM-3230** - Add missing providers in CaseEditorModule and write up README of demo app.

### Version 1.2.28 - October 29 2018
**RDM-3230** - Vanilla app to POC the case progression facade components

### Version 1.2.27 - October 29 2018
**RDM-1202** - Custom case event field labels and hint texts

Expand Down
93 changes: 93 additions & 0 deletions demo/README.md
@@ -0,0 +1,93 @@
# `ccd-case-ui-toolkit` demo project
[![Heroku CI Status](https://heroku-badge.herokuapp.com/?app=heroku-badge&style=flat)](https://ccd-case-ui-toolkit-demo.herokuapp.com/)

> This folder contains a demo-project for [ccd-case-ui-toolkit](https://github.com/hmcts/ccd-case-ui-toolkit). This demo project may help you to test whether your library supports JIT build or not.
>
> - `src` folder contains Angular project that is built using [@angular/cli](https://www.npmjs.com/package/@angular/cli). This demo project utilizes ESM (pure ES2015) sources of your library to do [JIT](https://angular.io/docs/ts/latest/cookbook/aot-compiler.html) (just-in-time) compilation.
>
Demo-project is created as an alternative to `npm link` command. You may simply delete this `demo` folder if you prefer to use [yarn link](https://yarnpkg.com/en/docs/cli/link) instead to check how your library is being built.

# Quick Start

```bash
# Open first terminal and assuming that you are already in case-ui-toolkit folder

# Install all dependencies
yarn install

# Start build of ccd-case-ui-toolkit in esm watch mode
yarn build:esm:watch

# Open second terminal and assuming that you are already in case-ui-toolkit/demo folder

# Install all dependencies
yarn install

# Start watching library dist folder and do project build in watch mode. (notice it will reload twice as the gulp watch task registers two changes: copy inited and copy finished; also notice this spins up stubs api in the same process - see server.js)
yarn start:watch

# To verify the demo app is working go to http://localhost:8080
```

# Heroku

```bash
There is a `heroku-publish.sh` script in this folder that can be used as:

./heroku-publish.sh

# After that the app is accessible in heroku under: https://ccd-case-ui-toolkit-demo.herokuapp.com/
```

# File Structure

```
ccd-case-ui-toolkit
└─ demo * Folder with demo application (MAY BE DELETED if not required)
├─ src * Demo project
| ├─ app * Demo application sources. Adopt them with your library.
| ├─ public * Demo application resources. Adopt them with your library.
| ├─ style * Demo application styles. Adopt them with your library.
| ├─ index.html * Main application template.
| ├─ main.ts * Main entry.
| ├─ polyfills.ts * Browser polyfills.
| └─ tsconfig.app.json * Angular app configuration.
|
├─ stubs * Stubs routes and data for stub server
├─ .gitignore * List of files that are ignored while publishing to git repository
├─ angular.json * Typescript app configuration.
├─ heroku-publish.sh * Heroku publish script.
├─ server.js * Node js server wrapping angular app (needed for heroku)
├─ gulpfile.js * Gulp helper scripts for building demos
├─ package.json * NPM dependencies and helper scripts for building demos
├─ tsconfig.json * Typescript base configuration.
└─ yarn.lock * Yarn dependency versions lock for demo applications
```

# Getting Started

## Dependencies

#### Node/NPM
Install latest Node and NPM following the [instructions](https://nodejs.org/en/download/). Make sure you have Node version ≥ 7.0 and NPM ≥ 4.

- `brew install node` for Mac.

#### Yarn
Install Yarn by following the [instructions](https://yarnpkg.com/en/docs/install).

- `brew install yarn` for Mac.

## Installing
- Switch to `demo` folder in your console.
- `yarn install` to install required dependencies.

## Build project
- `yarn build` for building Angular Demo app.

## Start project in watch mode
- `yarn start:watch` for starting version of demo project and start watching for library changes.

This command may be used simultaneously in combination with [ccd-case-ui-toolkit](https://github.com/hmcts/ccd-case-ui-toolkit)'s `yarn build:watch`. As a result once you change library source code it will be automatically re-compiled and in turn your demo-project will be automatically re-built and you will be able to see that changes in your browser instantly.

See [Development Workflow](https://github.com/hmcts/ccd-case-ui-toolkit#development-workflow) section of [ccd-case-ui-toolkit](hhttps://github.com/hmcts/ccd-case-ui-toolkit)'s README for more details.
92 changes: 92 additions & 0 deletions demo/angular.json
@@ -0,0 +1,92 @@
{
"$schema": "./node_modules/@angular-devkit/core/src/workspace/workspace-schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"demo-app": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/browser",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"stylePreprocessorOptions": {
"includePaths": [
"node_modules/govuk_frontend_toolkit/stylesheets",
"node_modules/govuk-elements-sass/public/sass"
]
},
"assets": [
{
"glob": "**/*",
"input": "src/public",
"output": "/"
}
],
"styles": [
"src/style/app.scss",
"node_modules/govuk_template_mustache/assets/stylesheets/govuk-template.css"
],
"scripts": []
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "demo-app:build"
},
"configurations": {
"production": {
"browserTarget": "demo-app:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "demo-app:build"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"cli": {},
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "scss"
},
"@schematics/angular:directive": {
"prefix": "app"
},
"@schematics/angular:guard": {
"spec": false
},
"@schematics/angular:module": {
"spec": false
},
"@schematics/angular:pipe": {
"spec": false
},
"@schematics/angular:service": {
"spec": false
}
}
}
13 changes: 13 additions & 0 deletions demo/gulpfile.js
@@ -0,0 +1,13 @@
const gulp = require('gulp');
const copyfiles = require('copyfiles');

const LIBRARY_SRC = '../dist/**/*';
const LIBRARY_DIST = 'node_modules/@hmcts/ccd-case-ui-toolkit/dist';

gulp.task('copy-lib', (callback) => {
copyfiles([ LIBRARY_SRC, LIBRARY_DIST ], 2, callback);
});

gulp.task('copy-lib:watch', () => {
gulp.watch(LIBRARY_SRC, ['copy-lib']);
});
7 changes: 7 additions & 0 deletions demo/heroku-publish.sh
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
CURRENT_BRANCH_NAME=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
heroku create --remote ccd-case-ui-toolkit-demo --stack heroku-16 ccd-case-ui-toolkit-demo
heroku config:set USERNAME=pirate --app ccd-case-ui-toolkit-demo
heroku config:set PASSWORD=bunting --app ccd-case-ui-toolkit-demo
heroku config:set YARN_PRODUCTION=false --app ccd-case-ui-toolkit-demo
git push heroku $CURRENT_BRANCH_NAME:master
63 changes: 63 additions & 0 deletions demo/package.json
@@ -0,0 +1,63 @@
{
"name": "angular-library-seed-demo",
"description": "AOT/JIT/UMD build demo of angular library seed",
"license": "MIT",
"scripts": {
"build": "ng build",
"prebuild": "gulp copy-lib",
"start": "node server.js",
"start:watch": "concurrently --raw \"gulp copy-lib:watch\" \"npm run start\""
},
"dependencies": {
"@angular/cli": "^7.0.3",
"@angular/common": "^7.0.3",
"@angular/core": "^7.0.3",
"@angular-devkit/build-angular": "0.10.5",
"@angular/animations": "~7.0.3",
"@angular/cdk": "^7.0.3",
"@angular/compiler": "7.0.3",
"@angular/compiler-cli": "7.0.3",
"@angular/forms": "~7.0.3",
"@angular/http": "~7.0.3",
"@angular/material": "^7.0.3",
"@angular/router": "~7.0.3",
"@angular/upgrade": "~7.0.3",
"@angular/platform-browser": "^7.0.3",
"@angular/platform-browser-dynamic": "^7.0.3",
"@hmcts/ccd-case-ui-toolkit": "2.3.0",
"@hmcts/ccpay-web-component": "1.6.2",
"@nicky-lenaers/ngx-scroll-to": "^1.0.0",
"copyfiles": "^2.1.0",
"enhanced-resolve": "3.3.0",
"express": "^4.16.4",
"govuk-elements-sass": "3.1.2",
"govuk_frontend_toolkit": "8.0.0",
"govuk_template_mustache": "0.23.0",
"ngx-md": "~6.0.0",
"node-sass": "4.9.3",
"angular2-router-loader": "^0.3.4",
"angular2-template-loader": "^0.6.0",
"awesome-typescript-loader": "^5.2.1",
"concurrently": "^4.0.1",
"core-js": "^2.4.1",
"css-loader": "^1.0.0",
"extract-text-webpack-plugin": "next",
"file-loader": "^2.0.0",
"gulp": "^3.9.1",
"html-webpack-plugin": "^3.2.0",
"json-loader": "^0.5.7",
"json-server": "^0.12.1",
"ncp": "2.0.0",
"postcss": "7.0.5",
"raw-loader": "^0.5.1",
"rimraf": "^2.6.2",
"rxjs": "^6.2.1",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"typescript": "3.1.6",
"url-loader": "1.1.2",
"webpack": "^4.20.2",
"webpack-dev-server": "^3.1.10",
"zone.js": "^0.8.26"
}
}
41 changes: 41 additions & 0 deletions demo/server.js
@@ -0,0 +1,41 @@
//Install express server
const express = require('express');
const path = require('path');
let jsonServer = require('json-server');
let router = jsonServer.router('stubs/api.json');
const app = express();

// Serve only the static files form the dist directory
app.use(express.static(__dirname + '/dist/browser'));
app.use(function (req, res) {
let response = null;
let db = router.db // lowdb instance
if (req.method === 'POST') {
res.setHeader('Content-Type', 'application/json;charset=UTF-8')
if (req.url.indexOf('events') !== -1) {
response = db.get('submitted_event').value();
} else {
response = db.get('submitted_case').value();
}
} else {
if (req.url.indexOf('event-triggers/createCase') !== -1) {
response = db.get('create-case-event-trigger').value();
} else if (req.url.indexOf('validate') !== -1) {
response = db.get('validate').value();
} else if (req.url.indexOf('profile') !== -1) {
response = db.get('profile').value();
} else if (req.url.indexOf('internal/cases/1111222233334444') !== -1) {
response = db.get('case').value();
} else if (req.url.indexOf('event-triggers/enterCaseIntoLegacy') !== -1) {
response = db.get('event-trigger').value();
}
}
if (response) {
res.jsonp(response);
} else {
res.sendFile(path.join(__dirname+'/dist/browser/index.html'));
}
});

// Start the app by listening on the default Heroku port
app.listen(process.env.PORT || 8080);
File renamed without changes.
9 changes: 9 additions & 0 deletions demo/src/app/app.component.ts
@@ -0,0 +1,9 @@
import { Component } from '@angular/core';
import '../style/app.scss';

@Component({
selector: 'my-app',
templateUrl: './app.component.html'
})
export class AppComponent {
}

0 comments on commit bcc4378

Please sign in to comment.