Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Create sub package as a plugin #147

Open
robiness opened this issue Dec 11, 2022 · 4 comments
Open

Create sub package as a plugin #147

robiness opened this issue Dec 11, 2022 · 4 comments
Labels
enhancement New feature or request sidekick_plugin_installer https://pub.dev/packages/sidekick_plugin_installer

Comments

@robiness
Copy link
Member

As a plugin we create a new folder for the dockerize command called server.
We create it by hand and later when we need to reference it we need to find it ourselves.

Would it be wanted and feasible to have a addPackage function in the plugin_installer?

It would be cool to have the project's structure abstracted away for plugins.

I imagine this creates a folder in the right place. Be it the packages folder or top level if no packages folder is present.
Then introduces this folder in the <cli>_project.dart.

@robiness robiness changed the title Create sub package as plugin Create sub package as a plugin Dec 11, 2022
@passsy
Copy link
Contributor

passsy commented Dec 12, 2022

I don't think a default folder where a plugin has access to write stuff will work. Project structures are too different and I don't want sidekick to force one.

But, there are two things sidekick could help you with:

  • Folder Selector: An easy-to-use directory selector, where a user can point to a location where your server should be created.
  • Plugin Settings: a way to save plugin settings on disk. You could save the path to your server folder, or the sidekick_vault plugin may save a path to the default vault. I'd love to save this information in pubspec.yaml under the sidekick.plugins section.

But, Plugin Settings, might be unnecessary. Checkout the current implementation of sidekick_vault. It writes the location of the vault folder into source during generation. You could do the same and always know where the folder is located.

@passsy passsy added enhancement New feature or request sidekick_plugin_installer https://pub.dev/packages/sidekick_plugin_installer labels Dec 12, 2022
@jxstxn1
Copy link

jxstxn1 commented Dec 12, 2022

It would be nice if we could just move the method from the vault into the installer so that the creation of the paths is unified and we are able to ensure that no one will destroy other paths by accident

@passsy
Copy link
Contributor

passsy commented Dec 12, 2022

Which code do you mean? All you need is a relative path from a fixed location. Sidekick already provides:

Repo root

// in install.dart
final serverDir = findRepository().root.directory('server');
// in sidekick cli
final serverDir = repository.root.directory('server');

Both point to the same location

sidekick cli package location

// in install.dart
final serverDir = PluginContext.sidekickPackage.root.directory('server');
// in sidekick cli
final serverDir = Repository.cliPackageDir.root.directory('server');

Both point to the same location

@jxstxn1
Copy link

jxstxn1 commented Jan 29, 2023

@passsy I think we can close this

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request sidekick_plugin_installer https://pub.dev/packages/sidekick_plugin_installer
Projects
None yet
Development

No branches or pull requests

3 participants