bootstrap method
Implementation
Future<void> bootstrap({GlobalOptions? global, PackageFilter? filter}) async {
final workspace = await createWorkspace(global: global, filter: filter);
return _runLifecycle(
workspace,
ScriptLifecycle.bootstrap,
() async {
final pubCommandForLogging = [
...pubCommandExecArgs(
useFlutter: workspace.isFlutterWorkspace,
workspace: workspace,
),
'get',
if (workspace.config.commands.bootstrap.runPubGetOffline) '--offline'
].join(' ');
logger
..command('melos bootstrap')
..child(targetStyle(workspace.path))
..newLine();
logger.log('Running "$pubCommandForLogging" in workspace packages...');
if (!utils.isCI && workspace.filteredPackages.keys.length > 20) {
logger.warning(
'Note: this may take a while in large workspaces such as this one.',
label: false,
);
}
try {
if (workspace.config.commands.bootstrap.usePubspecOverrides) {
await _linkPackagesWithPubspecOverrides(workspace);
} else {
await _linkPackagesWithPubFiles(workspace);
}
} on BootstrapException catch (exception) {
_logBootstrapException(exception, workspace);
rethrow;
}
logger.child(successLabel, prefix: '> ');
if (workspace.config.ide.intelliJ.enabled) {
logger
..newLine()
..log('Generating IntelliJ IDE files...');
await cleanIntelliJ(workspace);
await workspace.ide.intelliJ.generate();
logger.child(successLabel, prefix: '> ');
}
logger
..newLine()
..log(
' -> ${workspace.filteredPackages.length} packages bootstrapped',
);
},
);
}