diff --git a/lib/puro_sidekick_plugin.dart b/lib/puro_sidekick_plugin.dart index 0fc6558..278c7b5 100644 --- a/lib/puro_sidekick_plugin.dart +++ b/lib/puro_sidekick_plugin.dart @@ -13,7 +13,7 @@ export 'package:puro_sidekick_plugin/src/flutter_sdk.dart' hide createSymlink, puroFlutterSdkPath; export 'package:puro_sidekick_plugin/src/puro.dart'; -void initializePuro(Directory sdk) { +void initializePuro(SdkInitializerContext context) { // Create folder for flutter sdk symlink final symlinkPath = flutterSdkSymlink(); @@ -21,7 +21,7 @@ void initializePuro(Directory sdk) { dcli.env['PURO_ROOT'] = puroRootDir.absolute.path; // Setup puro environment - _setupFlutterEnvironment(); + _setupFlutterEnvironment(context); // Create symlink to puro flutter sdk final flutterPath = puroFlutterSdkPath(); @@ -29,9 +29,9 @@ void initializePuro(Directory sdk) { createSymlink(symlinkPath, flutterPath); } -void _setupFlutterEnvironment() { +void _setupFlutterEnvironment(SdkInitializerContext context) { final sdkVersion = VersionParser( - packagePath: entryWorkingDirectory, + packagePath: context.packageDir?.root ?? SidekickContext.projectRoot, projectRoot: SidekickContext.projectRoot, ).getMaxFlutterSdkVersionFromPubspec(); if (sdkVersion == null) { diff --git a/lib/src/commands/puro_command.dart b/lib/src/commands/puro_command.dart index c2d13e9..13b5652 100644 --- a/lib/src/commands/puro_command.dart +++ b/lib/src/commands/puro_command.dart @@ -13,7 +13,14 @@ class PuroCommand extends ForwardCommand { Future run() async { final args = argResults!.arguments; - initializePuro(Directory.current); + initializePuro( + SdkInitializerContext( + flutterSdk: flutterSdk, + dartSdk: dartSdk, + packageDir: SidekickContext.sidekickPackage, + workingDirectory: Directory.current, + ), + ); exitCode = puro(args); } diff --git a/pubspec.yaml b/pubspec.yaml index 1bc5549..d7fd152 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,12 +10,12 @@ topics: - puro environment: - sdk: '>=3.0.0 <4.0.0' + sdk: '>=3.3.0 <4.0.0' dependencies: - dcli: ^2.2.0 + dcli: ^4.0.0 pub_semver: ^2.1.4 - sidekick_core: ^2.0.0 + sidekick_core: ^3.0.0-preview.1 yaml: ^3.1.1 dev_dependencies: @@ -23,5 +23,5 @@ dev_dependencies: dart_style: ^2.2.0 indent: ^2.0.0 lint: '>=1.5.0 <=3.0.0' - sidekick_plugin_installer: ^1.0.0 + sidekick_plugin_installer: ^1.2.1 test: ^1.21.0 diff --git a/tool/install.dart b/tool/install.dart index e180f27..f33529a 100644 --- a/tool/install.dart +++ b/tool/install.dart @@ -1,6 +1,5 @@ import 'package:puro_sidekick_plugin/puro_sidekick_plugin.dart'; -import 'package:sidekick_core/sidekick_core.dart' - hide cliName, mainProject, repository; +import 'package:sidekick_core/sidekick_core.dart' hide cliName, mainProject, repository; import 'package:sidekick_core/sidekick_core.dart'; import 'package:sidekick_plugin_installer/sidekick_plugin_installer.dart'; @@ -31,7 +30,7 @@ Future main() async { "import 'package:puro_sidekick_plugin/puro_sidekick_plugin.dart';", ); mainSourceFile.registerSdkInitializer( - 'addFlutterSdkInitializer(initializePuro);', + 'addSdkInitializer(initializePuro);', ); mainSourceFile.flush(); @@ -57,7 +56,14 @@ Future main() async { ); } - initializePuro(Directory.current); + initializePuro( + SdkInitializerContext( + flutterSdk: flutterSdk, + dartSdk: dartSdk, + packageDir: SidekickContext.sidekickPackage, + workingDirectory: Directory.current, + ), + ); puro(['flutter', '--version']); print(green('Successfully installed sidekick Puro plugin'));