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

feat: add analytic events #75

Merged
merged 8 commits into from
Jul 14, 2017
Merged

feat: add analytic events #75

merged 8 commits into from
Jul 14, 2017

Conversation

Shou
Copy link
Contributor

@Shou Shou commented Jun 28, 2017

We add analytics sent over the console.log method and intercepted by
Etcher. The debug messages are in the robot format, e.g.

{"command":"log","data":"Hello, World!"}

We also remove the recently introduced way to copy Javascript-less pages
into the build because all banners will now contain code for analytics.

@@ -39,7 +55,9 @@ const Footer = () => (
made with
<img className="icon" src="/static/love.svg" />
by
<img className="brand" src="/static/resin.png" />
<a href="https://resin.io/">
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this link have a click-handler too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I've added that now.

<img className="icon github" src="/static/social/octocat.png" />
Star on Github
</Button>
<Button href="https://twitter.com/intent/tweet?text=%23etcher">
<Button href="https://twitter.com/intent/tweet?text=%23etcher"
event="click Tweet button">
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if it'd make sense to move the "click " and " button" text into the Button's on-click handler?
So that event="click Tweet button" here could be changed to label="Tweet" and line 24 would change to onClick={ eventLog('click '+this.props.label+' button') }>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did this too now.

@@ -23,8 +23,7 @@
"build": "npm run build:data && npm run build-css && next build",
"build-css": "node-sass --include-path scss styles/index.scss static/index.css --output-style compressed && node-sass --include-path scss styles/success-banner.scss static/success-banner.css --output-style compressed",
"serve": "next start",
"export": "npm run build && next export -o build && cp CNAME build/CNAME && cp .nojekyll build/.nojekyll && npm run copy-static",
"copy-static": "cp -r static_html/* build/",
"export": "npm run build && next export -o build && cp CNAME build/CNAME && cp .nojekyll build/.nojekyll",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this simplification of the build-system be mentioned in the commit-message too?
(perhaps it'd be worth splitting this PR into 2 commits? *shrug*)

Copy link
Contributor Author

@Shou Shou Jun 28, 2017

Choose a reason for hiding this comment

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

I'll mention it, since it was introduced so recently (yesterday) I don't think we need another commit.

@@ -1 +1 @@
body{display:flex;justify-content:center;background-color:#535760;font-family:'Helvetica Thin', Helvetica, sans-serif;color:#ffffff}.horizontal,.vertical{display:flex}.vertical{flex-direction:column}.center{display:flex;justify-content:center;align-items:center}.button{display:flex;align-items:center;justify-content:center;width:165px;padding:14px 44px;margin:7.5px;background-color:#313339;color:#fff;font-weight:bold;text-decoration:none;border-radius:3px}.button>img{margin:0 10px}.icon{max-height:24px}.icon.github{margin-right:15px}.icon.twitter{margin-right:8px;margin-left:-4px}footer{margin-top:30px;display:flex;align-items:center;justify-content:center}footer>img{margin:0 0.5em}footer>.brand{max-height:24px}h1{display:inline-block;padding:5px;margin-top:0;font-weight:normal;font-size:26px}.etcher-logo{margin-left:8px;width:130px}
body{display:flex;justify-content:center;background-color:#535760;font-family:'Helvetica Thin', Helvetica, sans-serif;color:#ffffff}.horizontal,.vertical{display:flex}.vertical{flex-direction:column}.center{display:flex;justify-content:center;align-items:center}.button{display:flex;align-items:center;justify-content:center;width:165px;padding:14px 44px;margin:7.5px;background-color:#313339;color:#fff;font-weight:bold;text-decoration:none;border-radius:3px}.button>img{margin:0 10px}.icon{max-height:24px}.icon.github{margin-right:15px}.icon.twitter{margin-right:8px;margin-left:-4px}footer{margin-top:30px;display:flex;align-items:center;justify-content:center}footer>img,footer>a{margin:0 0.5em}footer>a>.brand{max-height:24px}h1{display:inline-block;padding:5px;margin-top:0;font-weight:normal;font-size:26px}.etcher-logo{margin-left:8px;width:130px}
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this file get updated at build / export time? Does it need to be included in the repo?

Copy link
Contributor Author

@Shou Shou Jun 28, 2017

Choose a reason for hiding this comment

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

It does get updated at build time, yeah. We could probably safely remove it, but the project contains other generated CSS as well, so for the sake of consistency I've kept it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Your thoughts here @craig-mulligan ?

Copy link
Contributor Author

@Shou Shou Jun 29, 2017

Choose a reason for hiding this comment

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

I believe he's away on vacation now (I could be wrong, edit: oh I'm not), but either way I've opened this as a separate issue #76 we can fix later.

@Shou
Copy link
Contributor Author

Shou commented Jun 28, 2017

Thanks for the review @lurch!

return () => {
const url = new URL(location.href);

if (url.searchParams.get('etcher-version').indexOf('1.0.0') !== -1) {
Copy link
Contributor

@lurch lurch Jun 28, 2017

Choose a reason for hiding this comment

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

Hmmm, what's this for? Isn't Etcher 1.0.0 the only version that contains code to display this banner anyway? Or is this related to the Robot-changes in balena-io/etcher#1422 which were performed after the release of Etcher 1.0.0?

EDIT: And why use indexOf rather than a direct === ? Does using indexOf mean that it'll get confused when we release Etcher 11.0.0 ? ;-) And would this code error if etcher-version didn't exist in the searchParams?

EDIT2: Ah, I guess this is to take the commit-hash versions (created by snapshot-builds) into account. But even then it probably ought to be checking that the string startsWith 1.0.0, rather than checking if it occurs anywhere in the string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, the latter. Prior to those changes they weren't robot objects, and instead just strings forwarded based on which console object method was used. So we have to check and send the appropriate string to Etcher via the console.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean that the current 'development' versions of Etcher that we're building and testing with (which include these new Robot-logging changes) ought to have a version-number different to 1.0.0?
Ping @jviotti I guess this is (almost) an example of "API version-breaking" ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

If we want to check these kinds of things, we should make Etcher expose a "web banner" version number instead of using Etcher's main version. E.g. we can say "web banner messaging protocol version 1", and then independently increment that when we need to. If such protocol version property is unset, then we infer is the oldest one.

Copy link
Contributor

Choose a reason for hiding this comment

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

In this particular case though, we're printing in both sides of the conditional, so I guess it doesn't hurt at all to always send a robot object.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess a webview-version would fit that nicely. So that we'd then send URLs like

https://etcher.io/?etcher-version=1.0.0&webview-version=2

we're printing in both sides of the conditional, so I guess it doesn't hurt at all to always send a robot object.

I wondered that too, but assumed that @Shou had some good reason for not doing so?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jviotti So you mean we should just send the robot object instead?

Also I've made balena-io/etcher#1558 now.

}
}

class Link extends React.PureComponent {
Copy link
Contributor

Choose a reason for hiding this comment

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

Given that the Button and Link here have target="_blank" I wonder if they should be named e.g. ExternalButton and ExternalLink to emphasise the fact that they'll open a new browser window, rather than being displayed inside the Etcher 'iframe' ?
Or perhaps it makes more sense to leave them as-is (i.e. open-externally by default), and then if we ever wanted Buttons or Links that opened inside the Etcher webview, we could name them e.g. InternalButton and InternalLink?

@@ -22,11 +56,13 @@ const Banner = () => (
</h1>
</div>
<div className="horizontal center">
<Button href="https://github.com/resin-io/etcher">
<Button href="https://github.com/resin-io/etcher"
label="Github star">
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor nit, but for consistency with the actual button label, should this be label="Star on Github" ?

Copy link
Contributor Author

@Shou Shou Jun 28, 2017

Choose a reason for hiding this comment

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

Sure. I did that now.

<img className="brand" src="/static/resin.png" />
<Link href="https://resin.io/"
label="Resin">
<img className="brand" src="/static/resin.png" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Given that this page is only intended to be displayed inside the Etcher webview, I guess it doesn't really make sense to add ALT attributes to the IMG tags?

Copy link
Contributor Author

@Shou Shou Jun 28, 2017

Choose a reason for hiding this comment

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

Had the same thought, I'm not sure if it matters either, so I think we can just leave it.

constructor() {
super();

this.type = 'button';
Copy link
Contributor

Choose a reason for hiding this comment

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

Ooooh, nice 👍

@lurch
Copy link
Contributor

lurch commented Jun 28, 2017

@craig-mulligan The most recent commit on this PR caused a Travis build failure, even though the previous commits built fine, and the errors look totally unrelated to what the most recent commit changed.

$ npm run build && next export -o build && cp CNAME build/CNAME && cp .nojekyll build/.nojekyll 
> etcher.io@ build /home/travis/build/resin-io/etcher-homepage
> npm run build:data && npm run build-css && next build
> etcher.io@ build:data /home/travis/build/resin-io/etcher-homepage
> babel-node lib/fetchData.js
TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.
    at fromObject (buffer.js:280:9)
    at Function.Buffer.from (buffer.js:106:10)
    at new Buffer (buffer.js:85:17)
    at /home/travis/build/resin-io/etcher-homepage/lib/fetchData.js:21:12
    at tryCatcher (/home/travis/build/resin-io/etcher-homepage/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/travis/build/resin-io/etcher-homepage/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/travis/build/resin-io/etcher-homepage/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/travis/build/resin-io/etcher-homepage/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/travis/build/resin-io/etcher-homepage/node_modules/bluebird/js/release/promise.js:693:18)
    at Promise._fulfill (/home/travis/build/resin-io/etcher-homepage/node_modules/bluebird/js/release/promise.js:638:18)
    at PromiseArray._resolve (/home/travis/build/resin-io/etcher-homepage/node_modules/bluebird/js/release/promise_array.js:126:19)
    at PromiseArray._promiseFulfilled (/home/travis/build/resin-io/etcher-homepage/node_modules/bluebird/js/release/promise_array.js:144:14)
    at Promise._settlePromise (/home/travis/build/resin-io/etcher-homepage/node_modules/bluebird/js/release/promise.js:574:26)
    at Promise._settlePromise0 (/home/travis/build/resin-io/etcher-homepage/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/travis/build/resin-io/etcher-homepage/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/home/travis/build/resin-io/etcher-homepage/node_modules/bluebird/js/release/async.js:133:16)
> etcher.io@ build-css /home/travis/build/resin-io/etcher-homepage
> node-sass --include-path scss styles/index.scss static/index.css --output-style compressed && node-sass --include-path scss styles/success-banner.scss static/success-banner.css --output-style compressed
Rendering Complete, saving .css file...
Wrote CSS to /home/travis/build/resin-io/etcher-homepage/static/index.css
Rendering Complete, saving .css file...
Wrote CSS to /home/travis/build/resin-io/etcher-homepage/static/success-banner.css
> Using external babel configuration
> location: "/home/travis/build/resin-io/etcher-homepage/.babelrc"
> Using "webpack" config function defined in next.config.js.
> Failed to build on /tmp/e688f561-3f0c-4154-af30-1a302be84ad1
{ Error: ./pages/changelog.js?entry
Module not found: Error: Can't resolve '../config/cache.json' in '/home/travis/build/resin-io/etcher-homepage/pages'
resolve '../config/cache.json' in '/home/travis/build/resin-io/etcher-homepage/pages'
  using description file: /home/travis/build/resin-io/etcher-homepage/package.json (relative path: ./pages)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /home/travis/build/resin-io/etcher-homepage/package.json (relative path: ./pages)
    using description file: /home/travis/build/resin-io/etcher-homepage/package.json (relative path: ./config/cache.json)
      as directory
        /home/travis/build/resin-io/etcher-homepage/config/cache.json doesn't exist
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        /home/travis/build/resin-io/etcher-homepage/config/cache.json doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        /home/travis/build/resin-io/etcher-homepage/config/cache.json.js doesn't exist
      .json
        Field 'browser' doesn't contain a valid alias configuration
        /home/travis/build/resin-io/etcher-homepage/config/cache.json.json doesn't exist
[/home/travis/build/resin-io/etcher-homepage/config/cache.json]
[/home/travis/build/resin-io/etcher-homepage/config/cache.json]
[/home/travis/build/resin-io/etcher-homepage/config/cache.json.js]
[/home/travis/build/resin-io/etcher-homepage/config/cache.json.json]
 @ ./pages/changelog.js?entry 23:13-44
 @ multi ./pages/changelog.js?entry
    at /home/travis/build/resin-io/etcher-homepage/node_modules/next/dist/server/build/index.js:181:21
    at /home/travis/build/resin-io/etcher-homepage/node_modules/webpack/lib/Compiler.js:272:15
    at Compiler.emitRecords (/home/travis/build/resin-io/etcher-homepage/node_modules/webpack/lib/Compiler.js:367:37)
    at /home/travis/build/resin-io/etcher-homepage/node_modules/webpack/lib/Compiler.js:265:12
    at /home/travis/build/resin-io/etcher-homepage/node_modules/webpack/lib/Compiler.js:360:11
    at next (/home/travis/build/resin-io/etcher-homepage/node_modules/tapable/lib/Tapable.js:154:11)
    at Compiler.compiler.plugin (/home/travis/build/resin-io/etcher-homepage/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
    at Compiler.applyPluginsAsyncSeries1 (/home/travis/build/resin-io/etcher-homepage/node_modules/tapable/lib/Tapable.js:158:13)
    at Compiler.afterEmit (/home/travis/build/resin-io/etcher-homepage/node_modules/webpack/lib/Compiler.js:357:8)
    at Compiler.<anonymous> (/home/travis/build/resin-io/etcher-homepage/node_modules/webpack/lib/Compiler.js:352:14)
  errors: 
   [ './pages/changelog.js?entry\nModule not found: Error: Can\'t resolve \'../config/cache.json\' in \'/home/travis/build/resin-io/etcher-homepage/pages\'\nresolve \'../config/cache.json\' in \'/home/travis/build/resin-io/etcher-homepage/pages\'\n  using description file: /home/travis/build/resin-io/etcher-homepage/package.json (relative path: ./pages)\n    Field \'browser\' doesn\'t contain a valid alias configuration\n  after using description file: /home/travis/build/resin-io/etcher-homepage/package.json (relative path: ./pages)\n    using description file: /home/travis/build/resin-io/etcher-homepage/package.json (relative path: ./config/cache.json)\n      as directory\n        /home/travis/build/resin-io/etcher-homepage/config/cache.json doesn\'t exist\n      no extension\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /home/travis/build/resin-io/etcher-homepage/config/cache.json doesn\'t exist\n      .js\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /home/travis/build/resin-io/etcher-homepage/config/cache.json.js doesn\'t exist\n      .json\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /home/travis/build/resin-io/etcher-homepage/config/cache.json.json doesn\'t exist\n[/home/travis/build/resin-io/etcher-homepage/config/cache.json]\n[/home/travis/build/resin-io/etcher-homepage/config/cache.json]\n[/home/travis/build/resin-io/etcher-homepage/config/cache.json.js]\n[/home/travis/build/resin-io/etcher-homepage/config/cache.json.json]\n @ ./pages/changelog.js?entry 23:13-44\n @ multi ./pages/changelog.js?entry',
     './pages?entry\nModule not found: Error: Can\'t resolve \'../config/cache.json\' in \'/home/travis/build/resin-io/etcher-homepage/pages\'\nresolve \'../config/cache.json\' in \'/home/travis/build/resin-io/etcher-homepage/pages\'\n  using description file: /home/travis/build/resin-io/etcher-homepage/package.json (relative path: ./pages)\n    Field \'browser\' doesn\'t contain a valid alias configuration\n  after using description file: /home/travis/build/resin-io/etcher-homepage/package.json (relative path: ./pages)\n    using description file: /home/travis/build/resin-io/etcher-homepage/package.json (relative path: ./config/cache.json)\n      as directory\n        /home/travis/build/resin-io/etcher-homepage/config/cache.json doesn\'t exist\n      no extension\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /home/travis/build/resin-io/etcher-homepage/config/cache.json doesn\'t exist\n      .js\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /home/travis/build/resin-io/etcher-homepage/config/cache.json.js doesn\'t exist\n      .json\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /home/travis/build/resin-io/etcher-homepage/config/cache.json.json doesn\'t exist\n[/home/travis/build/resin-io/etcher-homepage/config/cache.json]\n[/home/travis/build/resin-io/etcher-homepage/config/cache.json]\n[/home/travis/build/resin-io/etcher-homepage/config/cache.json.js]\n[/home/travis/build/resin-io/etcher-homepage/config/cache.json.json]\n @ ./pages?entry 37:13-44\n @ multi ./pages?entry',
     './pages/cli.js?entry\nModule not found: Error: Can\'t resolve \'../config/cache.json\' in \'/home/travis/build/resin-io/etcher-homepage/pages\'\nresolve \'../config/cache.json\' in \'/home/travis/build/resin-io/etcher-homepage/pages\'\n  using description file: /home/travis/build/resin-io/etcher-homepage/package.json (relative path: ./pages)\n    Field \'browser\' doesn\'t contain a valid alias configuration\n  after using description file: /home/travis/build/resin-io/etcher-homepage/package.json (relative path: ./pages)\n    using description file: /home/travis/build/resin-io/etcher-homepage/package.json (relative path: ./config/cache.json)\n      as directory\n        /home/travis/build/resin-io/etcher-homepage/config/cache.json doesn\'t exist\n      no extension\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /home/travis/build/resin-io/etcher-homepage/config/cache.json doesn\'t exist\n      .js\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /home/travis/build/resin-io/etcher-homepage/config/cache.json.js doesn\'t exist\n      .json\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /home/travis/build/resin-io/etcher-homepage/config/cache.json.json doesn\'t exist\n[/home/travis/build/resin-io/etcher-homepage/config/cache.json]\n[/home/travis/build/resin-io/etcher-homepage/config/cache.json]\n[/home/travis/build/resin-io/etcher-homepage/config/cache.json.js]\n[/home/travis/build/resin-io/etcher-homepage/config/cache.json.json]\n @ ./pages/cli.js?entry 27:13-44\n @ multi ./pages/cli.js?entry' ],
  warnings: [] }
npm ERR! Linux 4.8.12-040812-generic
npm ERR! argv "/home/travis/.nvm/versions/node/v7.10.0/bin/node" "/home/travis/.nvm/versions/node/v7.10.0/bin/npm" "run" "build"
npm ERR! node v7.10.0
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! etcher.io@ build: `npm run build:data && npm run build-css && next build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the etcher.io@ build script 'npm run build:data && npm run build-css && next build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the etcher.io package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run build:data && npm run build-css && next build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs etcher.io
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls etcher.io
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!     /home/travis/.npm/_logs/2017-06-28T15_00_12_696Z-debug.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The command "yarn run export" exited with 1.

I'll restart the build, in case this was a spurious failure, like we saw in #69

@@ -22,11 +57,13 @@ const Banner = () => (
</h1>
</div>
<div className="horizontal center">
<Button href="https://github.com/resin-io/etcher">
<Button href="https://github.com/resin-io/etcher"
label="star on Github">
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: should it be Star with a capital S? ;) (as that's what the button says)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I left it like that because 'Banner ' is prepended. Either works though.

@lurch
Copy link
Contributor

lurch commented Jun 28, 2017

I'll restart the build, in case this was a spurious failure, like we saw in #69

Nope, failed again :-(

@craigmulligan
Copy link
Contributor

:( yea, I'm not sure what it is it only seemed to happen on travis and not locally, I have to run to the airport now, but I'd give the build another try otherwise just merge and I'll fix the false negs when I'm back.

@lurch
Copy link
Contributor

lurch commented Jun 28, 2017

I guess it makes sense to get balena-io/etcher#1558 merged, and then update this PR afterwards.

This was referenced Jun 29, 2017
@Shou
Copy link
Contributor Author

Shou commented Jul 5, 2017

I've updated this to use the API version information, but the test fails again, at a timeout this time.

@lurch
Copy link
Contributor

lurch commented Jul 5, 2017

@Shou looks like the error is the same as last time (there seems to be a 'knack' to reading NPM errors properly ;-) ).
I tried digging into the error message a bit, and see that it's complaining about:

> babel-node lib/fetchData.js

TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.
    at fromObject (buffer.js:280:9)
    at Function.Buffer.from (buffer.js:106:10)
    at new Buffer (buffer.js:85:17)
    at /home/travis/build/resin-io/etcher-homepage/lib/fetchData.js:21:12

line 21 of fetchData.js says:

cli: new Buffer(data[0].content, 'base64').toString(),

so I guess this must mean that data[0].content isn't a string, and tracing back a bit further, data[0] is fetch('https://api.github.com/repos/resin-io/etcher/contents/docs/CLI-INSTALLATION.md').then(res => ( res.json() )).
I still don't know why it's failing on TravisCI when it works locally, but @craig-mulligan why are you fetching https://api.github.com/repos/resin-io/etcher/contents/docs/CLI-INSTALLATION.md, converting it to JSON, and then base64-decoding its .content property? Wouldn't it be much simpler to just fetch https://raw.githubusercontent.com/resin-io/etcher/master/docs/CLI-INSTALLATION.md directly? ;-) (or is there a reason for doing it the way you are?)

And then I guess the later Error: Can't resolve '../config/cache.json' must be a side-effect of the first error (i.e. it couldn't download the URLs it needed, so ../config/cache.json couldn't be created, and so the later steps fail).

This was referenced Jul 11, 2017
@lurch
Copy link
Contributor

lurch commented Jul 11, 2017

Can you try rebasing this now that #80 had been merged @Shou ?

EDIT: And might be worth including the change from #76 too.

Copy link
Contributor

@lurch lurch left a comment

Choose a reason for hiding this comment

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

Yay tests all passing again

@Shou
Copy link
Contributor Author

Shou commented Jul 12, 2017

Added some jsdoc, and more importantly fixed a potential future security issue with target="_blank". Right now Etcher shouldn't be affected, but if it ever decides to run in a browser then it'll be; better to just get rid of it.

Shou added 3 commits July 14, 2017 11:45
We add analytics sent over the `console.log` method and intercepted by
Etcher. The debug messages are in the [robot][1] format, e.g.

```js
{"command":"log","data":"Hello, World!"}
```

We also remove the recently introduced way to copy Javascript-less pages
into the build because all banners will now contain code for analytics.

[1]: https://github.com/resin-io/etcher/tree/master/lib/shared/robot#the-robot-mechanism
@Shou Shou merged commit 6a9a900 into master Jul 14, 2017
* @function
* @private
*
* @param {String} eventDecs - event description
Copy link
Contributor

Choose a reason for hiding this comment

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

Just noticed that this says eventDecs when it should say eventDesc - could you squeeze it into #77 @Shou :)

@jhermsmeier jhermsmeier deleted the banner-analytics branch April 11, 2018 15:45
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