benr77 / obsidian-gitlab-issues

Obsidian plugin to create/update/remove notes based on GitLab issues
MIT License
28 stars 15 forks source link

Installation with src directory #7

Closed mahoromax closed 1 year ago

mahoromax commented 1 year ago

I installed this plugin with BRAT (cause I didn't find the correct .json or .js files on first glance)

When I tried to run the plugin (I could enable it and use settings just fine) I noticed an error in the terminal about a file in the src folder, which was not present in the plugin folder.

I suspect that this behaviour might carry over to the installation when the plugin if accepted to community plugins.

ENOENT: no such file or directory, open 'C:\git\Obsidian\Work\.obsidian\plugins\obsidian-gitlab-issues\src\default-template.md.hb'

I did not specify my own template, so it tried to use the default, which wasn't present.

I have no idea how to resolve this generally (local I just copied the folder from the repo).

benr77 commented 1 year ago

I'm still waiting for approval to get onto the official community plugins list. I guess the developers have been busy with the 1.0 release recently.

Unless I'm mistaken, the src folder is not delivered to the local Obsidian installation when the plugin is installed through the normal way, so I'm not sure your error is anything to worry about. Obsidian will only get the compiled output from the dist directory.

In any case, what's the exact console error you are getting?

mahoromax commented 1 year ago

Hey, I guess I edited in the error after you replied :-/

I do believe that not having the src folder delivered is exactly the problem, because the plugin defaults to a template located inside?

benr77 commented 1 year ago

This should now be resolved in 0.1.4.

mahoromax commented 1 year ago

I think the problem has moved. It is not looking for a template in the 'src' folder anymore, but there is still no template installed (I did a fresh install using BRAT). There was no template file present inside the plugin folder after install.

Gitlab Issues: ENOENT: no such file or directory, open 'C:\git\Obsidian\Work\.obsidian\plugins\obsidian-gitlab-issues\default-template.md.hb'
benr77 commented 1 year ago

How does BRAT do the install?

The template is in the zip file which is part of the release: https://github.com/benr77/obsidian-gitlab-issues/releases/download/0.1.4/obsidian-gitlab-issues-0.1.4.zip

If it doesn't use the zip file I'll have to add it as a separate file.

mahoromax commented 1 year ago

I was assuming that BRAT uses the same method that the "released" community plugins would use.
And their documentation supports this: https://github.com/TfTHacker/obsidian42-brat/blob/main/help/developers.md

Once a matching release is found based on that version number, the main.js, manifest.json and styles.css are downloaded by Obsidian and installed into your vault.

I kind of doubt that is a complete description, but comparing your release with another plugin (Dataview) I notice that they don't bundle the files (main.json) into a zip, so yeah, I think there's no need for a zip, only the files themselves are needed.

benr77 commented 1 year ago

OK so I have found out that Obsidian will ONLY install the three files for a plugin - main.js, styles.css and manifest.json. This means we need to incorporate the default template into the source code itself.

I'll try and sort this today or tomorrow.

benr77 commented 1 year ago

This should now be fixed in 0.1.6. @mahoromax please can you test on your install thanks.

mahoromax commented 1 year ago

Sorry for the wait.

I can confirm that with the latest (0.1.7) this error is resolved.