@centreon/js-config 24.4.27 → 24.4.29
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 +14 -53
- package/cypress/component/configuration.js +2 -15
- package/cypress/e2e/commands/configuration.ts +0 -324
- package/cypress/e2e/commands.ts +149 -460
- package/cypress/e2e/configuration.ts +7 -14
- package/cypress/e2e/plugins.ts +1 -1
- package/cypress/e2e/tasks.ts +53 -206
- package/jest/index.js +1 -0
- package/package.json +57 -64
- package/webpack/base/globalConfig.js +2 -7
- package/webpack/base/index.js +5 -5
- package/cypress/component/excludeNodeModulesFromCoverage.js +0 -36
- package/tsconfig/lambda/node20.tsconfig.json +0 -12
|
@@ -5,7 +5,6 @@ import { execSync } from 'child_process';
|
|
|
5
5
|
|
|
6
6
|
import { defineConfig } from 'cypress';
|
|
7
7
|
import installLogsPrinter from 'cypress-terminal-report/src/installLogsPrinter';
|
|
8
|
-
import { config as configDotenv } from 'dotenv';
|
|
9
8
|
|
|
10
9
|
import esbuildPreprocessor from './esbuild-preprocessor';
|
|
11
10
|
import plugins from './plugins';
|
|
@@ -13,8 +12,8 @@ import tasks from './tasks';
|
|
|
13
12
|
|
|
14
13
|
interface ConfigurationOptions {
|
|
15
14
|
cypressFolder?: string;
|
|
15
|
+
dockerName?: string;
|
|
16
16
|
env?: Record<string, unknown>;
|
|
17
|
-
envFile?: string;
|
|
18
17
|
isDevelopment?: boolean;
|
|
19
18
|
specPattern: string;
|
|
20
19
|
}
|
|
@@ -23,13 +22,9 @@ export default ({
|
|
|
23
22
|
specPattern,
|
|
24
23
|
cypressFolder,
|
|
25
24
|
isDevelopment,
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
dockerName,
|
|
26
|
+
env
|
|
28
27
|
}: ConfigurationOptions): Cypress.ConfigOptions => {
|
|
29
|
-
if (envFile) {
|
|
30
|
-
configDotenv({ path: envFile });
|
|
31
|
-
}
|
|
32
|
-
|
|
33
28
|
const resultsFolder = `${cypressFolder || '.'}/results`;
|
|
34
29
|
|
|
35
30
|
const webImageVersion = execSync('git rev-parse --abbrev-ref HEAD')
|
|
@@ -39,7 +34,6 @@ export default ({
|
|
|
39
34
|
return defineConfig({
|
|
40
35
|
chromeWebSecurity: false,
|
|
41
36
|
defaultCommandTimeout: 6000,
|
|
42
|
-
downloadsFolder: `${resultsFolder}/downloads`,
|
|
43
37
|
e2e: {
|
|
44
38
|
excludeSpecPattern: ['*.js', '*.ts', '*.md'],
|
|
45
39
|
fixturesFolder: 'fixtures',
|
|
@@ -59,17 +53,16 @@ export default ({
|
|
|
59
53
|
},
|
|
60
54
|
env: {
|
|
61
55
|
...env,
|
|
62
|
-
|
|
63
|
-
OPENID_IMAGE_VERSION: process.env.MAJOR || '24.04',
|
|
64
|
-
SAML_IMAGE_VERSION: process.env.MAJOR || '24.04',
|
|
56
|
+
OPENID_IMAGE_VERSION: '23.04',
|
|
65
57
|
WEB_IMAGE_OS: 'alma9',
|
|
66
|
-
WEB_IMAGE_VERSION: webImageVersion
|
|
58
|
+
WEB_IMAGE_VERSION: webImageVersion,
|
|
59
|
+
dockerName: dockerName || 'centreon-dev'
|
|
67
60
|
},
|
|
68
61
|
execTimeout: 60000,
|
|
69
62
|
requestTimeout: 10000,
|
|
70
63
|
retries: 0,
|
|
71
64
|
screenshotsFolder: `${resultsFolder}/screenshots`,
|
|
72
|
-
video:
|
|
65
|
+
video: true,
|
|
73
66
|
videoCompression: 0,
|
|
74
67
|
videosFolder: `${resultsFolder}/videos`
|
|
75
68
|
});
|
package/cypress/e2e/plugins.ts
CHANGED
package/cypress/e2e/tasks.ts
CHANGED
|
@@ -1,40 +1,10 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
1
|
import { execSync } from 'child_process';
|
|
3
2
|
import { existsSync, mkdirSync } from 'fs';
|
|
4
|
-
import path from 'path';
|
|
5
3
|
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
DockerComposeEnvironment,
|
|
9
|
-
GenericContainer,
|
|
10
|
-
StartedDockerComposeEnvironment,
|
|
11
|
-
StartedTestContainer,
|
|
12
|
-
Wait,
|
|
13
|
-
getContainerRuntimeClient
|
|
14
|
-
} from 'testcontainers';
|
|
15
|
-
import { createConnection } from 'mysql2/promise';
|
|
16
|
-
|
|
17
|
-
interface Containers {
|
|
18
|
-
[key: string]: StartedTestContainer;
|
|
19
|
-
}
|
|
4
|
+
import Docker from 'dockerode';
|
|
20
5
|
|
|
21
6
|
export default (on: Cypress.PluginEvents): void => {
|
|
22
|
-
|
|
23
|
-
const containers: Containers = {};
|
|
24
|
-
|
|
25
|
-
const getContainer = (containerName): StartedTestContainer => {
|
|
26
|
-
let container;
|
|
27
|
-
|
|
28
|
-
if (dockerEnvironment !== null) {
|
|
29
|
-
container = dockerEnvironment.getContainer(`${containerName}-1`);
|
|
30
|
-
} else if (containers[containerName]) {
|
|
31
|
-
container = containers[containerName];
|
|
32
|
-
} else {
|
|
33
|
-
throw new Error(`Cannot get container ${containerName}`);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return container;
|
|
37
|
-
};
|
|
7
|
+
const docker = new Docker();
|
|
38
8
|
|
|
39
9
|
interface PortBinding {
|
|
40
10
|
destination: number;
|
|
@@ -42,7 +12,6 @@ export default (on: Cypress.PluginEvents): void => {
|
|
|
42
12
|
}
|
|
43
13
|
|
|
44
14
|
interface StartContainerProps {
|
|
45
|
-
command?: string;
|
|
46
15
|
image: string;
|
|
47
16
|
name: string;
|
|
48
17
|
portBindings: Array<PortBinding>;
|
|
@@ -53,48 +22,6 @@ export default (on: Cypress.PluginEvents): void => {
|
|
|
53
22
|
}
|
|
54
23
|
|
|
55
24
|
on('task', {
|
|
56
|
-
copyFromContainer: async ({ destination, serviceName, source }) => {
|
|
57
|
-
try {
|
|
58
|
-
if (dockerEnvironment !== null) {
|
|
59
|
-
const container = dockerEnvironment.getContainer(`${serviceName}-1`);
|
|
60
|
-
|
|
61
|
-
await container
|
|
62
|
-
.copyArchiveFromContainer(source)
|
|
63
|
-
.then((archiveStream) => {
|
|
64
|
-
return new Promise<void>((resolve) => {
|
|
65
|
-
const dest = tar.extract(destination);
|
|
66
|
-
archiveStream.pipe(dest);
|
|
67
|
-
dest.on('finish', resolve);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
} catch (error) {
|
|
72
|
-
console.error(error);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return null;
|
|
76
|
-
},
|
|
77
|
-
copyToContainer: async ({ destination, serviceName, source, type }) => {
|
|
78
|
-
const container = getContainer(serviceName);
|
|
79
|
-
|
|
80
|
-
if (type === 'directory') {
|
|
81
|
-
await container.copyDirectoriesToContainer([
|
|
82
|
-
{
|
|
83
|
-
source,
|
|
84
|
-
target: destination
|
|
85
|
-
}
|
|
86
|
-
]);
|
|
87
|
-
} else if (type === 'file') {
|
|
88
|
-
await container.copyFilesToContainer([
|
|
89
|
-
{
|
|
90
|
-
source,
|
|
91
|
-
target: destination
|
|
92
|
-
}
|
|
93
|
-
]);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return null;
|
|
97
|
-
},
|
|
98
25
|
createDirectory: async (directoryPath: string) => {
|
|
99
26
|
if (!existsSync(directoryPath)) {
|
|
100
27
|
mkdirSync(directoryPath, { recursive: true });
|
|
@@ -102,150 +29,70 @@ export default (on: Cypress.PluginEvents): void => {
|
|
|
102
29
|
|
|
103
30
|
return null;
|
|
104
31
|
},
|
|
105
|
-
execInContainer: async ({ command, name }) => {
|
|
106
|
-
const { exitCode, output } = await getContainer(name).exec([
|
|
107
|
-
'bash',
|
|
108
|
-
'-c',
|
|
109
|
-
`${command}${command.match(/[\n\r]/) ? '' : ' 2>&1'}`
|
|
110
|
-
]);
|
|
111
|
-
|
|
112
|
-
return { exitCode, output };
|
|
113
|
-
},
|
|
114
|
-
getContainerId: (containerName: string) =>
|
|
115
|
-
getContainer(containerName).getId(),
|
|
116
|
-
getContainerIpAddress: (containerName: string) => {
|
|
117
|
-
const container = getContainer(containerName);
|
|
118
|
-
|
|
119
|
-
const networkNames = container.getNetworkNames();
|
|
120
|
-
|
|
121
|
-
return container.getIpAddress(networkNames[0]);
|
|
122
|
-
},
|
|
123
|
-
getContainersLogs: async () => {
|
|
124
|
-
try {
|
|
125
|
-
const { dockerode } = (await getContainerRuntimeClient()).container;
|
|
126
|
-
const loggedContainers = await dockerode.listContainers();
|
|
127
|
-
|
|
128
|
-
return loggedContainers.reduce((acc, container) => {
|
|
129
|
-
const containerName = container.Names[0].replace('/', '');
|
|
130
|
-
acc[containerName] = execSync(`docker logs -t ${container.Id}`, {
|
|
131
|
-
stdio: 'pipe'
|
|
132
|
-
}).toString('utf8');
|
|
133
|
-
|
|
134
|
-
return acc;
|
|
135
|
-
}, {});
|
|
136
|
-
} catch (error) {
|
|
137
|
-
console.warn('Cannot get containers logs');
|
|
138
|
-
console.warn(error);
|
|
139
|
-
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
requestOnDatabase: async ({ database, query }) => {
|
|
144
|
-
let container: StartedTestContainer | null = null;
|
|
145
|
-
|
|
146
|
-
if (dockerEnvironment !== null) {
|
|
147
|
-
container = dockerEnvironment.getContainer('db-1');
|
|
148
|
-
} else {
|
|
149
|
-
container = getContainer('web');
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const client = await createConnection({
|
|
153
|
-
database,
|
|
154
|
-
host: container.getHost(),
|
|
155
|
-
password: 'centreon',
|
|
156
|
-
port: container.getMappedPort(3306),
|
|
157
|
-
user: 'centreon'
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
const [rows, fields] = await client.execute(query);
|
|
161
|
-
|
|
162
|
-
await client.end();
|
|
163
|
-
|
|
164
|
-
return [rows, fields];
|
|
165
|
-
},
|
|
166
32
|
startContainer: async ({
|
|
167
|
-
command,
|
|
168
33
|
image,
|
|
169
34
|
name,
|
|
170
35
|
portBindings = []
|
|
171
36
|
}: StartContainerProps) => {
|
|
172
|
-
|
|
37
|
+
const imageList = execSync(
|
|
38
|
+
'docker image list --format "{{.Repository}}:{{.Tag}}"'
|
|
39
|
+
).toString('utf8');
|
|
40
|
+
|
|
41
|
+
if (
|
|
42
|
+
!imageList.match(
|
|
43
|
+
new RegExp(
|
|
44
|
+
`^${image.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')}`,
|
|
45
|
+
'm'
|
|
46
|
+
)
|
|
47
|
+
)
|
|
48
|
+
) {
|
|
49
|
+
execSync(`docker pull ${image}`);
|
|
50
|
+
}
|
|
173
51
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
host: destination
|
|
178
|
-
});
|
|
52
|
+
const webContainers = await docker.listContainers({
|
|
53
|
+
all: true,
|
|
54
|
+
filters: { name: [name] }
|
|
179
55
|
});
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
container
|
|
183
|
-
.withCommand(['bash', '-c', command])
|
|
184
|
-
.withWaitStrategy(Wait.forSuccessfulCommand('ls'));
|
|
56
|
+
if (webContainers.length) {
|
|
57
|
+
return webContainers[0];
|
|
185
58
|
}
|
|
186
59
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
.withWaitStrategy(
|
|
215
|
-
'web-1',
|
|
216
|
-
Wait.forAll([
|
|
217
|
-
Wait.forHealthCheck(),
|
|
218
|
-
Wait.forLogMessage('Centreon is ready')
|
|
219
|
-
])
|
|
220
|
-
)
|
|
221
|
-
.up();
|
|
60
|
+
const container = await docker.createContainer({
|
|
61
|
+
AttachStderr: true,
|
|
62
|
+
AttachStdin: false,
|
|
63
|
+
AttachStdout: true,
|
|
64
|
+
ExposedPorts: portBindings.reduce((accumulator, currentValue) => {
|
|
65
|
+
accumulator[`${currentValue.source}/tcp`] = {};
|
|
66
|
+
|
|
67
|
+
return accumulator;
|
|
68
|
+
}, {}),
|
|
69
|
+
HostConfig: {
|
|
70
|
+
PortBindings: portBindings.reduce((accumulator, currentValue) => {
|
|
71
|
+
accumulator[`${currentValue.source}/tcp`] = [
|
|
72
|
+
{
|
|
73
|
+
HostIP: '127.0.0.1',
|
|
74
|
+
HostPort: `${currentValue.destination}`
|
|
75
|
+
}
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
return accumulator;
|
|
79
|
+
}, {})
|
|
80
|
+
},
|
|
81
|
+
Image: image,
|
|
82
|
+
OpenStdin: false,
|
|
83
|
+
StdinOnce: false,
|
|
84
|
+
Tty: true,
|
|
85
|
+
name
|
|
86
|
+
});
|
|
222
87
|
|
|
223
|
-
|
|
224
|
-
} catch (error) {
|
|
225
|
-
if (error instanceof Error) {
|
|
226
|
-
console.error(error.message);
|
|
227
|
-
}
|
|
88
|
+
await container.start();
|
|
228
89
|
|
|
229
|
-
|
|
230
|
-
}
|
|
90
|
+
return container;
|
|
231
91
|
},
|
|
232
92
|
stopContainer: async ({ name }: StopContainerProps) => {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
await container.stop();
|
|
237
|
-
|
|
238
|
-
delete containers[name];
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
return null;
|
|
242
|
-
},
|
|
243
|
-
stopContainers: async () => {
|
|
244
|
-
if (dockerEnvironment !== null) {
|
|
245
|
-
await dockerEnvironment.down();
|
|
246
|
-
|
|
247
|
-
dockerEnvironment = null;
|
|
248
|
-
}
|
|
93
|
+
const container = await docker.getContainer(name);
|
|
94
|
+
await container.kill();
|
|
95
|
+
await container.remove();
|
|
249
96
|
|
|
250
97
|
return null;
|
|
251
98
|
},
|
package/jest/index.js
CHANGED
|
@@ -5,6 +5,7 @@ module.exports = {
|
|
|
5
5
|
'jest-transform-stub',
|
|
6
6
|
'^react($|/.+)': '<rootDir>/node_modules/react$1'
|
|
7
7
|
},
|
|
8
|
+
setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect'],
|
|
8
9
|
testEnvironment: 'jsdom',
|
|
9
10
|
testPathIgnorePatterns: ['/node_modules/', '!*.cypress.spec.tsx'],
|
|
10
11
|
transform: {
|
package/package.json
CHANGED
|
@@ -1,66 +1,59 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
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
|
-
"eslint-plugin-sort-keys-fix": "^1.1.2",
|
|
60
|
-
"eslint-plugin-typescript-sort-keys": "^2.1.0",
|
|
61
|
-
"mochawesome": "^7.1.3",
|
|
62
|
-
"mysql2": "^3.9.1",
|
|
63
|
-
"tar-fs": "^3.0.4",
|
|
64
|
-
"testcontainers": "^10.7.1"
|
|
65
|
-
}
|
|
2
|
+
"name": "@centreon/js-config",
|
|
3
|
+
"description": "Centreon Frontend shared build configuration",
|
|
4
|
+
"version": "24.4.29",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/centreon/centreon-frontend.git"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"centreon",
|
|
11
|
+
"eslint"
|
|
12
|
+
],
|
|
13
|
+
"author": "centreon@centreon.com",
|
|
14
|
+
"license": "GPL-2.0",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/centreon/centreon-frontend/issues"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@tsconfig/node16": "^16.1.1",
|
|
20
|
+
"eslint": "^8.17.0",
|
|
21
|
+
"eslint-config-airbnb": "19.0.4",
|
|
22
|
+
"eslint-config-prettier": "^8.5.0",
|
|
23
|
+
"eslint-import-resolver-alias": "^1.1.2",
|
|
24
|
+
"eslint-import-resolver-typescript": "^3.5.5",
|
|
25
|
+
"eslint-plugin-babel": "^5.3.1",
|
|
26
|
+
"eslint-plugin-hooks": "^0.4.3",
|
|
27
|
+
"eslint-plugin-import": "^2.26.0",
|
|
28
|
+
"eslint-plugin-jest": "^26.1.5",
|
|
29
|
+
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
30
|
+
"eslint-plugin-node": "^11.1.0",
|
|
31
|
+
"eslint-plugin-prefer-arrow-functions": "^3.1.4",
|
|
32
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
33
|
+
"eslint-plugin-react": "^7.29.4",
|
|
34
|
+
"eslint-plugin-react-hooks": "^4.5.0",
|
|
35
|
+
"eslint-plugin-sort-keys-fix": "^1.1.2",
|
|
36
|
+
"eslint-plugin-typescript-sort-keys": "^2.1.0"
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://github.com/centreon/centreon-frontend#readme",
|
|
39
|
+
"files": [
|
|
40
|
+
"eslint",
|
|
41
|
+
"jest",
|
|
42
|
+
"tsconfig",
|
|
43
|
+
"webpack",
|
|
44
|
+
"cypress"
|
|
45
|
+
],
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@badeball/cypress-cucumber-preprocessor": "^19.1.0",
|
|
48
|
+
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.0",
|
|
49
|
+
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
|
50
|
+
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
|
|
51
|
+
"@types/cypress-cucumber-preprocessor": "^4.0.5",
|
|
52
|
+
"@types/dockerode": "^3.3.23",
|
|
53
|
+
"cypress-multi-reporters": "^1.6.4",
|
|
54
|
+
"cypress-terminal-report": "^5.3.9",
|
|
55
|
+
"dockerode": "^4.0.0",
|
|
56
|
+
"esbuild": "^0.19.5",
|
|
57
|
+
"mochawesome": "^7.1.3"
|
|
58
|
+
}
|
|
66
59
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const excludeNodeModulesExceptCentreonUi =
|
|
2
|
-
/node_modules(\\|\/)\.pnpm(\\|\/)(?!(@centreon
|
|
2
|
+
/node_modules(\\|\/)\.pnpm(\\|\/)(?!(@centreon))/;
|
|
3
3
|
|
|
4
4
|
module.exports = {
|
|
5
5
|
cache: false,
|
|
6
6
|
excludeNodeModulesExceptCentreonUi,
|
|
7
|
-
getModuleConfiguration: (jscTransformConfiguration
|
|
7
|
+
getModuleConfiguration: (jscTransformConfiguration) => ({
|
|
8
8
|
rules: [
|
|
9
9
|
{
|
|
10
10
|
parser: { system: false },
|
|
@@ -17,11 +17,6 @@ module.exports = {
|
|
|
17
17
|
loader: 'swc-loader',
|
|
18
18
|
options: {
|
|
19
19
|
jsc: {
|
|
20
|
-
experimental: {
|
|
21
|
-
plugins: [
|
|
22
|
-
enableCoverage && ['swc-plugin-coverage-instrument', {}]
|
|
23
|
-
].filter(Boolean)
|
|
24
|
-
},
|
|
25
20
|
parser: {
|
|
26
21
|
syntax: 'typescript',
|
|
27
22
|
tsx: true
|
package/webpack/base/index.js
CHANGED
|
@@ -13,11 +13,10 @@ const {
|
|
|
13
13
|
const getBaseConfiguration = ({
|
|
14
14
|
moduleName,
|
|
15
15
|
moduleFederationConfig,
|
|
16
|
-
jscTransformConfiguration
|
|
17
|
-
enableCoverage
|
|
16
|
+
jscTransformConfiguration
|
|
18
17
|
}) => ({
|
|
19
18
|
cache,
|
|
20
|
-
module: getModuleConfiguration(jscTransformConfiguration
|
|
19
|
+
module: getModuleConfiguration(jscTransformConfiguration),
|
|
21
20
|
optimization,
|
|
22
21
|
output: {
|
|
23
22
|
...output,
|
|
@@ -34,18 +33,19 @@ const getBaseConfiguration = ({
|
|
|
34
33
|
shared: [
|
|
35
34
|
{
|
|
36
35
|
'@centreon/ui-context': {
|
|
37
|
-
requiredVersion: '
|
|
36
|
+
requiredVersion: '22.10.0',
|
|
38
37
|
singleton: true
|
|
39
38
|
}
|
|
40
39
|
},
|
|
41
40
|
{
|
|
42
41
|
jotai: {
|
|
43
|
-
requiredVersion: '
|
|
42
|
+
requiredVersion: '1.x',
|
|
44
43
|
singleton: true
|
|
45
44
|
}
|
|
46
45
|
},
|
|
47
46
|
{
|
|
48
47
|
'jotai-suspense': {
|
|
48
|
+
requiredVersion: '0.1.x',
|
|
49
49
|
singleton: true
|
|
50
50
|
}
|
|
51
51
|
},
|
|
@@ -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
|
-
}
|