@eui/tools 6.20.21 → 6.20.23
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/.version.properties +1 -1
- package/CHANGELOG.md +19 -0
- package/package.json +1 -1
- package/scripts/csdr/init/remotes/17.x/full/options/extra-locales/config/global.ts +33 -1
- package/scripts/csdr/init/remotes/18.x/full/options/extra-locales/config/global.ts +33 -1
- package/scripts/utils/build/package/element.js +53 -36
- package/scripts/utils/remotes/remotes-utils.js +121 -91
- package/scripts/utils/serve/element.js +27 -4
package/.version.properties
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.20.
|
|
1
|
+
6.20.23
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## 6.20.23 (2024-09-05)
|
|
2
|
+
|
|
3
|
+
##### Chores
|
|
4
|
+
|
|
5
|
+
* **other:**
|
|
6
|
+
* improve names MWP-11061 [MWP-11061](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-11061) ([bd68b63d](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/bd68b63de9a4208d6aa667d1c5f0b88c26661ae2))
|
|
7
|
+
* support esbuild build + bundle files in order to load elements as js modules MWP-11061 [MWP-11061](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-11061) ([967657f5](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/967657f5708153ae24360407a62f015fdbf03633))
|
|
8
|
+
|
|
9
|
+
* * *
|
|
10
|
+
* * *
|
|
11
|
+
## 6.20.22 (2024-09-03)
|
|
12
|
+
|
|
13
|
+
##### Chores
|
|
14
|
+
|
|
15
|
+
* **other:**
|
|
16
|
+
* align moment short and long date formats - MWP-11162 [MWP-11162](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-11162) ([d7a8211a](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/d7a8211a4fceae5172ea93879eb729e657d19a59))
|
|
17
|
+
|
|
18
|
+
* * *
|
|
19
|
+
* * *
|
|
1
20
|
## 6.20.21 (2024-08-12)
|
|
2
21
|
|
|
3
22
|
##### Chores
|
package/package.json
CHANGED
|
@@ -79,19 +79,43 @@ registerLocaleData(localeFR_LU, localeFRExtra_LU);
|
|
|
79
79
|
registerLocaleData(localeFR_CH, localeFRExtra_CH);
|
|
80
80
|
registerLocaleData(localeFR_BE, localeFRExtra_BE);
|
|
81
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Within the MyWP environment, the 'L' and 'l' date formats have been modified to align with each other
|
|
84
|
+
* and to adhere to the CLDR-based date formats utilized by Angular.
|
|
85
|
+
* For instance, the 'shortDate' format now corresponds to 'DD/MM/YY' instead of the default
|
|
86
|
+
* Moment.js format of 'DD/MM/YYYY'.
|
|
87
|
+
*/
|
|
82
88
|
const longDateFormat = {
|
|
83
89
|
/** LTS: Specifies the format for displaying time with seconds. */
|
|
84
90
|
LT: 'HH:mm',
|
|
85
91
|
/** LT: Specifies the format for displaying time without seconds. */
|
|
86
92
|
LTS: 'HH:mm:ss',
|
|
93
|
+
/**
|
|
94
|
+
* This format typically produces a localized short date format that is more complete,
|
|
95
|
+
* often including the full month name and day of the month without any abbreviations.
|
|
96
|
+
* e.g. moment().format('L'); // Output: 09/03/2024
|
|
97
|
+
*/
|
|
87
98
|
/** L: Specifies the format for displaying the date in short format. */
|
|
88
|
-
L: 'DD/MM/
|
|
99
|
+
L: 'DD/MM/YY',
|
|
89
100
|
/** LL: Specifies the format for displaying the date in long format. */
|
|
90
101
|
LL: 'D MMMM YYYY',
|
|
91
102
|
/** LLL: Specifies the format for displaying the date and time. */
|
|
92
103
|
LLL: 'D MMMM YYYY HH:mm',
|
|
93
104
|
/** LLLL: Specifies the format for displaying the full date and time with the day of the week. */
|
|
94
105
|
LLLL: 'dddd, D MMMM YYYY HH:mm',
|
|
106
|
+
/**
|
|
107
|
+
* This format usually renders a localized short date format that is even shorter,
|
|
108
|
+
* potentially using abbreviations for the month and/or day of the month.
|
|
109
|
+
* e.g. moment().format('l'); // Output: 9/3/2024
|
|
110
|
+
*/
|
|
111
|
+
/** l: Specifies the format for displaying the date in short format. */
|
|
112
|
+
l: 'DD/MM/YY',
|
|
113
|
+
/** ll: Specifies the format for displaying the date in long format. */
|
|
114
|
+
ll: 'D MMMM YYYY',
|
|
115
|
+
/** lll: Specifies the format for displaying the date and time. */
|
|
116
|
+
lll: 'D MMMM YYYY HH:mm',
|
|
117
|
+
/** llll: Specifies the format for displaying the full date and time with the day of the week. */
|
|
118
|
+
llll: 'dddd, D MMMM YYYY HH:mm',
|
|
95
119
|
}
|
|
96
120
|
|
|
97
121
|
moment.defineLocale('en-at', { parentLocale: 'en', longDateFormat });
|
|
@@ -122,6 +146,14 @@ moment.defineLocale('en-se', {
|
|
|
122
146
|
LLL: 'D MMMM YYYY HH:mm',
|
|
123
147
|
/** LLLL: Specifies the format for displaying the full date and time with the day of the week. */
|
|
124
148
|
LLLL: 'dddd, D MMMM YYYY HH:mm',
|
|
149
|
+
/** l: Specifies the format for displaying the date in short format. */
|
|
150
|
+
l: 'Y-MM-DD',
|
|
151
|
+
/** ll: Specifies the format for displaying the date in long format. */
|
|
152
|
+
ll: 'D MMMM YYYY',
|
|
153
|
+
/** lll: Specifies the format for displaying the date and time. */
|
|
154
|
+
lll: 'D MMMM YYYY HH:mm',
|
|
155
|
+
/** llll: Specifies the format for displaying the full date and time with the day of the week. */
|
|
156
|
+
llll: 'dddd, D MMMM YYYY HH:mm',
|
|
125
157
|
}
|
|
126
158
|
});
|
|
127
159
|
moment.defineLocale('en-si', { parentLocale: 'en', longDateFormat });
|
|
@@ -79,19 +79,43 @@ registerLocaleData(localeFR_LU, localeFRExtra_LU);
|
|
|
79
79
|
registerLocaleData(localeFR_CH, localeFRExtra_CH);
|
|
80
80
|
registerLocaleData(localeFR_BE, localeFRExtra_BE);
|
|
81
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Within the MyWP environment, the 'L' and 'l' date formats have been modified to align with each other
|
|
84
|
+
* and to adhere to the CLDR-based date formats utilized by Angular.
|
|
85
|
+
* For instance, the 'shortDate' format now corresponds to 'DD/MM/YY' instead of the default
|
|
86
|
+
* Moment.js format of 'DD/MM/YYYY'.
|
|
87
|
+
*/
|
|
82
88
|
const longDateFormat = {
|
|
83
89
|
/** LTS: Specifies the format for displaying time with seconds. */
|
|
84
90
|
LT: 'HH:mm',
|
|
85
91
|
/** LT: Specifies the format for displaying time without seconds. */
|
|
86
92
|
LTS: 'HH:mm:ss',
|
|
93
|
+
/**
|
|
94
|
+
* This format typically produces a localized short date format that is more complete,
|
|
95
|
+
* often including the full month name and day of the month without any abbreviations.
|
|
96
|
+
* e.g. moment().format('L'); // Output: 09/03/2024
|
|
97
|
+
*/
|
|
87
98
|
/** L: Specifies the format for displaying the date in short format. */
|
|
88
|
-
L: 'DD/MM/
|
|
99
|
+
L: 'DD/MM/YY',
|
|
89
100
|
/** LL: Specifies the format for displaying the date in long format. */
|
|
90
101
|
LL: 'D MMMM YYYY',
|
|
91
102
|
/** LLL: Specifies the format for displaying the date and time. */
|
|
92
103
|
LLL: 'D MMMM YYYY HH:mm',
|
|
93
104
|
/** LLLL: Specifies the format for displaying the full date and time with the day of the week. */
|
|
94
105
|
LLLL: 'dddd, D MMMM YYYY HH:mm',
|
|
106
|
+
/**
|
|
107
|
+
* This format usually renders a localized short date format that is even shorter,
|
|
108
|
+
* potentially using abbreviations for the month and/or day of the month.
|
|
109
|
+
* e.g. moment().format('l'); // Output: 9/3/2024
|
|
110
|
+
*/
|
|
111
|
+
/** l: Specifies the format for displaying the date in short format. */
|
|
112
|
+
l: 'DD/MM/YY',
|
|
113
|
+
/** ll: Specifies the format for displaying the date in long format. */
|
|
114
|
+
ll: 'D MMMM YYYY',
|
|
115
|
+
/** lll: Specifies the format for displaying the date and time. */
|
|
116
|
+
lll: 'D MMMM YYYY HH:mm',
|
|
117
|
+
/** llll: Specifies the format for displaying the full date and time with the day of the week. */
|
|
118
|
+
llll: 'dddd, D MMMM YYYY HH:mm',
|
|
95
119
|
}
|
|
96
120
|
|
|
97
121
|
moment.defineLocale('en-at', { parentLocale: 'en', longDateFormat });
|
|
@@ -122,6 +146,14 @@ moment.defineLocale('en-se', {
|
|
|
122
146
|
LLL: 'D MMMM YYYY HH:mm',
|
|
123
147
|
/** LLLL: Specifies the format for displaying the full date and time with the day of the week. */
|
|
124
148
|
LLLL: 'dddd, D MMMM YYYY HH:mm',
|
|
149
|
+
/** l: Specifies the format for displaying the date in short format. */
|
|
150
|
+
l: 'Y-MM-DD',
|
|
151
|
+
/** ll: Specifies the format for displaying the date in long format. */
|
|
152
|
+
ll: 'D MMMM YYYY',
|
|
153
|
+
/** lll: Specifies the format for displaying the date and time. */
|
|
154
|
+
lll: 'D MMMM YYYY HH:mm',
|
|
155
|
+
/** llll: Specifies the format for displaying the full date and time with the day of the week. */
|
|
156
|
+
llll: 'dddd, D MMMM YYYY HH:mm',
|
|
125
157
|
}
|
|
126
158
|
});
|
|
127
159
|
moment.defineLocale('en-si', { parentLocale: 'en', longDateFormat });
|
|
@@ -87,8 +87,8 @@ module.exports.build = (pkg, isMaster) => {
|
|
|
87
87
|
return tools.runNodeScriptProcessOutput(args, pkg.paths.root);
|
|
88
88
|
|
|
89
89
|
} else {
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
return execa('node', args, { cwd: pkg.paths.root, stdio: 'inherit' });
|
|
91
|
+
}
|
|
92
92
|
}
|
|
93
93
|
})
|
|
94
94
|
|
|
@@ -96,8 +96,7 @@ module.exports.build = (pkg, isMaster) => {
|
|
|
96
96
|
.catch((e) => {
|
|
97
97
|
throw e;
|
|
98
98
|
});
|
|
99
|
-
}
|
|
100
|
-
|
|
99
|
+
};
|
|
101
100
|
|
|
102
101
|
|
|
103
102
|
module.exports.postBuild = (pkg, version) => {
|
|
@@ -110,44 +109,62 @@ module.exports.postBuild = (pkg, version) => {
|
|
|
110
109
|
|
|
111
110
|
if (dryRun) {
|
|
112
111
|
tools.logInfo('DRY-RUN...skipping');
|
|
113
|
-
return;
|
|
114
|
-
|
|
115
112
|
} else {
|
|
116
113
|
return Promise.resolve()
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (euiVersionNumber >= 18) {
|
|
122
|
-
tools.copydirFiles(path.join(pkg.paths.dist, 'browser'), path.join(pkg.paths.dist));
|
|
123
|
-
tools.remove(path.join(pkg.paths.dist, 'browser'));
|
|
124
|
-
}
|
|
125
|
-
tools.copydir(path.join(pkg.paths.dist), path.join(pkg.paths.dist, 'bundles'));
|
|
126
|
-
})
|
|
114
|
+
.then(() => {
|
|
115
|
+
tools.logTitle('ELEMENT POST build');
|
|
116
|
+
tools.logInfo('Copying dist to bundles folder');
|
|
117
|
+
tools.mkdir(path.join(pkg.paths.dist, 'bundles'));
|
|
127
118
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
})
|
|
119
|
+
// remove browser folder for esbuild builds
|
|
120
|
+
const isEsbuild = pkg?.build?.esbuild !== undefined ?? false;
|
|
131
121
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
122
|
+
if (isEsbuild) {
|
|
123
|
+
tools.copydirFiles(path.join(pkg.paths.dist, 'browser'), path.join(pkg.paths.dist));
|
|
124
|
+
tools.remove(path.join(pkg.paths.dist, 'browser'));
|
|
125
|
+
}
|
|
126
|
+
tools.copydir(path.join(pkg.paths.dist), path.join(pkg.paths.dist, 'bundles'));
|
|
127
|
+
})
|
|
135
128
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
})
|
|
129
|
+
.then(() => {
|
|
130
|
+
// Note: it's limited to 18, but it could be applied to 15 / 16 / 17 / 18
|
|
131
|
+
const loadedAsJsModule = euiVersionNumber >= 18;
|
|
140
132
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
133
|
+
if (loadedAsJsModule) {
|
|
134
|
+
return remotesUtils.createEntryJsFile(pkg, path.join(pkg.paths.dist, 'bundles'), euiVersionNumber);
|
|
135
|
+
} else {
|
|
136
|
+
return remotesUtils.concatFiles(pkg, path.join(pkg.paths.dist, 'bundles'), euiVersionNumber);
|
|
137
|
+
}
|
|
138
|
+
})
|
|
144
139
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
140
|
+
.then(() => {
|
|
141
|
+
// Note: it's limited to 18, but it could be applied to 15 / 16 / 17 / 18
|
|
142
|
+
const loadedAsJsModule = euiVersionNumber >= 18;
|
|
148
143
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
144
|
+
const name = loadedAsJsModule ? 'entry' : undefined;
|
|
145
|
+
return remotesUtils.copyPackageJson(pkg, pkg.paths.root, pkg.paths.dist, remoteEuiVersion, name);
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
.then(() => {
|
|
149
|
+
tools.logInfo(`Renaming main.js or entry.js file to current version : ${version}`);
|
|
150
|
+
|
|
151
|
+
// Note: it's limited to 18, but it could be applied to 15 / 16 / 17 / 18
|
|
152
|
+
const loadedAsJsModule = euiVersionNumber >= 18;
|
|
153
|
+
|
|
154
|
+
const name = loadedAsJsModule ? 'entry' : 'main';
|
|
155
|
+
return tools.move(path.join(pkg.paths.dist, 'bundles', `${name}.js`), path.join(pkg.paths.dist, 'bundles', `${name}-` + version + '.js'));
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
.then(() => {
|
|
159
|
+
return remotesUtils.emptyIndexHtml(pkg, path.join(pkg.paths.dist, 'bundles'));
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
.then(() => {
|
|
163
|
+
return remotesUtils.cleanupUnusedAssets(path.join(pkg.paths.dist, 'bundles', 'assets'), euiVersionNumber);
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
.catch((e) => {
|
|
167
|
+
throw e;
|
|
168
|
+
});
|
|
152
169
|
}
|
|
153
|
-
}
|
|
170
|
+
};
|
|
@@ -7,119 +7,149 @@ const concat = require('concat');
|
|
|
7
7
|
// LOCAL
|
|
8
8
|
const tools = require('../tools');
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
module.exports.concatFiles = (pkg, workingPath, euiVersionNumber = 10) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
tools.logInfo('Concatenating JS files into main.js');
|
|
15
|
-
|
|
16
|
-
tools.move(path.join(workingPath, 'main.js'), path.join(workingPath, 'main-old.js'));
|
|
11
|
+
return Promise.resolve()
|
|
12
|
+
.then(() => {
|
|
17
13
|
|
|
18
|
-
|
|
19
|
-
// covers both webpack and esbuild
|
|
20
|
-
...(tools.isFileExists(path.join(workingPath, 'runtime.js')) ? ['runtime.js'] : []),
|
|
21
|
-
...(tools.isFileExists(path.join(workingPath, 'polyfills.js')) ? ['polyfills.js'] : []),
|
|
22
|
-
...(tools.isFileExists(path.join(workingPath, 'scripts.js')) ? ['scripts.js'] : []),
|
|
23
|
-
...(tools.isFileExists(path.join(workingPath, 'vendor.js')) ? ['vendor.js'] : []),
|
|
24
|
-
'main-old.js',
|
|
25
|
-
].map(f => path.join(workingPath, f));
|
|
14
|
+
tools.logInfo('Concatenating JS files into main.js');
|
|
26
15
|
|
|
27
|
-
|
|
16
|
+
tools.move(path.join(workingPath, 'main.js'), path.join(workingPath, 'main-old.js'));
|
|
28
17
|
|
|
29
|
-
|
|
18
|
+
const files = [
|
|
19
|
+
// covers both webpack and esbuild
|
|
20
|
+
...(tools.isFileExists(path.join(workingPath, 'runtime.js')) ? ['runtime.js'] : []),
|
|
21
|
+
...(tools.isFileExists(path.join(workingPath, 'polyfills.js')) ? ['polyfills.js'] : []),
|
|
22
|
+
...(tools.isFileExists(path.join(workingPath, 'scripts.js')) ? ['scripts.js'] : []),
|
|
23
|
+
...(tools.isFileExists(path.join(workingPath, 'vendor.js')) ? ['vendor.js'] : []),
|
|
24
|
+
'main-old.js',
|
|
25
|
+
].map(f => path.join(workingPath, f));
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
})
|
|
27
|
+
const outFilePath = path.join(workingPath, 'main.js');
|
|
33
28
|
|
|
34
|
-
|
|
35
|
-
throw e;
|
|
36
|
-
})
|
|
37
|
-
}
|
|
29
|
+
console.log(files);
|
|
38
30
|
|
|
31
|
+
return concat(files, outFilePath);
|
|
32
|
+
})
|
|
39
33
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
.catch((e) => {
|
|
35
|
+
throw e;
|
|
36
|
+
});
|
|
37
|
+
};
|
|
44
38
|
|
|
45
|
-
|
|
39
|
+
module.exports.createEntryJsFile = (pkg, workingPath, euiVersionNumber = 15) => {
|
|
40
|
+
return Promise.resolve()
|
|
41
|
+
.then(() => {
|
|
46
42
|
|
|
47
|
-
|
|
48
|
-
const packageJsonFile = path.join(destPath, 'package.json');
|
|
49
|
-
const packageJson = require(packageJsonFile);
|
|
43
|
+
tools.logInfo('Importing files into entry.js');
|
|
50
44
|
|
|
51
|
-
|
|
45
|
+
const files = [
|
|
46
|
+
// covers both webpack and esbuild
|
|
47
|
+
...(tools.isFileExists(path.join(workingPath, 'runtime.js')) ? ['runtime.js'] : []),
|
|
48
|
+
...(tools.isFileExists(path.join(workingPath, 'polyfills.js')) ? ['polyfills.js'] : []),
|
|
49
|
+
...(tools.isFileExists(path.join(workingPath, 'scripts.js')) ? ['scripts.js'] : []),
|
|
50
|
+
...(tools.isFileExists(path.join(workingPath, 'vendor.js')) ? ['vendor.js'] : []),
|
|
51
|
+
...(tools.isFileExists(path.join(workingPath, 'main.js')) ? ['main.js'] : []),
|
|
52
|
+
];
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
})
|
|
54
|
+
const outFilePath = path.join(workingPath, 'entry.js');
|
|
56
55
|
|
|
57
|
-
|
|
58
|
-
throw e;
|
|
59
|
-
})
|
|
60
|
-
}
|
|
56
|
+
console.log(files);
|
|
61
57
|
|
|
58
|
+
let content = ``;
|
|
59
|
+
files.forEach(f => content = `${content}\nimport \'./${f}\';`.trim());
|
|
62
60
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
.then(() => {
|
|
66
|
-
try {
|
|
67
|
-
if (pkg.build.injectPiwikScript) {
|
|
68
|
-
tools.logInfo('Inject index.html with piwik script embedded');
|
|
61
|
+
return tools.writeFileContent(outFilePath, content);
|
|
62
|
+
})
|
|
69
63
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
.catch((e) => {
|
|
65
|
+
throw e;
|
|
66
|
+
});
|
|
67
|
+
};
|
|
73
68
|
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
module.exports.copyPackageJson = (pkg, srcPath, destPath, euiVersion, entryName) => {
|
|
70
|
+
return Promise.resolve()
|
|
71
|
+
.then(() => {
|
|
72
|
+
tools.logInfo('Copying package.json to dist');
|
|
76
73
|
|
|
77
|
-
|
|
78
|
-
const outputIndexHmtlFile = path.join(destPath, 'index.html');
|
|
79
|
-
return tools.copy(emptyIndexHtmlFile, outputIndexHmtlFile);
|
|
80
|
-
}
|
|
74
|
+
tools.copy(path.join(srcPath, 'package.json'), path.join(destPath, 'package.json'));
|
|
81
75
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
})
|
|
76
|
+
if (euiVersion || entryName) {
|
|
77
|
+
const packageJsonFile = path.join(destPath, 'package.json');
|
|
78
|
+
const packageJson = require(packageJsonFile);
|
|
86
79
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
})
|
|
90
|
-
}
|
|
80
|
+
packageJson.euiVersion = euiVersion;
|
|
81
|
+
packageJson.entryName = entryName;
|
|
91
82
|
|
|
83
|
+
tools.writeJsonFileSync(packageJsonFile, packageJson);
|
|
84
|
+
}
|
|
85
|
+
})
|
|
92
86
|
|
|
93
|
-
|
|
94
|
-
|
|
87
|
+
.catch((e) => {
|
|
88
|
+
throw e;
|
|
89
|
+
});
|
|
90
|
+
};
|
|
95
91
|
|
|
96
|
-
if (euiVersionNumber > 10) {
|
|
97
92
|
|
|
93
|
+
module.exports.emptyIndexHtml = (pkg, destPath) => {
|
|
98
94
|
return Promise.resolve()
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
95
|
+
.then(() => {
|
|
96
|
+
try {
|
|
97
|
+
if (pkg.build.injectPiwikScript) {
|
|
98
|
+
tools.logInfo('Inject index.html with piwik script embedded');
|
|
99
|
+
|
|
100
|
+
const emptyIndexHtmlFile = path.join(__dirname, 'skeletons', 'elements', 'index-piwik.html');
|
|
101
|
+
const outputIndexHmtlFile = path.join(destPath, 'index.html');
|
|
102
|
+
return tools.copy(emptyIndexHtmlFile, outputIndexHmtlFile);
|
|
103
|
+
|
|
104
|
+
} else {
|
|
105
|
+
tools.logInfo('Set empty index.html');
|
|
106
|
+
|
|
107
|
+
const emptyIndexHtmlFile = path.join(__dirname, 'skeletons', 'elements', 'index.html');
|
|
108
|
+
const outputIndexHmtlFile = path.join(destPath, 'index.html');
|
|
109
|
+
return tools.copy(emptyIndexHtmlFile, outputIndexHmtlFile);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
} catch (e) {
|
|
113
|
+
console.log(e);
|
|
114
|
+
}
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
.catch((e) => {
|
|
118
|
+
throw e;
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
module.exports.cleanupUnusedAssets = (assetsPath, euiVersionNumber = 10) => {
|
|
124
|
+
tools.logInfo(`Cleanup unused assets for version : ${euiVersionNumber} in ${assetsPath}`);
|
|
125
|
+
|
|
126
|
+
if (euiVersionNumber > 10) {
|
|
127
|
+
|
|
128
|
+
return Promise.resolve()
|
|
129
|
+
.then(() => {
|
|
130
|
+
return tools.rimraf(path.join(assetsPath, 'ecl'));
|
|
131
|
+
})
|
|
132
|
+
.then(() => {
|
|
133
|
+
return tools.rimraf(path.join(assetsPath, 'icons', 'ionicons'));
|
|
134
|
+
})
|
|
135
|
+
.then(() => {
|
|
136
|
+
return tools.rimraf(path.join(assetsPath, 'icons', 'svg'));
|
|
137
|
+
})
|
|
138
|
+
.then(() => {
|
|
139
|
+
return tools.rimraf(path.join(assetsPath, 'icons', 'svg-src'));
|
|
140
|
+
})
|
|
141
|
+
.then(() => {
|
|
142
|
+
return tools.rimraf(path.join(assetsPath, 'icons', 'flags'));
|
|
143
|
+
})
|
|
144
|
+
.then(() => {
|
|
145
|
+
return tools.rimraf(path.join(assetsPath, 'fonts'));
|
|
146
|
+
})
|
|
147
|
+
.then(() => {
|
|
148
|
+
return tools.rimraf(path.join(assetsPath, 'i18n-eui'));
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
.catch((e) => {
|
|
152
|
+
throw e;
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const path = require('path');
|
|
4
|
-
const execa = require('execa');
|
|
5
4
|
|
|
6
5
|
const tools = require('../tools');
|
|
7
6
|
const remotesUtils = require('../remotes/remotes-utils');
|
|
@@ -98,11 +97,35 @@ module.exports.serve = (remote = false) => {
|
|
|
98
97
|
})
|
|
99
98
|
|
|
100
99
|
.then(() => {
|
|
101
|
-
|
|
100
|
+
// remove browser folder for esbuild builds
|
|
101
|
+
const isEsbuild = pkg?.build?.esbuild !== undefined ?? false;
|
|
102
|
+
|
|
103
|
+
if (isEsbuild) {
|
|
104
|
+
tools.copydirFiles(path.join(destPath, 'browser'), path.join(destPath));
|
|
105
|
+
tools.remove(path.join(destPath, 'browser'));
|
|
106
|
+
return Promise.resolve();
|
|
107
|
+
} else {
|
|
108
|
+
Promise.resolve();
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
.then(() => {
|
|
113
|
+
// Note: it's limited to 18, but it could be applied to 15 / 16 / 17 / 18
|
|
114
|
+
const loadedAsJsModule = euiVersionNumber >= 18;
|
|
115
|
+
|
|
116
|
+
if (loadedAsJsModule) {
|
|
117
|
+
return remotesUtils.createEntryJsFile(pkg, destPath, euiVersionNumber);
|
|
118
|
+
} else {
|
|
119
|
+
return remotesUtils.concatFiles(pkg, destPath, euiVersionNumber);
|
|
120
|
+
}
|
|
102
121
|
})
|
|
103
122
|
|
|
104
123
|
.then(() => {
|
|
105
|
-
|
|
124
|
+
// Note: it's limited to 18, but it could be applied to 15 / 16 / 17 / 18
|
|
125
|
+
const loadedAsJsModule = euiVersionNumber >= 18;
|
|
126
|
+
|
|
127
|
+
const name = loadedAsJsModule ? 'entry' : undefined;
|
|
128
|
+
return remotesUtils.copyPackageJson(pkg, pkg.paths.root, rootDestPath, remoteEuiVersion, name);
|
|
106
129
|
})
|
|
107
130
|
|
|
108
131
|
.then(() => {
|
|
@@ -112,4 +135,4 @@ module.exports.serve = (remote = false) => {
|
|
|
112
135
|
.catch((e) => {
|
|
113
136
|
throw e;
|
|
114
137
|
});
|
|
115
|
-
}
|
|
138
|
+
};
|