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

Running paperbits-demo using Github as blob and object storage #191

Open
feranto opened this issue Aug 16, 2021 · 2 comments
Open

Running paperbits-demo using Github as blob and object storage #191

feranto opened this issue Aug 16, 2021 · 2 comments

Comments

@feranto
Copy link

feranto commented Aug 16, 2021

Describe the bug
I'm trying to implement the githubmodule for object and blob storage for the demo website with no success.

To Reproduce

  1. Installed and added the github module to package.json

Package.json

...
        "@paperbits/github": "^0.1.438",
...
  1. Created a personal access token on github with full access to "repo" scope
  2. Added the credentials to the following files:

config.publish.json:

...
    "github": {
        "authorizationKey": "<personalAcessToken>",
        "repositoryName": "<myREPO>",
        "repositoryOwner": "<myUsername>",
        "pathToData": "project/src/data/demo.json"
    }
...

config.design.json:

...
    "github": {
        "authorizationKey": "<personalAcessToken>",
        "repositoryName": "<myREPO>",
        "repositoryOwner": "<myUsername>",
        "pathToData": "project/src/data/demo.json"
    }
...
  1. Inject module in the following files:

startup.design.ts

import "./polyfills";
import * as ko from "knockout";
import { InversifyInjector } from "@paperbits/common/injection";
import { CoreDesignModule } from "@paperbits/core/core.design.module";
import { FormsDesignModule } from "@paperbits/forms/forms.design.module";
import { EmailsDesignModule } from "@paperbits/emails/emails.design.module";
import { StylesDesignModule } from "@paperbits/styles/styles.design.module";
import { ProseMirrorModule } from "@paperbits/prosemirror/prosemirror.module";
import { OfflineModule } from "@paperbits/common/persistence/offline.module";
import { DemoDesignModule } from "./modules/demo.design.module";

/* Github storage module */
import { GithubDesignModule } from "@paperbits/github/github.design.module"

/* Initializing dependency injection  */
const injector = new InversifyInjector();
injector.bindModule(new CoreDesignModule());
injector.bindModule(new FormsDesignModule());
injector.bindModule(new EmailsDesignModule());
injector.bindModule(new StylesDesignModule());
injector.bindModule(new ProseMirrorModule());
injector.bindModule(new DemoDesignModule());

/* Injection Github Module */
injector.bindModule(new GithubDesignModule());

injector.bindModule(new OfflineModule({ autosave: false }));
injector.resolve("autostart");

document.addEventListener("DOMContentLoaded", () => {
    setImmediate(() => ko.applyBindings(undefined, document.body));
});

startup.publish.ts

import { InversifyInjector } from "@paperbits/common/injection";
 import { IPublisher } from "@paperbits/common/publishing";
 import { CacheStorageModule } from "@paperbits/common/publishing/cacheStorageModule";
 import { FormsModule } from "@paperbits/forms/forms.module";
 import { CoreModule } from "@paperbits/core/core.module";
 import { CorePublishModule } from "@paperbits/core/core.publish.module";
 import { EmailsModule } from "@paperbits/emails/emails.module";
 import { EmailsPublishModule } from "@paperbits/emails/emails.publish.module";
 import { StylePublishModule } from "@paperbits/styles/styles.publish.module";
 import { ProseMirrorModule } from "@paperbits/prosemirror/prosemirror.module";
 import { IntercomPublishModule } from "@paperbits/intercom/intercom.publish.module";
 import { GoogleTagManagerPublishModule } from "@paperbits/gtm/gtm.publish.module";
 import { DemoPublishModule } from "./modules/demo.publish.module";
 
  /* Github storage module */
 import { GithubPublishModule } from "@paperbits/github/github.publish.module";
 
 /* Initializing dependency injection  */
 const injector = new InversifyInjector();
 injector.bindModule(new CoreModule());
 injector.bindModule(new CorePublishModule());
 injector.bindModule(new FormsModule());
 injector.bindModule(new EmailsModule());
 injector.bindModule(new EmailsPublishModule());
 injector.bindModule(new StylePublishModule());
 injector.bindModule(new ProseMirrorModule());
 injector.bindModule(new IntercomPublishModule());
 injector.bindModule(new GoogleTagManagerPublishModule());
 
 /* Initializing Demo module */
 const outputBasePath = "./dist/website";
 const settingsPath = "./dist/publisher/config.json";
 const dataPath = "./dist/publisher/data/demo.json";
 injector.bindModule(new DemoPublishModule(dataPath, settingsPath, outputBasePath));
 
 /* Injection Github Module */
 injector.bindModule(new GithubPublishModule());
 
 injector.bindModule(new CacheStorageModule());
 injector.resolve("autostart");
 
 const publisher = injector.resolve<IPublisher>("sitePublisher");
 
 /* Running actual publishing */
 publisher.publish()
     .then(() => {
         console.log("DONE.");
         process.exit();
     })
     .catch((error) => {
         console.log(error);
         process.exit();
     });

And I'm getting the following error when running npm start:

    ERROR in /workspaces/paperbits-demo/project/node_modules/@paperbits/github/githubObjectStorage.ts
    [tsl] ERROR in /workspaces/paperbits-demo/project/node_modules/@paperbits/github/githubObjectStorage.ts(98,18)
          TS2416: Property 'searchObjects' in type 'GithubObjectStorage' is not assignable to the same property in base type 'IObjectStorage'.
      Type '<T>(path: string, query: Query<T>) => Promise<Bag<T>>' is not assignable to type '<T>(key: string, query?: Query<T>) => Promise<Page<T>>'.
        Type 'Promise<Bag<any>>' is not assignable to type 'Promise<Page<any>>'.
          Property 'value' is missing in type 'Bag<any>' but required in type 'Page<any>'.

Expected behavior
Being able to run the paperbits-demo website using Github for objectstorage and blobstorage, exactly as you can do with Firebase.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: linux
  • Browser Edge Chromium
  • Version 92.0.902.73 (Official build) (x86_64)

Additional context
We would appreciate to have a full documentation of the Github storage module, at the same level with the Firebase module.

@azaslonov
Copy link
Member

Thanks Fernando, we'll check this and fix it.

@msrshahrukh100
Copy link

Hi, @azaslonov I am still facing this issue. Can you please help us with this? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants