@centreon/js-config 23.4.11-MON-build-npm-packages.6 → 23.4.11

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.
@@ -3,23 +3,27 @@ module.exports = {
3
3
  {
4
4
  extends: [
5
5
  'plugin:@typescript-eslint/recommended',
6
- 'plugin:typescript-sort-keys/recommended',
6
+ 'plugin:typescript-sort-keys/recommended'
7
7
  ],
8
8
  files: ['*.ts', '*.tsx'],
9
9
  parser: '@typescript-eslint/parser',
10
+ parserOptions: {
11
+ ecmaVersion: 2022,
12
+ sourceType: 'module'
13
+ },
10
14
  plugins: ['@typescript-eslint', 'typescript-sort-keys'],
11
15
  rules: {
12
16
  '@typescript-eslint/array-type': [
13
17
  'error',
14
18
  {
15
19
  default: 'generic',
16
- readonly: 'generic',
17
- },
20
+ readonly: 'generic'
21
+ }
18
22
  ],
19
23
  '@typescript-eslint/camelcase': 'off',
20
24
  '@typescript-eslint/consistent-type-definitions': [
21
25
  'error',
22
- 'interface',
26
+ 'interface'
23
27
  ],
24
28
  '@typescript-eslint/explicit-function-return-type': ['error'],
25
29
  '@typescript-eslint/explicit-member-accessibility': [
@@ -31,33 +35,33 @@ module.exports = {
31
35
  constructors: 'explicit',
32
36
  methods: 'explicit',
33
37
  parameterProperties: 'explicit',
34
- properties: 'explicit',
35
- },
36
- },
38
+ properties: 'explicit'
39
+ }
40
+ }
37
41
  ],
38
42
  '@typescript-eslint/method-signature-style': ['error'],
39
43
  '@typescript-eslint/naming-convention': [
40
44
  'error',
41
45
  {
42
46
  format: ['camelCase', 'PascalCase'],
43
- selector: 'variable',
47
+ selector: 'variable'
44
48
  },
45
49
  {
46
50
  filter: {
47
51
  match: false,
48
- regex: '((__esModule|.+-.+)|^_$|^(/|&))',
52
+ regex: '((__esModule|.+-.+)|^_$|^(/|&))'
49
53
  },
50
54
  format: ['snake_case', 'camelCase', 'PascalCase'],
51
- selector: 'property',
55
+ selector: 'property'
52
56
  },
53
57
  {
54
58
  filter: {
55
59
  match: false,
56
- regex: '^_$|^(/|&)',
60
+ regex: '^_$|^(/|&)'
57
61
  },
58
62
  format: ['snake_case', 'camelCase', 'PascalCase'],
59
- selector: 'parameter',
60
- },
63
+ selector: 'parameter'
64
+ }
61
65
  ],
62
66
  '@typescript-eslint/no-shadow': ['error'],
63
67
  '@typescript-eslint/no-unused-expressions': ['error'],
@@ -68,21 +72,21 @@ module.exports = {
68
72
  {
69
73
  after: true,
70
74
  before: false,
71
- overrides: { arrow: { after: true, before: true } },
72
- },
75
+ overrides: { arrow: { after: true, before: true } }
76
+ }
73
77
  ],
74
78
  camelcase: 'off',
75
79
  'no-shadow': 'off',
76
- 'no-unused-expressions': 'off',
80
+ 'no-unused-expressions': 'off'
77
81
  },
78
82
  settings: {
79
83
  'import/resolver': {
80
84
  alias: {
81
- extensions: ['.ts', '.tsx', '.js', '.jsx'],
82
- },
83
- },
84
- },
85
- },
85
+ extensions: ['.ts', '.tsx', '.js', '.jsx']
86
+ }
87
+ }
88
+ }
89
+ }
86
90
  ],
87
- root: true,
91
+ root: true
88
92
  };
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.4.11-MON-build-npm-packages.6",
4
+ "version": "23.4.11",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/centreon/centreon-frontend.git"
@@ -6,13 +6,10 @@ const { ModuleFederationPlugin } = require('webpack').container;
6
6
  const excludeNodeModulesExceptCentreonUi =
7
7
  /node_modules(\\|\/)\.pnpm(\\|\/)(?!(@centreon))/;
8
8
 
9
- const excludeAllNodeModules = /node_modules/;
10
-
11
9
  const getBaseConfiguration = ({
12
10
  moduleName,
13
11
  moduleFederationConfig,
14
- jscTransformConfiguration,
15
- filesExcludedFromSWCLoader = excludeNodeModulesExceptCentreonUi,
12
+ jscTransformConfiguration
16
13
  }) => ({
17
14
  cache: false,
18
15
  module: {
@@ -22,7 +19,7 @@ const getBaseConfiguration = ({
22
19
  test: /\.[cm]?(j|t)sx?$/
23
20
  },
24
21
  {
25
- exclude: filesExcludedFromSWCLoader,
22
+ exclude: excludeNodeModulesExceptCentreonUi,
26
23
  test: /\.[jt]sx?$/,
27
24
  use: {
28
25
  loader: 'swc-loader',
@@ -129,8 +126,4 @@ const getBaseConfiguration = ({
129
126
  }
130
127
  });
131
128
 
132
- module.exports = {
133
- getBaseConfiguration,
134
- excludeNodeModulesExceptCentreonUi,
135
- excludeAllNodeModules,
136
- };
129
+ module.exports = getBaseConfiguration;
@@ -0,0 +1,37 @@
1
+ const os = require('os');
2
+
3
+ const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
4
+
5
+ const devServerPort = 9090;
6
+
7
+ const interfaces = os.networkInterfaces();
8
+ const externalInterface = Object.keys(interfaces).find(
9
+ (interfaceName) =>
10
+ !interfaceName.includes('docker') &&
11
+ interfaces[interfaceName][0].family === 'IPv4' &&
12
+ interfaces[interfaceName][0].internal === false &&
13
+ !process.env.IS_STATIC_PORT_FORWARDED
14
+ );
15
+
16
+ const devServerAddress = externalInterface
17
+ ? interfaces[externalInterface][0].address
18
+ : 'localhost';
19
+
20
+ const publicPath = `http://${devServerAddress}:${devServerPort}/static/`;
21
+
22
+ const isServeMode = process.env.WEBPACK_ENV === 'serve';
23
+ const isDevelopmentMode = process.env.WEBPACK_ENV === 'development';
24
+
25
+ const devServerPlugins = isServeMode ? [new ReactRefreshWebpackPlugin()] : [];
26
+
27
+ module.exports = {
28
+ devServer: {
29
+ compress: true,
30
+ hot: true,
31
+ port: devServerPort
32
+ },
33
+ devServerPlugins,
34
+ isDevelopmentMode,
35
+ isServeMode,
36
+ publicPath
37
+ };