Skip to content

Commit fce57e4

Browse files
committed
Update for yFiles for HTML 2.5
1 parent 06ba7b7 commit fce57e4

20 files changed

+141
-149
lines changed

.browserslistrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ last 2 Edge major versions
1414
last 2 Safari major versions
1515
last 2 iOS major versions
1616
Firefox ESR
17-
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.

.gitignore

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,43 @@
11
# See http://help.github.com/ignore-files/ for more about ignoring files.
22

3-
# compiled output
3+
# Compiled output
44
/dist
55
/tmp
66
/out-tsc
7-
# Only exists if Bazel was run
87
/bazel-out
98

10-
# dependencies
9+
# Node
1110
/node_modules
12-
13-
# profiling files
14-
chrome-profiler-events*.json
11+
npm-debug.log
12+
yarn-error.log
1513

1614
# IDEs and editors
17-
/.idea
15+
.idea/
1816
.project
1917
.classpath
2018
.c9/
2119
*.launch
2220
.settings/
2321
*.sublime-workspace
2422

25-
# IDE - VSCode
23+
# Visual Studio Code
2624
.vscode/*
2725
!.vscode/settings.json
2826
!.vscode/tasks.json
2927
!.vscode/launch.json
3028
!.vscode/extensions.json
3129
.history/*
3230

33-
# misc
34-
/.sass-cache
31+
# Miscellaneous
32+
/.angular/cache
33+
.sass-cache/
3534
/connect.lock
3635
/coverage
3736
/libpeerconnection.log
38-
npm-debug.log
39-
yarn-error.log
4037
testem.log
4138
/typings
4239
license.json
4340

44-
# System Files
41+
# System files
4542
.DS_Store
4643
Thumbs.db

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ This sample application serves as a basic scaffold of how to integrate [yFiles f
88

99
## Version Information
1010

11-
- Angular CLI v12.1
12-
- yFiles for HTML 2.4
11+
- Angular CLI v14.1
12+
- yFiles for HTML 2.5
1313

1414
## Getting Started
1515

@@ -56,5 +56,5 @@ and customize the interaction with the graph. Generate Angular code for your pro
5656

5757
## Support
5858

59-
If you need help with your setup or a certain feature, don't hesitate to contact our support
60-
through our [Customer Center](https://my.yworks.com/) or by email [[email protected]](mailto:[email protected]).
59+
If you need help with your setup or a certain feature, don't hesitate to contact our support through
60+
the [Customer Center](https://my.yworks.com/) or by email [[email protected]](mailto:[email protected]).

angular.json

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,17 @@
33
"version": 1,
44
"newProjectRoot": "projects",
55
"projects": {
6-
"yfiles-angular-cli-integration": {
6+
"yfiles-angular-integration-basic": {
77
"projectType": "application",
8-
"schematics": {
9-
"@schematics/angular:application": {
10-
"strict": true
11-
}
12-
},
8+
"schematics": {},
139
"root": "",
1410
"sourceRoot": "src",
1511
"prefix": "app",
1612
"architect": {
1713
"build": {
1814
"builder": "@angular-devkit/build-angular:browser",
1915
"options": {
20-
"outputPath": "dist/yfiles-angular-cli-integration",
16+
"outputPath": "dist/yfiles-angular-integration-basic",
2117
"index": "src/index.html",
2218
"main": "src/main.ts",
2319
"polyfills": "src/polyfills.ts",
@@ -28,6 +24,18 @@
2824
},
2925
"configurations": {
3026
"production": {
27+
"budgets": [
28+
{
29+
"type": "initial",
30+
"maximumWarning": "500kb",
31+
"maximumError": "1mb"
32+
},
33+
{
34+
"type": "anyComponentStyle",
35+
"maximumWarning": "2kb",
36+
"maximumError": "4kb"
37+
}
38+
],
3139
"fileReplacements": [
3240
{
3341
"replace": "src/environments/environment.ts",
@@ -51,18 +59,18 @@
5159
"builder": "@angular-devkit/build-angular:dev-server",
5260
"configurations": {
5361
"production": {
54-
"browserTarget": "yfiles-angular-cli-integration:build:production"
62+
"browserTarget": "yfiles-angular-integration-basic:build:production"
5563
},
5664
"development": {
57-
"browserTarget": "yfiles-angular-cli-integration:build:development"
65+
"browserTarget": "yfiles-angular-integration-basic:build:development"
5866
}
5967
},
6068
"defaultConfiguration": "development"
6169
},
6270
"extract-i18n": {
6371
"builder": "@angular-devkit/build-angular:extract-i18n",
6472
"options": {
65-
"browserTarget": "yfiles-angular-cli-integration:build"
73+
"browserTarget": "yfiles-angular-integration-basic:build"
6674
}
6775
},
6876
"test": {
@@ -79,6 +87,5 @@
7987
}
8088
}
8189
}
82-
},
83-
"defaultProject": "yfiles-angular-cli-integration"
90+
}
8491
}

integration-howto.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
This is a step-by-step description of how to add a yFiles graph component to a basic Angular application.
44

5-
TL;DR Add yFiles as a dependency in the `package.json` and start importing yFiles classes in your project.
5+
TL;DR Add `yfiles` as a dependency in the `package.json`,
6+
[include your license](https://docs.yworks.com/yfileshtml/#/dguide/licensing#_general_concept),
7+
and start importing yFiles classes in your project.
68

79
## Running the CLI
810

@@ -15,27 +17,25 @@ This creates a basic Angular project.
1517

1618
## Add yFiles as a dependency
1719

18-
Adding yFiles as a dependency is as easy as installing an external library from the npm registry:
20+
Adding yFiles as a dependency is almost as easy as installing an external library from the npm registry:
1921

20-
1. Add yFiles for HTML as npm dependency to the created project:
22+
1. Add yFiles for HTML as npm dependency to the created project, for example like this:
2123

22-
- If you have a fresh yFiles for HTML package, you need to prepare the library package first by running `npm install` in the
23-
package folder. This creates the development library and a tarball that can be installed as npm dependency in
24-
other projects. See also [Working with the yFiles npm Module](https://docs.yworks.com/yfileshtml/#/dguide/yfiles_npm_module#yfiles_npm_module).
24+
```
25+
"dependencies": {
26+
...
27+
"yfiles": "../yFiles-for-HTML-Complete-2.5-Evaluation/lib-dev/yfiles-25.0.0+eval-dev.tgz"
28+
},
29+
```
2530

26-
Note: This sample project runs `npm install` as `preinstall` script in the `package.json`.
31+
2. Install the newly added dependency with `npm install`.
2732

28-
- Reference the packed library in the `package.json` of the project:
29-
```
30-
"dependencies": {
31-
...
32-
"yfiles": "../yFiles-for-HTML-Complete-2.4.0.6-Evaluation/lib-dev/es-modules/yfiles-24.0.6-eval-dev.tgz"
33-
},
34-
```
33+
3. Include your yFiles license by copying the `license.json` file into your project. For more options,
34+
see the [developer's guide](https://docs.yworks.com/yfileshtml/#/dguide/licensing#_general_concept)
3535

36-
2. Now install the newly added dependency with `npm install`.
37-
38-
After installing the dependency, you can import classes from `yfiles` in your project. Since yFiles is installed as proper npm dependency, IDEs provide full code-completion and automatic imports out of the box to easily work with the library.
36+
After installing the dependency, you can import classes from `yfiles` in your project. Since yFiles
37+
is installed as proper npm dependency, IDEs provide full code-completion and automatic imports out
38+
of the box to easily work with the library.
3939

4040
## Integrate a basic yFiles graph component
4141

@@ -46,7 +46,7 @@ With the yFiles dependency, you can easily create a new Angular component that c
4646
3. In `graph-component.component.ts`, instantiate a new GraphComponent in the container `div` with editing capabilities
4747
and a basic sample graph. See the contents of `/src/app/graph-component/graph-component.component.ts` in this repository for the full implementation.
4848

49-
Also, make sure to configure your `license.json` for the library (see `graph-component.component.ts`).
49+
Make sure to configure your license data as described above (see `graph-component.component.ts`, too).
5050

5151
4. Add the new component to the `/src/app/app.component.html` that was created by the Angular CLI.
5252

karma.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports = function (config) {
2525
suppressAll: true, // removes the duplicated traces
2626
},
2727
coverageReporter: {
28-
dir: require('path').join(__dirname, './coverage/yfiles-angular-cli-integration'),
28+
dir: require('path').join(__dirname, './coverage/yfiles-angular-integration-basic'),
2929
subdir: '.',
3030
reporters: [{ type: 'html' }, { type: 'text-summary' }],
3131
},

package.json

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,40 @@
33
"version": "1.0.0",
44
"author": "yWorks GmbH <[email protected]>",
55
"scripts": {
6-
"preinstall": "cd ../yFiles-for-HTML-Complete-2.4.0.6-Evaluation && npm run prepare-package",
7-
"postinstall": "node -e \"require('fs').copyFileSync('../yFiles-for-HTML-Complete-2.4.0.6-Evaluation/lib/license.json','./src/license.json')\"",
86
"ng": "ng",
97
"start": "ng serve",
10-
"build": "node --max_old_space_size=6000 node_modules/@angular/cli/bin/ng build",
8+
"build": "ng build",
119
"watch": "ng build --watch --configuration development",
12-
"test": "ng test"
10+
"test": "ng test",
11+
"postinstall": "npm run copy-eval-license",
12+
"copy-eval-license": "node -e \"require('fs').copyFileSync('../yFiles-for-HTML-Complete-2.5-Evaluation/lib/license.json','./src/license.json')\""
1313
},
1414
"private": true,
1515
"dependencies": {
16-
"@angular/animations": "~12.2.7",
17-
"@angular/common": "~12.2.7",
18-
"@angular/compiler": "~12.2.7",
19-
"@angular/core": "~12.2.7",
20-
"@angular/forms": "~12.2.7",
21-
"@angular/platform-browser": "~12.2.7",
22-
"@angular/platform-browser-dynamic": "~12.2.7",
23-
"@angular/router": "~12.2.7",
24-
"rxjs": "~7.1.0",
16+
"@angular/animations": "^14.1.0",
17+
"@angular/common": "^14.1.0",
18+
"@angular/compiler": "^14.1.0",
19+
"@angular/core": "^14.1.0",
20+
"@angular/forms": "^14.1.0",
21+
"@angular/platform-browser": "^14.1.0",
22+
"@angular/platform-browser-dynamic": "^14.1.0",
23+
"@angular/router": "^14.1.0",
24+
"rxjs": "~7.5.0",
2525
"tslib": "^2.3.0",
26-
"yfiles": "../yFiles-for-HTML-Complete-2.4.0.6-Evaluation/lib-dev/es-modules/yfiles-24.0.6-eval-dev.tgz",
26+
"yfiles": "../yFiles-for-HTML-Complete-2.5-Evaluation/lib-dev/yfiles-25.0.0+eval-dev.tgz",
2727
"zone.js": "~0.11.4"
2828
},
2929
"devDependencies": {
30-
"@angular-devkit/build-angular": "~12.2.7",
31-
"@angular/cli": "~12.2.7",
32-
"@angular/compiler-cli": "~12.2.7",
33-
"@types/jasmine": "~3.7.7",
34-
"@types/node": "^15.14.0",
35-
"jasmine-core": "^3.7.1",
36-
"karma": "~6.3.4",
30+
"@angular-devkit/build-angular": "^14.1.0",
31+
"@angular/cli": "~14.1.0",
32+
"@angular/compiler-cli": "^14.1.0",
33+
"@types/jasmine": "~4.0.0",
34+
"jasmine-core": "~4.2.0",
35+
"karma": "~6.4.0",
3736
"karma-chrome-launcher": "~3.1.0",
38-
"karma-coverage": "~2.0.3",
39-
"karma-jasmine": "~4.0.1",
40-
"karma-jasmine-html-reporter": "^1.6.0",
41-
"typescript": "~4.2.4"
37+
"karma-coverage": "~2.2.0",
38+
"karma-jasmine": "~5.1.0",
39+
"karma-jasmine-html-reporter": "~2.0.0",
40+
"typescript": "~4.7.2"
4241
}
4342
}

src/app/app.component.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
<div class="header">
2-
<img alt="yFiles logo" src="./assets/yfiles-logo.svg">
2+
<img alt="yFiles logo" src="./assets/yfiles-logo.svg" />
33
<h1>A Basic yFiles Integration in Angular</h1>
44
</div>
55

66
<app-graph-component></app-graph-component>
7-
8-
9-

src/app/app.component.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ describe('AppComponent', () => {
1414
expect(app).toBeTruthy()
1515
})
1616

17-
it(`should have as title 'yfiles-angular-cli-integration'`, () => {
17+
it(`should have as title 'yfiles-angular-integration-basic'`, () => {
1818
const fixture = TestBed.createComponent(AppComponent)
1919
const app = fixture.componentInstance
20-
expect(app.title).toEqual('yfiles-angular-cli-integration')
20+
expect(app.title).toEqual('yfiles-angular-integration-basic')
2121
})
2222

2323
it('should render title', () => {
2424
const fixture = TestBed.createComponent(AppComponent)
2525
fixture.detectChanges()
26-
const compiled = fixture.nativeElement
27-
expect(compiled.querySelector('.header h1').textContent).toContain(
28-
'A Basic yFiles Integration in Angular'
26+
const compiled = fixture.nativeElement as HTMLElement
27+
expect(compiled.querySelector('.content span')?.textContent).toContain(
28+
'yfiles-angular-integration-basic app is running!'
2929
)
3030
})
3131
})

src/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ import { Component } from '@angular/core'
66
styleUrls: ['./app.component.css'],
77
})
88
export class AppComponent {
9-
title = 'yfiles-angular-cli-integration'
9+
title = 'yfiles-angular-integration-basic'
1010
}

0 commit comments

Comments
 (0)