@redhat-cloud-services/frontend-components-config-utilities 1.5.14 → 1.5.15
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/package.json +1 -1
- package/serve-federated.js +9 -7
package/package.json
CHANGED
package/serve-federated.js
CHANGED
|
@@ -2,7 +2,7 @@ const path = require('path');
|
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const concurrently = require('concurrently');
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
function federate(argv, cwd) {
|
|
6
6
|
let configPath = argv.config;
|
|
7
7
|
const WEBPACK_PATH = path.resolve(cwd, './node_modules/.bin/webpack');
|
|
8
8
|
const HTTP_SERVER_PATH = path.resolve(cwd, './node_modules/.bin/http-server');
|
|
@@ -17,15 +17,17 @@ async function federate(argv, cwd) {
|
|
|
17
17
|
fs.statSync(configPath);
|
|
18
18
|
let config = require(configPath);
|
|
19
19
|
if (typeof config === 'function') {
|
|
20
|
-
config =
|
|
20
|
+
config = config(process.env);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Promise.resolve(config).then((config) => {
|
|
24
|
+
const outputPath = config.output.path;
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
concurrently([
|
|
27
|
+
`${WEBPACK_PATH} --config ${configPath} --watch --output-path ${path.join(outputPath, config.output.publicPath)}`,
|
|
28
|
+
`${HTTP_SERVER_PATH} ${outputPath} -p ${argv.port || 8003} -c-1`,
|
|
29
|
+
]);
|
|
30
|
+
});
|
|
29
31
|
} catch (error) {
|
|
30
32
|
console.error(error);
|
|
31
33
|
process.exit(1);
|