Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

svelte-kit package retain original casing in file names #1734

Closed
janosh opened this issue Jun 22, 2021 · 4 comments · Fixed by #1735 or #1747
Closed

svelte-kit package retain original casing in file names #1734

janosh opened this issue Jun 22, 2021 · 4 comments · Fixed by #1735 or #1747

Comments

@janosh
Copy link
Contributor

janosh commented Jun 22, 2021

Is your feature request related to a problem? Please describe.

svelte-kit package should not change case of copied files. In my case, I'm getting readme.md -> package/README.md.

Describe the solution you'd like

Project files should be treated as faithfully as possible.

How important is this feature to you?

Nice to have, not essential.

@dummdidumm
Copy link
Member

dummdidumm commented Jun 22, 2021

Looking at the source code README is specifically handled and written all uppercase, so this should be the only file where this happens. And I guess it only happens on case insensitive systems since it's checked that an all-uppercase README exists. Code: https://github.com/sveltejs/kit/blob/master/packages/kit/src/core/make_package/index.js#L92

@ignatiusmb
Copy link
Member

It seems there's other stuff that svelte-kit package isn't preserving as well. We could perhaps repurpose this to also track them, or I could open up a new issue for it as well. Here's some that I've found so far, I'll put it here for tracking purposes

  1. only certain keys from package.json are copied and the rest are discarded
  2. essential files from root folder (not in lib) such as .npmignore, LICENSE, CHANGELOG.md, etc. are not copied
  3. package exports map starts with ./, but subsequent separators will be changed to \\ on windows
  4. package exports map specifies path only, not { "import": ..., "require": ..., "browser": ... }, this breaks vite for nested modules

There's probably other stuff that I missed, but it generally goes back to the package.json. Perhaps, we could copy the whole package file and only add or overwrite stuff that are missing, that way we can also preserve the package.json key ordering, which I know some would appreciate (there's even a prettier plugin for it).

@janosh
Copy link
Contributor Author

janosh commented Jun 22, 2021

@ignatiusmb The docs make it sound like 1. is intentional (though don't explain why):

- A `package.json` that copies the `name`, `version`, `description`, `keywords`, `homepage`, `bugs`, `license`, `author`, `contributors`, `funding`, `repository`, `dependencies`, `private` and `publishConfig` fields from the root of the project, and adds a `"type": "module"` and an `"exports"` field

@ignatiusmb
Copy link
Member

ignatiusmb commented Jun 22, 2021

Yes, it was intentional from #1499, can't really say much about it. I've just had the thought that other libraries will most likely use some keys specified in package that will be discarded. It's common as every library will certainly have a package.json, hence why I bring this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants