@centreon/js-config 25.3.1 → 25.4.0-MON-191119-npm-develop.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cypress/component/commands.tsx +1 -1
- package/cypress/component/configuration.js +45 -6
- package/cypress/e2e/commands.ts +19 -3
- package/cypress/e2e/configuration.ts +11 -8
- package/cypress/e2e/tasks.ts +111 -32
- package/package.json +6 -6
- package/rspack/base/globalConfig.js +19 -5
- package/rspack/base/index.js +49 -44
- package/rspack/patch/dev.js +7 -10
- package/cypress/component/excludeNodeModulesFromCoverage.js +0 -36
|
@@ -6,6 +6,9 @@ const {
|
|
|
6
6
|
} = require('@simonsmith/cypress-image-snapshot/plugin');
|
|
7
7
|
const cypressCodeCoverageTask = require('@cypress/code-coverage/task');
|
|
8
8
|
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
|
|
9
12
|
module.exports = ({
|
|
10
13
|
rspackConfig,
|
|
11
14
|
cypressFolder,
|
|
@@ -28,21 +31,52 @@ module.exports = ({
|
|
|
28
31
|
addMatchImageSnapshotPlugin(on, config);
|
|
29
32
|
|
|
30
33
|
cypressCodeCoverageTask(on, config);
|
|
31
|
-
on('task', {
|
|
32
|
-
coverageReport: () => {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
34
|
|
|
37
35
|
on('before:browser:launch', (browser, launchOptions) => {
|
|
38
|
-
if (
|
|
36
|
+
if (
|
|
37
|
+
['chrome', 'chromium'].includes(browser.name) &&
|
|
38
|
+
browser.isHeadless
|
|
39
|
+
) {
|
|
39
40
|
launchOptions.args.push('--headless=new');
|
|
40
41
|
launchOptions.args.push('--force-color-profile=srgb');
|
|
41
42
|
launchOptions.args.push('--window-size=1400,1200');
|
|
43
|
+
launchOptions.args.push('--max-old-space-size=4096');
|
|
44
|
+
launchOptions.args.push('--disable-dev-shm-usage');
|
|
45
|
+
launchOptions.args.push('--disable-gpu');
|
|
46
|
+
launchOptions.args.push('--no-sandbox');
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
return launchOptions;
|
|
45
50
|
});
|
|
51
|
+
|
|
52
|
+
on('after:run', (results) => {
|
|
53
|
+
const testRetries = {};
|
|
54
|
+
if ('runs' in results) {
|
|
55
|
+
results.runs.forEach((run) => {
|
|
56
|
+
run.tests.forEach((test) => {
|
|
57
|
+
if (test.attempts && test.attempts.length > 1 && test.state === 'passed') {
|
|
58
|
+
const testTitle = test.title.join(' > '); // Convert the array to a string
|
|
59
|
+
testRetries[testTitle] = test.attempts.length - 1;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Save the testRetries object to a file in the e2e/results directory
|
|
66
|
+
const resultFilePath = path.join(
|
|
67
|
+
mainCypressFolder,
|
|
68
|
+
'results',
|
|
69
|
+
'retries.json'
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
fs.writeFileSync(resultFilePath, JSON.stringify(testRetries, null, 2));
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
on('after:spec', () => {
|
|
76
|
+
if (global.__coverage__) {
|
|
77
|
+
delete global.__coverage__;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
46
80
|
},
|
|
47
81
|
specPattern,
|
|
48
82
|
supportFile: `${mainCypressFolder}/support/component.tsx`
|
|
@@ -60,6 +94,7 @@ module.exports = ({
|
|
|
60
94
|
},
|
|
61
95
|
...env
|
|
62
96
|
},
|
|
97
|
+
numTestsKeptInMemory: 1,
|
|
63
98
|
reporter: 'mochawesome',
|
|
64
99
|
reporterOptions: {
|
|
65
100
|
html: false,
|
|
@@ -68,6 +103,10 @@ module.exports = ({
|
|
|
68
103
|
reportDir: `${mainCypressFolder}/results`,
|
|
69
104
|
reportFilename: '[name]-report.json'
|
|
70
105
|
},
|
|
106
|
+
retries: {
|
|
107
|
+
openMode: 0,
|
|
108
|
+
runMode: 2
|
|
109
|
+
},
|
|
71
110
|
video: true,
|
|
72
111
|
videosFolder: `${mainCypressFolder}/results/videos`,
|
|
73
112
|
viewportHeight: 590,
|
package/cypress/e2e/commands.ts
CHANGED
|
@@ -166,6 +166,12 @@ Cypress.Commands.add('getContainersLogs', () => {
|
|
|
166
166
|
return cy.task('getContainersLogs');
|
|
167
167
|
});
|
|
168
168
|
|
|
169
|
+
Cypress.Commands.add('getContainerMappedPort', (containerName: string, containerPort: number) => {
|
|
170
|
+
cy.log(`Getting mapped port ${containerPort} of container ${containerName}`);
|
|
171
|
+
|
|
172
|
+
return cy.task('getContainerMappedPort', { containerName, containerPort });
|
|
173
|
+
});
|
|
174
|
+
|
|
169
175
|
interface CopyFromContainerProps {
|
|
170
176
|
destination: string;
|
|
171
177
|
name?: string;
|
|
@@ -280,7 +286,16 @@ Cypress.Commands.add('logout', (): void => {
|
|
|
280
286
|
|
|
281
287
|
cy.contains(/^Logout$/).click();
|
|
282
288
|
|
|
283
|
-
cy.
|
|
289
|
+
cy.waitUntil(() =>
|
|
290
|
+
cy.wait('@logout').then((interception) => {
|
|
291
|
+
return interception?.response?.statusCode === 302;
|
|
292
|
+
}),
|
|
293
|
+
{
|
|
294
|
+
errorMsg: 'Logout did not complete successfully',
|
|
295
|
+
timeout: 30000,
|
|
296
|
+
interval: 2000
|
|
297
|
+
}
|
|
298
|
+
);
|
|
284
299
|
|
|
285
300
|
// https://github.com/cypress-io/cypress/issues/25841
|
|
286
301
|
cy.clearAllCookies();
|
|
@@ -539,8 +554,8 @@ Cypress.Commands.add(
|
|
|
539
554
|
cy.log(`Getting logs from container ${name} ...`);
|
|
540
555
|
|
|
541
556
|
return cy.getLogDirectory().then((logDirectory) => {
|
|
542
|
-
let sourcePhpLogs = '/var/log/php8.
|
|
543
|
-
let targetPhpLogs = `${logDirectory}/php8.
|
|
557
|
+
let sourcePhpLogs = '/var/log/php8.2-fpm-centreon-error.log';
|
|
558
|
+
let targetPhpLogs = `${logDirectory}/php8.2-fpm-centreon-error.log`;
|
|
544
559
|
let sourceApacheLogs = '/var/log/apache2';
|
|
545
560
|
let targetApacheLogs = `${logDirectory}/apache2`;
|
|
546
561
|
if (Cypress.env('WEB_IMAGE_OS').includes('alma')) {
|
|
@@ -907,6 +922,7 @@ declare global {
|
|
|
907
922
|
getContainerId: (containerName: string) => Cypress.Chainable;
|
|
908
923
|
getContainerIpAddress: (containerName: string) => Cypress.Chainable;
|
|
909
924
|
getContainersLogs: () => Cypress.Chainable;
|
|
925
|
+
getContainerMappedPort: (containerName: string, containerPort: number) => Cypress.Chainable;
|
|
910
926
|
getIframeBody: () => Cypress.Chainable;
|
|
911
927
|
getLogDirectory: () => Cypress.Chainable;
|
|
912
928
|
getTimeFromHeader: () => Cypress.Chainable;
|
|
@@ -50,13 +50,16 @@ export default ({
|
|
|
50
50
|
},
|
|
51
51
|
setupNodeEvents: async (cypressOn, config) => {
|
|
52
52
|
const on = require('cypress-on-fix')(cypressOn)
|
|
53
|
-
installLogsPrinter(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
installLogsPrinter(on, {
|
|
54
|
+
commandTrimLength: 5000,
|
|
55
|
+
defaultTrimLength: 5000,
|
|
56
|
+
});
|
|
57
|
+
on("task", {
|
|
58
|
+
logVersion(message) {
|
|
59
|
+
console.log(`[LOG]: ${message}`);
|
|
60
|
+
return null;
|
|
61
|
+
},
|
|
62
|
+
});
|
|
60
63
|
await esbuildPreprocessor(on, config);
|
|
61
64
|
tasks(on);
|
|
62
65
|
|
|
@@ -68,7 +71,7 @@ export default ({
|
|
|
68
71
|
},
|
|
69
72
|
env: {
|
|
70
73
|
...env,
|
|
71
|
-
DATABASE_IMAGE: '
|
|
74
|
+
DATABASE_IMAGE: 'bitnamilegacy/mariadb:10.11',
|
|
72
75
|
OPENID_IMAGE_VERSION: process.env.MAJOR || '24.04',
|
|
73
76
|
SAML_IMAGE_VERSION: process.env.MAJOR || '24.04',
|
|
74
77
|
STABILITY: 'unstable',
|
package/cypress/e2e/tasks.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { execSync } from 'child_process';
|
|
3
3
|
import { existsSync, mkdirSync } from 'fs';
|
|
4
4
|
import path from 'path';
|
|
5
|
+
import fs from "fs";
|
|
5
6
|
|
|
6
7
|
import tar from 'tar-fs';
|
|
7
8
|
import {
|
|
@@ -18,6 +19,13 @@ interface Containers {
|
|
|
18
19
|
[key: string]: StartedTestContainer;
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
class NotFoundContainerError extends Error {
|
|
23
|
+
constructor(message) {
|
|
24
|
+
super(message);
|
|
25
|
+
this.name = 'NotFoundContainerError';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
21
29
|
export default (on: Cypress.PluginEvents): void => {
|
|
22
30
|
let dockerEnvironment: StartedDockerComposeEnvironment | null = null;
|
|
23
31
|
const containers: Containers = {};
|
|
@@ -30,7 +38,7 @@ export default (on: Cypress.PluginEvents): void => {
|
|
|
30
38
|
} else if (containers[containerName]) {
|
|
31
39
|
container = containers[containerName];
|
|
32
40
|
} else {
|
|
33
|
-
throw new
|
|
41
|
+
throw new NotFoundContainerError(`Cannot get container ${containerName}`);
|
|
34
42
|
}
|
|
35
43
|
|
|
36
44
|
return container;
|
|
@@ -52,7 +60,7 @@ export default (on: Cypress.PluginEvents): void => {
|
|
|
52
60
|
name: string;
|
|
53
61
|
}
|
|
54
62
|
|
|
55
|
-
on(
|
|
63
|
+
on("task", {
|
|
56
64
|
copyFromContainer: async ({ destination, serviceName, source }) => {
|
|
57
65
|
try {
|
|
58
66
|
const container = getContainer(serviceName);
|
|
@@ -63,11 +71,15 @@ export default (on: Cypress.PluginEvents): void => {
|
|
|
63
71
|
return new Promise<void>((resolve) => {
|
|
64
72
|
const dest = tar.extract(destination);
|
|
65
73
|
archiveStream.pipe(dest);
|
|
66
|
-
dest.on(
|
|
74
|
+
dest.on("finish", resolve);
|
|
67
75
|
});
|
|
68
76
|
});
|
|
69
77
|
} catch (error) {
|
|
70
|
-
|
|
78
|
+
if (error instanceof NotFoundContainerError) {
|
|
79
|
+
console.log(`Cannot get ${source} from container ${serviceName} because it doesn't exist.`);
|
|
80
|
+
} else {
|
|
81
|
+
console.error(error);
|
|
82
|
+
}
|
|
71
83
|
}
|
|
72
84
|
|
|
73
85
|
return null;
|
|
@@ -75,19 +87,19 @@ export default (on: Cypress.PluginEvents): void => {
|
|
|
75
87
|
copyToContainer: async ({ destination, serviceName, source, type }) => {
|
|
76
88
|
const container = getContainer(serviceName);
|
|
77
89
|
|
|
78
|
-
if (type ===
|
|
90
|
+
if (type === "directory") {
|
|
79
91
|
await container.copyDirectoriesToContainer([
|
|
80
92
|
{
|
|
81
93
|
source,
|
|
82
|
-
target: destination
|
|
83
|
-
}
|
|
94
|
+
target: destination,
|
|
95
|
+
},
|
|
84
96
|
]);
|
|
85
|
-
} else if (type ===
|
|
97
|
+
} else if (type === "file") {
|
|
86
98
|
await container.copyFilesToContainer([
|
|
87
99
|
{
|
|
88
100
|
source,
|
|
89
|
-
target: destination
|
|
90
|
-
}
|
|
101
|
+
target: destination,
|
|
102
|
+
},
|
|
91
103
|
]);
|
|
92
104
|
}
|
|
93
105
|
|
|
@@ -102,9 +114,9 @@ export default (on: Cypress.PluginEvents): void => {
|
|
|
102
114
|
},
|
|
103
115
|
execInContainer: async ({ command, name }) => {
|
|
104
116
|
const { exitCode, output } = await getContainer(name).exec([
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
`${command}${command.match(/[\n\r]/) ?
|
|
117
|
+
"bash",
|
|
118
|
+
"-c",
|
|
119
|
+
`${command}${command.match(/[\n\r]/) ? "" : " 2>&1"}`,
|
|
108
120
|
]);
|
|
109
121
|
|
|
110
122
|
return { exitCode, output };
|
|
@@ -124,35 +136,40 @@ export default (on: Cypress.PluginEvents): void => {
|
|
|
124
136
|
const loggedContainers = await dockerode.listContainers();
|
|
125
137
|
|
|
126
138
|
return loggedContainers.reduce((acc, container) => {
|
|
127
|
-
const containerName = container.Names[0].replace(
|
|
139
|
+
const containerName = container.Names[0].replace("/", "");
|
|
128
140
|
acc[containerName] = execSync(`docker logs -t ${container.Id}`, {
|
|
129
|
-
stdio:
|
|
130
|
-
}).toString(
|
|
141
|
+
stdio: "pipe",
|
|
142
|
+
}).toString("utf8");
|
|
131
143
|
|
|
132
144
|
return acc;
|
|
133
145
|
}, {});
|
|
134
146
|
} catch (error) {
|
|
135
|
-
console.warn(
|
|
147
|
+
console.warn("Cannot get containers logs");
|
|
136
148
|
console.warn(error);
|
|
137
149
|
|
|
138
150
|
return null;
|
|
139
151
|
}
|
|
140
152
|
},
|
|
153
|
+
getContainerMappedPort: async ({ containerName, containerPort }) => {
|
|
154
|
+
const container = getContainer(containerName);
|
|
155
|
+
|
|
156
|
+
return container.getMappedPort(containerPort);
|
|
157
|
+
},
|
|
141
158
|
requestOnDatabase: async ({ database, query }) => {
|
|
142
159
|
let container: StartedTestContainer | null = null;
|
|
143
160
|
|
|
144
161
|
if (dockerEnvironment !== null) {
|
|
145
|
-
container = dockerEnvironment.getContainer(
|
|
162
|
+
container = dockerEnvironment.getContainer("db-1");
|
|
146
163
|
} else {
|
|
147
|
-
container = getContainer(
|
|
164
|
+
container = getContainer("web");
|
|
148
165
|
}
|
|
149
166
|
|
|
150
167
|
const client = await createConnection({
|
|
151
168
|
database,
|
|
152
169
|
host: container.getHost(),
|
|
153
|
-
password:
|
|
170
|
+
password: "centreon",
|
|
154
171
|
port: container.getMappedPort(3306),
|
|
155
|
-
user:
|
|
172
|
+
user: "centreon",
|
|
156
173
|
});
|
|
157
174
|
|
|
158
175
|
const [rows, fields] = await client.query(query);
|
|
@@ -165,21 +182,21 @@ export default (on: Cypress.PluginEvents): void => {
|
|
|
165
182
|
command,
|
|
166
183
|
image,
|
|
167
184
|
name,
|
|
168
|
-
portBindings = []
|
|
185
|
+
portBindings = [],
|
|
169
186
|
}: StartContainerProps) => {
|
|
170
187
|
let container = await new GenericContainer(image).withName(name);
|
|
171
188
|
|
|
172
189
|
portBindings.forEach(({ source, destination }) => {
|
|
173
190
|
container = container.withExposedPorts({
|
|
174
191
|
container: source,
|
|
175
|
-
host: destination
|
|
192
|
+
host: destination,
|
|
176
193
|
});
|
|
177
194
|
});
|
|
178
195
|
|
|
179
196
|
if (command) {
|
|
180
197
|
container
|
|
181
|
-
.withCommand([
|
|
182
|
-
.withWaitStrategy(Wait.forSuccessfulCommand(
|
|
198
|
+
.withCommand(["bash", "-c", command])
|
|
199
|
+
.withWaitStrategy(Wait.forSuccessfulCommand("ls"));
|
|
183
200
|
}
|
|
184
201
|
|
|
185
202
|
containers[name] = await container.start();
|
|
@@ -192,7 +209,7 @@ export default (on: Cypress.PluginEvents): void => {
|
|
|
192
209
|
openidImage,
|
|
193
210
|
profiles,
|
|
194
211
|
samlImage,
|
|
195
|
-
webImage
|
|
212
|
+
webImage,
|
|
196
213
|
}) => {
|
|
197
214
|
try {
|
|
198
215
|
const composeFileDir = path.dirname(composeFile);
|
|
@@ -200,22 +217,22 @@ export default (on: Cypress.PluginEvents): void => {
|
|
|
200
217
|
|
|
201
218
|
dockerEnvironment = await new DockerComposeEnvironment(
|
|
202
219
|
composeFileDir,
|
|
203
|
-
composeFileName
|
|
220
|
+
composeFileName,
|
|
204
221
|
)
|
|
205
222
|
.withEnvironment({
|
|
206
223
|
MYSQL_IMAGE: databaseImage,
|
|
207
224
|
OPENID_IMAGE: openidImage,
|
|
208
225
|
SAML_IMAGE: samlImage,
|
|
209
|
-
WEB_IMAGE: webImage
|
|
226
|
+
WEB_IMAGE: webImage,
|
|
210
227
|
})
|
|
211
228
|
.withProfiles(...profiles)
|
|
212
229
|
.withStartupTimeout(120000)
|
|
213
230
|
.withWaitStrategy(
|
|
214
|
-
|
|
231
|
+
"web-1",
|
|
215
232
|
Wait.forAll([
|
|
216
233
|
Wait.forHealthCheck(),
|
|
217
|
-
Wait.forLogMessage(
|
|
218
|
-
])
|
|
234
|
+
Wait.forLogMessage("Centreon is ready"),
|
|
235
|
+
]),
|
|
219
236
|
)
|
|
220
237
|
.up();
|
|
221
238
|
|
|
@@ -252,6 +269,68 @@ export default (on: Cypress.PluginEvents): void => {
|
|
|
252
269
|
execSync(`npx wait-on ${url}`);
|
|
253
270
|
|
|
254
271
|
return null;
|
|
255
|
-
}
|
|
272
|
+
},
|
|
273
|
+
listFilesInDirectory: async ( directoryPath ) => {
|
|
274
|
+
return new Promise((resolve, reject) => {
|
|
275
|
+
fs.readdir(directoryPath, (err, files) => {
|
|
276
|
+
if (err) {
|
|
277
|
+
reject(err);
|
|
278
|
+
} else {
|
|
279
|
+
resolve(files);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
},
|
|
284
|
+
fileExists: async ( filePath ) => {
|
|
285
|
+
return fs.existsSync(filePath);
|
|
286
|
+
},
|
|
287
|
+
getExportedFile({ downloadsFolder }: { downloadsFolder: string }): string {
|
|
288
|
+
const files = fs
|
|
289
|
+
.readdirSync(downloadsFolder)
|
|
290
|
+
.filter((name) => name.startsWith("ResourceStatusExport_all") && name.endsWith(".csv"))
|
|
291
|
+
.map((name) => ({
|
|
292
|
+
name,
|
|
293
|
+
time: fs.statSync(path.join(downloadsFolder, name)).mtime.getTime()
|
|
294
|
+
}))
|
|
295
|
+
.sort((a, b) => b.time - a.time);
|
|
296
|
+
|
|
297
|
+
if (files.length === 0) {
|
|
298
|
+
throw new Error("No exported file found");
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return path.join(downloadsFolder, files[0].name);
|
|
302
|
+
},
|
|
303
|
+
readCsvFile({ filePath }: { filePath: string }): Promise<string> {
|
|
304
|
+
return new Promise((resolve, reject) => {
|
|
305
|
+
fs.readFile(filePath, "utf8", (err, data) => {
|
|
306
|
+
if (err) return reject(err);
|
|
307
|
+
resolve(data);
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
},
|
|
311
|
+
clearDownloadsFolder({ downloadsFolder }: { downloadsFolder: string }): null {
|
|
312
|
+
if (!fs.existsSync(downloadsFolder)) {
|
|
313
|
+
return null;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
const files = fs.readdirSync(downloadsFolder);
|
|
317
|
+
for (const file of files) {
|
|
318
|
+
const filePath = path.join(downloadsFolder, file);
|
|
319
|
+
fs.unlinkSync(filePath);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
return null;
|
|
323
|
+
},
|
|
324
|
+
isDownloadComplete({ downloadsFolder }: { downloadsFolder: string }): boolean {
|
|
325
|
+
if (!fs.existsSync(downloadsFolder)) return false;
|
|
326
|
+
|
|
327
|
+
const files = fs
|
|
328
|
+
.readdirSync(downloadsFolder)
|
|
329
|
+
.filter(
|
|
330
|
+
(name) => !name.endsWith(".crdownload") && !name.endsWith(".tmp")
|
|
331
|
+
);
|
|
332
|
+
|
|
333
|
+
return files.length > 0;
|
|
334
|
+
},
|
|
256
335
|
});
|
|
257
336
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@centreon/js-config",
|
|
3
3
|
"description": "Centreon Frontend shared build configuration",
|
|
4
|
-
"version": "25.
|
|
4
|
+
"version": "25.4.0-MON-191119-npm-develop.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/centreon/centreon-frontend.git"
|
|
@@ -21,16 +21,16 @@
|
|
|
21
21
|
"prettier": "^3.0.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@badeball/cypress-cucumber-preprocessor": "^
|
|
25
|
-
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.
|
|
24
|
+
"@badeball/cypress-cucumber-preprocessor": "^23.2.1",
|
|
25
|
+
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.7",
|
|
26
26
|
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
|
27
27
|
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
|
|
28
28
|
"@tsconfig/node16": "^16.1.3",
|
|
29
29
|
"@tsconfig/node20": "^20.1.4",
|
|
30
30
|
"@types/cypress-cucumber-preprocessor": "^4.0.5",
|
|
31
|
-
"cypress": "^
|
|
32
|
-
"cypress-multi-reporters": "^
|
|
33
|
-
"cypress-terminal-report": "^
|
|
31
|
+
"cypress": "^15.5.0",
|
|
32
|
+
"cypress-multi-reporters": "^2.0.5",
|
|
33
|
+
"cypress-terminal-report": "^7.3.3",
|
|
34
34
|
"cypress-wait-until": "^3.0.2",
|
|
35
35
|
"dotenv": "^16.4.5",
|
|
36
36
|
"esbuild": "^0.21.5",
|
|
@@ -6,7 +6,7 @@ const excludeNodeModulesExceptCentreonUi =
|
|
|
6
6
|
module.exports = {
|
|
7
7
|
cache: false,
|
|
8
8
|
excludeNodeModulesExceptCentreonUi,
|
|
9
|
-
getModuleConfiguration: (enableCoverage) => ({
|
|
9
|
+
getModuleConfiguration: (enableCoverage, postCssBase = './') => ({
|
|
10
10
|
rules: [
|
|
11
11
|
{
|
|
12
12
|
exclude: [excludeNodeModulesExceptCentreonUi],
|
|
@@ -51,8 +51,22 @@ module.exports = {
|
|
|
51
51
|
type: 'asset/resource'
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
|
-
test: /\.css
|
|
55
|
-
|
|
54
|
+
test: /\.css$/,
|
|
55
|
+
type: 'css/auto',
|
|
56
|
+
use: [
|
|
57
|
+
{
|
|
58
|
+
loader: 'postcss-loader',
|
|
59
|
+
options: {
|
|
60
|
+
postcssOptions: {
|
|
61
|
+
plugins: {
|
|
62
|
+
'@tailwindcss/postcss': {
|
|
63
|
+
base: postCssBase
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
]
|
|
56
70
|
}
|
|
57
71
|
]
|
|
58
72
|
}),
|
|
@@ -64,10 +78,10 @@ module.exports = {
|
|
|
64
78
|
},
|
|
65
79
|
output: {
|
|
66
80
|
chunkFilename: isDev
|
|
67
|
-
? '[name].[chunkhash:8].chunk.js'
|
|
81
|
+
? '[name].[contenthash:8].[chunkhash:8].chunk.js'
|
|
68
82
|
: '[name].[contenthash].[chunkhash].[hash].js',
|
|
69
83
|
filename: isDev
|
|
70
|
-
? '[name].[
|
|
84
|
+
? '[name].[contenthash:8].js'
|
|
71
85
|
: '[name].[contenthash].[hash].js',
|
|
72
86
|
libraryTarget: 'umd',
|
|
73
87
|
umdNamedDefine: true
|
package/rspack/base/index.js
CHANGED
|
@@ -12,10 +12,11 @@ const {
|
|
|
12
12
|
const getBaseConfiguration = ({
|
|
13
13
|
moduleName,
|
|
14
14
|
moduleFederationConfig,
|
|
15
|
-
enableCoverage
|
|
15
|
+
enableCoverage,
|
|
16
|
+
postCssBase
|
|
16
17
|
}) => ({
|
|
17
18
|
cache,
|
|
18
|
-
module: getModuleConfiguration(enableCoverage),
|
|
19
|
+
module: getModuleConfiguration(enableCoverage, postCssBase),
|
|
19
20
|
optimization,
|
|
20
21
|
output: {
|
|
21
22
|
...output,
|
|
@@ -23,51 +24,55 @@ const getBaseConfiguration = ({
|
|
|
23
24
|
library: moduleName,
|
|
24
25
|
uniqueName: moduleName
|
|
25
26
|
},
|
|
27
|
+
experiments: {
|
|
28
|
+
css: true
|
|
29
|
+
},
|
|
26
30
|
plugins: [
|
|
27
31
|
moduleName &&
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
32
|
+
new rspack.container.ModuleFederationPlugin({
|
|
33
|
+
filename: 'remoteEntry.[chunkhash:8].js',
|
|
34
|
+
library: { name: moduleName, type: 'umd' },
|
|
35
|
+
name: moduleName,
|
|
36
|
+
shared: [
|
|
37
|
+
{
|
|
38
|
+
'@centreon/ui-context': {
|
|
39
|
+
requiredVersion: '1.x',
|
|
40
|
+
singleton: true
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
jotai: {
|
|
45
|
+
requiredVersion: '2.x',
|
|
46
|
+
singleton: true
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
'jotai-suspense': {
|
|
51
|
+
singleton: true
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
react: {
|
|
56
|
+
requiredVersion: '19.x',
|
|
57
|
+
singleton: true
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
'react-i18next': {
|
|
62
|
+
requiredVersion: '15.x',
|
|
63
|
+
singleton: true
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
'react-router': {
|
|
68
|
+
requiredVersion: '7.x',
|
|
69
|
+
singleton: true
|
|
67
70
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
},
|
|
72
|
+
{ tailwindcss: { singleton: true, requiredVersion: '4.x' } }
|
|
73
|
+
],
|
|
74
|
+
...moduleFederationConfig
|
|
75
|
+
})
|
|
71
76
|
].filter(Boolean),
|
|
72
77
|
resolve: {
|
|
73
78
|
alias: {
|
package/rspack/patch/dev.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
filename: '[name].js'
|
|
10
|
-
}
|
|
11
|
-
})
|
|
2
|
+
getDevConfiguration: () => ({
|
|
3
|
+
cache: true,
|
|
4
|
+
devtool: "eval-cheap-module-source-map",
|
|
5
|
+
optimization: {
|
|
6
|
+
splitChunks: false,
|
|
7
|
+
},
|
|
8
|
+
}),
|
|
12
9
|
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const filePath = process.argv[2];
|
|
5
|
-
|
|
6
|
-
const { error: logError } = console;
|
|
7
|
-
|
|
8
|
-
try {
|
|
9
|
-
const outFile = fs.readFileSync(path.resolve(filePath)).toString();
|
|
10
|
-
const outFileJson = JSON.parse(outFile);
|
|
11
|
-
|
|
12
|
-
const coveragesWithoutNodeModules = Object.entries(outFileJson)
|
|
13
|
-
.map(([key, value]) => {
|
|
14
|
-
if (key.includes('node_modules')) {
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return [key, value];
|
|
19
|
-
})
|
|
20
|
-
.filter((v) => v);
|
|
21
|
-
|
|
22
|
-
const finalOutJson = coveragesWithoutNodeModules.reduce(
|
|
23
|
-
(acc, [key, value]) => ({
|
|
24
|
-
...acc,
|
|
25
|
-
[key]: value
|
|
26
|
-
}),
|
|
27
|
-
{}
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
fs.writeFileSync(
|
|
31
|
-
path.resolve(filePath),
|
|
32
|
-
JSON.stringify(finalOutJson, null, 2)
|
|
33
|
-
);
|
|
34
|
-
} catch (error) {
|
|
35
|
-
logError(error.message);
|
|
36
|
-
}
|