Trouble with building a plug (silverbullet-git) with deno

Hi,
I’m trying to create a new plug to use “fossil”, a replacement for GIT.
As fossil has pretty similar commands and functions like git, I started by copying the silverbullet git repo and changed everything needed in the code.

So far, so good, but if I try to build, I get an error:

Task build silverbullet plug:compile --importmap import_map.json fossil.plug.yaml
Building [ "fossil.plug.yaml" ]
✘ [ERROR] specifier was a bare specifier, but was not remapped to anything by importMap. [plugin deno-resolver]

    ../root/silverbulletmd/silverbullet/plug-api/lib/settings_page.ts:1:23:
      1 │ import { system } from "@silverbulletmd/silverbullet/syscalls";
        ╵                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

✘ [ERROR] specifier was a bare specifier, but was not remapped to anything by importMap. [plugin deno-resolver]

    ../root/silverbulletmd/silverbullet/plug-api/lib/settings_page.ts:2:29:
      2 │ import { readYamlPage } from "@silverbulletmd/silverbullet/lib/yaml_page";
        ╵                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error building fossil.plug.yaml: Error: Build failed with 2 errors:
../root/silverbulletmd/silverbullet/plug-api/lib/settings_page.ts:1:23: ERROR: [plugin: deno-resolver] specifier was a bare specifier, but was not remapped to anything by importMap.
../root/silverbulletmd/silverbullet/plug-api/lib/settings_page.ts:2:29: ERROR: [plugin: deno-resolver] specifier was a bare specifier, but was not remapped to anything by importMap.
    at xR (https://get.silverbullet.md/:2399:56)
    at https://get.silverbullet.md/:2392:14243
    at M (https://get.silverbullet.md/:2392:21156)
    at h (https://get.silverbullet.md/:2392:14198)
    at https://get.silverbullet.md/:2392:14520
    at I.<computed> (https://get.silverbullet.md/:2392:9401)
    at y (https://get.silverbullet.md/:2392:10191)
    at s (https://get.silverbullet.md/:2392:9101)
    at https://get.silverbullet.md/:2399:5566
    at eventLoopTick (ext:core/01_core.js:175:7) {
  errors: [Getter/Setter],
  warnings: [Getter/Setter]
}
Done building plugs in 202ms

Even, if I try that with the unchanged, original silverbullet-git, so it was not my changes causing the error.

Am I doing something wrong?
Maybe there are prerequisites missing?
Silverbullet itself, as well as the “silverbullet-plug-template” compile with no errors, so I think my setup is basically OK…

I did not find any helpful information, but I also lack of any knowledge about deno, yet…

Thanks for any hints!!

The problem is here: silverbullet-git/import_map.json at main · silverbulletmd/silverbullet-git · GitHub

This assumes you have a checkout of silverbullet next to your silverbullet-git checkout. It’s not very elegant, and should be replaced with the same import structure used in the plug template. I’ll see if I can update the git repo to the new format, I just didn’t get around to it yet.

Thanks, Zef!

Looks like I already was on the right way… I already created such structure:

~/deno_silverbullet/:

├── silverbullet
│   ├── cmd
│   ├── common
│   ├── dist
│   ├── dist_client_bundle
│   ├── dist_plug_bundle
│   ├── lib
│   ├── plug-api
│   ├── plugs
│   ├── scripts
│   ├── server
│   ├── type
│   ├── web
│   └── website
├── silverbullet-fossil
├── silverbullet-git
└── silverbullet-plug-template

But this doesn’t work. Or do I understand “next to” wrong and I must place everything in ONE directory?
Tried this, too, but there was a problem with two different gits in one dir. And copied manually to one dir also did not work, as the build run was running with the silverbullet build only and the git/fossil part was left untouched…

Then I tried to change the include path in “import_map.json” to an absolute path, pointing to the “main” silverbullet directory. Also with no luck.

There must be some detail I’m missing :slight_smile:

Do you have some hints again, please?

Thanks a lot!

I just pushed an update to the repo, let me know if it works for you now.

1 Like

Thanks a lot, Zef!
This time everything works as expected, I could compile the git plug myself.

Now I’m struggling a bit with “fossil” itself, but that is NOT your problem anymore :wink:

If everything works as expected, I’ll share the plug, of course :slight_smile:

2 Likes