@madgex/fert 5.0.1 → 5.0.2
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.
|
@@ -8,7 +8,6 @@ const {
|
|
|
8
8
|
const commandDevSever = require('./dev-server.js');
|
|
9
9
|
const commandBuild = require('./build.js');
|
|
10
10
|
const commandPublish = require('./publish.js');
|
|
11
|
-
const { log } = require('../utils/logging.js');
|
|
12
11
|
const { FERT_SERVICE_CONFIG_FILENAME } = require('../../constants.js');
|
|
13
12
|
|
|
14
13
|
const commandMap = {
|
|
@@ -33,39 +32,35 @@ module.exports.serivceCommandBootstrap = async function serivceCommandBootstrap(
|
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
// explicitly run a single service - if we are inside a service folder
|
|
35
|
+
let cwdServiceConfig;
|
|
36
36
|
try {
|
|
37
37
|
// try to load service config in process.cwd
|
|
38
|
-
|
|
38
|
+
cwdServiceConfig = await loadConfigFromFile({
|
|
39
39
|
dir: process.cwd(),
|
|
40
40
|
filename: FERT_SERVICE_CONFIG_FILENAME,
|
|
41
41
|
silent: true,
|
|
42
42
|
});
|
|
43
|
-
if (serviceConfig) {
|
|
44
|
-
console.log(`🔦 ${chalk.green('Running single service mode')}`);
|
|
45
|
-
await commandMap[command]({
|
|
46
|
-
...options,
|
|
47
|
-
serviceName: serviceConfig.serviceName,
|
|
48
|
-
});
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
43
|
} catch {
|
|
52
44
|
// no service config file in cwd
|
|
53
45
|
}
|
|
54
|
-
|
|
46
|
+
// found service config in cwd, only load this single service
|
|
47
|
+
if (cwdServiceConfig) {
|
|
48
|
+
console.log(`🔦 ${chalk.green('Running single service mode')}`);
|
|
49
|
+
await commandMap[command]({
|
|
50
|
+
...options,
|
|
51
|
+
serviceName: cwdServiceConfig.serviceName,
|
|
52
|
+
});
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
55
|
// not single service - try to find and load all services
|
|
56
56
|
const serviceConfigs = await loadServiceConfigFiles();
|
|
57
57
|
console.log(
|
|
58
58
|
`🔦 ${chalk.green('Running multi service mode')}, searching for services`
|
|
59
59
|
);
|
|
60
60
|
for (const { serviceConfig } of serviceConfigs) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
});
|
|
66
|
-
} catch (error) {
|
|
67
|
-
log.error('Failed to run command', command, options, serviceConfig);
|
|
68
|
-
console.error(error);
|
|
69
|
-
}
|
|
61
|
+
await commandMap[command]({
|
|
62
|
+
...options,
|
|
63
|
+
serviceName: serviceConfig.serviceName,
|
|
64
|
+
});
|
|
70
65
|
}
|
|
71
66
|
};
|