fabien0102 / gatsby-starter

Gatsby 2.0 starter with typescript and many cools dev tools
386 stars 99 forks source link

Google Verification & Google Analytics #52

Closed sielay closed 6 years ago

sielay commented 6 years ago

Regards #10

Allows you to add GA and verification

fabien0102 commented 6 years ago

@sielay Thanks a lot 😃 Just a question, did you have a look on this? https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-google-analytics

If yes, why your solution is better? And if is really better, it can be nice to integrate this directly in the GA gatsby plugin :wink:

BTW, my build is broken… really need to debug this… sorry for that

sielay commented 6 years ago

My version is rudimental. Just does the job. You can go for plugins, but that shortly can start look like with grunt or webpack when you lose control over the content.

I try to debug now issue with your build. It's related IMHO to dependencies as all will work fine as long you won't refresh package-lock.json by adding any new package. Then Connect starts to complain about not getting store. Not sure if that's the same issue on netlify, but for sure it makes impossible to add plugins.

fabien0102 commented 6 years ago

@sielay Thanks for all your PR, it's really look awesome! If you have time to find why typescript refuse to compile it will be awesome. Else I will fix this next week, and try/merge everything (not always easy to find some time for side project…)

The actual error into netlify:

12:47:30 AM:   Error: ./~/gatsby-module-loader?name=component---src-templates-blog-post-tsx!.  /src/templates/blog-post.tsx
12:47:30 AM:   (9,29): error TS7006: Parameter 'props' implicitly has an 'any' type.
sielay commented 6 years ago

I saw it, have it in the next PR and @fabien0102 . I think it affects all of your netlify builds. I will hunt it down. It's something where typescript goes mental. If we dislable inplicit any it shows up more issues. Also gatsby hides most of webpack errors. I'll need to patch them first.

fabien0102 commented 6 years ago

https://github.com/fabien0102/gatsby-starter/blob/3048e7ca20b01d04ce3c127cdb9431af5bd151f8/tsconfig.json#L5

Already tried ^^ And it's works perfectly locally for me… (so hard and long to debug)

sielay commented 6 years ago

It doesn't for me, so it may be because dependency or node version. What node u use?

fabien0102 commented 6 years ago

I'm on v8.9.4, but I don't touched this starter since a big month and probably update my node version since my last test

sielay commented 6 years ago

Ok. Let me debug. I don't want to disable implicity just to cover real issues.

BTW had to do that https://github.com/gatsbyjs/gatsby/pull/4634 as they hidden more errors ;(

sielay commented 6 years ago

It's semantic-ui-react breaking stuff because changes in typings. Upgrade to 0.79.0 will do the job. I'm retesting and will re-push both PRs.

sielay commented 6 years ago

Now wait for that to be merged https://github.com/gatsbyjs/gatsby/pull/4667#issuecomment-375650037

sielay commented 6 years ago

@fabien0102 did you notice that most of dependencies target node 7+ but netlify setup is node 6? I experience same build problems when downgrading node. Do we care about node 6? If not we should put node version in the package.json and the README.

I'm not sure how to change netlify node version target (never used it before).

fabien0102 commented 6 years ago

@sielay Nice catch, I will try this :wink: and no, I really don't care about the minimal node version ^^ The current LTS is the 8.10.0, so let's update this!

fabien0102 commented 6 years ago

With v8.10.0… 😢

12:12:48 PM:   Error: Cannot find module 'sharp'
12:12:48 PM:   
12:12:48 PM:   - v8-compile-cache.js:159 require
12:12:48 PM:     [repo]/[v8-compile-cache]/v8-compile-cache.js:159:20
12:12:48 PM:   
12:12:48 PM:   - extend-node-type.js:35 Object.<anonymous>
12:12:49 PM:     [repo]/[gatsby-transformer-sharp]/extend-node-type.js:35:13
12:12:49 PM:   
12:12:49 PM:   - v8-compile-cache.js:178 Module._compile
12:12:49 PM:     [repo]/[v8-compile-cache]/v8-compile-cache.js:178:30
12:12:49 PM:   
12:12:49 PM:   - v8-compile-cache.js:159 require
12:12:49 PM:     [repo]/[v8-compile-cache]/v8-compile-cache.js:159:20
12:12:49 PM:   
12:12:49 PM:   - gatsby-node.js:16 Object.<anonymous>
12:12:49 PM:     [repo]/[gatsby-transformer-sharp]/gatsby-node.js:16:38
12:12:49 PM:   
12:12:49 PM:   - v8-compile-cache.js:178 Module._compile
12:12:49 PM:     [repo]/[v8-compile-cache]/v8-compile-cache.js:178:30
fabien0102 commented 6 years ago

Just trying from scratch (directly clone your branch) on my computer, everything install and build correctly (and I'm on windows 10 ^^)

I'm on node v8.9.4 locally, I will try this version on netlify, but it's really strange…

EDIT: Same result with 8.9.4 on netlify

sielay commented 6 years ago

Had no problem with 7 and 8. With six even after removing implicty it has problem with some language features i.e. some dependency tries to read proto of lambda function

fabien0102 commented 6 years ago

Deploy preview for fabien0102-gatsby-starter ready!

Built with commit d01801f49a5561f51a0094b35ac57408ed669393

https://deploy-preview-52--fabien0102-gatsby-starter.netlify.com

sielay commented 6 years ago

Looks neat! I will try to do same sort of cleanup with the next one. We have to be careful with updating deps (don't touch package-lock.json). Also gatsby have some cli problems that pop up outside of current version snapshot.