Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MC-9766 - Reorganise the repo to support multiple Angular projects #435

Draft
wants to merge 8 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,8 @@ $RECYCLE.BIN/

# Windows shortcuts
*.lnk
/test-report.xml
/test-report
junit.xml
**/test-report
yarn.lock
eslint_report.json
eslint_report.*
.scannerwork
releases
14 changes: 6 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ pipeline {
}
stage('Jenkins Clean') {
steps {
sh 'rm -f junit.xml'
sh 'rm -rf test-report'
sh 'rm -rf coverage'
sh 'rm -f eslint_report.json'
}
}

Expand Down Expand Up @@ -80,23 +78,23 @@ pipeline {
steps {
nvm('') {
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
sh 'npm run test-with-coverage'
sh 'npm run test-clearCache'
sh 'npm run test mdm-ui -- --coverage'
sh 'npm run test mdm-ui -- --clear-cache'
sh "rm -rf /tmp/jest_${JOB_BASE_NAME}"
}
}
}
post {
always {
junit allowEmptyResults: true, testResults: 'junit.xml'
junit allowEmptyResults: true, testResults: 'test-report/mdm-ui/junit.xml'
}
}
}
stage('Lint') {
steps {
nvm('') {
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
sh 'npm run eslint-report'
sh 'npm run eslint-xml'
}
}
}
Expand Down Expand Up @@ -217,8 +215,8 @@ pipeline {
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : false,
reportDir : 'test-report',
reportFiles : 'index.html',
reportDir : 'test-report/mdm-ui',
reportFiles : 'jest-report.html',
reportName : 'Test Report',
reportTitles : 'Test'
])
Expand Down
34 changes: 26 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,34 @@ $ npm install

### Run the application

* To start the application in development mode run `ng serve`
* After the terminal finishes compiling, open up your browser and navigate to http://localhost:4200
To start the application in development mode run `npm start`. After the terminal finishes compiling, open up your browser and navigate to http://localhost:4200.

Alternatively:

```bash
# Explicitly state which Angular project to test
npm start mdm-ui
```

### Testing the application

* To test the application run `npm test`
To test the application run `npm test`.

This Angular workspace uses [Jest](https://jestjs.io/) as testing framework, so any command line parameters that Jest can use can also be provided. For example:

```bash
# Explicitly state which Angular project to test
npm run test mdm-ui

# Execute test runner in watch mode. Note the "--" separator for npm to separate command line arguments
npm run test mdm-ui -- --watch
```

## Build the application

To 'export' the code for production, run `ng build --configuration production`. This will compile & minify the code, making it ready for production.

### Deployments

All pushes to the repository will invoke a Jenkins CI build.
When Jenkins runs the builds it uses `npm ci` which uses the `package-lock.json` to determine dependencies,
Expand Down Expand Up @@ -95,8 +117,4 @@ This is surprisingly simple just run `npm install` or `npm ci`

There is a useful npm package ([symlinked](https://www.npmjs.com/package/symlinked)) which can list what modules are linked into your repository.
This is helpful if you want to check if mdm-resources is currently linked to mdm-ui.
We recommend installing this globally with `npm i -g symlinked` then you can call it inside mdm-ui using `symlinked names`.

## Build the application

To 'export' the code for production, run `ng build --prod` this will compile & minify the code, making it ready for production
We recommend installing this globally with `npm i -g symlinked` then you can call it inside mdm-ui using `symlinked names`.
Empty file removed TESTING.md
Empty file.
49 changes: 18 additions & 31 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"root": "projects/mdm-ui",
"sourceRoot": "projects/mdm-ui/src",
"prefix": "mdm",
"architect": {
"build": {
Expand All @@ -23,43 +23,43 @@
},
"preserveSymlinks": true,
"customWebpackConfig": {
"path": "webpack.config.js"
"path": "projects/mdm-ui/webpack.config.js"
},
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"outputPath": "dist/mdm-ui",
"index": "projects/mdm-ui/src/index.html",
"main": "projects/mdm-ui/src/main.ts",
"polyfills": "projects/mdm-ui/src/polyfills.ts",
"tsConfig": "projects/mdm-ui/tsconfig.app.json",
"aot": true,
"assets": [
"src/assets/favicon.ico",
"src/assets",
"projects/mdm-ui/src/assets/favicon.ico",
"projects/mdm-ui/src/assets",
{
"glob": "open-id-connect-redirect.html",
"input": "src/static-pages",
"input": "projects/mdm-ui/src/static-pages",
"output": "/redirects"
}
],
"styles": [
"src/styles.scss",
"projects/mdm-ui/src/styles.scss",
"node_modules/jodit/build/jodit.min.css"
],
"scripts": [
"node_modules/jodit/build/jodit.min.js"
],
"stylePreprocessorOptions": {
"includePaths": [
"src/style",
"src/app"
"projects/mdm-ui/src/style",
"projects/mdm-ui/src/app"
]
}
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
"replace": "projects/mdm-ui/src/environments/environment.ts",
"with": "projects/mdm-ui/src/environments/environment.prod.ts"
}
],
"optimization": true,
Expand Down Expand Up @@ -120,26 +120,13 @@
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
"projects/mdm-ui/tsconfig.app.json",
"projects/mdm-ui/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "mdm-ui:serve"
},
"configurations": {
"production": {
"devServerTarget": "mdm-ui:serve:production"
}
}
}
}
}
Expand Down
Loading