Just My Type... Script

Just My Type... Script

TL;DR - My first foray into a TypeScript powered Node-verse - a tale of toolchain madness (gulp!, grunt) and learning to dread implicit-type-any during those long pregnant VS-Code pauses.

Starting {Block}

My goal - learn a new stack, stack - I chose Nodeverse + Typescript - project: link. Looked at the options over two weeks, tried Twig and a bunch of Php frameworks, Laravel, Cake, Code igniter - all nice, meanwhile, the Ghost bunch seem like smart cats - decided PHP doesnt have the same reach - so settled on TypeScript in the Node-verse, with all that NPM coolness wafting in the wings.

Mind your Language

TS language - like oh wow - sooo nice, actually feels like a proper language... at first... and in the end :) and VS code - slick slick slick... but those hard privates - import helpers!! weirdness with tsc not finding tsconfig.json - generating .d.ts for baby gulps, and getting it into global! <vscode pic>

Why though are some things so hard? Need to learn more about the index-type things - its not you, its me! only discovered Record<string,unknown> near the end, sigh. Scoping weirdness - static vs module const? AMD IMHI Argness, and why can't I just $instance[$key_name]

JavaScript changes - advances and limitations - kind of hidden by the niceness of TS... but every now and then it comes back to bite you - global name collision use type=module. Not the elegance of Raku or the solidity of Perl <== now that's not something you hear every day!

Twisted Toolchains

Toolchains - the gulp rabbit hole... back to npm... and then taking another gulp <pic of linux terminal> grunt - looked at... Ghost uses it, but I prefer small modular moveable parts...

Bundles of Joy

Packaging for the Web - webkit, microbundle, rollup terser frustration - a little unpolished? eg the mangle tangle - goal for another day, unpack the microbundle and work through each part. Pick the best - enable some customisation. There's something wrong with the interaction through the toolchain - need to think about this. You end up with parallel streams by source-type - e.g. a CSS stream, an HTML stream, a TS-JS stream... and an orthogonal with action - clean, build, lint, minify, bundle and ship. Some of the streams intertwine - CSS-modules, WTH?!?

Heavenly Handlebars

Generating static test HTML pages - using Handlebars - easy peasy, lemon squeezy. Handlebars vs twig - partials, helpers - layout inheritance? icecream on my moustache - in ts-node command line :-)) Noice

Great Gitness

Github - learning the cycle, used to local master... where is that branch tag gone / come from, git pages 8-o

Frustrations

Old info on the Web, it's happening now. TightScript - Record<string: any>, code for code's sake... maybe I am not getting the protection thing? Global? Types until I learnt about .d.tsc config. Too many frameworks. Heavy reliance on lightweight support - fork-n-fix??

Delights

It's good enough to transition to. Worthwile experience, fun, will try something a bit more ambitious...

Denouement

I would do it all again

Tomorrow never dies

Things for another day - foal-ts, vue, express, npm packaging, myown libraries, deconstruct microbundle - its good - but wound a bit too tight - cannot poke the Tenser mangle reliably? Clearly based on experience and smarts. Gulpy streams for my Handlebar Jenny - dressed in Vinyl. CSS-modules, CSS-Head-hoisting. Terser tension, Rigorous rollup.

Credits