-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat MET-12: Generate TypeScript type definitions from jsonschema (#45)
* Generate TypeScript type definitions from jsonschema * Drop old type definitions
- Loading branch information
Showing
25 changed files
with
653 additions
and
213 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[package] | ||
name = "typescript" | ||
version = "0.0.3-dev.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
anyhow = "1.0.68" | ||
swc_common = { version = "0.29.10", features = ["tty-emitter"] } | ||
swc_ecma_ast = "0.94.14" | ||
swc_ecmascript = { version = "0.205.47", features = [ | ||
"visit", | ||
"transforms", | ||
"typescript-parser", | ||
"parser", | ||
"codegen", | ||
] } | ||
swc_ecma_transforms = { version = "0.198.26", features = ["typescript"] } | ||
string_cache = "0.8.4" | ||
dprint-plugin-typescript = "0.80.2" | ||
lazy_static = "1.4.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright Metatype OÜ under the Elastic License 2.0 (ELv2). See LICENSE.md for usage. | ||
|
||
pub mod parser; | ||
|
||
pub use dprint_plugin_typescript as dprint_plugin; | ||
pub use string_cache; | ||
pub use swc_common; | ||
pub use swc_ecma_ast as ast; | ||
pub use swc_ecmascript::*; | ||
|
||
use anyhow::Result; | ||
use dprint_plugin::configuration::Configuration; | ||
use lazy_static::lazy_static; | ||
use std::path::Path; | ||
|
||
lazy_static! { | ||
static ref TS_FORMAT_CONFIG: Configuration = { | ||
use dprint_plugin_typescript::configuration::*; | ||
ConfigurationBuilder::new() | ||
.line_width(80) | ||
.prefer_hanging(true) | ||
.prefer_single_line(false) | ||
.next_control_flow_position(NextControlFlowPosition::SameLine) | ||
.union_and_intersection_type_prefer_hanging(false) | ||
.union_and_intersection_type_prefer_single_line(false) | ||
.build() | ||
}; | ||
} | ||
|
||
pub fn format_text<P: AsRef<Path>>(path: P, source: &str) -> Result<String> { | ||
Ok(dprint_plugin::format_text(path.as_ref(), source, &TS_FORMAT_CONFIG)?.unwrap()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.