Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions packages/cli/src/tools/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function getDependencyConfig(
* Loads CLI configuration
*/
function loadConfig(projectRoot: string = process.cwd()): ConfigT {
let lazyProject;
const userConfig = readConfigFromDisk(projectRoot);

const initialConfig: ConfigT = {
Expand All @@ -84,14 +85,19 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT {
platforms: Object.keys(userConfig.platforms),
},
get project() {
const project = {};
if (lazyProject) {
return lazyProject;
}

lazyProject = {};
for (const platform in finalConfig.platforms) {
project[platform] = finalConfig.platforms[platform].projectConfig(
lazyProject[platform] = finalConfig.platforms[platform].projectConfig(
projectRoot,
userConfig.project[platform] || {},
);
}
return project;

return lazyProject;
},
};

Expand Down