From 4e67fe1c2c88cda84c58316d70fb6bde15e3cde5 Mon Sep 17 00:00:00 2001 From: Erin van der Veen Date: Wed, 20 Sep 2023 11:17:37 +0200 Subject: [PATCH] Rename topiary to topiary-core This works towards future publishing of this crate on crates.io --- CONTRIBUTING.md | 2 +- Cargo.lock | 46 +++++++++---------- Cargo.toml | 2 +- README.md | 4 +- default.nix | 8 ++-- flake.nix | 2 +- languages.toml | 2 +- playground.sh | 2 +- samples/client-app/Cargo.toml | 2 +- samples/client-app/src/main.rs | 2 +- topiary-cli/Cargo.toml | 2 +- topiary-cli/src/cli.rs | 2 +- topiary-cli/src/configuration.rs | 6 +-- topiary-cli/src/error.rs | 2 +- topiary-cli/src/io.rs | 2 +- topiary-cli/src/language.rs | 2 +- topiary-cli/src/main.rs | 2 +- topiary-cli/src/visualisation.rs | 4 +- {topiary => topiary-core}/Cargo.toml | 2 +- .../benches/benchmark.rs | 4 +- {topiary => topiary-core}/languages.toml | 0 .../src/atom_collection.rs | 0 .../src/configuration.rs | 0 {topiary => topiary-core}/src/error.rs | 0 {topiary => topiary-core}/src/graphviz.rs | 0 {topiary => topiary-core}/src/language.rs | 0 {topiary => topiary-core}/src/lib.rs | 2 +- {topiary => topiary-core}/src/pretty.rs | 0 {topiary => topiary-core}/src/test_utils.rs | 0 {topiary => topiary-core}/src/tree_sitter.rs | 0 .../tests/sample-tester.rs | 2 +- .../tests/samples/expected/bash.sh | 0 .../tests/samples/expected/json.json | 0 .../tests/samples/expected/nickel.ncl | 0 .../samples/expected/ocaml-interface.mli | 0 .../tests/samples/expected/ocaml.ml | 0 .../tests/samples/expected/ocamllex.mll | 0 .../tests/samples/expected/rust.rs | 0 .../tests/samples/expected/toml.toml | 0 .../samples/expected/tree-sitter-query.scm | 0 .../tests/samples/input/bash.sh | 0 .../tests/samples/input/json.json | 0 .../tests/samples/input/nickel.ncl | 0 .../tests/samples/input/ocaml-interface.mli | 0 .../tests/samples/input/ocaml.ml | 0 .../tests/samples/input/ocamllex.mll | 0 .../tests/samples/input/rust.rs | 0 .../tests/samples/input/toml.toml | 0 .../tests/samples/input/tree-sitter-query.scm | 0 topiary-playground/Cargo.toml | 4 +- topiary-playground/build.rs | 6 +-- topiary-playground/src/lib.rs | 4 +- web-playground/e2e/sample-tester.test.ts | 4 +- 53 files changed, 61 insertions(+), 61 deletions(-) rename {topiary => topiary-core}/Cargo.toml (98%) rename {topiary => topiary-core}/benches/benchmark.rs (92%) rename {topiary => topiary-core}/languages.toml (100%) rename {topiary => topiary-core}/src/atom_collection.rs (100%) rename {topiary => topiary-core}/src/configuration.rs (100%) rename {topiary => topiary-core}/src/error.rs (100%) rename {topiary => topiary-core}/src/graphviz.rs (100%) rename {topiary => topiary-core}/src/language.rs (100%) rename {topiary => topiary-core}/src/lib.rs (99%) rename {topiary => topiary-core}/src/pretty.rs (100%) rename {topiary => topiary-core}/src/test_utils.rs (100%) rename {topiary => topiary-core}/src/tree_sitter.rs (100%) rename {topiary => topiary-core}/tests/sample-tester.rs (99%) rename {topiary => topiary-core}/tests/samples/expected/bash.sh (100%) rename {topiary => topiary-core}/tests/samples/expected/json.json (100%) rename {topiary => topiary-core}/tests/samples/expected/nickel.ncl (100%) rename {topiary => topiary-core}/tests/samples/expected/ocaml-interface.mli (100%) rename {topiary => topiary-core}/tests/samples/expected/ocaml.ml (100%) rename {topiary => topiary-core}/tests/samples/expected/ocamllex.mll (100%) rename {topiary => topiary-core}/tests/samples/expected/rust.rs (100%) rename {topiary => topiary-core}/tests/samples/expected/toml.toml (100%) rename {topiary => topiary-core}/tests/samples/expected/tree-sitter-query.scm (100%) rename {topiary => topiary-core}/tests/samples/input/bash.sh (100%) rename {topiary => topiary-core}/tests/samples/input/json.json (100%) rename {topiary => topiary-core}/tests/samples/input/nickel.ncl (100%) rename {topiary => topiary-core}/tests/samples/input/ocaml-interface.mli (100%) rename {topiary => topiary-core}/tests/samples/input/ocaml.ml (100%) rename {topiary => topiary-core}/tests/samples/input/ocamllex.mll (100%) rename {topiary => topiary-core}/tests/samples/input/rust.rs (100%) rename {topiary => topiary-core}/tests/samples/input/toml.toml (100%) rename {topiary => topiary-core}/tests/samples/input/tree-sitter-query.scm (100%) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 764f17b8..79e382d4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,7 @@ If you do `cargo install flamegraph`, you can generate a performance flamegraph like this: ```bash -CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph -- -l ocaml < topiary/tests/samples/input/ocaml.ml > formatted.ml +CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph -- -l ocaml < topiary-core/tests/samples/input/ocaml.ml > formatted.ml ``` ## Code Coverage diff --git a/Cargo.lock b/Cargo.lock index 6fe1f772..132e5277 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1317,24 +1317,26 @@ dependencies = [ ] [[package]] -name = "topiary" +name = "topiary-cli" version = "0.2.3" dependencies = [ + "assert_cmd", + "async-scoped", "clap", - "criterion", + "clap_complete", + "directories", "env_logger", "futures", + "indoc", "itertools 0.11.0", "log", - "pretty_assertions", - "prettydiff", - "regex", - "serde", - "serde_json", - "test-log", + "predicates", + "serde-toml-merge", + "tempfile", "tokio", - "tokio-test", "toml", + "topiary-core", + "topiary-queries", "tree-sitter-bash", "tree-sitter-facade", "tree-sitter-json", @@ -1344,31 +1346,27 @@ dependencies = [ "tree-sitter-query", "tree-sitter-rust", "tree-sitter-toml", - "unescape", - "web-tree-sitter-sys", ] [[package]] -name = "topiary-cli" +name = "topiary-core" version = "0.2.3" dependencies = [ - "assert_cmd", - "async-scoped", "clap", - "clap_complete", - "directories", + "criterion", "env_logger", "futures", - "indoc", "itertools 0.11.0", "log", - "predicates", - "serde-toml-merge", - "tempfile", + "pretty_assertions", + "prettydiff", + "regex", + "serde", + "serde_json", + "test-log", "tokio", + "tokio-test", "toml", - "topiary", - "topiary-queries", "tree-sitter-bash", "tree-sitter-facade", "tree-sitter-json", @@ -1378,6 +1376,8 @@ dependencies = [ "tree-sitter-query", "tree-sitter-rust", "tree-sitter-toml", + "unescape", + "web-tree-sitter-sys", ] [[package]] @@ -1386,7 +1386,7 @@ version = "0.2.3" dependencies = [ "cfg-if", "itertools 0.11.0", - "topiary", + "topiary-core", "tree-sitter-facade", "wasm-bindgen", "wasm-bindgen-futures", diff --git a/Cargo.toml b/Cargo.toml index fb11a8b0..4858ccd1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ readme = "README.md" license = "MIT" [workspace] -members = ["topiary", "topiary-cli", "topiary-queries", "topiary-playground"] +members = ["topiary-core", "topiary-cli", "topiary-queries", "topiary-playground"] exclude = ["samples"] [profile.release] diff --git a/README.md b/README.md index 0a965099..19265f29 100644 --- a/README.md +++ b/README.md @@ -1327,9 +1327,9 @@ containing the matched nodes are is single-line (resp. multi-line). In order to work productively on query files, the following is one suggested way to work: -1. Add a sample file to `topiary/tests/samples/input`. +1. Add a sample file to `topiary-core/tests/samples/input`. -2. Copy the same file to `topiary/tests/samples/expected`, and make any changes +2. Copy the same file to `topiary-core/tests/samples/expected`, and make any changes to how you want the output to be formatted. 3. If this is a new language, add its Tree-sitter grammar, extend diff --git a/default.nix b/default.nix index 21c86a38..0a4a2610 100644 --- a/default.nix +++ b/default.nix @@ -27,7 +27,7 @@ let "Cargo.toml" "languages.toml" "queries" - "topiary" + "topiary-core" "topiary-queries" "topiary-cli" "topiary-playground" @@ -79,11 +79,11 @@ in cargoTestCommand = "cargo bench --profile release"; }); - topiary-lib = craneLib.buildPackage (commonArgs + topiary-core = craneLib.buildPackage (commonArgs // { inherit cargoArtifacts; - pname = "topiary-lib"; - cargoExtraArgs = "-p topiary"; + pname = "topiary-core"; + cargoExtraArgs = "-p topiary-core"; }); topiary-cli = craneLib.buildPackage (commonArgs diff --git a/flake.nix b/flake.nix index 922f5f0a..93930a2b 100644 --- a/flake.nix +++ b/flake.nix @@ -47,7 +47,7 @@ }; checks = { - inherit (code) clippy clippy-wasm fmt topiary-lib topiary-cli topiary-playground audit benchmark; + inherit (code) clippy clippy-wasm fmt topiary-core topiary-cli topiary-playground audit benchmark; ## Check that the `lib.pre-commit-hook` output builds/evaluates ## correctly. `deepSeq e1 e2` evaluates `e1` strictly in depth before diff --git a/languages.toml b/languages.toml index d4d7a87f..b93e4517 120000 --- a/languages.toml +++ b/languages.toml @@ -1 +1 @@ -topiary/languages.toml \ No newline at end of file +topiary-core/languages.toml \ No newline at end of file diff --git a/playground.sh b/playground.sh index b6e33fb5..3e14ba51 100755 --- a/playground.sh +++ b/playground.sh @@ -31,7 +31,7 @@ get_sample_input() { local language="$1" # Only return the first result, presuming there is one - find topiary/tests/samples/input -name "${language}.*" \ + find topiary-core/tests/samples/input -name "${language}.*" \ | head -1 } diff --git a/samples/client-app/Cargo.toml b/samples/client-app/Cargo.toml index e273bee6..61382a67 100644 --- a/samples/client-app/Cargo.toml +++ b/samples/client-app/Cargo.toml @@ -5,4 +5,4 @@ edition = "2021" [dependencies] tokio = { version = "^1.28.1", features = ["rt-multi-thread", "macros"] } -topiary = { path = "../../topiary" } +topiary-core = { path = "../../topiary-core" } diff --git a/samples/client-app/src/main.rs b/samples/client-app/src/main.rs index 528acd43..7b487d24 100644 --- a/samples/client-app/src/main.rs +++ b/samples/client-app/src/main.rs @@ -1,4 +1,4 @@ -use topiary::{formatter, Configuration, Operation, TopiaryQuery}; +use topiary_core::{formatter, Configuration, Operation, TopiaryQuery}; #[tokio::main] async fn main() { diff --git a/topiary-cli/Cargo.toml b/topiary-cli/Cargo.toml index 85a5d37a..10b1b6eb 100644 --- a/topiary-cli/Cargo.toml +++ b/topiary-cli/Cargo.toml @@ -39,7 +39,7 @@ serde-toml-merge = { workspace = true } tempfile = { workspace = true } tokio = { workspace = true, features = ["fs", "rt-multi-thread", "sync", "macros"] } toml = { workspace = true } -topiary = { path = "../topiary" } +topiary-core = { path = "../topiary-core" } topiary-queries = { path = "../topiary-queries" } tree-sitter-facade = { workspace = true } diff --git a/topiary-cli/src/cli.rs b/topiary-cli/src/cli.rs index 4df9ced5..a87ea5e6 100644 --- a/topiary-cli/src/cli.rs +++ b/topiary-cli/src/cli.rs @@ -5,7 +5,7 @@ use clap_complete::{generate, shells::Shell}; use std::{io::stdout, path::PathBuf}; use log::LevelFilter; -use topiary::SupportedLanguage; +use topiary_core::SupportedLanguage; use crate::{ configuration, diff --git a/topiary-cli/src/configuration.rs b/topiary-cli/src/configuration.rs index 3eb3e9d8..2064538c 100644 --- a/topiary-cli/src/configuration.rs +++ b/topiary-cli/src/configuration.rs @@ -3,7 +3,7 @@ use directories::ProjectDirs; use indoc::formatdoc; use itertools::Itertools; use std::{env::current_dir, fmt, path::PathBuf}; -use topiary::{default_configuration_toml, Configuration}; +use topiary_core::{default_configuration_toml, Configuration}; use crate::error::{CLIResult, TopiaryError}; @@ -164,7 +164,7 @@ impl TryFrom<&ConfigSource> for toml::Value { /// Return the valid sources of configuration, in priority order (lowest to highest): /// -/// 1. Built-in configuration (`topiary::default_configuration_toml`) +/// 1. Built-in configuration (`topiary_core::default_configuration_toml`) /// 2. `~/.config/topiary/languages.toml` (or equivalent) /// 3. `.topiary/languages.toml` (or equivalent) /// 4. `file`, passed as a CLI argument/environment variable @@ -305,7 +305,7 @@ mod test_config_collation { use super::{collate_toml, CollationMode, Configuration}; // NOTE PartialEq for toml::Value is (understandably) order sensitive over array elements, so - // we deserialse to `topiary::Configuration` for equality testing. This also has the effect of + // we deserialse to `topiary_core::Configuration` for equality testing. This also has the effect of // side-stepping potential duplication, from concatenation, when using `CollationMode::Merge`. static BASE: &str = r#" diff --git a/topiary-cli/src/error.rs b/topiary-cli/src/error.rs index e6edd243..cd6539cc 100644 --- a/topiary-cli/src/error.rs +++ b/topiary-cli/src/error.rs @@ -1,5 +1,5 @@ use std::{error, fmt, io, process::ExitCode, result}; -use topiary::FormatterError; +use topiary_core::FormatterError; /// A convenience wrapper around `std::result::Result`. pub type CLIResult = result::Result; diff --git a/topiary-cli/src/io.rs b/topiary-cli/src/io.rs index e204d087..f70ccad3 100644 --- a/topiary-cli/src/io.rs +++ b/topiary-cli/src/io.rs @@ -7,7 +7,7 @@ use std::{ }; use tempfile::NamedTempFile; -use topiary::{Configuration, Language, SupportedLanguage, TopiaryQuery}; +use topiary_core::{Configuration, Language, SupportedLanguage, TopiaryQuery}; use crate::{ cli::{AtLeastOneInput, ExactlyOneInput, FromStdin}, diff --git a/topiary-cli/src/language.rs b/topiary-cli/src/language.rs index 2ab5666a..fd57895b 100644 --- a/topiary-cli/src/language.rs +++ b/topiary-cli/src/language.rs @@ -8,7 +8,7 @@ use std::{ }; use tokio::sync::Mutex; -use topiary::{Language, TopiaryQuery}; +use topiary_core::{Language, TopiaryQuery}; use crate::{error::CLIResult, io::InputFile}; diff --git a/topiary-cli/src/main.rs b/topiary-cli/src/main.rs index 50d7a764..28150d39 100644 --- a/topiary-cli/src/main.rs +++ b/topiary-cli/src/main.rs @@ -11,7 +11,7 @@ use std::{ process::ExitCode, }; -use topiary::{formatter, Operation}; +use topiary_core::{formatter, Operation}; use crate::{ cli::Commands, diff --git a/topiary-cli/src/visualisation.rs b/topiary-cli/src/visualisation.rs index 5defe40f..0c6f1ac9 100644 --- a/topiary-cli/src/visualisation.rs +++ b/topiary-cli/src/visualisation.rs @@ -1,8 +1,8 @@ use clap::ValueEnum; -use topiary::Visualisation; +use topiary_core::Visualisation; /// Visualisation output formats for Tree-sitter parse trees -// NOTE While redundant, we cannot implement clap::ValueEnum for topiary::Visualisation without +// NOTE While redundant, we cannot implement clap::ValueEnum for topiary_core::Visualisation without // breaking the orphan rules. So we have to maintain a local copy for the sake of the CLI. #[derive(Clone, Debug, ValueEnum)] pub enum Format { diff --git a/topiary/Cargo.toml b/topiary-core/Cargo.toml similarity index 98% rename from topiary/Cargo.toml rename to topiary-core/Cargo.toml index ba7e93b2..bcf2dc5c 100644 --- a/topiary/Cargo.toml +++ b/topiary-core/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "topiary" +name = "topiary-core" description = "Formats input source code in a style defined for that language." categories = ["development-tools", "text-processing"] keywords = ["code-formatter", "formatter", "text", "tree-sitter"] diff --git a/topiary/benches/benchmark.rs b/topiary-core/benches/benchmark.rs similarity index 92% rename from topiary/benches/benchmark.rs rename to topiary-core/benches/benchmark.rs index 4b1e7bc7..44da79a8 100644 --- a/topiary/benches/benchmark.rs +++ b/topiary-core/benches/benchmark.rs @@ -2,8 +2,8 @@ use criterion::async_executor::FuturesExecutor; use criterion::{criterion_group, criterion_main, Criterion}; use std::fs; use std::io; -use topiary::{formatter, Operation}; -use topiary::{Configuration, TopiaryQuery}; +use topiary_core::{formatter, Operation}; +use topiary_core::{Configuration, TopiaryQuery}; async fn format() { let input = fs::read_to_string("tests/samples/input/ocaml.ml").unwrap(); diff --git a/topiary/languages.toml b/topiary-core/languages.toml similarity index 100% rename from topiary/languages.toml rename to topiary-core/languages.toml diff --git a/topiary/src/atom_collection.rs b/topiary-core/src/atom_collection.rs similarity index 100% rename from topiary/src/atom_collection.rs rename to topiary-core/src/atom_collection.rs diff --git a/topiary/src/configuration.rs b/topiary-core/src/configuration.rs similarity index 100% rename from topiary/src/configuration.rs rename to topiary-core/src/configuration.rs diff --git a/topiary/src/error.rs b/topiary-core/src/error.rs similarity index 100% rename from topiary/src/error.rs rename to topiary-core/src/error.rs diff --git a/topiary/src/graphviz.rs b/topiary-core/src/graphviz.rs similarity index 100% rename from topiary/src/graphviz.rs rename to topiary-core/src/graphviz.rs diff --git a/topiary/src/language.rs b/topiary-core/src/language.rs similarity index 100% rename from topiary/src/language.rs rename to topiary-core/src/language.rs diff --git a/topiary/src/lib.rs b/topiary-core/src/lib.rs similarity index 99% rename from topiary/src/lib.rs rename to topiary-core/src/lib.rs index bac97475..0d42af8c 100644 --- a/topiary/src/lib.rs +++ b/topiary-core/src/lib.rs @@ -161,7 +161,7 @@ pub enum Operation { /// # tokio_test::block_on(async { /// use std::fs::File; /// use std::io::{BufReader, Read}; -/// use topiary::{formatter, Configuration, FormatterError, TopiaryQuery, Operation}; +/// use topiary_core::{formatter, Configuration, FormatterError, TopiaryQuery, Operation}; /// /// let input = "[1,2]".to_string(); /// let mut input = input.as_bytes(); diff --git a/topiary/src/pretty.rs b/topiary-core/src/pretty.rs similarity index 100% rename from topiary/src/pretty.rs rename to topiary-core/src/pretty.rs diff --git a/topiary/src/test_utils.rs b/topiary-core/src/test_utils.rs similarity index 100% rename from topiary/src/test_utils.rs rename to topiary-core/src/test_utils.rs diff --git a/topiary/src/tree_sitter.rs b/topiary-core/src/tree_sitter.rs similarity index 100% rename from topiary/src/tree_sitter.rs rename to topiary-core/src/tree_sitter.rs diff --git a/topiary/tests/sample-tester.rs b/topiary-core/tests/sample-tester.rs similarity index 99% rename from topiary/tests/sample-tester.rs rename to topiary-core/tests/sample-tester.rs index 5d001b22..241c90cc 100644 --- a/topiary/tests/sample-tester.rs +++ b/topiary-core/tests/sample-tester.rs @@ -5,7 +5,7 @@ use std::path::Path; use log::info; use test_log::test; -use topiary::{ +use topiary_core::{ apply_query, formatter, test_utils::pretty_assert_eq, Configuration, FormatterError, Language, Operation, TopiaryQuery, }; diff --git a/topiary/tests/samples/expected/bash.sh b/topiary-core/tests/samples/expected/bash.sh similarity index 100% rename from topiary/tests/samples/expected/bash.sh rename to topiary-core/tests/samples/expected/bash.sh diff --git a/topiary/tests/samples/expected/json.json b/topiary-core/tests/samples/expected/json.json similarity index 100% rename from topiary/tests/samples/expected/json.json rename to topiary-core/tests/samples/expected/json.json diff --git a/topiary/tests/samples/expected/nickel.ncl b/topiary-core/tests/samples/expected/nickel.ncl similarity index 100% rename from topiary/tests/samples/expected/nickel.ncl rename to topiary-core/tests/samples/expected/nickel.ncl diff --git a/topiary/tests/samples/expected/ocaml-interface.mli b/topiary-core/tests/samples/expected/ocaml-interface.mli similarity index 100% rename from topiary/tests/samples/expected/ocaml-interface.mli rename to topiary-core/tests/samples/expected/ocaml-interface.mli diff --git a/topiary/tests/samples/expected/ocaml.ml b/topiary-core/tests/samples/expected/ocaml.ml similarity index 100% rename from topiary/tests/samples/expected/ocaml.ml rename to topiary-core/tests/samples/expected/ocaml.ml diff --git a/topiary/tests/samples/expected/ocamllex.mll b/topiary-core/tests/samples/expected/ocamllex.mll similarity index 100% rename from topiary/tests/samples/expected/ocamllex.mll rename to topiary-core/tests/samples/expected/ocamllex.mll diff --git a/topiary/tests/samples/expected/rust.rs b/topiary-core/tests/samples/expected/rust.rs similarity index 100% rename from topiary/tests/samples/expected/rust.rs rename to topiary-core/tests/samples/expected/rust.rs diff --git a/topiary/tests/samples/expected/toml.toml b/topiary-core/tests/samples/expected/toml.toml similarity index 100% rename from topiary/tests/samples/expected/toml.toml rename to topiary-core/tests/samples/expected/toml.toml diff --git a/topiary/tests/samples/expected/tree-sitter-query.scm b/topiary-core/tests/samples/expected/tree-sitter-query.scm similarity index 100% rename from topiary/tests/samples/expected/tree-sitter-query.scm rename to topiary-core/tests/samples/expected/tree-sitter-query.scm diff --git a/topiary/tests/samples/input/bash.sh b/topiary-core/tests/samples/input/bash.sh similarity index 100% rename from topiary/tests/samples/input/bash.sh rename to topiary-core/tests/samples/input/bash.sh diff --git a/topiary/tests/samples/input/json.json b/topiary-core/tests/samples/input/json.json similarity index 100% rename from topiary/tests/samples/input/json.json rename to topiary-core/tests/samples/input/json.json diff --git a/topiary/tests/samples/input/nickel.ncl b/topiary-core/tests/samples/input/nickel.ncl similarity index 100% rename from topiary/tests/samples/input/nickel.ncl rename to topiary-core/tests/samples/input/nickel.ncl diff --git a/topiary/tests/samples/input/ocaml-interface.mli b/topiary-core/tests/samples/input/ocaml-interface.mli similarity index 100% rename from topiary/tests/samples/input/ocaml-interface.mli rename to topiary-core/tests/samples/input/ocaml-interface.mli diff --git a/topiary/tests/samples/input/ocaml.ml b/topiary-core/tests/samples/input/ocaml.ml similarity index 100% rename from topiary/tests/samples/input/ocaml.ml rename to topiary-core/tests/samples/input/ocaml.ml diff --git a/topiary/tests/samples/input/ocamllex.mll b/topiary-core/tests/samples/input/ocamllex.mll similarity index 100% rename from topiary/tests/samples/input/ocamllex.mll rename to topiary-core/tests/samples/input/ocamllex.mll diff --git a/topiary/tests/samples/input/rust.rs b/topiary-core/tests/samples/input/rust.rs similarity index 100% rename from topiary/tests/samples/input/rust.rs rename to topiary-core/tests/samples/input/rust.rs diff --git a/topiary/tests/samples/input/toml.toml b/topiary-core/tests/samples/input/toml.toml similarity index 100% rename from topiary/tests/samples/input/toml.toml rename to topiary-core/tests/samples/input/toml.toml diff --git a/topiary/tests/samples/input/tree-sitter-query.scm b/topiary-core/tests/samples/input/tree-sitter-query.scm similarity index 100% rename from topiary/tests/samples/input/tree-sitter-query.scm rename to topiary-core/tests/samples/input/tree-sitter-query.scm diff --git a/topiary-playground/Cargo.toml b/topiary-playground/Cargo.toml index dcc680a7..ec05dd64 100644 --- a/topiary-playground/Cargo.toml +++ b/topiary-playground/Cargo.toml @@ -24,11 +24,11 @@ crate-type = ["cdylib"] [dependencies] cfg-if = { workspace = true } -topiary = { path = "../topiary" } +topiary-core = { path = "../topiary-core" } tree-sitter-facade = { workspace = true } wasm-bindgen = { workspace = true } wasm-bindgen-futures = { workspace = true } [build-dependencies] itertools = { workspace = true } -topiary = { path = "../topiary" } +topiary-core = { path = "../topiary-core" } diff --git a/topiary-playground/build.rs b/topiary-playground/build.rs index 25faadb9..c6854e0d 100644 --- a/topiary-playground/build.rs +++ b/topiary-playground/build.rs @@ -5,7 +5,7 @@ use std::io::Write; use std::path::{Path, PathBuf}; use std::{env::current_dir, fs}; -use topiary::{Configuration, SupportedLanguage}; +use topiary_core::{Configuration, SupportedLanguage}; fn to_js_string(path: PathBuf) -> String { fs::read_to_string(path) @@ -21,7 +21,7 @@ fn to_js_string(path: PathBuf) -> String { fn main() { println!("cargo:rerun-if-changed=../queries/"); - println!("cargo:rerun-if-changed=../topiary/tests/samples/input/"); + println!("cargo:rerun-if-changed=../topiary-core/tests/samples/input/"); // Export test samples and queries as JS files let language_dir = current_dir().unwrap().join("../queries/"); @@ -50,7 +50,7 @@ fn main() { let input_dir = current_dir() .unwrap() - .join("../topiary/tests/samples/input/"); + .join("../topiary-core/tests/samples/input/"); let input_files = fs::read_dir(input_dir).unwrap(); let mut input_map: HashMap = HashMap::new(); diff --git a/topiary-playground/src/lib.rs b/topiary-playground/src/lib.rs index c5b5228e..5d89cafd 100644 --- a/topiary-playground/src/lib.rs +++ b/topiary-playground/src/lib.rs @@ -1,7 +1,7 @@ #[cfg(target_arch = "wasm32")] use std::sync::Mutex; #[cfg(target_arch = "wasm32")] -use topiary::{formatter, Configuration, FormatterResult, Language, Operation, TopiaryQuery}; +use topiary_core::{formatter, Configuration, FormatterResult, Language, Operation, TopiaryQuery}; #[cfg(target_arch = "wasm32")] use tree_sitter_facade::TreeSitter; #[cfg(target_arch = "wasm32")] @@ -89,7 +89,7 @@ async fn format_inner( Ok(String::from_utf8(output)?) } - None => Err(topiary::FormatterError::Internal( + None => Err(topiary_core::FormatterError::Internal( "The query has not been initialized.".into(), None, )), diff --git a/web-playground/e2e/sample-tester.test.ts b/web-playground/e2e/sample-tester.test.ts index 56f083ba..7d4d78ce 100644 --- a/web-playground/e2e/sample-tester.test.ts +++ b/web-playground/e2e/sample-tester.test.ts @@ -28,8 +28,8 @@ describe('test all grammars with puppeteer', () => { it('can format', async () => { const rootDir = path.join(__dirname, "../../"); - const inputDir = path.join(rootDir, "topiary/tests/samples/input/"); - const expectedDir = path.join(rootDir, "topiary/tests/samples/expected/"); + const inputDir = path.join(rootDir, "topiary-core/tests/samples/input/"); + const expectedDir = path.join(rootDir, "topiary-core/tests/samples/expected/"); const queryDir = path.join(rootDir, "queries/"); for (let inputFileName of await fs.promises.readdir(inputDir)) {