Modules with [<AutoOpen>] does not require open
to use.
lib/
... target-agnostic part of the tool (will be separated to a different repo in near future)Bindings/
... bindings to JS libraries (typescript, browser-or-node)Extensions.fs
... [<AutoOpen>] extensions for standard library and JS librariesDataTypes/
... common data structures and algorithmText.fs
... efficient rope withO(1)
concat &O(n)
stringifyTrie.fs
... trie based on immutable mapGraph.fs
... graph based on immutable map & graph algorithms
Common.fs
... global interfacesSyntax.fs
... AST for parsed TypeScAript codeNaming.fs
... naming helpersJsHelper.fs
... helper functions for JavaScript-related things e.g. NPM packages and ES6 module names.TypeScriptHelper.fs
... helper functions for using TypeScript Compiler APITyper.fs
... functions for resolving and manipulating ASTParser.fs
... functions for converting TS syntax tree to our AST
src/
... target-dependent part of the toolBindings/
... bindings to JS libraries (yargs)Extensions.fs
... [<AutoOpen>] extensions for standard library and JS librariesCommon.fs
... [<AutoOpen>] global command line options, types, and modulesTarget.fs
... generic definitions for each targets (ITarget<_>
)Targets/
... targets should be placed into hereParserTest.fs
... debug target to test parser and typerJsOfOCaml/
...js_of_ocaml
target specific codesCommon.fs
... command line options forjs_of_ocaml
targetOCamlHelper.fs
... helper functions to generate OCaml codeWriter.fs
... functions for generating OCaml code from ASTTarget.fs
...ITarget<_>
instance forjs_of_ocaml
target
Main.fs
... entry point
test/
jsoo/
... test forjs_of_ocaml
target
dist/
... output directory for NPM packagingdist_jsoo/
... output directory for OPAM packagingoutput/
... temporary output directory for automated testing, etc
-
OCaml 4.08 or higher
- js_of_ocaml should be installed to your opam switch.
- gen_js_api
>= 1.0.9
should also be installed to your opam switch. - Run
opam install . --deps-only
to install all the dependencies.
-
Node 14.0 or higher
- yarn is required.
dotnet fake build -t Watch
to live update dist/ts2ocaml.js
.
It will be bundled by Webpack with the development
mode.
dotnet fake build -t Build
performs the followings:
yarn install
to populatenode_modules
dotnet restore
to install required F# libraries- Compile F# source files into JS source files (through Fable)
- Bundle the JS files into
dist/ts2ocaml.js
(through Webpack)
The resulting dist/ts2ocaml.js
is then ready to run through node
.
dotnet fake build -t Test
builds the tool and then performs the followings:
Test the tool for js_of_ocaml
target
- Generate bindings for the following packages:
- TypeScript standard libraries (
node_modules/typescript/lib/lib.*.d.ts
) typescript
with thefull
preset (involving a lot of inheritance)react
with thefull
preset (depending on bothfull
packages andsafe
packages)scheduler/tracing
(safe
)csstype
(full
)prop-types
(safe
)
react-modal
with thefull
preset (depending on afull
package)yargs
with thesafe
preset (depending on asafe
package)yargs-parser
(safe
)
- TypeScript standard libraries (
- The bindings will be placed into
output/test_jsoo/
- Copy the bindings to
test/jsoo/src/
- Perform
dune build
intest/jsoo/
Tests for other targets will be added here
dotnet fake build -t Publish
builds the tool, runs the tests, and then performs the followings:
Prepare for publishing the standard library for js_of_ocaml
target to the jsoo-stdlib
branch
- Copy
ts2ocaml_*.mli
fromoutput/test_jsoo/
todist_jsoo/src/
- Copy
ts2ocaml_*.ml
fromtest/jsoo/_build/default/src/
todist_jsoo/src/
- Set the correct
version
indist_jsoo/dune-project
- Perform
dune build
indist_jsoo/
to generate.opam
file and check if it compiles
GitHub Action publish.yml
is configured to push the dist_jsoo
directory to the jsoo-stdlib
branch.
- Set the correct
version
inpackage.json
GitHub Action publish.yml
is configured to publish ts2ocaml
to NPM.