@centreon/js-config 24.4.8 → 24.4.9

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.
@@ -1,105 +0,0 @@
1
- import { execSync } from 'child_process';
2
- import { existsSync, mkdirSync } from 'fs';
3
-
4
- import Docker from 'dockerode';
5
-
6
- export default (on: Cypress.PluginEvents): void => {
7
- const docker = new Docker();
8
-
9
- interface PortBinding {
10
- destination: number;
11
- source: number;
12
- }
13
-
14
- interface StartContainerProps {
15
- image: string;
16
- name: string;
17
- portBindings: Array<PortBinding>;
18
- }
19
-
20
- interface StopContainerProps {
21
- name: string;
22
- }
23
-
24
- on('task', {
25
- createDirectory: async (directoryPath: string) => {
26
- if (!existsSync(directoryPath)) {
27
- mkdirSync(directoryPath, { recursive: true });
28
- }
29
-
30
- return null;
31
- },
32
- startContainer: async ({
33
- image,
34
- name,
35
- portBindings = []
36
- }: StartContainerProps) => {
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
- }
51
-
52
- const webContainers = await docker.listContainers({
53
- all: true,
54
- filters: { name: [name] }
55
- });
56
- if (webContainers.length) {
57
- return webContainers[0];
58
- }
59
-
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
- });
87
-
88
- await container.start();
89
-
90
- return container;
91
- },
92
- stopContainer: async ({ name }: StopContainerProps) => {
93
- const container = await docker.getContainer(name);
94
- await container.kill();
95
- await container.remove();
96
-
97
- return null;
98
- },
99
- waitOn: async (url: string) => {
100
- execSync(`npx wait-on ${url}`);
101
-
102
- return null;
103
- }
104
- });
105
- };
@@ -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,12 +0,0 @@
1
- {
2
- "extends": "@tsconfig/node20/tsconfig.json",
3
- "compilerOptions": {
4
- "sourceMap": true,
5
- "allowJs": true,
6
- "strictNullChecks": false,
7
- "declaration": false,
8
- "esModuleInterop": true,
9
- "strict": true,
10
- "types": ["@types/jest", "node"]
11
- }
12
- }
@@ -1,14 +0,0 @@
1
- {
2
- "extends": "@tsconfig/node16/tsconfig.json",
3
- "compilerOptions": {
4
- "sourceMap": true,
5
- "allowJs": true,
6
- "strictNullChecks": false,
7
- "declaration": false,
8
- "esModuleInterop": true,
9
- "types": [
10
- "@types/jest",
11
- "node"
12
- ]
13
- }
14
- }
@@ -1,76 +0,0 @@
1
- const excludeNodeModulesExceptCentreonUi =
2
- /node_modules(\\|\/)\.pnpm(\\|\/)(?!(@centreon|file\+packages\+ui-context))/;
3
-
4
- module.exports = {
5
- cache: false,
6
- excludeNodeModulesExceptCentreonUi,
7
- getModuleConfiguration: (jscTransformConfiguration, enableCoverage) => ({
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
- experimental: {
21
- plugins: [
22
- enableCoverage && ['swc-plugin-coverage-instrument', {}]
23
- ].filter(Boolean)
24
- },
25
- parser: {
26
- syntax: 'typescript',
27
- tsx: true
28
- },
29
- transform: jscTransformConfiguration
30
- }
31
- }
32
- }
33
- },
34
- {
35
- test: /\.icon.svg$/,
36
- use: ['@svgr/webpack']
37
- },
38
- {
39
- exclude: excludeNodeModulesExceptCentreonUi,
40
- test: /\.(bmp|png|jpg|jpeg|gif|svg)$/,
41
- use: [
42
- {
43
- loader: 'url-loader',
44
- options: {
45
- limit: 10000,
46
- name: '[name].[hash:8].[ext]'
47
- }
48
- }
49
- ]
50
- },
51
- {
52
- generator: {
53
- filename: '[name][ext]'
54
- },
55
- test: /\.(woff|woff2|eot|ttf|otf)$/i,
56
- type: 'asset/resource'
57
- },
58
- {
59
- test: /\.css$/i,
60
- use: ['style-loader', 'css-loader']
61
- }
62
- ]
63
- }),
64
- optimization: {
65
- splitChunks: {
66
- chunks: 'all',
67
- maxSize: 400 * 1024
68
- }
69
- },
70
- output: {
71
- chunkFilename: '[name].[chunkhash:8].chunk.js',
72
- filename: '[name].[chunkhash:8].js',
73
- libraryTarget: 'umd',
74
- umdNamedDefine: true
75
- }
76
- };