status-im / pluto

https://status-im.github.io/pluto/
12 stars 3 forks source link

expose reader and js functions globally #115

Closed tpscrpt closed 5 years ago

tpscrpt commented 5 years ago

90 I probably won't work on this very much in the coming days. I am therefore sharing my findings in hopes that it may help someone else.

jeluard commented 5 years ago

That's a great start! Do you have a simple sample of how it would be used in a new node project?

tpscrpt commented 5 years ago

It would need to be published after being compiled with cljsbuild. Once published, it would be added by running yarn add @status-im/pluto or npm install @status-im/pluto; then imported with const { reader } = require('@status-im/pluto'). You can make use of webpack, gulp or a similar library to make it browser compatible.

tpscrpt commented 5 years ago

Is it normal that the reader ships with some React code? I.e. does it depend on React code? I haven't yet understood from where it gets included from in the reader/js. That's why I've put in the package.json dependencies on React and ReactDOM, otherwise it complains when running the built javascript in reader.js

jeluard commented 5 years ago

Yes it is!

You can make use of webpack, gulp or a similar library to make it browser compatible.

Which one do you think is the best option?

tpscrpt commented 5 years ago

I remember using browserify and it being very simple.

On Tue, Dec 18, 2018, 10:36 AM Julien Eluard <notifications@github.com wrote:

Yes it is!

You can make use of webpack, gulp or a similar library to make it browser compatible.

Which one do you think is the best option?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/status-im/pluto/pull/115#issuecomment-448262456, or mute the thread https://github.com/notifications/unsubscribe-auth/AWfqZaxVLPOsudISg8y6xyjxvaU5YOPXks5u6Qt5gaJpZM4ZYT4a .

tpscrpt commented 5 years ago

Caused by: java.io.FileNotFoundException: Could not locate pluto/storage/http__init.class or pluto/storage/http.clj on classpath. when compiling with lein cljsbuild once nodejs with :main pluto.js and :main pluto.reader both.

tpscrpt commented 5 years ago

closed for #116 , which now includes a cleaner structure and both nodejs/browser Proofs of Concept.