handleWorkspaceNotFound static method
Handles the case where a workspace could not be found in the current
or a parent directory by throwing an error with a helpful message.
Implementation
static Future<Never> handleWorkspaceNotFound(Directory current) async {
final legacyWorkspace = await _findRootPubspec(current);
if (legacyWorkspace != null) {
throw UnresolvedWorkspace(
multiLine([
'From version 7.0.0, the ${AnsiStyles.bold('melos')} package must be '
'added as a dev_dependency in the root '
'${AnsiStyles.bold('pubspec.yaml')} file.',
'',
'For more information on migrating to version 7.0.0, see: '
'https://melos.invertase.dev/guides/migrations#6xx-to-7xx'
'',
'To migrate at a later time, ensure you have version 6.3.0 or below '
'installed: dart pub global activate melos 6.3.0',
]),
);
}
throw UnresolvedWorkspace(
multiLine([
'Your current directory does not appear to be within a Melos '
'workspace.',
'',
'For setting up a workspace, see: '
'https://melos.invertase.dev/getting-started#setup',
]),
);
}