@centreon/js-config 23.10.20 → 23.10.21
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/configuration.js +2 -10
- package/cypress/component/enableVisualTesting.ts +1 -1
- package/cypress/e2e/commands.ts +21 -134
- package/cypress/e2e/configuration.ts +1 -1
- package/eslint/base.typescript.eslintrc.js +3 -15
- package/jest/index.js +1 -5
- package/package.json +1 -3
- package/tsconfig/index.json +4 -5
- package/webpack/base/index.js +57 -14
- package/eslint/lambda/typescript.eslintrc.js +0 -48
- package/jest/lambda/typescript.js +0 -49
- package/tsconfig/lambda/tsconfig.json +0 -14
- package/webpack/base/globalConfig.js +0 -71
|
@@ -4,24 +4,16 @@ const {
|
|
|
4
4
|
addMatchImageSnapshotPlugin
|
|
5
5
|
} = require('@simonsmith/cypress-image-snapshot/plugin');
|
|
6
6
|
|
|
7
|
-
module.exports = ({
|
|
8
|
-
webpackConfig,
|
|
9
|
-
cypressFolder,
|
|
10
|
-
specPattern,
|
|
11
|
-
env,
|
|
12
|
-
useVite = false,
|
|
13
|
-
excludeSpecPattern
|
|
14
|
-
}) => {
|
|
7
|
+
module.exports = ({ webpackConfig, cypressFolder, specPattern, env }) => {
|
|
15
8
|
const mainCypressFolder = cypressFolder || 'cypress';
|
|
16
9
|
|
|
17
10
|
return defineConfig({
|
|
18
11
|
component: {
|
|
19
12
|
devServer: {
|
|
20
|
-
bundler:
|
|
13
|
+
bundler: 'webpack',
|
|
21
14
|
framework: 'react',
|
|
22
15
|
webpackConfig
|
|
23
16
|
},
|
|
24
|
-
excludeSpecPattern,
|
|
25
17
|
setupNodeEvents: (on, config) => {
|
|
26
18
|
addMatchImageSnapshotPlugin(on, config);
|
|
27
19
|
},
|
|
@@ -13,7 +13,7 @@ const enableVisualTesting = (cypressFolder = 'cypress'): void => {
|
|
|
13
13
|
capture: 'viewport',
|
|
14
14
|
customDiffConfig: { threshold: 0.01 },
|
|
15
15
|
customSnapshotsDir: `${cypressFolder}/visual-testing-snapshots`,
|
|
16
|
-
failureThreshold: 0.
|
|
16
|
+
failureThreshold: 0.06,
|
|
17
17
|
failureThresholdType: 'percent'
|
|
18
18
|
});
|
|
19
19
|
};
|
package/cypress/e2e/commands.ts
CHANGED
|
@@ -4,8 +4,6 @@ import './commands/configuration';
|
|
|
4
4
|
|
|
5
5
|
const apiLoginV2 = '/centreon/authentication/providers/configurations/local';
|
|
6
6
|
|
|
7
|
-
const artifactIllegalCharactersMatcher = /[,\s/|<>*?:"]/g;
|
|
8
|
-
|
|
9
7
|
Cypress.Commands.add('getWebVersion', (): Cypress.Chainable => {
|
|
10
8
|
return cy
|
|
11
9
|
.exec(
|
|
@@ -23,7 +21,7 @@ Cypress.Commands.add('getWebVersion', (): Cypress.Chainable => {
|
|
|
23
21
|
|
|
24
22
|
Cypress.Commands.add('getIframeBody', (): Cypress.Chainable => {
|
|
25
23
|
return cy
|
|
26
|
-
.get('iframe#main-content'
|
|
24
|
+
.get('iframe#main-content')
|
|
27
25
|
.its('0.contentDocument.body')
|
|
28
26
|
.should('not.be.empty')
|
|
29
27
|
.then(cy.wrap);
|
|
@@ -39,13 +37,6 @@ Cypress.Commands.add(
|
|
|
39
37
|
}
|
|
40
38
|
);
|
|
41
39
|
|
|
42
|
-
Cypress.Commands.add(
|
|
43
|
-
'clickSubRootMenuItem',
|
|
44
|
-
(page: string): Cypress.Chainable => {
|
|
45
|
-
return cy.get('div[data-cy="collapse"]').eq(1).contains(page).click();
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
|
|
49
40
|
interface NavigateToProps {
|
|
50
41
|
page: string;
|
|
51
42
|
rootItemNumber: number;
|
|
@@ -58,13 +49,8 @@ Cypress.Commands.add(
|
|
|
58
49
|
if (subMenu) {
|
|
59
50
|
cy.hoverRootMenuItem(rootItemNumber)
|
|
60
51
|
.contains(subMenu)
|
|
61
|
-
.trigger('mouseover')
|
|
62
|
-
|
|
63
|
-
.find('div[data-cy="collapse"]')
|
|
64
|
-
.should('be.visible')
|
|
65
|
-
.and('contain', page);
|
|
66
|
-
|
|
67
|
-
cy.clickSubRootMenuItem(page);
|
|
52
|
+
.trigger('mouseover', { force: true });
|
|
53
|
+
cy.contains(page).click({ force: true });
|
|
68
54
|
|
|
69
55
|
return;
|
|
70
56
|
}
|
|
@@ -97,35 +83,29 @@ Cypress.Commands.add(
|
|
|
97
83
|
|
|
98
84
|
interface CopyFromContainerProps {
|
|
99
85
|
destination: string;
|
|
100
|
-
name?: string;
|
|
101
86
|
source: string;
|
|
102
87
|
}
|
|
103
88
|
|
|
104
89
|
Cypress.Commands.add(
|
|
105
90
|
'copyFromContainer',
|
|
106
|
-
({
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}: CopyFromContainerProps) => {
|
|
111
|
-
return cy.exec(`docker cp ${name}:${source} "${destination}"`);
|
|
91
|
+
({ source, destination }: CopyFromContainerProps) => {
|
|
92
|
+
return cy.exec(
|
|
93
|
+
`docker cp ${Cypress.env('dockerName')}:${source} "${destination}"`
|
|
94
|
+
);
|
|
112
95
|
}
|
|
113
96
|
);
|
|
114
97
|
|
|
115
98
|
interface CopyToContainerProps {
|
|
116
99
|
destination: string;
|
|
117
|
-
name?: string;
|
|
118
100
|
source: string;
|
|
119
101
|
}
|
|
120
102
|
|
|
121
103
|
Cypress.Commands.add(
|
|
122
104
|
'copyToContainer',
|
|
123
|
-
({
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}: CopyToContainerProps) => {
|
|
128
|
-
return cy.exec(`docker cp ${source} ${name}:${destination}`);
|
|
105
|
+
({ source, destination }: CopyToContainerProps) => {
|
|
106
|
+
return cy.exec(
|
|
107
|
+
`docker cp ${source} ${Cypress.env('dockerName')}:${destination}`
|
|
108
|
+
);
|
|
129
109
|
}
|
|
130
110
|
);
|
|
131
111
|
|
|
@@ -216,28 +196,8 @@ Cypress.Commands.add(
|
|
|
216
196
|
'startContainer',
|
|
217
197
|
({ name, image, portBindings }: StartContainerProps): Cypress.Chainable => {
|
|
218
198
|
return cy
|
|
219
|
-
.exec(
|
|
220
|
-
.
|
|
221
|
-
if (
|
|
222
|
-
stdout.match(
|
|
223
|
-
new RegExp(
|
|
224
|
-
`^${image.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')}`,
|
|
225
|
-
'm'
|
|
226
|
-
)
|
|
227
|
-
)
|
|
228
|
-
) {
|
|
229
|
-
cy.log(`Local docker image found : ${image}`);
|
|
230
|
-
|
|
231
|
-
return cy.wrap(image);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
cy.log(`Pulling remote docker image : ${image}`);
|
|
235
|
-
|
|
236
|
-
return cy.exec(`docker pull ${image}`).then(() => cy.wrap(image));
|
|
237
|
-
})
|
|
238
|
-
.then((imageName) =>
|
|
239
|
-
cy.task('startContainer', { image: imageName, name, portBindings })
|
|
240
|
-
);
|
|
199
|
+
.exec(`docker image inspect ${image} || docker pull ${image}`)
|
|
200
|
+
.task('startContainer', { image, name, portBindings });
|
|
241
201
|
}
|
|
242
202
|
);
|
|
243
203
|
|
|
@@ -252,7 +212,7 @@ Cypress.Commands.add(
|
|
|
252
212
|
'startWebContainer',
|
|
253
213
|
({
|
|
254
214
|
name = Cypress.env('dockerName'),
|
|
255
|
-
os =
|
|
215
|
+
os = 'alma9',
|
|
256
216
|
useSlim = true,
|
|
257
217
|
version = Cypress.env('WEB_IMAGE_VERSION')
|
|
258
218
|
}: StartWebContainerProps = {}): Cypress.Chainable => {
|
|
@@ -289,47 +249,25 @@ Cypress.Commands.add(
|
|
|
289
249
|
({
|
|
290
250
|
name = Cypress.env('dockerName')
|
|
291
251
|
}: StopWebContainerProps = {}): Cypress.Chainable => {
|
|
292
|
-
const logDirectory = `cypress/results/logs/${
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
)}/${Cypress.currentTest.title.replace(
|
|
296
|
-
artifactIllegalCharactersMatcher,
|
|
297
|
-
'_'
|
|
298
|
-
)}`;
|
|
252
|
+
const logDirectory = `cypress/results/logs/${
|
|
253
|
+
Cypress.spec.name
|
|
254
|
+
}/${Cypress.currentTest.title.replace(/,|\s|\//g, '_')}`;
|
|
299
255
|
|
|
300
256
|
return cy
|
|
301
257
|
.visitEmptyPage()
|
|
302
258
|
.exec(`mkdir -p "${logDirectory}"`)
|
|
303
259
|
.copyFromContainer({
|
|
304
260
|
destination: `${logDirectory}/broker`,
|
|
305
|
-
name,
|
|
306
261
|
source: '/var/log/centreon-broker'
|
|
307
262
|
})
|
|
308
263
|
.copyFromContainer({
|
|
309
264
|
destination: `${logDirectory}/engine`,
|
|
310
|
-
name,
|
|
311
265
|
source: '/var/log/centreon-engine'
|
|
312
266
|
})
|
|
313
267
|
.copyFromContainer({
|
|
314
268
|
destination: `${logDirectory}/centreon`,
|
|
315
|
-
name,
|
|
316
269
|
source: '/var/log/centreon'
|
|
317
270
|
})
|
|
318
|
-
.then(() => {
|
|
319
|
-
if (Cypress.env('WEB_IMAGE_OS').includes('alma')) {
|
|
320
|
-
return cy.copyFromContainer({
|
|
321
|
-
destination: `${logDirectory}/php`,
|
|
322
|
-
name,
|
|
323
|
-
source: '/var/log/php-fpm'
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
return cy.copyFromContainer({
|
|
328
|
-
destination: `${logDirectory}/php8.1-fpm-centreon-error.log`,
|
|
329
|
-
name,
|
|
330
|
-
source: '/var/log/php8.1-fpm-centreon-error.log'
|
|
331
|
-
});
|
|
332
|
-
})
|
|
333
271
|
.stopContainer({ name });
|
|
334
272
|
}
|
|
335
273
|
);
|
|
@@ -343,11 +281,10 @@ Cypress.Commands.add(
|
|
|
343
281
|
({ name }: StopContainerProps): Cypress.Chainable => {
|
|
344
282
|
cy.exec(`docker logs ${name}`).then(({ stdout }) => {
|
|
345
283
|
cy.writeFile(
|
|
346
|
-
`cypress/results/logs/${
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
artifactIllegalCharactersMatcher,
|
|
284
|
+
`cypress/results/logs/${
|
|
285
|
+
Cypress.spec.name
|
|
286
|
+
}/${Cypress.currentTest.title.replace(
|
|
287
|
+
/,|\s|\//g,
|
|
351
288
|
'_'
|
|
352
289
|
)}/container-${name}.log`,
|
|
353
290
|
stdout
|
|
@@ -358,56 +295,9 @@ Cypress.Commands.add(
|
|
|
358
295
|
}
|
|
359
296
|
);
|
|
360
297
|
|
|
361
|
-
interface Dashboard {
|
|
362
|
-
description?: string;
|
|
363
|
-
name: string;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
Cypress.Commands.add(
|
|
367
|
-
'insertDashboardList',
|
|
368
|
-
(fixtureFile: string): Cypress.Chainable => {
|
|
369
|
-
return cy.fixture(fixtureFile).then((dashboardList) => {
|
|
370
|
-
cy.wrap(
|
|
371
|
-
Promise.all(
|
|
372
|
-
dashboardList.map((dashboardBody: Dashboard) =>
|
|
373
|
-
cy.insertDashboard({ ...dashboardBody })
|
|
374
|
-
)
|
|
375
|
-
)
|
|
376
|
-
);
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
);
|
|
380
|
-
|
|
381
|
-
Cypress.Commands.add(
|
|
382
|
-
'insertDashboard',
|
|
383
|
-
(dashboardBody: Dashboard): Cypress.Chainable => {
|
|
384
|
-
return cy.request({
|
|
385
|
-
body: {
|
|
386
|
-
...dashboardBody
|
|
387
|
-
},
|
|
388
|
-
method: 'POST',
|
|
389
|
-
url: '/centreon/api/latest/configuration/dashboards'
|
|
390
|
-
});
|
|
391
|
-
}
|
|
392
|
-
);
|
|
393
|
-
|
|
394
|
-
Cypress.Commands.add('getTimeFromHeader', (): Cypress.Chainable => {
|
|
395
|
-
return cy.waitUntil(() => {
|
|
396
|
-
return cy.get('header div[data-cy="clock"]').then(($time) => {
|
|
397
|
-
const headerTime = $time.children()[1].textContent;
|
|
398
|
-
if (headerTime?.match(/\d+:\d+/)) {
|
|
399
|
-
return headerTime;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
return false;
|
|
403
|
-
});
|
|
404
|
-
});
|
|
405
|
-
});
|
|
406
|
-
|
|
407
298
|
declare global {
|
|
408
299
|
namespace Cypress {
|
|
409
300
|
interface Chainable {
|
|
410
|
-
clickSubRootMenuItem: (page: string) => Cypress.Chainable;
|
|
411
301
|
copyFromContainer: (props: CopyFromContainerProps) => Cypress.Chainable;
|
|
412
302
|
copyToContainer: (props: CopyToContainerProps) => Cypress.Chainable;
|
|
413
303
|
execInContainer: ({
|
|
@@ -415,11 +305,8 @@ declare global {
|
|
|
415
305
|
name
|
|
416
306
|
}: ExecInContainerProps) => Cypress.Chainable;
|
|
417
307
|
getIframeBody: () => Cypress.Chainable;
|
|
418
|
-
getTimeFromHeader: () => Cypress.Chainable;
|
|
419
308
|
getWebVersion: () => Cypress.Chainable;
|
|
420
309
|
hoverRootMenuItem: (rootItemNumber: number) => Cypress.Chainable;
|
|
421
|
-
insertDashboard: (dashboard: Dashboard) => Cypress.Chainable;
|
|
422
|
-
insertDashboardList: (fixtureFile: string) => Cypress.Chainable;
|
|
423
310
|
loginByTypeOfUser: ({
|
|
424
311
|
jsonName = 'admin',
|
|
425
312
|
loginViaApi = false
|
|
@@ -21,15 +21,11 @@ module.exports = {
|
|
|
21
21
|
}
|
|
22
22
|
],
|
|
23
23
|
'@typescript-eslint/camelcase': 'off',
|
|
24
|
-
'@typescript-eslint/consistent-type-definitions': [
|
|
25
|
-
'@typescript-eslint/explicit-function-return-type': [
|
|
24
|
+
'@typescript-eslint/consistent-type-definitions': [
|
|
26
25
|
'error',
|
|
27
|
-
|
|
28
|
-
allowExpressions: true,
|
|
29
|
-
allowHigherOrderFunctions: true,
|
|
30
|
-
allowTypedFunctionExpressions: true
|
|
31
|
-
}
|
|
26
|
+
'interface'
|
|
32
27
|
],
|
|
28
|
+
'@typescript-eslint/explicit-function-return-type': ['error'],
|
|
33
29
|
'@typescript-eslint/explicit-member-accessibility': [
|
|
34
30
|
'error',
|
|
35
31
|
{
|
|
@@ -80,21 +76,13 @@ module.exports = {
|
|
|
80
76
|
}
|
|
81
77
|
],
|
|
82
78
|
camelcase: 'off',
|
|
83
|
-
'import/no-cycle': 'off',
|
|
84
|
-
'import/no-named-as-default': 'warn',
|
|
85
79
|
'no-shadow': 'off',
|
|
86
80
|
'no-unused-expressions': 'off'
|
|
87
81
|
},
|
|
88
82
|
settings: {
|
|
89
|
-
'import/parsers': {
|
|
90
|
-
'@typescript-eslint/parser': ['.ts', '.tsx']
|
|
91
|
-
},
|
|
92
83
|
'import/resolver': {
|
|
93
84
|
alias: {
|
|
94
85
|
extensions: ['.ts', '.tsx', '.js', '.jsx']
|
|
95
|
-
},
|
|
96
|
-
typescript: {
|
|
97
|
-
alwaysTryTypes: true
|
|
98
86
|
}
|
|
99
87
|
}
|
|
100
88
|
}
|
package/jest/index.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
moduleNameMapper: {
|
|
3
3
|
'\\.(s?css|png|svg|jpg)$': 'identity-obj-proxy',
|
|
4
|
-
'^.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$':
|
|
5
|
-
'jest-transform-stub',
|
|
6
4
|
'^react($|/.+)': '<rootDir>/node_modules/react$1'
|
|
7
5
|
},
|
|
8
6
|
setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect'],
|
|
9
7
|
testEnvironment: 'jsdom',
|
|
10
|
-
testPathIgnorePatterns: ['/node_modules/'
|
|
8
|
+
testPathIgnorePatterns: ['/node_modules/'],
|
|
11
9
|
transform: {
|
|
12
|
-
'.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$':
|
|
13
|
-
'jest-transform-stub',
|
|
14
10
|
'^.+\\.[jt]sx?$': [
|
|
15
11
|
'@swc/jest',
|
|
16
12
|
{
|
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": "23.10.
|
|
4
|
+
"version": "23.10.21",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/centreon/centreon-frontend.git"
|
|
@@ -17,14 +17,12 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@badeball/cypress-cucumber-preprocessor": "^14.0.0",
|
|
20
|
-
"@tsconfig/node16": "^1.0.4",
|
|
21
20
|
"@types/dockerode": "^3.3.16",
|
|
22
21
|
"dockerode": "^3.3.5",
|
|
23
22
|
"eslint": "^8.17.0",
|
|
24
23
|
"eslint-config-airbnb": "19.0.4",
|
|
25
24
|
"eslint-config-prettier": "^8.5.0",
|
|
26
25
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
27
|
-
"eslint-import-resolver-typescript": "^3.5.5",
|
|
28
26
|
"eslint-plugin-babel": "^5.3.1",
|
|
29
27
|
"eslint-plugin-hooks": "^0.4.3",
|
|
30
28
|
"eslint-plugin-import": "^2.26.0",
|
package/tsconfig/index.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"moduleResolution": "
|
|
3
|
+
"moduleResolution": "node",
|
|
4
4
|
"downlevelIteration": true,
|
|
5
|
-
"module": "
|
|
6
|
-
"target": "
|
|
5
|
+
"module": "es6",
|
|
6
|
+
"target": "es6",
|
|
7
7
|
"jsx": "react-jsx",
|
|
8
8
|
"strict": true,
|
|
9
9
|
"noImplicitAny": false,
|
|
10
10
|
"skipLibCheck": true,
|
|
11
|
-
"esModuleInterop": true
|
|
12
|
-
"resolveJsonModule": true
|
|
11
|
+
"esModuleInterop": true
|
|
13
12
|
}
|
|
14
13
|
}
|
package/webpack/base/index.js
CHANGED
|
@@ -3,22 +3,68 @@ const path = require('path');
|
|
|
3
3
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
|
4
4
|
const { ModuleFederationPlugin } = require('webpack').container;
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
optimization,
|
|
9
|
-
output,
|
|
10
|
-
cache
|
|
11
|
-
} = require('./globalConfig');
|
|
6
|
+
const excludeNodeModulesExceptCentreonUi =
|
|
7
|
+
/node_modules(\\|\/)\.pnpm(\\|\/)(?!(@centreon))/;
|
|
12
8
|
|
|
13
9
|
const getBaseConfiguration = ({
|
|
14
10
|
moduleName,
|
|
15
11
|
moduleFederationConfig,
|
|
16
12
|
jscTransformConfiguration
|
|
17
13
|
}) => ({
|
|
18
|
-
cache,
|
|
19
|
-
module:
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
cache: false,
|
|
15
|
+
module: {
|
|
16
|
+
rules: [
|
|
17
|
+
{
|
|
18
|
+
parser: { system: false },
|
|
19
|
+
test: /\.[cm]?(j|t)sx?$/
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
exclude: excludeNodeModulesExceptCentreonUi,
|
|
23
|
+
test: /\.[jt]sx?$/,
|
|
24
|
+
use: {
|
|
25
|
+
loader: 'swc-loader',
|
|
26
|
+
options: {
|
|
27
|
+
jsc: {
|
|
28
|
+
parser: {
|
|
29
|
+
syntax: 'typescript',
|
|
30
|
+
tsx: true
|
|
31
|
+
},
|
|
32
|
+
transform: jscTransformConfiguration
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
test: /\.icon.svg$/,
|
|
39
|
+
use: ['@svgr/webpack']
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
exclude: excludeNodeModulesExceptCentreonUi,
|
|
43
|
+
test: /\.(bmp|png|jpg|jpeg|gif|svg)$/,
|
|
44
|
+
use: [
|
|
45
|
+
{
|
|
46
|
+
loader: 'url-loader',
|
|
47
|
+
options: {
|
|
48
|
+
limit: 10000,
|
|
49
|
+
name: '[name].[hash:8].[ext]'
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
optimization: {
|
|
57
|
+
splitChunks: {
|
|
58
|
+
chunks: 'all',
|
|
59
|
+
maxSize: 400 * 1024
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
output: {
|
|
63
|
+
chunkFilename: '[name].[chunkhash:8].chunk.js',
|
|
64
|
+
filename: '[name].[chunkhash:8].js',
|
|
65
|
+
libraryTarget: 'umd',
|
|
66
|
+
umdNamedDefine: true
|
|
67
|
+
},
|
|
22
68
|
plugins: [
|
|
23
69
|
new CleanWebpackPlugin(),
|
|
24
70
|
moduleName &&
|
|
@@ -75,10 +121,7 @@ const getBaseConfiguration = ({
|
|
|
75
121
|
].filter(Boolean),
|
|
76
122
|
resolve: {
|
|
77
123
|
alias: {
|
|
78
|
-
react: path.resolve('./node_modules/react')
|
|
79
|
-
'@centreon/ui/fonts': path.resolve(
|
|
80
|
-
'./node_modules/@centreon/ui/public/fonts'
|
|
81
|
-
)
|
|
124
|
+
react: path.resolve('./node_modules/react')
|
|
82
125
|
},
|
|
83
126
|
extensions: ['.js', '.jsx', '.ts', '.tsx']
|
|
84
127
|
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extends: [ '../node/typescript.eslintrc.js'],
|
|
3
|
-
overrides: [
|
|
4
|
-
{
|
|
5
|
-
files: ["*.spec.js", "*.test.ts", "*.tests.ts"],
|
|
6
|
-
rules: {
|
|
7
|
-
"import/first": 0,
|
|
8
|
-
"import/order": 0,
|
|
9
|
-
"@typescript-eslint/ban-ts-comment": 0,
|
|
10
|
-
"@typescript-eslint/no-explicit-any": 0
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
],
|
|
14
|
-
rules: {
|
|
15
|
-
"import/extensions": ["off"],
|
|
16
|
-
"no-console": "off",
|
|
17
|
-
"no-underscore-dangle": "off",
|
|
18
|
-
"class-methods-use-this": "off",
|
|
19
|
-
"@typescript-eslint/naming-convention": [
|
|
20
|
-
"error",
|
|
21
|
-
{
|
|
22
|
-
format: ["camelCase", "PascalCase", "UPPER_CASE"],
|
|
23
|
-
selector: "variable"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
filter: {
|
|
27
|
-
match: false,
|
|
28
|
-
regex: "(__esModule|.+-.+)"
|
|
29
|
-
},
|
|
30
|
-
format: ["snake_case", "camelCase", "PascalCase", "UPPER_CASE"],
|
|
31
|
-
selector: "property",
|
|
32
|
-
leadingUnderscore: "allow"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
filter: {
|
|
36
|
-
match: false,
|
|
37
|
-
regex: "^_$"
|
|
38
|
-
},
|
|
39
|
-
format: ["snake_case", "camelCase", "PascalCase"],
|
|
40
|
-
selector: "parameter"
|
|
41
|
-
}
|
|
42
|
-
],
|
|
43
|
-
"@typescript-eslint/require-array-sort-compare": "error"
|
|
44
|
-
},
|
|
45
|
-
parserOptions: {
|
|
46
|
-
project: ["./tsconfig.json"]
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2023 Centreon Team
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
// For a detailed explanation regarding each configuration property, visit:
|
|
18
|
-
// https://jestjs.io/docs/en/configuration.html
|
|
19
|
-
const path = require('path');
|
|
20
|
-
|
|
21
|
-
const rootPath = path.join(__dirname);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
module.exports = {
|
|
26
|
-
rootDir: rootPath,
|
|
27
|
-
// Automatically clear mock calls and instances between every test
|
|
28
|
-
clearMocks: true,
|
|
29
|
-
// The directory where Jest should output its coverage files
|
|
30
|
-
coverageDirectory: '<rootDir>/coverage',
|
|
31
|
-
// An array of regexp pattern strings used to skip coverage collection
|
|
32
|
-
coveragePathIgnorePatterns: ['\\\\node_modules\\\\', 'tests'],
|
|
33
|
-
|
|
34
|
-
// An array of file extensions your modules use
|
|
35
|
-
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
|
36
|
-
|
|
37
|
-
// Automatically reset mock state between every test
|
|
38
|
-
// resetMocks: true,
|
|
39
|
-
|
|
40
|
-
testMatch: ['**/*.(test|tests|spec|specs).+(ts|tsx|js)'],
|
|
41
|
-
|
|
42
|
-
// This option allows the use of a custom results processor
|
|
43
|
-
// testResultsProcessor: 'jest-sonar-reporter',
|
|
44
|
-
|
|
45
|
-
// A map from regular expressions to paths to transformers
|
|
46
|
-
transform: {
|
|
47
|
-
'^.+\\.(ts|tsx)$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.json' }],
|
|
48
|
-
},
|
|
49
|
-
};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
const excludeNodeModulesExceptCentreonUi =
|
|
2
|
-
/node_modules(\\|\/)\.pnpm(\\|\/)(?!(@centreon))/;
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
cache: false,
|
|
6
|
-
excludeNodeModulesExceptCentreonUi,
|
|
7
|
-
getModuleConfiguration: (jscTransformConfiguration) => ({
|
|
8
|
-
rules: [
|
|
9
|
-
{
|
|
10
|
-
parser: { system: false },
|
|
11
|
-
test: /\.[cm]?(j|t)sx?$/
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
exclude: [excludeNodeModulesExceptCentreonUi],
|
|
15
|
-
test: /\.[jt]sx?$/,
|
|
16
|
-
use: {
|
|
17
|
-
loader: 'swc-loader',
|
|
18
|
-
options: {
|
|
19
|
-
jsc: {
|
|
20
|
-
parser: {
|
|
21
|
-
syntax: 'typescript',
|
|
22
|
-
tsx: true
|
|
23
|
-
},
|
|
24
|
-
transform: jscTransformConfiguration
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
test: /\.icon.svg$/,
|
|
31
|
-
use: ['@svgr/webpack']
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
exclude: excludeNodeModulesExceptCentreonUi,
|
|
35
|
-
test: /\.(bmp|png|jpg|jpeg|gif|svg)$/,
|
|
36
|
-
use: [
|
|
37
|
-
{
|
|
38
|
-
loader: 'url-loader',
|
|
39
|
-
options: {
|
|
40
|
-
limit: 10000,
|
|
41
|
-
name: '[name].[hash:8].[ext]'
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
]
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
generator: {
|
|
48
|
-
filename: '[name][ext]'
|
|
49
|
-
},
|
|
50
|
-
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
|
51
|
-
type: 'asset/resource'
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
test: /\.css$/i,
|
|
55
|
-
use: ['style-loader', 'css-loader']
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
}),
|
|
59
|
-
optimization: {
|
|
60
|
-
splitChunks: {
|
|
61
|
-
chunks: 'all',
|
|
62
|
-
maxSize: 400 * 1024
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
output: {
|
|
66
|
-
chunkFilename: '[name].[chunkhash:8].chunk.js',
|
|
67
|
-
filename: '[name].[chunkhash:8].js',
|
|
68
|
-
libraryTarget: 'umd',
|
|
69
|
-
umdNamedDefine: true
|
|
70
|
-
}
|
|
71
|
-
};
|