Code diet

For the past 3 (+/–) years my relationships with the code can be described as relationships of fatty with the fridge, at 3 AM, after alcohol. Development was a funky magic runaway train I was late for and I had to push hard to catch up. But now, when I can state that I jumped in, I must get on the diet to keep going.

No, it's still same (and even bigger) fun playing with all these shiny new tech toys and do the stuff that I'm doing, but what actually bothers me:

  • Amount of time spent on solving / debating on issues, that has nothing to do with the real world problems: terrifying.
  • Number of books (not focused on specific tech) I read in the past 3 years: 0 (zero).
  • Text notes made outside git repos: close to zero.

Code is extremely powerful matter, but code for code is road to nowhere (of course there are exceptions, but I'm not one of them for sure).

npm pitfalls

Lately we've been facing a number of issues with our npm workflow. I made a few notes how to prevent them in the future.

First, we use npm shrinkwrap to lock down production dependencies. And sometimes we find it broken for some reason. How it's happening.

Mocha + Webpack

There is one annoying issue with Webpack: if you use Webpack-specific code in your JS modules, it's impossible to use it outside of Webpack environment (or it takes time to made up a number of workarounds). A few days ago I was playing around with one awesome loader (sass-variable-loader) and it struck me again: I can share style variables with JSX views, but it makes them intestable, b/c mocha can't handle imports with Webpack loaders. So long story short: now I officially can state, that everything in my stack — production & development client builds, production & development builds for Node server and, finally, test builds — all compiled with Webpack.

Yo, ES6

The only thing I officially couldn't write using ES6 syntax / Babel is Yeoman generator. Even it's not something I write too often, this limitation is quite annoying when you actually write it. Here's the workaround I came up with.

Webpack Declarative

One of the greatest features in React is a declarative way to construct the things. Once you've tried it — you'll never go back to imperative mess. A few days ago, while rewriting some webpack configs, I finally figured out what's so annoying in the way we usually cook them — we cook them in imperative way.