-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
44 lines (34 loc) · 1.16 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const { readJson } = require("fs-extra");
const { Lazy } = require("lazy-val");
const { join, resolve } = require("path");
const { getConfig } = require("read-config-file");
function getPackageMetadata(projectDir) {
return new Lazy(() => readJson(join(projectDir, "package.json")));
}
const getElectronWebpackConfiguration = async (context) => {
const result = await getConfig({
packageKey: "betterElectronWebpack",
configFilename: "better-electron-webpack",
projectDir: context.projectDir,
packageMetadata: context.packageMetadata,
});
const configuration = result == null || result.result == null ? {} : result.result;
if (configuration.commonDistDirectory == null) {
configuration.commonDistDirectory = "dist";
}
configuration.commonDistDirectory = resolve(context.projectDir, configuration.commonDistDirectory);
if (configuration.renderer === undefined) {
configuration.renderer = {};
}
if (configuration.main === undefined) {
configuration.main = {};
}
if (configuration.projectDir == null) {
configuration.projectDir = context.projectDir;
}
return configuration;
};
module.exports = {
getPackageMetadata,
getElectronWebpackConfiguration,
};