@centreon/js-config 22.10.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/eslint/base.eslintrc.js +38 -0
- package/eslint/base.typescript.eslintrc.js +88 -0
- package/eslint/node/index.eslintrc.js +16 -0
- package/eslint/node/typescript.eslintrc.js +13 -0
- package/eslint/react/index.eslintrc.js +99 -0
- package/eslint/react/typescript.eslintrc.js +25 -0
- package/jest/index.js +28 -0
- package/package.json +37 -0
- package/tsconfig/index.json +13 -0
- package/webpack/base/index.js +130 -0
- package/webpack/patch/dev.js +24 -0
- package/webpack/patch/module.js +46 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
extends: ['plugin:prettier/recommended'],
|
|
3
|
+
globals: {
|
|
4
|
+
Atomics: 'readonly',
|
|
5
|
+
SharedArrayBuffer: 'readonly',
|
|
6
|
+
},
|
|
7
|
+
parserOptions: {
|
|
8
|
+
ecmaVersion: 2022,
|
|
9
|
+
sourceType: 'module',
|
|
10
|
+
},
|
|
11
|
+
plugins: ['prefer-arrow-functions', 'sort-keys-fix'],
|
|
12
|
+
root: true,
|
|
13
|
+
rules: {
|
|
14
|
+
camelcase: ['error', { ignoreDestructuring: true, properties: 'never' }],
|
|
15
|
+
'import/extensions': [
|
|
16
|
+
'error',
|
|
17
|
+
'ignorePackages',
|
|
18
|
+
{
|
|
19
|
+
js: 'never',
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
|
|
23
|
+
'import/prefer-default-export': 'off',
|
|
24
|
+
'newline-before-return': ['error'],
|
|
25
|
+
'no-promise-executor-return': 'off',
|
|
26
|
+
'prefer-arrow-functions/prefer-arrow-functions': ['error'],
|
|
27
|
+
'prettier/prettier': [
|
|
28
|
+
'error',
|
|
29
|
+
{
|
|
30
|
+
arrowParens: 'always',
|
|
31
|
+
endOfLine: 'auto',
|
|
32
|
+
singleQuote: true,
|
|
33
|
+
trailingComma: 'all',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
'sort-keys-fix/sort-keys-fix': ['error', 'asc', { natural: true }],
|
|
37
|
+
},
|
|
38
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
overrides: [
|
|
3
|
+
{
|
|
4
|
+
extends: [
|
|
5
|
+
'plugin:@typescript-eslint/recommended',
|
|
6
|
+
'plugin:typescript-sort-keys/recommended',
|
|
7
|
+
],
|
|
8
|
+
files: ['*.ts', '*.tsx'],
|
|
9
|
+
parser: '@typescript-eslint/parser',
|
|
10
|
+
plugins: ['@typescript-eslint', 'typescript-sort-keys'],
|
|
11
|
+
rules: {
|
|
12
|
+
'@typescript-eslint/array-type': [
|
|
13
|
+
'error',
|
|
14
|
+
{
|
|
15
|
+
default: 'generic',
|
|
16
|
+
readonly: 'generic',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
'@typescript-eslint/camelcase': 'off',
|
|
20
|
+
'@typescript-eslint/consistent-type-definitions': [
|
|
21
|
+
'error',
|
|
22
|
+
'interface',
|
|
23
|
+
],
|
|
24
|
+
'@typescript-eslint/explicit-function-return-type': ['error'],
|
|
25
|
+
'@typescript-eslint/explicit-member-accessibility': [
|
|
26
|
+
'error',
|
|
27
|
+
{
|
|
28
|
+
accessibility: 'explicit',
|
|
29
|
+
overrides: {
|
|
30
|
+
accessors: 'explicit',
|
|
31
|
+
constructors: 'explicit',
|
|
32
|
+
methods: 'explicit',
|
|
33
|
+
parameterProperties: 'explicit',
|
|
34
|
+
properties: 'explicit',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
'@typescript-eslint/method-signature-style': ['error'],
|
|
39
|
+
'@typescript-eslint/naming-convention': [
|
|
40
|
+
'error',
|
|
41
|
+
{
|
|
42
|
+
format: ['camelCase', 'PascalCase'],
|
|
43
|
+
selector: 'variable',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
filter: {
|
|
47
|
+
match: false,
|
|
48
|
+
regex: '((__esModule|.+-.+)|^_$|^(/|&))',
|
|
49
|
+
},
|
|
50
|
+
format: ['snake_case', 'camelCase', 'PascalCase'],
|
|
51
|
+
selector: 'property',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
filter: {
|
|
55
|
+
match: false,
|
|
56
|
+
regex: '^_$|^(/|&)',
|
|
57
|
+
},
|
|
58
|
+
format: ['snake_case', 'camelCase', 'PascalCase'],
|
|
59
|
+
selector: 'parameter',
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
'@typescript-eslint/no-shadow': ['error'],
|
|
63
|
+
'@typescript-eslint/no-unused-expressions': ['error'],
|
|
64
|
+
'@typescript-eslint/no-unused-vars': ['error'],
|
|
65
|
+
'@typescript-eslint/prefer-function-type': 'error',
|
|
66
|
+
'@typescript-eslint/type-annotation-spacing': [
|
|
67
|
+
'error',
|
|
68
|
+
{
|
|
69
|
+
after: true,
|
|
70
|
+
before: false,
|
|
71
|
+
overrides: { arrow: { after: true, before: true } },
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
camelcase: 'off',
|
|
75
|
+
'no-shadow': 'off',
|
|
76
|
+
'no-unused-expressions': 'off',
|
|
77
|
+
},
|
|
78
|
+
settings: {
|
|
79
|
+
'import/resolver': {
|
|
80
|
+
alias: {
|
|
81
|
+
extensions: ['.ts', '.tsx', '.js', '.jsx'],
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
root: true,
|
|
88
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
browser: true,
|
|
4
|
+
es6: true,
|
|
5
|
+
jest: true,
|
|
6
|
+
},
|
|
7
|
+
extends: ['airbnb', '../base.eslintrc.js'],
|
|
8
|
+
parserOptions: {
|
|
9
|
+
ecmaFeatures: {
|
|
10
|
+
jsx: true,
|
|
11
|
+
},
|
|
12
|
+
ecmaVersion: 2018,
|
|
13
|
+
sourceType: 'module',
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
plugins: ['react', 'hooks', 'react-hooks'],
|
|
17
|
+
root: true,
|
|
18
|
+
rules: {
|
|
19
|
+
camelcase: ['error', { ignoreDestructuring: true, properties: 'never' }],
|
|
20
|
+
'hooks/sort': [
|
|
21
|
+
2,
|
|
22
|
+
{
|
|
23
|
+
groups: [
|
|
24
|
+
'useStyles',
|
|
25
|
+
'useTranslation',
|
|
26
|
+
'useState',
|
|
27
|
+
'useRequest',
|
|
28
|
+
'useUserContext',
|
|
29
|
+
'useAtom',
|
|
30
|
+
'useAtomValue',
|
|
31
|
+
'useUpdateAtom',
|
|
32
|
+
'useCallback',
|
|
33
|
+
'useEffect',
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
'import/extensions': [
|
|
38
|
+
'error',
|
|
39
|
+
'ignorePackages',
|
|
40
|
+
{
|
|
41
|
+
js: 'never',
|
|
42
|
+
jsx: 'never',
|
|
43
|
+
ts: 'never',
|
|
44
|
+
tsx: 'never',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
'import/no-extraneous-dependencies': 'off',
|
|
48
|
+
'import/order': [
|
|
49
|
+
'error',
|
|
50
|
+
{
|
|
51
|
+
'newlines-between': 'always',
|
|
52
|
+
pathGroups: [
|
|
53
|
+
{
|
|
54
|
+
group: 'builtin',
|
|
55
|
+
pattern: 'react',
|
|
56
|
+
position: 'before',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
group: 'external',
|
|
60
|
+
pattern: '@mui/**',
|
|
61
|
+
position: 'after',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
group: 'parent',
|
|
65
|
+
pattern: '@centreon/**',
|
|
66
|
+
position: 'before',
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
pathGroupsExcludedImportTypes: ['builtin'],
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
'no-use-before-define': 'off',
|
|
73
|
+
'prefer-arrow-functions/prefer-arrow-functions': ['error'],
|
|
74
|
+
'react/function-component-definition': [
|
|
75
|
+
'error',
|
|
76
|
+
{
|
|
77
|
+
namedComponents: 'arrow-function',
|
|
78
|
+
unnamedComponents: 'arrow-function',
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
'react/jsx-filename-extension': ['error', { extensions: ['.jsx'] }],
|
|
82
|
+
'react/jsx-key': 'error',
|
|
83
|
+
'react/jsx-no-duplicate-props': ['error', { ignoreCase: false }],
|
|
84
|
+
'react/jsx-props-no-spreading': 'off',
|
|
85
|
+
'react/jsx-sort-props': [
|
|
86
|
+
'error',
|
|
87
|
+
{
|
|
88
|
+
callbacksLast: true,
|
|
89
|
+
shorthandFirst: true,
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
'react/jsx-uses-react': 'off',
|
|
93
|
+
'react/jsx-wrap-multilines': ['error', { prop: false }],
|
|
94
|
+
'react/react-in-jsx-scope': 'off',
|
|
95
|
+
'react/state-in-constructor': 'off',
|
|
96
|
+
'react-hooks/exhaustive-deps': 'off',
|
|
97
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
98
|
+
},
|
|
99
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
extends: ['./index.eslintrc.js', '../base.typescript.eslintrc.js'],
|
|
3
|
+
overrides: [
|
|
4
|
+
{
|
|
5
|
+
extends: [
|
|
6
|
+
'plugin:@typescript-eslint/recommended',
|
|
7
|
+
'plugin:typescript-sort-keys/recommended',
|
|
8
|
+
],
|
|
9
|
+
files: ['*.ts', '*.tsx'],
|
|
10
|
+
parser: '@typescript-eslint/parser',
|
|
11
|
+
plugins: ['@typescript-eslint', 'typescript-sort-keys'],
|
|
12
|
+
rules: {
|
|
13
|
+
'@typescript-eslint/naming-convention': [
|
|
14
|
+
'error',
|
|
15
|
+
{ format: null, selector: 'objectLiteralProperty' },
|
|
16
|
+
],
|
|
17
|
+
'react/jsx-filename-extension': [
|
|
18
|
+
'error',
|
|
19
|
+
{ extensions: ['.jsx', '.tsx'] },
|
|
20
|
+
],
|
|
21
|
+
'react/require-default-props': 'off',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
};
|
package/jest/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
moduleNameMapper: {
|
|
3
|
+
'@centreon/ui': '<rootDir>/packages/ui',
|
|
4
|
+
'@centreon/ui-context': '<rootDir>/packages/ui-context',
|
|
5
|
+
'\\.(s?css|png|svg|jpg)$': 'identity-obj-proxy',
|
|
6
|
+
'^react($|/.+)': '<rootDir>/node_modules/react$1',
|
|
7
|
+
},
|
|
8
|
+
setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect'],
|
|
9
|
+
testEnvironment: 'jsdom',
|
|
10
|
+
testPathIgnorePatterns: ['/node_modules/'],
|
|
11
|
+
transform: {
|
|
12
|
+
'^.+\\.[jt]sx?$': [
|
|
13
|
+
'@swc/jest',
|
|
14
|
+
{
|
|
15
|
+
jsc: {
|
|
16
|
+
transform: {
|
|
17
|
+
react: {
|
|
18
|
+
runtime: 'automatic',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
transformIgnorePatterns: [
|
|
26
|
+
'/node_modules/(?!centreon-frontend/packages/(centreon-ui|ui-context)).+\\.jsx?$',
|
|
27
|
+
],
|
|
28
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@centreon/js-config",
|
|
3
|
+
"description": "Centreon Frontend shared build configuration",
|
|
4
|
+
"version": "22.10.0",
|
|
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
|
+
"eslint": "^8.17.0",
|
|
20
|
+
"eslint-config-airbnb": "19.0.4",
|
|
21
|
+
"eslint-config-prettier": "^8.5.0",
|
|
22
|
+
"eslint-import-resolver-alias": "^1.1.2",
|
|
23
|
+
"eslint-plugin-babel": "^5.3.1",
|
|
24
|
+
"eslint-plugin-hooks": "^0.4.3",
|
|
25
|
+
"eslint-plugin-import": "^2.26.0",
|
|
26
|
+
"eslint-plugin-jest": "^26.1.5",
|
|
27
|
+
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
28
|
+
"eslint-plugin-node": "^11.1.0",
|
|
29
|
+
"eslint-plugin-prefer-arrow-functions": "^3.1.4",
|
|
30
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
31
|
+
"eslint-plugin-react": "^7.29.4",
|
|
32
|
+
"eslint-plugin-react-hooks": "^4.5.0",
|
|
33
|
+
"eslint-plugin-sort-keys-fix": "^1.1.2",
|
|
34
|
+
"eslint-plugin-typescript-sort-keys": "^2.1.0"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/centreon/centreon-frontend#readme"
|
|
37
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
3
|
+
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
|
4
|
+
const { ModuleFederationPlugin } = require('webpack').container;
|
|
5
|
+
|
|
6
|
+
const excludeNodeModulesExceptCentreonUi = /node_modules(\\|\/)(?!(@centreon))/;
|
|
7
|
+
|
|
8
|
+
const getBaseConfiguration = ({
|
|
9
|
+
moduleName,
|
|
10
|
+
moduleFederationConfig,
|
|
11
|
+
jscTransformConfiguration,
|
|
12
|
+
}) => ({
|
|
13
|
+
cache: false,
|
|
14
|
+
module: {
|
|
15
|
+
rules: [
|
|
16
|
+
{
|
|
17
|
+
parser: { system: false },
|
|
18
|
+
test: /\.[cm]?(j|t)sx?$/,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
exclude: excludeNodeModulesExceptCentreonUi,
|
|
22
|
+
test: /\.[jt]sx?$/,
|
|
23
|
+
use: {
|
|
24
|
+
loader: 'swc-loader',
|
|
25
|
+
options: {
|
|
26
|
+
jsc: {
|
|
27
|
+
parser: {
|
|
28
|
+
syntax: 'typescript',
|
|
29
|
+
tsx: true,
|
|
30
|
+
},
|
|
31
|
+
transform: jscTransformConfiguration,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
test: /\.icon.svg$/,
|
|
38
|
+
use: ['@svgr/webpack'],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
exclude: excludeNodeModulesExceptCentreonUi,
|
|
42
|
+
test: /\.(bmp|png|jpg|jpeg|gif|svg)$/,
|
|
43
|
+
use: [
|
|
44
|
+
{
|
|
45
|
+
loader: 'url-loader',
|
|
46
|
+
options: {
|
|
47
|
+
limit: 10000,
|
|
48
|
+
name: '[name].[hash:8].[ext]',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
optimization: {
|
|
56
|
+
splitChunks: {
|
|
57
|
+
chunks: 'all',
|
|
58
|
+
maxSize: 400 * 1024,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
output: {
|
|
62
|
+
chunkFilename: '[name].[chunkhash:8].chunk.js',
|
|
63
|
+
filename: '[name].[chunkhash:8].js',
|
|
64
|
+
libraryTarget: 'umd',
|
|
65
|
+
umdNamedDefine: true,
|
|
66
|
+
},
|
|
67
|
+
plugins: [
|
|
68
|
+
new CleanWebpackPlugin(),
|
|
69
|
+
new ModuleFederationPlugin({
|
|
70
|
+
filename: 'remoteEntry.[chunkhash:8].js',
|
|
71
|
+
library: { name: moduleName, type: 'var' },
|
|
72
|
+
name: moduleName,
|
|
73
|
+
shared: [
|
|
74
|
+
{
|
|
75
|
+
'@centreon/ui-context': {
|
|
76
|
+
requiredVersion: '22.10.0',
|
|
77
|
+
singleton: true,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
jotai: {
|
|
82
|
+
requiredVersion: '1.x',
|
|
83
|
+
singleton: true,
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
'jotai-suspense': {
|
|
88
|
+
requiredVersion: '0.1.x',
|
|
89
|
+
singleton: true,
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
react: {
|
|
94
|
+
requiredVersion: '18.x',
|
|
95
|
+
singleton: true,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
'react-dom': {
|
|
100
|
+
requiredVersion: '18.x',
|
|
101
|
+
singleton: true,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
'react-i18next': {
|
|
106
|
+
requiredVersion: '11.x',
|
|
107
|
+
singleton: true,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
'react-router-dom': {
|
|
112
|
+
requiredVersion: '6.x',
|
|
113
|
+
singleton: true,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
...moduleFederationConfig,
|
|
118
|
+
}),
|
|
119
|
+
],
|
|
120
|
+
resolve: {
|
|
121
|
+
alias: {
|
|
122
|
+
'@centreon/ui': path.resolve('packages', 'ui'),
|
|
123
|
+
'@centreon/ui-context': path.resolve('packages', 'ui-context'),
|
|
124
|
+
react: path.resolve('./node_modules/react'),
|
|
125
|
+
},
|
|
126
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
module.exports = getBaseConfiguration;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
devJscTransformConfiguration: {
|
|
3
|
+
react: {
|
|
4
|
+
development: true,
|
|
5
|
+
refresh: false,
|
|
6
|
+
},
|
|
7
|
+
},
|
|
8
|
+
devRefreshJscTransformConfiguration: {
|
|
9
|
+
react: {
|
|
10
|
+
development: true,
|
|
11
|
+
refresh: true,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
getDevConfiguration: () => ({
|
|
15
|
+
cache: true,
|
|
16
|
+
devtool: 'eval-cheap-module-source-map',
|
|
17
|
+
optimization: {
|
|
18
|
+
splitChunks: false,
|
|
19
|
+
},
|
|
20
|
+
output: {
|
|
21
|
+
filename: '[name].js',
|
|
22
|
+
},
|
|
23
|
+
}),
|
|
24
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
|
3
|
+
|
|
4
|
+
class CentreonModulePlugin {
|
|
5
|
+
constructor(federatedComponentConfiguration) {
|
|
6
|
+
this.federatedComponentConfiguration = federatedComponentConfiguration;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
apply(compiler) {
|
|
10
|
+
compiler.hooks.done.tap('CentreonModulePlugin', (stats) => {
|
|
11
|
+
const newFederatedComponentConfiguration = {
|
|
12
|
+
...this.federatedComponentConfiguration,
|
|
13
|
+
remoteEntry: Object.keys(stats.compilation.assets).find((assetName) =>
|
|
14
|
+
assetName.match(/(^remoteEntry)\S+.js$/),
|
|
15
|
+
),
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
if (!fs.existsSync(compiler.options.output.path)) {
|
|
19
|
+
fs.mkdirSync(compiler.options.output.path, { recursive: true });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
fs.writeFileSync(
|
|
23
|
+
`${compiler.options.output.path}/moduleFederation.json`,
|
|
24
|
+
JSON.stringify(newFederatedComponentConfiguration, null, 2),
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = ({
|
|
31
|
+
outputPath,
|
|
32
|
+
federatedComponentConfiguration,
|
|
33
|
+
}) => ({
|
|
34
|
+
output: {
|
|
35
|
+
library: '[chunkhash:8]',
|
|
36
|
+
path: outputPath,
|
|
37
|
+
},
|
|
38
|
+
plugins: [
|
|
39
|
+
new CleanWebpackPlugin({
|
|
40
|
+
cleanOnceBeforeBuildPatterns: [`${outputPath}/**/*.js`],
|
|
41
|
+
dangerouslyAllowCleanPatternsOutsideProject: true,
|
|
42
|
+
dry: false,
|
|
43
|
+
}),
|
|
44
|
+
new CentreonModulePlugin(federatedComponentConfiguration),
|
|
45
|
+
],
|
|
46
|
+
});
|