fix(new): default runtime is node (framework is node-first)
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
2 files changed
+20
-4
No files matched your search
+1
-1
@@ -14,7 +14,7 @@ pub enum Command {
|
||||
name: String,
|
||||
#[arg(long)]
|
||||
template_url: Option<String>,
|
||||
#[arg(long, default_value = "deno", value_parser = ["node", "deno", "bun"])]
|
||||
#[arg(long, default_value = "node", value_parser = ["node", "deno", "bun"])]
|
||||
runtime: String,
|
||||
},
|
||||
/// Detect the runtime and run the project in watch mode
|
||||
|
||||
+19
-3
@@ -17,15 +17,31 @@ fn new_scaffolds_into_named_dir() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn new_default_runtime_is_deno() {
|
||||
fn new_default_runtime_is_node() {
|
||||
let d = tempdir().unwrap();
|
||||
Command::cargo_bin("matcha")
|
||||
.unwrap()
|
||||
.current_dir(d.path())
|
||||
.args(["new", "my-api"])
|
||||
.args(["new", "demo"])
|
||||
.assert()
|
||||
.success();
|
||||
let root = d.path().join("my-api");
|
||||
let root = d.path().join("demo");
|
||||
let pkg = std::fs::read_to_string(root.join("package.json")).unwrap();
|
||||
assert!(pkg.contains("\"name\": \"demo\""));
|
||||
assert!(root.join("tsconfig.json").exists());
|
||||
assert!(!root.join("deno.json").exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn new_with_deno_runtime_produces_deno_json() {
|
||||
let d = tempdir().unwrap();
|
||||
Command::cargo_bin("matcha")
|
||||
.unwrap()
|
||||
.current_dir(d.path())
|
||||
.args(["new", "demo-deno", "--runtime", "deno"])
|
||||
.assert()
|
||||
.success();
|
||||
let root = d.path().join("demo-deno");
|
||||
assert!(root.join("deno.json").exists());
|
||||
assert!(!root.join("package.json").exists());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user