Skip to content

Commit c0542a0

Browse files
committed
update example to angular v21
1 parent 5f60c85 commit c0542a0

84 files changed

Lines changed: 1652 additions & 1864 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project Sdk="Microsoft.VisualStudio.JavaScript.Sdk/1.0.1738743">
2+
<PropertyGroup>
3+
<StartupCommand>npm start</StartupCommand>
4+
<!-- Allows the build (or compile) script located on package.json to run on Build -->
5+
<ShouldRunBuildScript>false</ShouldRunBuildScript>
6+
<!-- Folder where production build objects will be placed -->
7+
<BuildOutputFolder>$(MSBuildProjectDirectory)\dist\CustomParameterEditor.client\browser\</BuildOutputFolder>
8+
</PropertyGroup>
9+
</Project>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# CustomParameterEditor.client
2+
3+
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 21.1.3.
4+
5+
## Development server
6+
7+
To start a local development server, run:
8+
9+
```bash
10+
ng serve
11+
```
12+
13+
Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.
14+
15+
## Code scaffolding
16+
17+
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
18+
19+
```bash
20+
ng generate component component-name
21+
```
22+
23+
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
24+
25+
```bash
26+
ng generate --help
27+
```
28+
29+
## Building
30+
31+
To build the project run:
32+
33+
```bash
34+
ng build
35+
```
36+
37+
This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.
38+
39+
## Running unit tests
40+
41+
To execute unit tests with the [Vitest](https://vitest.dev/) test runner, use the following command:
42+
43+
```bash
44+
ng test
45+
```
46+
47+
## Running end-to-end tests
48+
49+
For end-to-end (e2e) testing, run:
50+
51+
```bash
52+
ng e2e
53+
```
54+
55+
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
56+
57+
## Additional Resources
58+
59+
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"cli": {
5+
"packageManager": "npm"
6+
},
7+
"newProjectRoot": "projects",
8+
"projects": {
9+
"CustomParameterEditor.client": {
10+
"projectType": "application",
11+
"schematics": {},
12+
"root": "",
13+
"sourceRoot": "src",
14+
"prefix": "app",
15+
"architect": {
16+
"build": {
17+
"builder": "@angular/build:application",
18+
"options": {
19+
"browser": "src/main.ts",
20+
"tsConfig": "tsconfig.app.json",
21+
"assets": [
22+
{
23+
"glob": "**/*",
24+
"input": "public"
25+
}
26+
],
27+
"styles": [
28+
"node_modules/bootstrap/dist/css/bootstrap.min.css",
29+
"src/styles.css"
30+
],
31+
"server": "src/main.server.ts",
32+
"outputMode": "server",
33+
"ssr": {
34+
"entry": "src/server.ts"
35+
}
36+
},
37+
"configurations": {
38+
"production": {
39+
"budgets": [
40+
{
41+
"type": "initial",
42+
"maximumWarning": "1000kB",
43+
"maximumError": "30MB"
44+
},
45+
{
46+
"type": "anyComponentStyle",
47+
"maximumWarning": "100kB",
48+
"maximumError": "1MB"
49+
}
50+
],
51+
"outputHashing": "all"
52+
},
53+
"development": {
54+
"optimization": false,
55+
"extractLicenses": false,
56+
"sourceMap": true
57+
}
58+
},
59+
"defaultConfiguration": "production"
60+
},
61+
"serve": {
62+
"builder": "@angular/build:dev-server",
63+
"configurations": {
64+
"production": {
65+
"buildTarget": "CustomParameterEditor.client:build:production"
66+
},
67+
"development": {
68+
"buildTarget": "CustomParameterEditor.client:build:development"
69+
}
70+
},
71+
"defaultConfiguration": "development",
72+
"options": {
73+
"proxyConfig": "src/proxy.conf.js"
74+
}
75+
},
76+
"test": {
77+
"builder": "@angular/build:unit-test"
78+
}
79+
}
80+
}
81+
}
82+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// This script sets up HTTPS for the application using the ASP.NET Core HTTPS certificate
2+
const fs = require('fs');
3+
const spawn = require('child_process').spawn;
4+
const path = require('path');
5+
6+
const baseFolder =
7+
process.env.APPDATA !== undefined && process.env.APPDATA !== ''
8+
? `${process.env.APPDATA}/ASP.NET/https`
9+
: `${process.env.HOME}/.aspnet/https`;
10+
11+
const certificateArg = process.argv.map(arg => arg.match(/--name=(?<value>.+)/i)).filter(Boolean)[0];
12+
const certificateName = certificateArg ? certificateArg.groups.value : process.env.npm_package_name;
13+
14+
if (!certificateName) {
15+
console.error('Invalid certificate name. Run this script in the context of an npm/yarn script or pass --name=<<app>> explicitly.')
16+
process.exit(-1);
17+
}
18+
19+
const certFilePath = path.join(baseFolder, `${certificateName}.pem`);
20+
const keyFilePath = path.join(baseFolder, `${certificateName}.key`);
21+
22+
if(!fs.existsSync(baseFolder)) {
23+
fs.mkdirSync(baseFolder, { recursive: true });
24+
}
25+
26+
if (!fs.existsSync(certFilePath) || !fs.existsSync(keyFilePath)) {
27+
spawn('dotnet', [
28+
'dev-certs',
29+
'https',
30+
'--export-path',
31+
certFilePath,
32+
'--format',
33+
'Pem',
34+
'--no-password',
35+
], { stdio: 'inherit', })
36+
.on('exit', (code) => process.exit(code));
37+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"name": "CustomParameterEditor",
3+
"version": "0.0.0",
4+
"scripts": {
5+
"ng": "ng",
6+
"start": "run-script-os",
7+
"build": "ng build",
8+
"watch": "ng build --watch --configuration development",
9+
"prestart": "node aspnetcore-https",
10+
"start:windows": "ng serve --ssl --ssl-cert \"%APPDATA%\\ASP.NET\\https\\%npm_package_name%.pem\" --ssl-key \"%APPDATA%\\ASP.NET\\https\\%npm_package_name%.key\"",
11+
"start:default": "ng serve --ssl --ssl-cert \"$HOME/.aspnet/https/${npm_package_name}.pem\" --ssl-key \"$HOME/.aspnet/https/${npm_package_name}.key\"",
12+
"test": "ng test"
13+
},
14+
"prettier": {
15+
"printWidth": 100,
16+
"singleQuote": true,
17+
"overrides": [
18+
{
19+
"files": "*.html",
20+
"options": {
21+
"parser": "angular"
22+
}
23+
}
24+
]
25+
},
26+
"private": true,
27+
"packageManager": "npm@11.6.2",
28+
"dependencies": {
29+
"@angular/common": "^21.1.0",
30+
"@angular/compiler": "^21.1.0",
31+
"@angular/core": "^21.1.0",
32+
"@angular/forms": "^21.1.0",
33+
"@angular/platform-browser": "^21.1.0",
34+
"@angular/platform-server": "^21.1.0",
35+
"@angular/router": "^21.1.0",
36+
"@angular/ssr": "^21.1.3",
37+
"express": "^5.1.0",
38+
"rxjs": "~7.8.0",
39+
"tslib": "^2.3.0",
40+
"run-script-os": "^1.1.0",
41+
"bootstrap": "^5.3.3",
42+
"devexpress-reporting-angular": "25.2-stable",
43+
"devextreme": "25.2-stable",
44+
"devextreme-angular": "25.2-stable"
45+
},
46+
"devDependencies": {
47+
"@angular/build": "^21.1.3",
48+
"@angular/cli": "^21.1.3",
49+
"@angular/compiler-cli": "^21.1.0",
50+
"@types/express": "^5.0.1",
51+
"@types/node": "^20.17.19",
52+
"jsdom": "^27.1.0",
53+
"typescript": "~5.9.2",
54+
"vitest": "^4.0.8"
55+
}
56+
}
14.7 KB
Binary file not shown.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
2+
import { provideServerRendering, withRoutes } from '@angular/ssr';
3+
import { appConfig } from './app.config';
4+
import { serverRoutes } from './app.routes.server';
5+
6+
const serverConfig: ApplicationConfig = {
7+
providers: [
8+
provideServerRendering(withRoutes(serverRoutes))
9+
]
10+
};
11+
12+
export const config = mergeApplicationConfig(appConfig, serverConfig);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { ApplicationConfig, provideBrowserGlobalErrorListeners } from '@angular/core';
2+
import { provideRouter } from '@angular/router';
3+
import { routes } from './app.routes';
4+
import { provideClientHydration, withEventReplay } from '@angular/platform-browser';
5+
import { provideHttpClient, withFetch } from '@angular/common/http';
6+
import { TemplateEngine } from 'devexpress-reporting-angular/dx-report-viewer';
7+
8+
function getBaseUrl() {
9+
return document.getElementsByTagName('base')[0].href;
10+
}
11+
12+
export const appConfig: ApplicationConfig = {
13+
providers: [
14+
provideBrowserGlobalErrorListeners(),
15+
provideRouter(routes), provideClientHydration(withEventReplay()),
16+
provideHttpClient(withFetch()),
17+
TemplateEngine,
18+
{ provide: 'BASE_URL', useFactory: getBaseUrl, deps: [] }
19+
]
20+
};

CustomParameterEditor.Client/src/app/app.css

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<app-nav-menu></app-nav-menu>
2+
<router-outlet></router-outlet>

0 commit comments

Comments
 (0)