瀏覽代碼

chore(cli): use unix path separator on $schema (#4384)

Lucas Fernandes Nogueira 3 年之前
父節點
當前提交
010530459e
共有 2 個文件被更改,包括 12 次插入1 次删除
  1. 6 0
      .changes/fix-schema-path-fmt.md
  2. 6 1
      tooling/cli/src/init.rs

+ 6 - 0
.changes/fix-schema-path-fmt.md

@@ -0,0 +1,6 @@
+---
+"cli.js": patch
+"cli.rs": patch
+---
+
+Use UNIX path separator on the init `$schema` field.

+ 6 - 1
tooling/cli/src/init.rs

@@ -217,7 +217,12 @@ pub fn command(mut options: Options) -> Result<()> {
         let mut map = serde_json::Map::default();
         map.insert(
           "$schema".into(),
-          serde_json::Value::String(cli_node_module_path.display().to_string()),
+          serde_json::Value::String(
+            cli_node_module_path
+              .display()
+              .to_string()
+              .replace('\\', "/"),
+          ),
         );
         let merge_config = serde_json::Value::Object(map);
         json_patch::merge(&mut config, &merge_config);