feat(plugin): matcha create plugin scaffolds an in-app plugin and wires it
In-app is the default. Each plugin gets its own folder under plugins/
(or --folder), so it can be exported as a package later, and the
factory is registered in createApp({ plugins }). A plugins value that
is not an array literal is left alone with a hint, as modules already
is.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
8 files changed
+383
-12
No files matched your search
+32
-2
@@ -6,9 +6,11 @@ mod cmd_create;
|
||||
mod cmd_doctor;
|
||||
mod cmd_graph;
|
||||
mod cmd_new;
|
||||
mod cmd_plugin;
|
||||
mod cmd_run;
|
||||
mod entry;
|
||||
mod naming;
|
||||
mod plugin_files;
|
||||
mod runtime;
|
||||
mod template;
|
||||
mod wire;
|
||||
@@ -35,8 +37,36 @@ fn main() {
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
Command::Create { kind, name, check } => {
|
||||
if let Err(e) = cmd_create::run(&kind, &name, check) {
|
||||
Command::Create {
|
||||
kind,
|
||||
name,
|
||||
check,
|
||||
package,
|
||||
folder,
|
||||
scope,
|
||||
registry,
|
||||
npm_name,
|
||||
} => {
|
||||
let result = if kind == "plugin" {
|
||||
cmd_plugin::run(cmd_plugin::Opts {
|
||||
name,
|
||||
package,
|
||||
folder,
|
||||
scope,
|
||||
registry,
|
||||
npm_name,
|
||||
check,
|
||||
})
|
||||
} else {
|
||||
match name {
|
||||
Some(name) => cmd_create::run(&kind, &name, check),
|
||||
None => Err(std::io::Error::new(
|
||||
std::io::ErrorKind::InvalidInput,
|
||||
format!("create {kind} needs a name"),
|
||||
)),
|
||||
}
|
||||
};
|
||||
if let Err(e) = result {
|
||||
eprintln!("error: {e}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user