-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add index.ts with export for all bindings. #133
Comments
Pretty sure we could just use export_to = '../bindings/index.ts' in every struct as per this. |
as a workaround, I am currently doing this in use std::{
ffi::OsStr,
fs::{self, File},
io::Write,
};
fn main() {
let exports: Vec<_> = fs::read_dir("./bindings")
.unwrap()
.filter_map(Result::ok)
.filter_map(|p| {
p.path()
.file_stem()
.map(OsStr::to_str)
.flatten()
.map(str::to_owned)
})
.filter(|f| f != "index")
.map(|f| format!("export * from \"./{}\"", f))
.collect();
let mut file = File::create("./bindings/index.ts").unwrap();
file.write_all(exports.join("\n").as_bytes()).unwrap();
} |
Currently the plan is to create a CLI tool to allow this |
To anyone who sees this issue and is interested in the feature, please try the CLI being developed in #304 and tell us what you think. To try it you need to clone the When we decide the CLI is complete, it will be available through |
Hi
Would it be possible to also generate an
index.ts
inside thebindings
directory?example
When I have the following structs:
I would like to have a
index.ts
generated inside thebindings
directory, that looks like:So I could add the following configuration to my
tsconfig.json
:this allows me to import all the exported types in my typescript code like this:
The text was updated successfully, but these errors were encountered: