At the moment, our organization is developing a JavaScript library for use with one of our products. Currently, this is developed through the following steps:
- use TypeScript and internal modules to create namespaced classes (one namespace for our internal classes, and one for the public API), using
/// <reference>tags to determine dependencies - targeting ES5, generate compiled JavaScript (with the
--outflag) from_references.ts(a two step process, for internal and public APIs), concatenate and minify everything into a single js file - automatically generate documentation using the generated
.d.tsfile for the public API
We've been looking at updating our codebase, and we're looking at the more recent updates to TypeScript's features, specifically, moving towards using a single tsconfig.json, and the use of ES6 modules. I admit I don't have the most comprehensive knowledge myself but I've encountered the following issues:
- ES6 modules seem to be dependent on preserving a directory structure so this might mean we lose our namespaces. I'm not sure how we will later be able to access classes on an ES5 platform.
- I've tried investigating the use of
browserifyto see how everything can be bundled up together; however, it requires an entry point for the program, which our library does not really have as it is generally just a series of class declarations with functionality to interact with our organization's products.
Am I missing some fundamental knowledge here? Is it feasible to use ES6 classes for what we're trying to accomplish, and if so, what would be a suggested workflow (in terms of tooling?) Or do we need to stay with namespaced classes for this kind of required output?