Skip to content

Commit c2854ca

Browse files
author
Gérard Collin
committed
fix: workflow vitest
1 parent 48870a2 commit c2854ca

26 files changed

Lines changed: 202 additions & 343 deletions

File tree

apps/xt-host/projects/host/src/app/shared/app-config/app-config.service.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { XtResolverService } from 'xt-components';
33

44
import { registerDefaultPlugin } from 'xt-plugin-default';
55
import { DcPluginModel, DcRepositoryModel } from '../models/dc-repository-model';
6+
import { loadRemoteModule } from '@angular-architects/native-federation';
67

78
@Injectable({
89
providedIn: 'root'
@@ -149,8 +150,11 @@ export class AppConfigService {
149150
async loadPlugin (plugin:DcPluginModel): Promise<boolean> {
150151
const url=plugin.info['remote-entry'];
151152
if (url==null) throw new Error ("No url for plugin "+ plugin['display-name']);
152-
await this.resolverService.loadPlugin(url);
153-
return true;
153+
const module = await loadRemoteModule({
154+
remoteEntry: url,
155+
exposedModule: './Register'
156+
});
157+
return this.resolverService.registerPluginModule (module, url);
154158
}
155159

156160
updateConfigName (newUrl:string ) {

common/config/rush/pnpm-lock.yaml

Lines changed: 137 additions & 71 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libs/xt-components/.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ trim_trailing_whitespace = true
1010

1111
[*.ts]
1212
quote_type = single
13+
ij_typescript_use_double_quotes = false
1314

1415
[*.md]
1516
max_line_length = off

libs/xt-components/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ yarn-error.log
2626
!.vscode/tasks.json
2727
!.vscode/launch.json
2828
!.vscode/extensions.json
29+
!.vscode/mcp.json
2930
.history/*
3031

3132
# Miscellaneous
@@ -36,6 +37,7 @@ yarn-error.log
3637
/libpeerconnection.log
3738
testem.log
3839
/typings
40+
__screenshots__/
3941

4042
# System files
4143
.DS_Store

libs/xt-components/.prettierrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"printWidth": 100,
3+
"singleQuote": true,
4+
"overrides": [
5+
{
6+
"files": "*.html",
7+
"options": {
8+
"parser": "angular"
9+
}
10+
}
11+
]
12+
}

libs/xt-components/angular.json

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@
1717
"prefix": "lib",
1818
"architect": {
1919
"build": {
20-
"builder": "@angular-devkit/build-angular:ng-packagr",
21-
"options": {
22-
"project": "projects/xt-components/ng-package.json"
23-
},
20+
"builder": "@angular/build:ng-packagr",
2421
"configurations": {
2522
"production": {
2623
"tsConfig": "projects/xt-components/tsconfig.lib.prod.json"
@@ -32,11 +29,9 @@
3229
"defaultConfiguration": "development"
3330
},
3431
"test": {
35-
"builder": "@analogjs/vitest-angular:test",
32+
"builder": "@angular/build:unit-test",
3633
"options": {
37-
"tsConfig": "projects/xt-components/tsconfig.spec.json",
38-
"polyfills": [
39-
]
34+
"tsConfig": "projects/xt-components/tsconfig.spec.json"
4035
}
4136
}
4237
}
@@ -53,16 +48,13 @@
5348
"prefix": "app",
5449
"architect": {
5550
"build": {
56-
"builder": "@angular-devkit/build-angular:application",
51+
"builder": "@angular/build:application",
5752
"options": {
5853
"outputPath": "dist/tester-app",
5954
"index": "projects/tester-app/src/index.html",
6055
"browser": "projects/tester-app/src/main.ts",
6156
"preserveSymlinks": true,
62-
"polyfills": [
63-
],
6457
"tsConfig": "projects/tester-app/tsconfig.app.json",
65-
"inlineStyleLanguage": "css",
6658
"assets": [
6759
{
6860
"glob": "**/*",
@@ -71,8 +63,7 @@
7163
],
7264
"styles": [
7365
"projects/tester-app/src/styles.css"
74-
],
75-
"scripts": []
66+
]
7667
},
7768
"configurations": {
7869
"production": {
@@ -100,7 +91,7 @@
10091
"defaultConfiguration": "development"
10192
},
10293
"serve": {
103-
"builder": "@angular-devkit/build-angular:dev-server",
94+
"builder": "@angular/build:dev-server",
10495
"configurations": {
10596
"production": {
10697
"buildTarget": "tester-app:build:production"
@@ -111,27 +102,8 @@
111102
},
112103
"defaultConfiguration": "development"
113104
},
114-
"extract-i18n": {
115-
"builder": "@angular-devkit/build-angular:extract-i18n"
116-
},
117105
"test": {
118-
"builder": "@analogjs/vitest-angular:test",
119-
"options": {
120-
"polyfills": [
121-
],
122-
"tsConfig": "projects/tester-app/tsconfig.spec.json",
123-
"inlineStyleLanguage": "css",
124-
"assets": [
125-
{
126-
"glob": "**/*",
127-
"input": "projects/tester-app/public"
128-
}
129-
],
130-
"styles": [
131-
"projects/tester-app/src/styles.css"
132-
],
133-
"scripts": []
134-
}
106+
"builder": "@angular/build:unit-test"
135107
}
136108
}
137109
}

libs/xt-components/package.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"build": "ng build xt-components --configuration=development && ng build tester-app --configuration=development ",
88
"build-deploy": "APP=xt-components && ng build $APP --configuration=$BUILD",
99
"watch": "ng build --watch --configuration development",
10-
"test": "cd projects/xt-components && ../../node_modules/.bin/vitest && cd ../tester-app && ../../node_modules/.bin/vitest"
10+
"test": "ng test xt-components && ng test tester-app"
1111
},
1212
"repository": {
1313
"url": "https://github.com/dont-code/ng-xtend.git"
@@ -32,22 +32,19 @@
3232
"xt-type": "workspace:^",
3333
"@primeuix/themes": "^2.0.3",
3434
"primeicons": "^7.0.0",
35-
"tslib": "^2.8.1",
36-
"@angular-architects/native-federation": "^21.2.3",
37-
"@softarc/native-federation-runtime": "^3.3.6"
35+
"tslib": "^2.8.1"
3836
},
3937
"devDependencies": {
40-
"@angular-devkit/build-angular": "^21.2.6",
38+
"@angular/build": "^21.2.6",
4139
"@angular/cli": "^21.2.6",
4240
"@angular/compiler-cli": "^21.2.7",
41+
"@types/node": "^24.12.2",
4342
"ng-packagr": "^21.2.2",
4443
"typescript": "^5.9.3",
4544
"happy-dom": "^20.8.9",
46-
"@analogjs/vite-plugin-angular": "^2.4.0",
47-
"@analogjs/vitest-angular": "^2.4.0",
4845
"jsdom": "^29.0.1",
49-
"vite": "^8.0.3",
5046
"vitest": "^4.1.2",
47+
"prettier": "^3.8.1",
5148
"@primeuix/utils": "^0.7.1",
5249
"@primeuix/styles": "^2.0.3",
5350
"@primeuix/styled": "^0.7.2"

libs/xt-components/projects/tester-app/src/test-setup.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

libs/xt-components/projects/tester-app/vitest.config.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

libs/xt-components/projects/xt-components/src/lib/angular/xt-resolver.service.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { XtResolvedComponent } from '../xt-resolved-component';
66
import {
77
ManagedDataHandler,
88
MappingHelper,
9-
XtSpecialFieldsHelper,
109
XtTypeHandler,
1110
XtTypeInfo,
1211
xtTypeManager,
@@ -16,7 +15,6 @@ import {
1615
import { XtComponentInfo, XtPluginInfo, XtTypeHandlerInfo } from '../plugin/xt-plugin-info';
1716
import { XtResolver } from '../resolver/xt-resolver';
1817
import { XtComponent } from '../xt-component';
19-
import { loadRemoteModule } from '@angular-architects/native-federation';
2018
import { XtAction } from '../action/xt-action';
2119
import { XtActionHandler, XtActionResult } from '../action/xt-action-handler';
2220
import { IStoreManager, StoreSupport } from '../store/store-support';
@@ -178,14 +176,11 @@ export class XtResolverService {
178176
/**
179177
* Dynamically load a register a plugin from the given url
180178
* The plugin must export at least a Register entrypoint that will be called right after loading..
181-
* @param url
182179
* @returns a Promise with the module loaded and already registered.
180+
* @param module
183181
*/
184-
loadPlugin (url:URL|string):Promise<any> {
185-
return loadRemoteModule({
186-
remoteEntry: url.toString(),
187-
exposedModule: './Register'
188-
}).then((module:any) => {
182+
registerPluginModule (module: {registerPlugin : (resolver:XtResolverService) => string}, url:URL|string):boolean {
183+
189184
const pluginName = module.registerPlugin(this);
190185
// Transform the configured Uris to real urls
191186
const pluginConfig=this.pluginRegistry.pluginRegistry.get(pluginName);
@@ -195,9 +190,7 @@ export class XtResolverService {
195190
urlString = urlString.substring(0, lastSlash+1)+pluginConfig?.uriLogo;
196191
pluginConfig.uriLogo=urlString;
197192
}
198-
return module;
199-
});
200-
193+
return true;
201194
}
202195

203196
/**

0 commit comments

Comments
 (0)