Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Migrate PLUGS to space config #1042

Open
zefhemel opened this issue Aug 18, 2024 · 6 comments
Open

Migrate PLUGS to space config #1042

zefhemel opened this issue Aug 18, 2024 · 6 comments
Milestone

Comments

@zefhemel
Copy link
Collaborator

Having a separate PLUGS file for maintaining what plugs to activate made sense at the time. But by now we have a pretty robust alternative with space config and should just move to that.

This can be done in a backwards compatible way by supporting both, with space config becoming the new way.

To figure out: how to implement Plugs: Add, which currently updates your PLUGS file automatically.

@zefhemel zefhemel added this to the 1.0 milestone Aug 18, 2024
@nodu
Copy link

nodu commented Sep 28, 2024

Perhaps drop the Plugs: Add command... ?

@Maarrk
Copy link
Contributor

Maarrk commented Oct 15, 2024

Proposal:

  1. Keep the plugs list in Space Config as:
```space-config
plugs:
- github:silverbulletmd/silverbullet-git/git.plug.js
- ghr:Maarrk/silverbullet-grep
```
  1. Plugs: Add appends to this list on the current page on the PLUGS page
  • if there is no space-config block, add it at the end of the page
  • if the space-config block doesn't have plugs: at the top level, append it at the end of the block
  • append the URI into the list
  1. If the PLUGS page contains the yaml block with a list, it changes it into the space-config block with the list under plugs: - this way the update happens automatically for the user, but in front of their eyes

Potential problem: there is another way to write a list in YAML:

```space-config
plugs: [ github:silverbulletmd/silverbullet-git/git.plug.js, ghr:Maarrk/silverbullet-grep ]
```

But I think this can also be handled reasonably if the inserting is done on the YAML as a parsetree instead of just adding a line

@zefhemel
Copy link
Collaborator Author

I think this makes sense. The only nasty thing is you probably want to update YAML without rewriting it (e.g. so that comments get lost, reformat everything). For the PLUGS file the whole plug list was always rewritten when using Plugs: Add I think, but in the new system I wouldn't want to happen. It should somehow attempt a minimal change.

@Maarrk
Copy link
Contributor

Maarrk commented Oct 17, 2024

New idea: the Plugs: Add command accepts a string argument that fills the editor.prompt, there can be a button {[Plugs: Add|Install now](https://example.com/cool.plug.js)}. The prompt would still show the user the address before adding it, so I think it's OK

Because of that, I'm back to the idea that the command should edit the PLUGS page, even if they can be loaded from anywhere, updated the #1042 (comment)

Maarrk added a commit to Maarrk/silverbullet that referenced this issue Nov 26, 2024
Maarrk added a commit to Maarrk/silverbullet that referenced this issue Nov 26, 2024
Maarrk added a commit to Maarrk/silverbullet that referenced this issue Nov 27, 2024
Maarrk added a commit to Maarrk/silverbullet that referenced this issue Nov 27, 2024
@Maarrk
Copy link
Contributor

Maarrk commented Nov 27, 2024

Finally got around to finishing this in #1122

For the PLUGS file the whole plug list was always rewritten when using Plugs: Add I think, but in the new system I wouldn't want to happen. It should somehow attempt a minimal change.

This behaviour is separated into insertIntoPlugPage function, which got a bit large in order to support all the cases with minimal edits, but at least it's well commented (I think) and has tests written for a bunch of scenarios.

@Maarrk
Copy link
Contributor

Maarrk commented Nov 27, 2024

chrome_oHlfHS33JV

zefhemel pushed a commit that referenced this issue Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

3 participants