Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Example: Upload file to IPFS via browser w/ React & Webpack #539

Merged
merged 2 commits into from
Mar 24, 2017

Conversation

harlantwood
Copy link
Contributor

@harlantwood harlantwood commented Mar 20, 2017

TL;DR: A new example, showing uploading a binary file to IPFS via the browser using js-ipfs-api, via a simple React app, bundled with Webpack.

Issues have been fixed, ready to merge. Works in (my) Chrome and Firefox on Mac.

From the readme of this example:

After uploading a file (left screen), and opening the uploaded file (right screen), you should see something like:

screenshot

For more background see #316.

@diasdavid @dignifiedquire @lidel

@harlantwood
Copy link
Contributor Author

harlantwood commented Mar 21, 2017

Weird... this was working last night, but now fails in the browser with this error:

screen shot 2017-03-21 at 12 59 22 am

Got nowhere googling it... any ideas? @dignifiedquire perhaps?

@daviddias
Copy link
Contributor

@harlantwood, just to remove weird chances, mind trying a fresh npm install and run through it again?

@harlantwood
Copy link
Contributor Author

harlantwood commented Mar 21, 2017 via email

@harlantwood harlantwood force-pushed the feat/upload-example branch from 88363de to 2a78adc Compare March 22, 2017 05:40
@harlantwood
Copy link
Contributor Author

Weird, fixed the issues above... by removing the eslint dependencies. No idea why. But works.

Someone give it a try to confirm it works on 2 machines. 😉

Other than that, ready for merging AFAICT.

@harlantwood
Copy link
Contributor Author

Note: this was originally forked from @victorbjelkholm's bundle-webpack example, which was a great head start.

@harlantwood harlantwood force-pushed the feat/upload-example branch 2 times, most recently from 97f6ed2 to 8339d38 Compare March 22, 2017 19:07
Copy link
Contributor

@daviddias daviddias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like an awesome example, thank you @harlantwood

Seems CI fails just because of linting, mind running a npm run lint and checking what is wrong?

Thank you :)

}
}

module.exports = config
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, we need a bit of lint config so that aegir doesn't get upset about react/jsx stuff. I simplified by replacing this one with the .eslintrc from examples/bundle-webpack.

@@ -0,0 +1,3 @@
{
"stage": 0
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like not. I cut it out and it all seems to hang together ok. 😜

@harlantwood harlantwood force-pushed the feat/upload-example branch from 8339d38 to 825add9 Compare March 24, 2017 05:46
@harlantwood
Copy link
Contributor Author

harlantwood commented Mar 24, 2017

Thanks @diasdavid. I fixed the lint issues.

FWIW, I looked at travis and saw that the build hadn't passed in a month, so I ignored the failing builds there without investigating, especially because Circle CI was passing. Not sure what the deal is there. Maybe we should lint on Circle as well?

Also @dignifiedquire aegir-lint was failing because I was trying to use the futuristic not yet allowed at all http://babeljs.io/docs/plugins/transform-class-properties/ -- it got a "parse error". The thing I wanted to bring to your attention is that aegir-lint gave no information on CI, just "exit code 1" ( https://travis-ci.org/ipfs/js-ipfs-api/jobs/213967377 ) although it gave a clear error message when I ran npm lint locally.

@dignifiedquire
Copy link
Contributor

Thanks @harlantwood there are some issues with output in awgir currently which will hopefully be fixed soonish. Not sure why we don't run linting circle we should fix that.

@daviddias
Copy link
Contributor

build hadn't passed in a month

I believe that isn't quite right, as the only run that 'typically' fails is the Node.js 6 because we run the SauceLabs tests there, which has a super short pool of workers and returns failure if there aren't any available. We need to use better those small resources available.

aegir-lint gave no information on CI

We are currently looking for help into refactoring aegir -- ipfs/aegir#113 -- These kind of problems are causing a lot of trouble, if you or if you know anyone that would like to help, please ping us :).

Thank you!

@daviddias daviddias merged commit 17636a9 into master Mar 24, 2017
@daviddias daviddias deleted the feat/upload-example branch March 24, 2017 09:56
@harlantwood
Copy link
Contributor Author

Great, glad to get this example in! 😁

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

Successfully merging this pull request may close these issues.

4 participants