Skip to content

Commit 822e1d3

Browse files
committed
Add minimal documentation
1 parent 9cf23a6 commit 822e1d3

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# TypeScript binding generator for Java
2+
java-ts-bind takes your Java source code and generates TypeScript types for it.
3+
It is meant to be used with [GraalJS](https://github.com/oracle/graaljs)
4+
to provide a strongly-typed scripting environment.
5+
6+
This project was created for [CraftJS](https://github.com/Valtakausi/craftjs),
7+
a Bukkit plugin for writing plugins in JavaScript. It is based on earlier work
8+
by [Ap3teus](https://github.com/Ap3teus).
9+
10+
No releases are currently provided. If you need it, compile it yourself
11+
(or open a bug in the issue tracker).
12+
13+
## Usage
14+
This is a command-line application.
15+
16+
* --format: output format
17+
* Currently only TS_TYPES is supported
18+
* --in: input directory or source jar
19+
* --symbols: symbol sources (compiled jars)
20+
* --repo: Maven repo to fetch the source jar from
21+
* --artifact: Artifact to fetch from given repo
22+
* tld.domain:artifact:version (Gradle-style)
23+
* --offset: path offset inside the input
24+
* Mainly used for Java core types; see .github/workflows for an example
25+
* --include: prefixes for included paths
26+
* By default, everything is included
27+
* --exclude: prefixes for excluded paths
28+
* Processed after includes; nothing is excluded by default
29+
* --blacklist: blacklisted type fragments
30+
* Types that have names which contain any of these are omitted
31+
* Methods and fields that would use them are also omitted!
32+
* --packageJson: read these options from a JSON file
33+
* The options should be placed under `tsbindOptions` object
34+
* Names of options lack -- prefixes but are otherwise same
35+
* Handy when you already have package.json for publishing
36+
37+
## Limitations
38+
java-ts-bind does not necessarily generate *valid* TypeScript declarations.
39+
The results are good enough to allow strongly-typed scripts, but it is
40+
recommended that `noLibCheck` is used.
41+
42+
Please also note that java-ts-bind provides *only the types*. Implementing
43+
a module loading system for importing them is left as an exercise for the
44+
reader. For pointers, see [CraftJS](https://github.com/Valtakausi/craftjs)
45+
which (at time of writing) implements a CommonJS module loader with
46+
Java and TypeScript.

0 commit comments

Comments
 (0)