neosphere icon indicating copy to clipboard operation
neosphere copied to clipboard

Add TypeScript support to Cell

Open fatcerberus opened this issue 9 years ago • 8 comments

Cell has been pretty superfluous overall since its introduction in minisphere 2.0. So far it has only served to copy files and write out a JSON manifest, which is simple enough to automate with a lowly shell script. Literally the tool's only unique application up until now has been making SPK packages.

As a first step in making Cell actually useful, add support for transpiling TypeScript and CoffeeScript code while building a game package.

Unlike the experimental TypeScript support introduced in minisphere 2.x, Cell would be able to set up a proper compile harness so that strong typing and other useful TS features actually work.

fatcerberus avatar Oct 08 '16 07:10 fatcerberus

It'd probably be best to implement require() support in Cell, so that cellscripts can pull in the TypeScript compiler to use themselves.

In general it might be better for extensibility if Cell just provides basic file-level dependency management like make but leave the actual heavy lifting up to the Cellscript.

fatcerberus avatar Nov 02 '16 17:11 fatcerberus

TypeScript support is implemented in master. It's drop-dead simple to use too:

const TypeScript = require('typescript');

TypeScript('@/main.js', files('src/*.ts', true));

fatcerberus avatar Jan 10 '17 08:01 fatcerberus

I'm going to change the TypeScript builder a bit. Right now, it creates a single output .js file from a list of .ts files, but this ends up being very slow for large codebases because any single source file changing requires the whole program to be rebuilt. Instead I'll have it create one JS script target for each TS script, which only requires those files that changed to be rebuilt.

fatcerberus avatar Jan 10 '17 16:01 fatcerberus

The above TypeScript change is now in master, and with that this issue can be closed. This was fun to implement!

fatcerberus avatar Jan 10 '17 16:01 fatcerberus

Reopening because TypeScript was replaced with Babel for v4.4.0. I'd still like to have some TypeScript integration out of the box, so I'll revisit it for minisphere 5.0.

fatcerberus avatar Jan 24 '17 06:01 fatcerberus

TypeScript is now the default ES6 transpiler, but Duktape has proven to be too slow down run it in full-program mode, and a command-line compiler isn't really the right venue for it anyway (no incremental compilation is possible, for example), so I'll close this.

fatcerberus avatar Aug 20 '17 06:08 fatcerberus

Reopening, as the switch to ChakraCore has made running the TypeScript compiler "in-house" feasible again.

fatcerberus avatar Nov 12 '19 01:11 fatcerberus

Currently blocked by #150.

fatcerberus avatar Nov 12 '19 01:11 fatcerberus