Content-Length: 74289 | pFad | http://github.com/postgresml/postgresml/pull/975.patch

thub.com From 201ab05600cf3e64e50e159e2fe35f2c99c55266 Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Sat, 2 Sep 2023 13:41:23 -0700 Subject: [PATCH 01/11] commit change --- pgml-apps/cargo-pgml-components/Cargo.lock | 2 +- .../src/frontend/components.rs | 118 ++++++++++++++---- .../src/frontend/templates/component.rs.tpl | 12 +- .../src/frontend/templates/mod.rs | 7 +- .../src/frontend/templates/mod.rs.tpl | 10 +- pgml-apps/cargo-pgml-components/src/main.rs | 2 +- pgml-apps/cargo-pgml-components/src/util.rs | 4 +- 7 files changed, 115 insertions(+), 40 deletions(-) diff --git a/pgml-apps/cargo-pgml-components/Cargo.lock b/pgml-apps/cargo-pgml-components/Cargo.lock index 518bdd2e6..b0c3e3f3f 100644 --- a/pgml-apps/cargo-pgml-components/Cargo.lock +++ b/pgml-apps/cargo-pgml-components/Cargo.lock @@ -79,7 +79,7 @@ checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" [[package]] name = "cargo-pgml-components" -version = "0.1.10" +version = "0.1.11" dependencies = [ "anyhow", "clap", diff --git a/pgml-apps/cargo-pgml-components/src/frontend/components.rs b/pgml-apps/cargo-pgml-components/src/frontend/components.rs index 29c24719e..4f4fa7497 100644 --- a/pgml-apps/cargo-pgml-components/src/frontend/components.rs +++ b/pgml-apps/cargo-pgml-components/src/frontend/components.rs @@ -1,7 +1,7 @@ use convert_case::{Case, Casing}; use sailfish::TemplateOnce; use std::fs::{create_dir_all, read_dir, read_to_string}; -use std::path::Path; +use std::path::{Path, PathBuf}; use std::process::exit; use crate::frontend::templates; @@ -10,39 +10,50 @@ use crate::util::{compare_strings, error, info, unwrap_or_exit, write_to_file}; static COMPONENT_DIRECTORY: &'static str = "src/components"; static COMPONENT_MOD: &'static str = "src/components/mod.rs"; +#[derive(Clone)] pub struct Component { name: String, + path: PathBuf, + is_node: bool, } impl Component { - pub fn new(name: &str) -> Component { + pub fn new(name: &str, path: &Path) -> Component { Component { - name: name.to_string(), + name: name.to_owned(), + path: path.to_owned(), + is_node: has_more_modules(path), } } pub fn path(&self) -> String { - self.name.to_case(Case::Snake).to_string() + self.path.display().to_string() } pub fn name(&self) -> String { + self.name.to_case(Case::Snake).to_string() + } + + pub fn is_node(&self) -> bool { + self.is_node + } + + pub fn rust_name(&self) -> String { self.name.to_case(Case::UpperCamel).to_string() } - pub fn full_path(&self) -> String { + pub fn full_path(&self) -> PathBuf { Path::new(COMPONENT_DIRECTORY) - .join(&self.path()) - .display() - .to_string() + .join(&self.path) + .to_owned() } pub fn controller_name(&self) -> String { - self.path().replace("_", "-") + self.name.to_case(Case::Snake).replace("_", "-") } - #[allow(dead_code)] pub fn controller_path(&self) -> String { - format!("{}_controller.js", self.path()) + format!("{}_controller.js", self.controller_name()) } pub fn rust_module(&self) -> String { @@ -61,8 +72,6 @@ impl Component { impl From<&Path> for Component { fn from(path: &Path) -> Self { - assert!(path.is_dir()); - let components = path.components(); let name = components .clone() @@ -71,14 +80,19 @@ impl From<&Path> for Component { .as_os_str() .to_str() .unwrap(); - Component::new(name) + Component::new(name, path) } } //github.com/ Add a new component. -pub fn add(name: &str, overwrite: bool) { - let component = Component::new(name); - let path = Path::new(COMPONENT_DIRECTORY).join(component.path()); +pub fn add(path: &Path, overwrite: bool) { + if let Some(_extension) = path.extension() { + error("component name should not contain an extension"); + exit(1); + } + + let component = Component::from(path); + let path = component.full_path(); if path.exists() && !overwrite { error(&format!("component {} already exists", component.path())); @@ -97,7 +111,7 @@ pub fn add(name: &str, overwrite: bool) { unwrap_or_exit!(write_to_file(&html_path, &html)); info(&format!("written {}", html_path.display())); - let stimulus_path = path.join(&format!("{}_controller.js", component.path())); + let stimulus_path = path.join(&component.controller_path()); unwrap_or_exit!(write_to_file(&stimulus_path, &stimulus)); info(&format!("written {}", stimulus_path.display())); @@ -105,7 +119,7 @@ pub fn add(name: &str, overwrite: bool) { unwrap_or_exit!(write_to_file(&rust_path, &rust)); info(&format!("written {}", rust_path.display())); - let scss_path = path.join(&format!("{}.scss", component.path())); + let scss_path = path.join(&format!("{}.scss", component.name())); unwrap_or_exit!(write_to_file(&scss_path, &scss)); info(&format!("written {}", scss_path.display())); @@ -114,8 +128,38 @@ pub fn add(name: &str, overwrite: bool) { //github.com/ Update `mod.rs` with all the components in `src/components`. pub fn update_modules() { + update_module(Path::new(COMPONENT_DIRECTORY), true); + // let mut modules = Vec::new(); + // let mut paths: Vec<_> = unwrap_or_exit!(read_dir(COMPONENT_DIRECTORY)) + // .map(|p| p.unwrap()) + // .collect(); + // paths.sort_by_key(|dir| dir.path()); + + // for path in paths { + // let path = path.path(); + // if path.is_file() { + // continue; + // } + + // let component = Component::from(Path::new(&path)); + // modules.push(component); + // } + + // let modules = unwrap_or_exit!(templates::Mod { modules, root: true }.render_once()); + // let existing_modules = unwrap_or_exit!(read_to_string(COMPONENT_MOD)); + + // if !compare_strings(&modules, &existing_modules) { + // debug!("mod.rs is different"); + // unwrap_or_exit!(write_to_file(&Path::new(COMPONENT_MOD), &modules)); + // info(&format!("written {}", COMPONENT_MOD)); + // } + + // debug!("mod.rs is the same"); +} + +fn update_module(path: &Path, root: bool) { let mut modules = Vec::new(); - let mut paths: Vec<_> = unwrap_or_exit!(read_dir(COMPONENT_DIRECTORY)) + let mut paths: Vec<_> = unwrap_or_exit!(read_dir(path)) .map(|p| p.unwrap()) .collect(); paths.sort_by_key(|dir| dir.path()); @@ -126,18 +170,42 @@ pub fn update_modules() { continue; } + if has_more_modules(&path) { + update_module(&path, false); + } + let component = Component::from(Path::new(&path)); modules.push(component); } - let modules = unwrap_or_exit!(templates::Mod { modules }.render_once()); - let existing_modules = unwrap_or_exit!(read_to_string(COMPONENT_MOD)); + let components_mod = path.join("mod.rs"); + let modules = unwrap_or_exit!(templates::Mod { modules, root }.render_once()); + + let existing_modules = if components_mod.is_file() { + unwrap_or_exit!(read_to_string(&components_mod)) + } else { + String::new() + }; if !compare_strings(&modules, &existing_modules) { - debug!("mod.rs is different"); - unwrap_or_exit!(write_to_file(&Path::new(COMPONENT_MOD), &modules)); - info(&format!("written {}", COMPONENT_MOD)); + debug!("{}/mod.rs is different", components_mod.display()); + unwrap_or_exit!(write_to_file(&components_mod, &modules)); + info(&format!("written {}", components_mod.display().to_string())); } debug!("mod.rs is the same"); } + +fn has_more_modules(path: &Path) -> bool { + assert!(path.is_dir()); + + let paths = unwrap_or_exit!(read_dir(path)); + let paths = paths.map(|path| path.unwrap().path().to_owned()); + let files = paths.filter(|path| path.is_file()).filter(|path| path.file_name().unwrap() != "mod.rs").count(); + + let only_has_mod = files == 0; + + debug!("{} has more modules: {}", path.display(), only_has_mod); + + only_has_mod +} diff --git a/pgml-apps/cargo-pgml-components/src/frontend/templates/component.rs.tpl b/pgml-apps/cargo-pgml-components/src/frontend/templates/component.rs.tpl index 483ccea1d..8d8512167 100644 --- a/pgml-apps/cargo-pgml-components/src/frontend/templates/component.rs.tpl +++ b/pgml-apps/cargo-pgml-components/src/frontend/templates/component.rs.tpl @@ -2,15 +2,15 @@ use sailfish::TemplateOnce; use crate::components::component; #[derive(TemplateOnce, Default)] -#[template(path = "<%= component_path %>/template.html")] -pub struct <%= component_name %> { +#[template(path = "<%= component.path() %>/template.html")] +pub struct <%= component.rust_name() %> { value: String, } -impl <%= component_name %> { - pub fn new() -> <%= component_name %> { - <%= component_name %>::default() +impl <%= component.rust_name() %> { + pub fn new() -> <%= component.rust_name() %> { + <%= component.rust_name() %>::default() } } -component!(<%= component_name %>); +component!(<%= component.rust_name() %>); diff --git a/pgml-apps/cargo-pgml-components/src/frontend/templates/mod.rs b/pgml-apps/cargo-pgml-components/src/frontend/templates/mod.rs index 2b78f9f64..fbcaf8cd9 100644 --- a/pgml-apps/cargo-pgml-components/src/frontend/templates/mod.rs +++ b/pgml-apps/cargo-pgml-components/src/frontend/templates/mod.rs @@ -5,15 +5,13 @@ use crate::frontend::components::Component as ComponentModel; #[derive(TemplateOnce)] #[template(path = "frontend/templates/component.rs.tpl")] pub struct Component { - pub component_name: String, - pub component_path: String, + pub component: ComponentModel, } impl Component { pub fn new(component: &ComponentModel) -> Self { Self { - component_name: component.name(), - component_path: component.path(), + component: component.clone(), } } } @@ -50,4 +48,5 @@ impl Stimulus { #[template(path = "frontend/templates/mod.rs.tpl")] pub struct Mod { pub modules: Vec, + pub root: bool, } diff --git a/pgml-apps/cargo-pgml-components/src/frontend/templates/mod.rs.tpl b/pgml-apps/cargo-pgml-components/src/frontend/templates/mod.rs.tpl index 2458898bd..630e2b250 100644 --- a/pgml-apps/cargo-pgml-components/src/frontend/templates/mod.rs.tpl +++ b/pgml-apps/cargo-pgml-components/src/frontend/templates/mod.rs.tpl @@ -1,11 +1,17 @@ // This file is automatically generated. // You shouldn't modify it manually. +<% if root { %> mod component; pub(crate) use component::{component, Component}; +<% } %> + <% for component in modules.iter() { %> // <%= component.full_path() %> -pub mod <%= component.path() %>; -pub use <%= component.rust_module() %>::<%= component.name() %>; +pub mod <%= component.name() %>; + +<% if !component.is_node() { %> +pub use <%= component.name() %>::<%= component.rust_name() %>; +<% } %> <% } %> diff --git a/pgml-apps/cargo-pgml-components/src/main.rs b/pgml-apps/cargo-pgml-components/src/main.rs index 98cb31510..b27727548 100644 --- a/pgml-apps/cargo-pgml-components/src/main.rs +++ b/pgml-apps/cargo-pgml-components/src/main.rs @@ -75,7 +75,7 @@ fn main() { Commands::Bundle {} => bundle(), Commands::Add(command) => match command { AddCommands::Component { name } => { - crate::frontend::components::add(&name, pgml_commands.overwrite) + crate::frontend::components::add(&Path::new(&name), pgml_commands.overwrite) } }, } diff --git a/pgml-apps/cargo-pgml-components/src/util.rs b/pgml-apps/cargo-pgml-components/src/util.rs index d1ed4d22c..b5533a9a6 100644 --- a/pgml-apps/cargo-pgml-components/src/util.rs +++ b/pgml-apps/cargo-pgml-components/src/util.rs @@ -72,7 +72,9 @@ pub fn execute_command(command: &mut Command) -> std::io::Result { } pub fn write_to_file(path: &Path, content: &str) -> std::io::Result<()> { - let mut file = File::create(path)?; + debug!("writing to file: {}", path.display()); + + let mut file = File::create(path)?; file.write_all(content.as_bytes())?; From 53a45443dd4afc5a741fffae2661bc9841a00e53 Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Sat, 2 Sep 2023 15:36:33 -0700 Subject: [PATCH 02/11] Nested components --- .../src/frontend/components.rs | 149 +++++++++++++++--- .../src/frontend/javascript.rs | 50 ++++-- .../src/frontend/templates/mod.rs | 4 +- .../src/frontend/templates/template.html.tpl | 2 +- pgml-apps/cargo-pgml-components/src/util.rs | 2 +- 5 files changed, 166 insertions(+), 41 deletions(-) diff --git a/pgml-apps/cargo-pgml-components/src/frontend/components.rs b/pgml-apps/cargo-pgml-components/src/frontend/components.rs index 4f4fa7497..184fa26d3 100644 --- a/pgml-apps/cargo-pgml-components/src/frontend/components.rs +++ b/pgml-apps/cargo-pgml-components/src/frontend/components.rs @@ -8,7 +8,6 @@ use crate::frontend::templates; use crate::util::{compare_strings, error, info, unwrap_or_exit, write_to_file}; static COMPONENT_DIRECTORY: &'static str = "src/components"; -static COMPONENT_MOD: &'static str = "src/components/mod.rs"; #[derive(Clone)] pub struct Component { @@ -43,30 +42,21 @@ impl Component { } pub fn full_path(&self) -> PathBuf { - Path::new(COMPONENT_DIRECTORY) - .join(&self.path) - .to_owned() + Path::new(COMPONENT_DIRECTORY).join(&self.path).to_owned() } pub fn controller_name(&self) -> String { - self.name.to_case(Case::Snake).replace("_", "-") + self.path + .components() + .map(|c| c.as_os_str().to_str().expect("os path valid utf-8")) + .collect::>() + .join("-") + .replace("_", "-") + .to_string() } pub fn controller_path(&self) -> String { - format!("{}_controller.js", self.controller_name()) - } - - pub fn rust_module(&self) -> String { - let full_path = self.full_path(); - let path = Path::new(&full_path); - let components = path.components(); - - components - .skip(2) // skip src/components - .map(|c| c.as_os_str().to_str().unwrap()) - .collect::>() - .join("::") - .to_string() + format!("{}_controller.js", self.name().to_case(Case::Snake)) } } @@ -91,6 +81,21 @@ pub fn add(path: &Path, overwrite: bool) { exit(1); } + if !path_rust_safe(path) { + error("component name contains Rust keywords"); + exit(1); + } + + let binding = Path::new(&COMPONENT_DIRECTORY).join(path); + let parent = binding + .parent() + .expect("paths should have parents, where are you putting the component?"); + + if parent.exists() && !has_more_modules(parent) { + error("component cannot be placed into a directory that has a component already"); + exit(1); + } + let component = Component::from(path); let path = component.full_path(); @@ -157,6 +162,8 @@ pub fn update_modules() { // debug!("mod.rs is the same"); } +//github.com/ Recusively write `mod.rs` in every Rust module directory +//github.com/ that has other modules in it. fn update_module(path: &Path, root: bool) { let mut modules = Vec::new(); let mut paths: Vec<_> = unwrap_or_exit!(read_dir(path)) @@ -196,16 +203,108 @@ fn update_module(path: &Path, root: bool) { debug!("mod.rs is the same"); } +//github.com/ Check that the path has more Rust modules. fn has_more_modules(path: &Path) -> bool { + debug!("checking if {} has more modules", path.display()); + + if !path.exists() { + return false; + } + assert!(path.is_dir()); - let paths = unwrap_or_exit!(read_dir(path)); - let paths = paths.map(|path| path.unwrap().path().to_owned()); - let files = paths.filter(|path| path.is_file()).filter(|path| path.file_name().unwrap() != "mod.rs").count(); + for path in unwrap_or_exit!(read_dir(path)) { + let dir_entry = unwrap_or_exit!(path); + let path = dir_entry.path(); - let only_has_mod = files == 0; + if path.is_dir() { + continue; + } - debug!("{} has more modules: {}", path.display(), only_has_mod); + if let Some(file_name) = path.file_name() { + if file_name != "mod.rs" { + return false; + } + } + } - only_has_mod + true } + +fn path_rust_safe(path: &Path) -> bool { + let components = path.components(); + + for component in components { + let name = component + .as_os_str() + .to_str() + .expect("os string to be valid utf-8"); + if KEYWORDS.contains(&name) { + return false; + } + } + + true +} + +static KEYWORDS: &[&str] = &[ + // STRICT, 2015 + "as", + "break", + "const", + "continue", + "crate", + "else", + "enum", + "extern", + "false", + "fn", + "for", + "if", + "impl", + "in", + "let", + "loop", + "match", + "mod", + "move", + "mut", + "pub", + "ref", + "return", + "self", + "Self", + "static", + "struct", + "super", + "trait", + "true", + "type", + "unsafe", + "use", + "where", + "while", + // STRICT, 2018 + #[cfg(feature = "2018")] + "async", + #[cfg(feature = "2018")] + "await", + #[cfg(feature = "2018")] + "dyn", + // RESERVED, 2015 + "abstract", + "become", + "box", + "do", + "final", + "macro", + "override", + "priv", + "typeof", + "unsized", + "virtual", + "yield", + // RESERVED, 2018 + #[cfg(feature = "2018")] + "try", +]; diff --git a/pgml-apps/cargo-pgml-components/src/frontend/javascript.rs b/pgml-apps/cargo-pgml-components/src/frontend/javascript.rs index 0c9bde514..10499f1b3 100644 --- a/pgml-apps/cargo-pgml-components/src/frontend/javascript.rs +++ b/pgml-apps/cargo-pgml-components/src/frontend/javascript.rs @@ -1,14 +1,16 @@ //! Javascript bundling. use glob::glob; +use std::collections::HashSet; use std::fs::{copy, read_to_string, remove_file, File}; use std::io::Write; -use std::process::Command; +use std::path::PathBuf; +use std::process::{exit, Command}; use convert_case::{Case, Casing}; use crate::frontend::tools::execute_with_nvm; -use crate::util::{info, unwrap_or_exit, warn}; +use crate::util::{error, info, unwrap_or_exit, warn}; //github.com/ The name of the JS file that imports all other JS files //github.com/ created in the modules. @@ -64,21 +66,45 @@ fn assemble_modules() { "const application = Application.start()" )); + let mut dup_check = HashSet::new(); + + // You can have controllers in static/js + // or in their respective components folders. for source in js { let source = unwrap_or_exit!(source); - let full_path = source.display(); - let stem = source.file_stem().unwrap().to_str().unwrap(); - let upper_camel = stem.to_case(Case::UpperCamel); - - let mut controller_name = stem.split("_").collect::>(); - - if stem.contains("controller") { - let _ = controller_name.pop().unwrap(); + let full_path = source.display().to_string(); + + let path = source + .components() + .skip(2) // skip src/components or static/js + .collect::>(); + + assert!(!path.is_empty()); + + let path = path.iter().collect::(); + let components = path.components(); + let controller_name = if components.clone().count() > 1 { + components + .map(|c| c.as_os_str().to_str().expect("component to be valid utf-8")) + .filter(|c| !c.ends_with(".js")) + .collect::>() + .join("_") + } else { + path.file_stem() + .expect("old controllers to be a single file") + .to_str() + .expect("stemp to be valid utf-8") + .to_string() + }; + let upper_camel = controller_name.to_case(Case::UpperCamel).to_string(); + let controller_name = controller_name.replace("_", "-"); + + if !dup_check.insert(controller_name.clone()) { + error(&format!("duplicate controller name: {}", controller_name)); + exit(1); } - let controller_name = controller_name.join("-"); - unwrap_or_exit!(writeln!( &mut modules, "import {{ default as {} }} from '../../{}'", diff --git a/pgml-apps/cargo-pgml-components/src/frontend/templates/mod.rs b/pgml-apps/cargo-pgml-components/src/frontend/templates/mod.rs index fbcaf8cd9..8606549c3 100644 --- a/pgml-apps/cargo-pgml-components/src/frontend/templates/mod.rs +++ b/pgml-apps/cargo-pgml-components/src/frontend/templates/mod.rs @@ -19,13 +19,13 @@ impl Component { #[derive(TemplateOnce)] #[template(path = "frontend/templates/template.html.tpl")] pub struct Html { - pub controller_name: String, + pub component: ComponentModel, } impl Html { pub fn new(component: &ComponentModel) -> Self { Self { - controller_name: component.path().replace("_", "-"), + component: component.clone(), } } } diff --git a/pgml-apps/cargo-pgml-components/src/frontend/templates/template.html.tpl b/pgml-apps/cargo-pgml-components/src/frontend/templates/template.html.tpl index a5cf6b8ea..d9d5d4450 100644 --- a/pgml-apps/cargo-pgml-components/src/frontend/templates/template.html.tpl +++ b/pgml-apps/cargo-pgml-components/src/frontend/templates/template.html.tpl @@ -1,3 +1,3 @@ -
+
<%%= value %>
diff --git a/pgml-apps/cargo-pgml-components/src/util.rs b/pgml-apps/cargo-pgml-components/src/util.rs index b5533a9a6..df906d557 100644 --- a/pgml-apps/cargo-pgml-components/src/util.rs +++ b/pgml-apps/cargo-pgml-components/src/util.rs @@ -74,7 +74,7 @@ pub fn execute_command(command: &mut Command) -> std::io::Result { pub fn write_to_file(path: &Path, content: &str) -> std::io::Result<()> { debug!("writing to file: {}", path.display()); - let mut file = File::create(path)?; + let mut file = File::create(path)?; file.write_all(content.as_bytes())?; From 0ac8c31894971862cb40a062896e84f62468dfbe Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Sat, 2 Sep 2023 15:46:02 -0700 Subject: [PATCH 03/11] remove comments --- .../src/frontend/components.rs | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/pgml-apps/cargo-pgml-components/src/frontend/components.rs b/pgml-apps/cargo-pgml-components/src/frontend/components.rs index 184fa26d3..e0c229c81 100644 --- a/pgml-apps/cargo-pgml-components/src/frontend/components.rs +++ b/pgml-apps/cargo-pgml-components/src/frontend/components.rs @@ -134,32 +134,6 @@ pub fn add(path: &Path, overwrite: bool) { //github.com/ Update `mod.rs` with all the components in `src/components`. pub fn update_modules() { update_module(Path::new(COMPONENT_DIRECTORY), true); - // let mut modules = Vec::new(); - // let mut paths: Vec<_> = unwrap_or_exit!(read_dir(COMPONENT_DIRECTORY)) - // .map(|p| p.unwrap()) - // .collect(); - // paths.sort_by_key(|dir| dir.path()); - - // for path in paths { - // let path = path.path(); - // if path.is_file() { - // continue; - // } - - // let component = Component::from(Path::new(&path)); - // modules.push(component); - // } - - // let modules = unwrap_or_exit!(templates::Mod { modules, root: true }.render_once()); - // let existing_modules = unwrap_or_exit!(read_to_string(COMPONENT_MOD)); - - // if !compare_strings(&modules, &existing_modules) { - // debug!("mod.rs is different"); - // unwrap_or_exit!(write_to_file(&Path::new(COMPONENT_MOD), &modules)); - // info(&format!("written {}", COMPONENT_MOD)); - // } - - // debug!("mod.rs is the same"); } //github.com/ Recusively write `mod.rs` in every Rust module directory From 8bf2577da0e0a35c3bcf79382f72240825fbb3eb Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Sat, 2 Sep 2023 16:17:43 -0700 Subject: [PATCH 04/11] Small changes --- pgml-dashboard/build.rs | 3 +- pgml-dashboard/src/components/mod.rs | 73 +++++++++++++++---- .../src/components/nav_link/.component | 0 .../src/components/static_nav_link/.component | 0 pgml-dashboard/src/utils/config.rs | 8 ++ .../content/dashboard/panels/notebook.html | 1 - 6 files changed, 68 insertions(+), 17 deletions(-) create mode 100644 pgml-dashboard/src/components/nav_link/.component create mode 100644 pgml-dashboard/src/components/static_nav_link/.component diff --git a/pgml-dashboard/build.rs b/pgml-dashboard/build.rs index 9cbc9e68b..d76aa7923 100644 --- a/pgml-dashboard/build.rs +++ b/pgml-dashboard/build.rs @@ -3,8 +3,7 @@ use std::process::Command; fn main() { println!("cargo:rerun-if-changed=migrations"); - println!("cargo:rerun-if-changed=static/css/.pgml-bundle"); - println!("cargo:rerun-if-changed=static/js/.pgml-bundle"); + println!("cargo:rerun-if-changed=src"); let output = Command::new("git") .args(&["rev-parse", "HEAD"]) diff --git a/pgml-dashboard/src/components/mod.rs b/pgml-dashboard/src/components/mod.rs index d8c65199b..f09539ce6 100644 --- a/pgml-dashboard/src/components/mod.rs +++ b/pgml-dashboard/src/components/mod.rs @@ -1,62 +1,107 @@ // This file is automatically generated. // You shouldn't modify it manually. + mod component; pub(crate) use component::{component, Component}; -// src/components/breadcrumbs + + +// src/components/src/components/breadcrumbs pub mod breadcrumbs; + + pub use breadcrumbs::Breadcrumbs; -// src/components/confirm_modal + +// src/components/src/components/confirm_modal pub mod confirm_modal; + + pub use confirm_modal::ConfirmModal; -// src/components/github_icon + +// src/components/src/components/github_icon pub mod github_icon; + + pub use github_icon::GithubIcon; -// src/components/left_nav_menu + +// src/components/src/components/left_nav_menu pub mod left_nav_menu; + + pub use left_nav_menu::LeftNavMenu; -// src/components/left_nav_web_app + +// src/components/src/components/left_nav_web_app pub mod left_nav_web_app; + + pub use left_nav_web_app::LeftNavWebApp; -// src/components/modal + +// src/components/src/components/modal pub mod modal; + + pub use modal::Modal; -// src/components/nav + +// src/components/src/components/nav pub mod nav; + + pub use nav::Nav; -// src/components/nav_link + +// src/components/src/components/nav_link pub mod nav_link; + + pub use nav_link::NavLink; -// src/components/navbar + +// src/components/src/components/navbar pub mod navbar; + + pub use navbar::Navbar; -// src/components/navbar_web_app + +// src/components/src/components/navbar_web_app pub mod navbar_web_app; + + pub use navbar_web_app::NavbarWebApp; -// src/components/postgres_logo + +// src/components/src/components/postgres_logo pub mod postgres_logo; + + pub use postgres_logo::PostgresLogo; -// src/components/static_nav + +// src/components/src/components/static_nav pub mod static_nav; + + pub use static_nav::StaticNav; -// src/components/static_nav_link + +// src/components/src/components/static_nav_link pub mod static_nav_link; + + pub use static_nav_link::StaticNavLink; -// src/components/test_component + +// src/components/src/components/test_component pub mod test_component; + + pub use test_component::TestComponent; + diff --git a/pgml-dashboard/src/components/nav_link/.component b/pgml-dashboard/src/components/nav_link/.component new file mode 100644 index 000000000..e69de29bb diff --git a/pgml-dashboard/src/components/static_nav_link/.component b/pgml-dashboard/src/components/static_nav_link/.component new file mode 100644 index 000000000..e69de29bb diff --git a/pgml-dashboard/src/utils/config.rs b/pgml-dashboard/src/utils/config.rs index 56dc30e48..a2ad413ae 100644 --- a/pgml-dashboard/src/utils/config.rs +++ b/pgml-dashboard/src/utils/config.rs @@ -63,6 +63,10 @@ pub fn deployment() -> String { } pub fn css_url() -> String { + if dev_mode() { + return "/dashboard/static/css/style.css".to_string(); + } + let filename = format!("style.{}.css", env!("CSS_VERSION")); let path = format!("/dashboard/static/css/{filename}"); @@ -74,6 +78,10 @@ pub fn css_url() -> String { } pub fn js_url(name: &str) -> String { + if dev_mode() { + return format!("/dashboard/static/js/{}", name); + } + let name = name.split(".").collect::>(); let name = name[0..name.len() - 1].join("."); let name = format!("{name}.{}.js", env!("JS_VERSION")); diff --git a/pgml-dashboard/templates/content/dashboard/panels/notebook.html b/pgml-dashboard/templates/content/dashboard/panels/notebook.html index 4bb6ee256..d76a0e92e 100644 --- a/pgml-dashboard/templates/content/dashboard/panels/notebook.html +++ b/pgml-dashboard/templates/content/dashboard/panels/notebook.html @@ -6,7 +6,6 @@ ).confirm_action("notebook#deleteCell").into() ); - %>
From f49c81a3f3abbf258073e4449bbfc9bc071856b7 Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Sat, 2 Sep 2023 16:41:14 -0700 Subject: [PATCH 05/11] spacing --- .../src/frontend/components.rs | 9 ++- .../src/frontend/templates/mod.rs.tpl | 3 - pgml-dashboard/src/components/mod.rs | 74 ++++--------------- 3 files changed, 19 insertions(+), 67 deletions(-) diff --git a/pgml-apps/cargo-pgml-components/src/frontend/components.rs b/pgml-apps/cargo-pgml-components/src/frontend/components.rs index e0c229c81..fbdd22cd4 100644 --- a/pgml-apps/cargo-pgml-components/src/frontend/components.rs +++ b/pgml-apps/cargo-pgml-components/src/frontend/components.rs @@ -86,8 +86,7 @@ pub fn add(path: &Path, overwrite: bool) { exit(1); } - let binding = Path::new(&COMPONENT_DIRECTORY).join(path); - let parent = binding + let parent = path .parent() .expect("paths should have parents, where are you putting the component?"); @@ -155,12 +154,13 @@ fn update_module(path: &Path, root: bool) { update_module(&path, false); } - let component = Component::from(Path::new(&path)); + let component_path = path.components().skip(2).collect::(); + let component = Component::from(Path::new(&component_path)); modules.push(component); } let components_mod = path.join("mod.rs"); - let modules = unwrap_or_exit!(templates::Mod { modules, root }.render_once()); + let modules = unwrap_or_exit!(templates::Mod { modules, root }.render_once()).replace("\n\n", "\n"); let existing_modules = if components_mod.is_file() { unwrap_or_exit!(read_to_string(&components_mod)) @@ -179,6 +179,7 @@ fn update_module(path: &Path, root: bool) { //github.com/ Check that the path has more Rust modules. fn has_more_modules(path: &Path) -> bool { + let path = Path::new(COMPONENT_DIRECTORY).join(path); debug!("checking if {} has more modules", path.display()); if !path.exists() { diff --git a/pgml-apps/cargo-pgml-components/src/frontend/templates/mod.rs.tpl b/pgml-apps/cargo-pgml-components/src/frontend/templates/mod.rs.tpl index 630e2b250..ca15b0754 100644 --- a/pgml-apps/cargo-pgml-components/src/frontend/templates/mod.rs.tpl +++ b/pgml-apps/cargo-pgml-components/src/frontend/templates/mod.rs.tpl @@ -4,13 +4,10 @@ <% if root { %> mod component; pub(crate) use component::{component, Component}; - <% } %> - <% for component in modules.iter() { %> // <%= component.full_path() %> pub mod <%= component.name() %>; - <% if !component.is_node() { %> pub use <%= component.name() %>::<%= component.rust_name() %>; <% } %> diff --git a/pgml-dashboard/src/components/mod.rs b/pgml-dashboard/src/components/mod.rs index f09539ce6..8e0a644bf 100644 --- a/pgml-dashboard/src/components/mod.rs +++ b/pgml-dashboard/src/components/mod.rs @@ -1,107 +1,61 @@ // This file is automatically generated. // You shouldn't modify it manually. - mod component; pub(crate) use component::{component, Component}; - - - -// src/components/src/components/breadcrumbs +// src/components/breadcrumbs pub mod breadcrumbs; - - pub use breadcrumbs::Breadcrumbs; - -// src/components/src/components/confirm_modal +// src/components/confirm_modal pub mod confirm_modal; - - pub use confirm_modal::ConfirmModal; - -// src/components/src/components/github_icon +// src/components/github_icon pub mod github_icon; - - pub use github_icon::GithubIcon; - -// src/components/src/components/left_nav_menu +// src/components/left_nav_menu pub mod left_nav_menu; - - pub use left_nav_menu::LeftNavMenu; - -// src/components/src/components/left_nav_web_app +// src/components/left_nav_web_app pub mod left_nav_web_app; - - pub use left_nav_web_app::LeftNavWebApp; - -// src/components/src/components/modal +// src/components/modal pub mod modal; - - pub use modal::Modal; - -// src/components/src/components/nav +// src/components/nav pub mod nav; - - pub use nav::Nav; - -// src/components/src/components/nav_link +// src/components/nav_link pub mod nav_link; - - pub use nav_link::NavLink; - -// src/components/src/components/navbar +// src/components/navbar pub mod navbar; - - pub use navbar::Navbar; - -// src/components/src/components/navbar_web_app +// src/components/navbar_web_app pub mod navbar_web_app; - - pub use navbar_web_app::NavbarWebApp; - -// src/components/src/components/postgres_logo +// src/components/postgres_logo pub mod postgres_logo; - - pub use postgres_logo::PostgresLogo; - -// src/components/src/components/static_nav +// src/components/static_nav pub mod static_nav; - - pub use static_nav::StaticNav; - -// src/components/src/components/static_nav_link +// src/components/static_nav_link pub mod static_nav_link; - - pub use static_nav_link::StaticNavLink; - -// src/components/src/components/test_component +// src/components/test_component pub mod test_component; - - pub use test_component::TestComponent; - From 6d79dbb684a07080be87451d1487d328a84ed81d Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Sat, 2 Sep 2023 19:45:41 -0700 Subject: [PATCH 06/11] Tests and fixes --- pgml-apps/cargo-pgml-components/Cargo.lock | 249 ++++++++++++++++++ pgml-apps/cargo-pgml-components/Cargo.toml | 6 + .../cargo-pgml-components/src/backend/mod.rs | 1 + .../src/backend/models/mod.rs | 0 .../src/backend/models/templates/mod.rs | 0 .../src/backend/models/templates/model.rs.tpl | 0 .../src/frontend/components.rs | 53 +++- pgml-apps/cargo-pgml-components/src/main.rs | 1 + .../tests/test_add_component.rs | 99 +++++++ 9 files changed, 401 insertions(+), 8 deletions(-) create mode 100644 pgml-apps/cargo-pgml-components/src/backend/mod.rs create mode 100644 pgml-apps/cargo-pgml-components/src/backend/models/mod.rs create mode 100644 pgml-apps/cargo-pgml-components/src/backend/models/templates/mod.rs create mode 100644 pgml-apps/cargo-pgml-components/src/backend/models/templates/model.rs.tpl create mode 100644 pgml-apps/cargo-pgml-components/tests/test_add_component.rs diff --git a/pgml-apps/cargo-pgml-components/Cargo.lock b/pgml-apps/cargo-pgml-components/Cargo.lock index b0c3e3f3f..d02e584dd 100644 --- a/pgml-apps/cargo-pgml-components/Cargo.lock +++ b/pgml-apps/cargo-pgml-components/Cargo.lock @@ -65,6 +65,42 @@ version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +[[package]] +name = "assert_cmd" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88903cb14723e4d4003335bb7f8a14f27691649105346a0f0957466c096adfe6" +dependencies = [ + "anstyle", + "bstr", + "doc-comment", + "predicates", + "predicates-core", + "predicates-tree", + "wait-timeout", +] + +[[package]] +name = "assert_fs" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f070617a68e5c2ed5d06ee8dd620ee18fb72b99f6c094bed34cf8ab07c875b48" +dependencies = [ + "anstyle", + "doc-comment", + "globwalk", + "predicates", + "predicates-core", + "predicates-tree", + "tempfile", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + [[package]] name = "bitflags" version = "1.3.2" @@ -77,11 +113,24 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +[[package]] +name = "bstr" +version = "1.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c2f7349907b712260e64b0afe2f84692af14a454be26187d9df565c7f69266a" +dependencies = [ + "memchr", + "regex-automata", + "serde", +] + [[package]] name = "cargo-pgml-components" version = "0.1.11" dependencies = [ "anyhow", + "assert_cmd", + "assert_fs", "clap", "convert_case", "env_logger", @@ -89,6 +138,8 @@ dependencies = [ "log", "md5", "owo-colors", + "predicates", + "regex", "sailfish", ] @@ -163,6 +214,24 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "difflib" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" + +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + [[package]] name = "env_logger" version = "0.10.0" @@ -203,6 +272,12 @@ dependencies = [ "libc", ] +[[package]] +name = "fastrand" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" + [[package]] name = "filetime" version = "0.2.22" @@ -215,12 +290,51 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "float-cmp" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" +dependencies = [ + "num-traits", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "glob" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "globset" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d" +dependencies = [ + "aho-corasick", + "bstr", + "fnv", + "log", + "regex", +] + +[[package]] +name = "globwalk" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" +dependencies = [ + "bitflags 1.3.2", + "ignore", + "walkdir", +] + [[package]] name = "hashbrown" version = "0.14.0" @@ -254,6 +368,23 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +[[package]] +name = "ignore" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492" +dependencies = [ + "globset", + "lazy_static", + "log", + "memchr", + "regex", + "same-file", + "thread_local", + "walkdir", + "winapi-util", +] + [[package]] name = "indexmap" version = "2.0.0" @@ -275,12 +406,27 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + [[package]] name = "itoap" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9028f49264629065d057f340a86acb84867925865f73bbf8d47b4d149a7e88b8" +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + [[package]] name = "libc" version = "0.2.147" @@ -311,6 +457,21 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f478948fd84d9f8e86967bf432640e46adfb5a4bd4f14ef7e864ab38220534ae" +[[package]] +name = "normalize-line-endings" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" + +[[package]] +name = "num-traits" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +dependencies = [ + "autocfg", +] + [[package]] name = "once_cell" version = "1.18.0" @@ -323,6 +484,37 @@ version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" +[[package]] +name = "predicates" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09963355b9f467184c04017ced4a2ba2d75cbcb4e7462690d388233253d4b1a9" +dependencies = [ + "anstyle", + "difflib", + "float-cmp", + "itertools", + "normalize-line-endings", + "predicates-core", + "regex", +] + +[[package]] +name = "predicates-core" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" + +[[package]] +name = "predicates-tree" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" +dependencies = [ + "predicates-core", + "termtree", +] + [[package]] name = "proc-macro2" version = "1.0.66" @@ -436,6 +628,15 @@ dependencies = [ "sailfish-compiler", ] +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + [[package]] name = "serde" version = "1.0.188" @@ -482,6 +683,19 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "tempfile" +version = "3.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys", +] + [[package]] name = "termcolor" version = "1.2.0" @@ -491,6 +705,22 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "termtree" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" + +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if", + "once_cell", +] + [[package]] name = "toml" version = "0.7.6" @@ -549,6 +779,25 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + +[[package]] +name = "walkdir" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "winapi" version = "0.3.9" diff --git a/pgml-apps/cargo-pgml-components/Cargo.toml b/pgml-apps/cargo-pgml-components/Cargo.toml index 1b4a1f9c8..c16ef5f20 100644 --- a/pgml-apps/cargo-pgml-components/Cargo.toml +++ b/pgml-apps/cargo-pgml-components/Cargo.toml @@ -18,3 +18,9 @@ env_logger = "0.10" anyhow = "1" owo-colors = "3" sailfish = "0.8" +regex = "1" + +[dev-dependencies] +assert_cmd = "2" +assert_fs = "1" +predicates = "3" diff --git a/pgml-apps/cargo-pgml-components/src/backend/mod.rs b/pgml-apps/cargo-pgml-components/src/backend/mod.rs new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/pgml-apps/cargo-pgml-components/src/backend/mod.rs @@ -0,0 +1 @@ + diff --git a/pgml-apps/cargo-pgml-components/src/backend/models/mod.rs b/pgml-apps/cargo-pgml-components/src/backend/models/mod.rs new file mode 100644 index 000000000..e69de29bb diff --git a/pgml-apps/cargo-pgml-components/src/backend/models/templates/mod.rs b/pgml-apps/cargo-pgml-components/src/backend/models/templates/mod.rs new file mode 100644 index 000000000..e69de29bb diff --git a/pgml-apps/cargo-pgml-components/src/backend/models/templates/model.rs.tpl b/pgml-apps/cargo-pgml-components/src/backend/models/templates/model.rs.tpl new file mode 100644 index 000000000..e69de29bb diff --git a/pgml-apps/cargo-pgml-components/src/frontend/components.rs b/pgml-apps/cargo-pgml-components/src/frontend/components.rs index fbdd22cd4..7ae03f99a 100644 --- a/pgml-apps/cargo-pgml-components/src/frontend/components.rs +++ b/pgml-apps/cargo-pgml-components/src/frontend/components.rs @@ -1,4 +1,5 @@ use convert_case::{Case, Casing}; +use regex::Regex; use sailfish::TemplateOnce; use std::fs::{create_dir_all, read_dir, read_to_string}; use std::path::{Path, PathBuf}; @@ -8,6 +9,7 @@ use crate::frontend::templates; use crate::util::{compare_strings, error, info, unwrap_or_exit, write_to_file}; static COMPONENT_DIRECTORY: &'static str = "src/components"; +static COMPONENT_NAME_REGEX: &'static str = "^[a-zA-Z]+[a-zA-Z0-9_/]*$"; #[derive(Clone)] pub struct Component { @@ -17,11 +19,20 @@ pub struct Component { } impl Component { + //github.com/ Create a new component. + //github.com/ + //github.com/ # Arguments + //github.com/ + //github.com/ * `name` - The name of the component. + //github.com/ * `path` - The path of the component, relative to `src/components`. + //github.com/ pub fn new(name: &str, path: &Path) -> Component { + let full_path = Path::new(COMPONENT_DIRECTORY).join(path); + Component { name: name.to_owned(), path: path.to_owned(), - is_node: has_more_modules(path), + is_node: has_more_modules(&full_path), } } @@ -86,15 +97,32 @@ pub fn add(path: &Path, overwrite: bool) { exit(1); } - let parent = path - .parent() - .expect("paths should have parents, where are you putting the component?"); + let regex = Regex::new(COMPONENT_NAME_REGEX).unwrap(); - if parent.exists() && !has_more_modules(parent) { - error("component cannot be placed into a directory that has a component already"); + if !regex.is_match(&path.to_str().unwrap()) { + error("component name is not valid"); exit(1); } + let mut parent = path.parent().expect("paths should have parents"); + let mut full_path = Path::new(COMPONENT_DIRECTORY).join(parent); + + while full_path != Path::new(COMPONENT_DIRECTORY) { + debug!("testing full path: {}", full_path.display()); + + if full_path.exists() + && full_path != Path::new(COMPONENT_DIRECTORY) // Not a top-level compoment + && !has_more_modules(&full_path) + // Directory contains a module already. + { + error("component cannot be placed into a directory that has a component already"); + exit(1); + } + + parent = parent.parent().expect("paths should have parents"); + full_path = Path::new(COMPONENT_DIRECTORY).join(parent); + } + let component = Component::from(path); let path = component.full_path(); @@ -138,6 +166,7 @@ pub fn update_modules() { //github.com/ Recusively write `mod.rs` in every Rust module directory //github.com/ that has other modules in it. fn update_module(path: &Path, root: bool) { + debug!("updating {} module", path.display()); let mut modules = Vec::new(); let mut paths: Vec<_> = unwrap_or_exit!(read_dir(path)) .map(|p| p.unwrap()) @@ -151,7 +180,10 @@ fn update_module(path: &Path, root: bool) { } if has_more_modules(&path) { + debug!("{} has more modules", path.display()); update_module(&path, false); + } else { + debug!("it does not really no"); } let component_path = path.components().skip(2).collect::(); @@ -159,8 +191,11 @@ fn update_module(path: &Path, root: bool) { modules.push(component); } + debug!("writing {} modules to mod.rs", modules.len()); + let components_mod = path.join("mod.rs"); - let modules = unwrap_or_exit!(templates::Mod { modules, root }.render_once()).replace("\n\n", "\n"); + let modules = + unwrap_or_exit!(templates::Mod { modules, root }.render_once()).replace("\n\n", "\n"); let existing_modules = if components_mod.is_file() { unwrap_or_exit!(read_to_string(&components_mod)) @@ -179,10 +214,10 @@ fn update_module(path: &Path, root: bool) { //github.com/ Check that the path has more Rust modules. fn has_more_modules(path: &Path) -> bool { - let path = Path::new(COMPONENT_DIRECTORY).join(path); debug!("checking if {} has more modules", path.display()); if !path.exists() { + debug!("path does not exist"); return false; } @@ -198,11 +233,13 @@ fn has_more_modules(path: &Path) -> bool { if let Some(file_name) = path.file_name() { if file_name != "mod.rs" { + debug!("it has another file that's not mod.rs"); return false; } } } + debug!("it does"); true } diff --git a/pgml-apps/cargo-pgml-components/src/main.rs b/pgml-apps/cargo-pgml-components/src/main.rs index b27727548..fce62915f 100644 --- a/pgml-apps/cargo-pgml-components/src/main.rs +++ b/pgml-apps/cargo-pgml-components/src/main.rs @@ -8,6 +8,7 @@ use std::path::Path; #[macro_use] extern crate log; +mod backend; mod components; mod frontend; mod util; diff --git a/pgml-apps/cargo-pgml-components/tests/test_add_component.rs b/pgml-apps/cargo-pgml-components/tests/test_add_component.rs new file mode 100644 index 000000000..4baafe7a5 --- /dev/null +++ b/pgml-apps/cargo-pgml-components/tests/test_add_component.rs @@ -0,0 +1,99 @@ +use assert_cmd::Command; +use assert_fs::prelude::*; +use predicates::prelude::*; + +#[test] +fn test_help() { + let mut cmd = Command::cargo_bin("cargo-pgml-components").unwrap(); + + cmd.arg("pgml-components") + .arg("add") + .arg("component") + .arg("--help"); + + cmd.assert().success(); +} + +#[test] +fn test_add_component() { + let mut cmd = Command::cargo_bin("cargo-pgml-components").unwrap(); + let temp = assert_fs::TempDir::new().unwrap(); + + cmd.arg("pgml-components") + .arg("--project-path") + .arg(temp.path().display().to_string()) + .arg("add") + .arg("component") + .arg("test_component"); + + cmd.assert().success(); + + for path in [ + "mod.rs", + "template.html", + "test_component.scss", + "test_component_controller.js", + ] { + temp.child(&format!("src/components/test_component/{}", path)) + .assert(predicate::path::exists()); + } +} + +#[test] +fn test_add_subcomponent() { + let mut cmd = Command::cargo_bin("cargo-pgml-components").unwrap(); + let temp = assert_fs::TempDir::new().unwrap(); + + cmd.arg("pgml-components") + .arg("--project-path") + .arg(temp.path().display().to_string()) + .arg("add") + .arg("component") + .arg("test_component/subcomponent/alpha"); + + cmd.assert() + .success() + .stdout(predicate::str::contains("written src/components/mod.rs")) + .stdout(predicate::str::contains( + "written src/components/test_component/mod.rs", + )); + + for path in [ + "mod.rs", + "template.html", + "alpha.scss", + "alpha_controller.js", + ] { + temp.child(&format!( + "src/components/test_component/subcomponent/alpha/{}", + path + )) + .assert(predicate::path::exists()); + } + + // Try to add a component in a folder that already has one. + let mut cmd = Command::cargo_bin("cargo-pgml-components").unwrap(); + cmd.arg("pgml-components") + .arg("--project-path") + .arg(temp.path().display().to_string()) + .arg("add") + .arg("component") + .arg("test_component/subcomponent/alpha/beta"); + + cmd.assert().failure().stdout(predicate::str::contains( + "component cannot be placed into a directory that has a component already", + )); + + // Try one deeper + let mut cmd = Command::cargo_bin("cargo-pgml-components").unwrap(); + cmd.arg("pgml-components") + .arg("--project-path") + .arg(temp.path().display().to_string()) + .arg("add") + .arg("component") + .arg("test_component/subcomponent/alpha/beta/theta"); + + cmd.assert().failure().stdout(predicate::str::contains( + "component cannot be placed into a directory that has a component already", + )); +} From 4896ecc10adb61032b4f3a47341294a440169a65 Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Sat, 2 Sep 2023 19:59:24 -0700 Subject: [PATCH 07/11] fix upper camle --- .../src/frontend/components.rs | 12 +- .../tests/test_add_component.rs | 111 ++++++++++++++++++ 2 files changed, 122 insertions(+), 1 deletion(-) diff --git a/pgml-apps/cargo-pgml-components/src/frontend/components.rs b/pgml-apps/cargo-pgml-components/src/frontend/components.rs index 7ae03f99a..c2bce95bf 100644 --- a/pgml-apps/cargo-pgml-components/src/frontend/components.rs +++ b/pgml-apps/cargo-pgml-components/src/frontend/components.rs @@ -104,6 +104,16 @@ pub fn add(path: &Path, overwrite: bool) { exit(1); } + let path = path + .components() + .map(|c| { + c.as_os_str() + .to_str() + .expect("utf-8 component") + .to_case(Case::Snake) + }) + .collect::(); + let mut parent = path.parent().expect("paths should have parents"); let mut full_path = Path::new(COMPONENT_DIRECTORY).join(parent); @@ -123,7 +133,7 @@ pub fn add(path: &Path, overwrite: bool) { full_path = Path::new(COMPONENT_DIRECTORY).join(parent); } - let component = Component::from(path); + let component = Component::from(path.as_path()); let path = component.full_path(); if path.exists() && !overwrite { diff --git a/pgml-apps/cargo-pgml-components/tests/test_add_component.rs b/pgml-apps/cargo-pgml-components/tests/test_add_component.rs index 4baafe7a5..429ce0976 100644 --- a/pgml-apps/cargo-pgml-components/tests/test_add_component.rs +++ b/pgml-apps/cargo-pgml-components/tests/test_add_component.rs @@ -1,6 +1,7 @@ use assert_cmd::Command; use assert_fs::prelude::*; use predicates::prelude::*; +use std::fs::read_to_string; #[test] fn test_help() { @@ -39,6 +40,93 @@ fn test_add_component() { } } +#[test] +fn test_add_upper_camel() { + let temp = assert_fs::TempDir::new().unwrap(); + let mut cmd = Command::cargo_bin("cargo-pgml-components").unwrap(); + cmd.arg("pgml-components") + .arg("--project-path") + .arg(temp.path().display().to_string()) + .arg("add") + .arg("component") + .arg("TestComponent"); + + cmd.assert().success(); + + for path in [ + "mod.rs", + "template.html", + "test_component.scss", + "test_component_controller.js", + ] { + temp.child(&format!("src/components/test_component/{}", path)) + .assert(predicate::path::exists()); + } + + let rust = read_to_string(temp.child("src/components/test_component/mod.rs").path()).unwrap(); + assert!(rust.contains("pub struct TestComponent {")); + + let js = read_to_string( + temp.child("src/components/test_component/test_component_controller.js") + .path(), + ) + .unwrap(); + assert!(js.contains("export default class extends Controller")); + assert!(js.contains("console.log('Initialized test-component')")); + + let html = read_to_string( + temp.child("src/components/test_component/template.html") + .path(), + ) + .unwrap(); + assert!(html.contains("
")); + + let mut cmd = Command::cargo_bin("cargo-pgml-components").unwrap(); + cmd.arg("pgml-components") + .arg("--project-path") + .arg(temp.path().display().to_string()) + .arg("add") + .arg("component") + .arg("RandomTest/Hello/snake_path/CamelComponent"); + cmd.assert().success(); + + for path in [ + "mod.rs", + "template.html", + "camel_component.scss", + "camel_component_controller.js", + ] { + temp.child(&format!( + "src/components/random_test/hello/snake_path/camel_component/{}", + path + )) + .assert(predicate::path::exists()); + } + + let js = temp.child( + "src/components/random_test/hello/snake_path/camel_component/camel_component_controller.js", + ); + + let js = read_to_string(js.path()).unwrap(); + assert!(js.contains("export default class extends Controller")); + assert!(js.contains("console.log('Initialized random-test-hello-snake-path-camel-component')")); + + let html = read_to_string( + temp.child("src/components/random_test/hello/snake_path/camel_component/template.html") + .path(), + ) + .unwrap(); + assert!(html.contains("
")); + + let rust = read_to_string( + temp.child("src/components/random_test/hello/snake_path/camel_component/mod.rs") + .path(), + ) + .unwrap(); + assert!(rust.contains("pub struct CamelComponent {")); + assert!(rust.contains("impl CamelComponent {")); +} + #[test] fn test_add_subcomponent() { let mut cmd = Command::cargo_bin("cargo-pgml-components").unwrap(); @@ -97,3 +185,26 @@ fn test_add_subcomponent() { "component cannot be placed into a directory that has a component already", )); } + +#[test] +fn test_invalid_component_names() { + let temp = assert_fs::TempDir::new().unwrap(); + for name in [ + "has-a-dash", + "5_starts_with_a_number", + "has%_special_characters", + ] { + let mut cmd = Command::cargo_bin("cargo-pgml-components").unwrap(); + + cmd.arg("pgml-components") + .arg("--project-path") + .arg(temp.path().display().to_string()) + .arg("add") + .arg("component") + .arg(name); + + cmd.assert() + .failure() + .stdout(predicate::str::contains("component name is not valid")); + } +} From f2f00d2ecf2827f4c1db4c959591d7cdfcc180cd Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Sat, 2 Sep 2023 20:16:29 -0700 Subject: [PATCH 08/11] allow dashes --- .../src/frontend/components.rs | 3 +- .../tests/test_add_component.rs | 78 +++++++++++++++++-- 2 files changed, 75 insertions(+), 6 deletions(-) diff --git a/pgml-apps/cargo-pgml-components/src/frontend/components.rs b/pgml-apps/cargo-pgml-components/src/frontend/components.rs index c2bce95bf..8659e47ff 100644 --- a/pgml-apps/cargo-pgml-components/src/frontend/components.rs +++ b/pgml-apps/cargo-pgml-components/src/frontend/components.rs @@ -9,7 +9,7 @@ use crate::frontend::templates; use crate::util::{compare_strings, error, info, unwrap_or_exit, write_to_file}; static COMPONENT_DIRECTORY: &'static str = "src/components"; -static COMPONENT_NAME_REGEX: &'static str = "^[a-zA-Z]+[a-zA-Z0-9_/]*$"; +static COMPONENT_NAME_REGEX: &'static str = "^[a-zA-Z]+[a-zA-Z0-9_/-]*$"; #[derive(Clone)] pub struct Component { @@ -110,6 +110,7 @@ pub fn add(path: &Path, overwrite: bool) { c.as_os_str() .to_str() .expect("utf-8 component") + .replace("-", "_") .to_case(Case::Snake) }) .collect::(); diff --git a/pgml-apps/cargo-pgml-components/tests/test_add_component.rs b/pgml-apps/cargo-pgml-components/tests/test_add_component.rs index 429ce0976..e6a01ac09 100644 --- a/pgml-apps/cargo-pgml-components/tests/test_add_component.rs +++ b/pgml-apps/cargo-pgml-components/tests/test_add_component.rs @@ -38,6 +38,24 @@ fn test_add_component() { temp.child(&format!("src/components/test_component/{}", path)) .assert(predicate::path::exists()); } + + let rust = read_to_string(temp.child("src/components/test_component/mod.rs").path()).unwrap(); + assert!(rust.contains("pub struct TestComponent {")); + + let js = read_to_string( + temp.child("src/components/test_component/test_component_controller.js") + .path(), + ) + .unwrap(); + assert!(js.contains("export default class extends Controller")); + assert!(js.contains("console.log('Initialized test-component')")); + + let html = read_to_string( + temp.child("src/components/test_component/template.html") + .path(), + ) + .unwrap(); + assert!(html.contains("
")); } #[test] @@ -187,13 +205,63 @@ fn test_add_subcomponent() { } #[test] -fn test_invalid_component_names() { +fn test_component_with_dashes() { + let mut cmd = Command::cargo_bin("cargo-pgml-components").unwrap(); let temp = assert_fs::TempDir::new().unwrap(); - for name in [ - "has-a-dash", - "5_starts_with_a_number", - "has%_special_characters", + + cmd.arg("pgml-components") + .arg("--project-path") + .arg(temp.path().display().to_string()) + .arg("add") + .arg("component") + .arg("test-component/subcomponent/alpha-beta-gamma"); + + cmd.assert().success(); + + for path in [ + "mod.rs", + "template.html", + "alpha_beta_gamma.scss", + "alpha_beta_gamma_controller.js", ] { + temp.child(&format!( + "src/components/test_component/subcomponent/alpha_beta_gamma/{}", + path + )) + .assert(predicate::path::exists()); + } + + let rust = read_to_string( + temp.child("src/components/test_component/subcomponent/alpha_beta_gamma/mod.rs") + .path(), + ) + .unwrap(); + + assert!(rust.contains("pub struct AlphaBetaGamma {")); + + let js = read_to_string( + temp.child( + "src/components/test_component/subcomponent/alpha_beta_gamma/alpha_beta_gamma_controller.js", + ) + .path(), + ).unwrap(); + + assert!(js.contains("export default class extends Controller")); + assert!(js.contains("console.log('Initialized test-component-subcomponent-alpha-beta-gamma')")); + + let html = read_to_string( + temp.child("src/components/test_component/subcomponent/alpha_beta_gamma/template.html") + .path(), + ) + .unwrap(); + + assert!(html.contains("
")); +} + +#[test] +fn test_invalid_component_names() { + let temp = assert_fs::TempDir::new().unwrap(); + for name in ["5_starts_with_a_number", "has%_special_characters"] { let mut cmd = Command::cargo_bin("cargo-pgml-components").unwrap(); cmd.arg("pgml-components") From 85b8365ec2b28f721bbf03e9bc30e9b6d524ea29 Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Sat, 2 Sep 2023 20:18:48 -0700 Subject: [PATCH 09/11] more test --- .../cargo-pgml-components/tests/test_add_component.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pgml-apps/cargo-pgml-components/tests/test_add_component.rs b/pgml-apps/cargo-pgml-components/tests/test_add_component.rs index e6a01ac09..c263755d1 100644 --- a/pgml-apps/cargo-pgml-components/tests/test_add_component.rs +++ b/pgml-apps/cargo-pgml-components/tests/test_add_component.rs @@ -256,6 +256,17 @@ fn test_component_with_dashes() { .unwrap(); assert!(html.contains("
")); + + for path in [ + "test_component/subcomponent/mod.rs", + "test_component/mod.rs", + ] { + temp.child(&format!("src/components/{}", path)) + .assert(predicate::path::exists()); + + let file = read_to_string(temp.child(&format!("src/components/{}", path)).path()).unwrap(); + assert!(file.contains("pub mod")); + } } #[test] From f0171c3c586f80d9f89cbcd650a96acc17eb8f85 Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Sun, 3 Sep 2023 15:13:00 -0700 Subject: [PATCH 10/11] Generate more sample code --- .../src/frontend/components.rs | 2 +- .../src/frontend/javascript.rs | 1 + .../cargo-pgml-components/src/frontend/sass.rs | 1 + .../src/frontend/templates/component.rs.tpl | 4 +++- .../src/frontend/templates/mod.rs | 14 ++++++++++++++ .../src/frontend/templates/sass.scss.tpl | 17 +++++++++++++++++ .../src/frontend/templates/template.html.tpl | 4 +++- .../cargo-pgml-components/src/frontend/tools.rs | 2 +- 8 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 pgml-apps/cargo-pgml-components/src/frontend/templates/sass.scss.tpl diff --git a/pgml-apps/cargo-pgml-components/src/frontend/components.rs b/pgml-apps/cargo-pgml-components/src/frontend/components.rs index 8659e47ff..390a1c3a0 100644 --- a/pgml-apps/cargo-pgml-components/src/frontend/components.rs +++ b/pgml-apps/cargo-pgml-components/src/frontend/components.rs @@ -148,7 +148,7 @@ pub fn add(path: &Path, overwrite: bool) { let rust = unwrap_or_exit!(templates::Component::new(&component).render_once()); let stimulus = unwrap_or_exit!(templates::Stimulus::new(&component).render_once()); let html = unwrap_or_exit!(templates::Html::new(&component).render_once()); - let scss = String::new(); + let scss = unwrap_or_exit!(templates::Sass::new(&component).render_once()); let html_path = path.join("template.html"); unwrap_or_exit!(write_to_file(&html_path, &html)); diff --git a/pgml-apps/cargo-pgml-components/src/frontend/javascript.rs b/pgml-apps/cargo-pgml-components/src/frontend/javascript.rs index 10499f1b3..9f1c80fc5 100644 --- a/pgml-apps/cargo-pgml-components/src/frontend/javascript.rs +++ b/pgml-apps/cargo-pgml-components/src/frontend/javascript.rs @@ -126,6 +126,7 @@ pub fn bundle() { assemble_modules(); // Bundle JavaScript. + info("bundling javascript with rollup"); unwrap_or_exit!(execute_with_nvm( Command::new(JS_COMPILER) .arg(MODULES_FILE) diff --git a/pgml-apps/cargo-pgml-components/src/frontend/sass.rs b/pgml-apps/cargo-pgml-components/src/frontend/sass.rs index c12ba643d..d07517113 100644 --- a/pgml-apps/cargo-pgml-components/src/frontend/sass.rs +++ b/pgml-apps/cargo-pgml-components/src/frontend/sass.rs @@ -78,6 +78,7 @@ pub fn bundle() { cleanup_old_bundles(); // Build Sass. + info("bundling css with sass"); unwrap_or_exit!(execute_with_nvm( Command::new(SASS_COMPILER).arg(SASS_FILE).arg(CSS_FILE), )); diff --git a/pgml-apps/cargo-pgml-components/src/frontend/templates/component.rs.tpl b/pgml-apps/cargo-pgml-components/src/frontend/templates/component.rs.tpl index 8d8512167..1c4873856 100644 --- a/pgml-apps/cargo-pgml-components/src/frontend/templates/component.rs.tpl +++ b/pgml-apps/cargo-pgml-components/src/frontend/templates/component.rs.tpl @@ -9,7 +9,9 @@ pub struct <%= component.rust_name() %> { impl <%= component.rust_name() %> { pub fn new() -> <%= component.rust_name() %> { - <%= component.rust_name() %>::default() + <%= component.rust_name() %> { + value: String::from("<%= component.full_path() %>"), + } } } diff --git a/pgml-apps/cargo-pgml-components/src/frontend/templates/mod.rs b/pgml-apps/cargo-pgml-components/src/frontend/templates/mod.rs index 8606549c3..a3e4bc276 100644 --- a/pgml-apps/cargo-pgml-components/src/frontend/templates/mod.rs +++ b/pgml-apps/cargo-pgml-components/src/frontend/templates/mod.rs @@ -50,3 +50,17 @@ pub struct Mod { pub modules: Vec, pub root: bool, } + +#[derive(TemplateOnce)] +#[template(path = "frontend/templates/sass.scss.tpl")] +pub struct Sass { + pub component: ComponentModel, +} + +impl Sass { + pub fn new(component: &ComponentModel) -> Self { + Self { + component: component.clone(), + } + } +} diff --git a/pgml-apps/cargo-pgml-components/src/frontend/templates/sass.scss.tpl b/pgml-apps/cargo-pgml-components/src/frontend/templates/sass.scss.tpl new file mode 100644 index 000000000..0ca359d44 --- /dev/null +++ b/pgml-apps/cargo-pgml-components/src/frontend/templates/sass.scss.tpl @@ -0,0 +1,17 @@ +div[data-controller="<%= component.controller_name() %>"] { + // Used to identify the component in the DOM. + // Delete these styles if you don't need them. + min-width: 100px; + width: 100%; + height: 100px; + + background: red; + + display: flex; + justify-content: center; + align-items: center; + + h3 { + color: white; + } +} diff --git a/pgml-apps/cargo-pgml-components/src/frontend/templates/template.html.tpl b/pgml-apps/cargo-pgml-components/src/frontend/templates/template.html.tpl index d9d5d4450..09ac5491b 100644 --- a/pgml-apps/cargo-pgml-components/src/frontend/templates/template.html.tpl +++ b/pgml-apps/cargo-pgml-components/src/frontend/templates/template.html.tpl @@ -1,3 +1,5 @@
- <%%= value %> +

+ <%%= value %> +

diff --git a/pgml-apps/cargo-pgml-components/src/frontend/tools.rs b/pgml-apps/cargo-pgml-components/src/frontend/tools.rs index c3f19f79d..5c7809fd9 100644 --- a/pgml-apps/cargo-pgml-components/src/frontend/tools.rs +++ b/pgml-apps/cargo-pgml-components/src/frontend/tools.rs @@ -66,7 +66,7 @@ fn install_node() { debug!("node is not available"); - if let Err(err) = execute_command(Command::new("nvm").arg("--version")) { + if let Err(err) = execute_with_nvm(Command::new("nvm").arg("--version")) { debug!("nvm is not available"); debug1!(err); // Install Node Version Manager. From 0f0f3a9198bcd674c01073e6f0d5df8747e66e4f Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Sun, 3 Sep 2023 15:18:39 -0700 Subject: [PATCH 11/11] version bump --- pgml-apps/cargo-pgml-components/Cargo.lock | 2 +- pgml-apps/cargo-pgml-components/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pgml-apps/cargo-pgml-components/Cargo.lock b/pgml-apps/cargo-pgml-components/Cargo.lock index d02e584dd..40c0e87cf 100644 --- a/pgml-apps/cargo-pgml-components/Cargo.lock +++ b/pgml-apps/cargo-pgml-components/Cargo.lock @@ -126,7 +126,7 @@ dependencies = [ [[package]] name = "cargo-pgml-components" -version = "0.1.11" +version = "0.1.12" dependencies = [ "anyhow", "assert_cmd", diff --git a/pgml-apps/cargo-pgml-components/Cargo.toml b/pgml-apps/cargo-pgml-components/Cargo.toml index c16ef5f20..74c3aace5 100644 --- a/pgml-apps/cargo-pgml-components/Cargo.toml +++ b/pgml-apps/cargo-pgml-components/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo-pgml-components" -version = "0.1.11" +version = "0.1.12" edition = "2021" authors = ["PostgresML "] license = "MIT"








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgresml/postgresml/pull/975.patch

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy