aspnet / LibraryManager

MIT License
457 stars 83 forks source link

[CLI] Adding library to libman.json should be consistent for CLI install and UI install #299

Open YangLyu89 opened 6 years ago

YangLyu89 commented 6 years ago

Minimal repro steps

  1. run libman install jquery@3.3.1 on CLI
  2. open UI adding client-side libraries, and install a library like "jo@0.4.1"
  3. open the libman.json file

Expected result

The libman.json should be look like something:

{
  "version": "1.0",
  "defaultProvider": "cdnjs",
  "libraries": [
    {
      "library": "jquery@3.3.1",
      "destination": "wwwroot/lib/jquery"
    },
    {
      "provider": "cdnjs",
      "library": "jo@0.4.1",
      "destination": "wwwroot/jo/"
    }
  ]
}

Actual result

{
  "version": "1.0",
  "defaultProvider": "cdnjs",
  "libraries": [
    {
      "library": "jquery@3.3.1",
      "destination": "wwwroot\\lib\\jquery"
    },
    {
      "provider": "cdnjs",
      "library": "jo@0.4.1",
      "destination": "wwwroot/jo/"
    }
  ]
}
jodavis commented 6 years ago

We should be consistent about what type of slashes we use.

jodavis commented 6 years ago

We also have an issue that the schema flags backslashes as errors, even though they are accepted by the tool.

All our tooling should be consistent, using forward slash.

But we should accept both slashes, and in all cases where we see a forward or back slash, we should interpret that as "path separator character for the current OS."

The schema should be updated to accept both, but Visual Studio should provide a warning when it sees backslashes informing the user that they won't work on other operating systems.