Modules with [<AutoOpen>] does not require open
to use.
src/
Bindings/
... bindings to JS librariesExtensions.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
... [<AutoOpen>] global command line options, types, and modulesSyntax.fs
... AST for parsed TypeScAript codeNaming.fs
... naming helpersJsHelper.fs
... helper functions for JavaScript-related things e.g. NPM packages and ES6 module names.Typer.fs
... functions for resolving and manipulating ASTParser.fs
... functions for converting TS syntax tree to our ASTTarget.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.
- The latest gen_js_api should also be installed to your opam switch.
- As of Oct 2021, most of the required features have not been present in the latest version in opam.
- You should install the latest version by
opam pin add gen_js_api https://github.com/LexiFi/gen_js_api.git
-
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.