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

Moving to micro module pattern #86

Closed
Bartvds opened this issue May 17, 2014 · 0 comments
Closed

Moving to micro module pattern #86

Bartvds opened this issue May 17, 2014 · 0 comments

Comments

@Bartvds
Copy link
Collaborator

Bartvds commented May 17, 2014

I've always hoped to be able to use TSD code as the ground-truth for working with the DT definition data.

The current version (0.5.x) was my first attempt at a package manager, it works as that, but I made a few bad assumptions (so naïve :) and the code is a fat ugly monolith with too much home-rolled code (so we learn.. :)

I tried re-factoring the internals in 0.6.x (dev/next branch): it is an improvement for itself but not right for data modules (and still too much own code in a fat messy monolith)

So.. I'm sitting on a new plan for TSD that splits it up proper npm/node-style micro-modules (like Substack et-al promote in all their talks, and is done in like the code of npm, bower, js-git etc). It would encompass all the things we've observed and learned over past year I'm involved in DT, and on how-to-node in "the node way".


I have some code on my drive for it already. Nice thing about this micro-module pattern is that it makes things so much simpler, testable and maintainable as it modularises things to the max and allows for re-use of different parts.

This gets rid of much of the fat borky Object Oriented approach I used in TSD 0.5x and 0.6.x so I can open it for collabs that follow the node way.

TypeScript lures you into heavy code full of classes and interfaces and models and stuff. Fine for big 300k LOC apps, but not for modularised reusable node code.

All this is a bit longer term, but on DT we're playing with idea of setting up webhooks to crunch data from repos, so these modules could for example be used to package for NuGet and consolidate our logic.


At this point I'm working on the micro-module structure (making a standard 'light' Gruntfile etc) and setting up the mini projects.

On paper I got a model that can swap input modules (one for Github-API, one for a local Git checkout, one for plain directories etc), then get trees, raw blobs and history (if supported).

On top of that lies a module that crunches these trees into the DT package model (using plain JS objects).

Next to that will be a module to filter selections of that DT model. Another module parses tsd.json. Another one uses these to install defs to one of a few IO output modules. Another one is the CLI wrapper (this will be the tsd package on npm).

It is modules all the way down. Very sexy stuff.

DefinitelyTyped/DefinitelyTyped#2022

DefinitelyTyped/DefinitelyTyped#1286

DefinitelyTyped/DefinitelyTyped#1556

DefinitelyTyped/DefinitelyTyped#427 (and more)

@Bartvds Bartvds changed the title Micro module pattern Moving to micro module pattern May 17, 2014
@Bartvds Bartvds closed this as completed Oct 6, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant