feat(new): multi-runtime starter (node/deno/bun) via --runtime, shared + overlay templates
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
1 parent
c63c121787
commit
e8cd20b7ec
20 files changed
+173
-16
No files matched your search
@@ -16,6 +16,50 @@ fn new_scaffolds_into_named_dir() {
|
||||
assert!(root.join("public/index.html").exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn new_default_runtime_is_deno() {
|
||||
let d = tempdir().unwrap();
|
||||
Command::cargo_bin("matcha")
|
||||
.unwrap()
|
||||
.current_dir(d.path())
|
||||
.args(["new", "my-api"])
|
||||
.assert()
|
||||
.success();
|
||||
let root = d.path().join("my-api");
|
||||
assert!(root.join("deno.json").exists());
|
||||
assert!(!root.join("package.json").exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn new_with_node_runtime_produces_package_json() {
|
||||
let d = tempdir().unwrap();
|
||||
Command::cargo_bin("matcha")
|
||||
.unwrap()
|
||||
.current_dir(d.path())
|
||||
.args(["new", "demo", "--runtime", "node"])
|
||||
.assert()
|
||||
.success();
|
||||
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("deno.json").exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn new_with_bun_runtime_produces_package_json() {
|
||||
let d = tempdir().unwrap();
|
||||
Command::cargo_bin("matcha")
|
||||
.unwrap()
|
||||
.current_dir(d.path())
|
||||
.args(["new", "demo-bun", "--runtime", "bun"])
|
||||
.assert()
|
||||
.success();
|
||||
let root = d.path().join("demo-bun");
|
||||
let pkg = std::fs::read_to_string(root.join("package.json")).unwrap();
|
||||
assert!(pkg.contains("\"name\": \"demo-bun\""));
|
||||
assert!(!root.join("deno.json").exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn new_refuses_existing_dir() {
|
||||
let d = tempdir().unwrap();
|
||||
|
||||
Reference in new issue
Block a user