rhysd / Shiba

Rich markdown live preview app with linter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problems compiling from source

robertgzr opened this issue · comments

After following the instructions here I run into the following two errors:

/src/node_modules/.bin/tsc --pretty -p ./browser
node_modules/@types/webcomponents.js/index.d.ts:39:9 - error TS2687: All declarations of 'extends' must have identical modifiers.

39         extends?: string;
           ~~~~~~~

That can be resolved by applying the following patch to node_modules/@types/webcomponents.js/index.d.ts:

@@ -36,7 + +36,7 @@
 declare global {
     // This contains duplicates of some types in lib.dom.d.ts in order to support typescript 2.0
     interface ElementDefinitionOptions {
-        extends?: string;
+        extends: string;
     }

     interface ShadowRoot extends DocumentFragment {

And after that

/src/node_modules/.bin/tsc --pretty -p ./renderer
node_modules/marked-sanitizer-github/index.ts:200:46 - error TS2345: Argument of type '{ onopentag: (name: string, attrs: { [s: string]: string; }) => void; oncomment: () => void; }' is not assignable to parameter of type 'DomHandler'.
  Property 'onparserinit' is missing in type '{ onopentag: (name: string, attrs: { [s: string]: string; }) => void; oncomment: () => void; }'.

200     private readonly parser = new HTMLParser({
                                                 ~
201         onopentag: (name, attrs) => {
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
208         // Note: onerror is not handled because no error occurs while only parsing an opening tag
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
209     });
    ~~~~~

To resolve that I needed to add all the callbacks defined by the HTMLParser object to the initialization in node_modules/marked-sanitizer-github/index.ts:

@@ -206,6 +206,15 @@
         },
         // Note: CDATA (cdatastart) is not handled
         // Note: onerror is not handled because no error occurs while only parsing an opening tag
+        onparserinit: () => {},
+        onend: () => {},
+        onreset: () => {},
+        onerror: () => {},
+        onclosetag: () => {},
+        oncommentend: () => {},
+        ontext: () => {},
+        oncdatastart: () => {},
+        onprocessinginstruction: () => {},
     });

     reset() {

Also hijacking this issue to ask about your opinion of packaging Shiba as an AppImage?

It should be easy to integrate by making use of electron-builder :)