1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-03 04:48:52 -05:00

feat(init): Use jsonc for configuration file (#17002)

Generate "deno.jsonc" instead of "deno.json" when running "deno init"
subcommand.
This commit is contained in:
Bartek Iwańczuk 2022-12-09 23:55:03 +01:00 committed by GitHub
parent 653aebfa1a
commit 6794d9fe5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -31,7 +31,7 @@ mod init {
assert_contains!(stderr, "deno task dev"); assert_contains!(stderr, "deno task dev");
assert_contains!(stderr, "deno test"); assert_contains!(stderr, "deno test");
assert!(cwd.join("deno.json").exists()); assert!(cwd.join("deno.jsonc").exists());
let mut deno_cmd = util::deno_cmd_with_deno_dir(&deno_dir); let mut deno_cmd = util::deno_cmd_with_deno_dir(&deno_dir);
let output = deno_cmd let output = deno_cmd
@ -86,7 +86,7 @@ mod init {
assert_contains!(stderr, "deno task dev"); assert_contains!(stderr, "deno task dev");
assert_contains!(stderr, "deno test"); assert_contains!(stderr, "deno test");
assert!(cwd.join("my_dir/deno.json").exists()); assert!(cwd.join("my_dir/deno.jsonc").exists());
let mut deno_cmd = util::deno_cmd_with_deno_dir(&deno_dir); let mut deno_cmd = util::deno_cmd_with_deno_dir(&deno_dir);
let output = deno_cmd let output = deno_cmd
@ -137,7 +137,7 @@ mod init {
assert!(output.status.success()); assert!(output.status.success());
let stdout = String::from_utf8(output.stdout).unwrap(); let stdout = String::from_utf8(output.stdout).unwrap();
assert_eq!(stdout, ""); assert_eq!(stdout, "");
assert!(cwd.join("deno.json").exists()); assert!(cwd.join("deno.jsonc").exists());
let mut deno_cmd = util::deno_cmd_with_deno_dir(&deno_dir); let mut deno_cmd = util::deno_cmd_with_deno_dir(&deno_dir);
let output = deno_cmd let output = deno_cmd

View file

@ -41,7 +41,7 @@ pub async fn init_project(init_flags: InitFlags) -> Result<(), AnyError> {
.replace("{CURRENT_STD_URL}", deno_std::CURRENT_STD_URL.as_str()); .replace("{CURRENT_STD_URL}", deno_std::CURRENT_STD_URL.as_str());
create_file(&dir, "main_test.ts", &main_test_ts)?; create_file(&dir, "main_test.ts", &main_test_ts)?;
create_file(&dir, "deno.json", include_str!("./templates/deno.json"))?; create_file(&dir, "deno.jsonc", include_str!("./templates/deno.jsonc"))?;
info!("✅ {}", colors::green("Project initialized")); info!("✅ {}", colors::green("Project initialized"));
info!(""); info!("");