-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
create-svelte
's to_valid_package_name
modifies valid package names
#4754
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
Comments
I actually am thinking about what would happen if you would call So this should be fixed too... |
I think there are two questions involved here -- behavior on the filesystem and behavior in package.jsonIf and only if the incoming else, the existing rules are applied. As far as implementation goes, if @willster277's pattern covers all edge cases, yay! If not, we can continue to add more complicated edge-case-catching regexes (🤮), or just do some string tests to figure out which one should be used. FilesystemI can think of two possibilities here:
Rich, if you greenlight this, I'm happy to implement it and open a PR. |
Great responses from both of you, I hadn't considered the nuances of I think for filesystem the first option should be used. It's easier for users if the script works as "we'll put it in the As for |
Took a crack at this via #4851. We'll see what the maintainers think of it! |
Actually how Vite's CLI works with |
The discussion in #4851 once again shows to me that we should have a different flow in
|
More generically, perhaps it makes sense for different templates to be able to offer their own prompts in addition to the universal prompts. Like, maybe you could imagine a future where we have many more starter templates, and one of them is a blog, and choosing it prompts you to choose a CMS, which in turn prompts you to set up some account/project details so that you can import content. In that world, rather than having a strict app/library dichotomy, those features would just be features of the template: Not going to lie, aspects of this make me nervous. I don't like scaffolding tools to be too smart, because it requires you to make all your decisions up-front, and it's generally hard to change those decisions later (not so much because it's actually difficult, but because all the logic was hidden from view so it's hard to know how to, for example, add packaging logic to an app after the fact). But the bullet point list is compelling. |
For everything else, we've been promoting https://github.com/svelte-add/ which avoids this issue. Potentially the packaging command could be a Svelte Adder, but I'd be worried people wouldn't find it. We could make it so that |
I like @dummdidumm's proposal best out of all of these -- I think Anyway, I think it makes sense to add a separate packaging option to |
Whoops, apparently ctrl+enter closes an issue. My bad. 😕 |
I think this has been resolved since the behaviour of |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
According to NPM's docs for
package.json
;Which if taken in a vacuum, the
to_valid_package_name
function correctly enforces.What it doesn't correctly enforce is the use of scopes, eg
@sveltejs/kit
. Instead, it replaces the@
and/
with hyphens.Reproduction
The easiest method is to locally install
create-svelte
and pass the following when creating the package;Observe the
package.json
"name"
field doesn't read"@scope/package"
, bet instead reads"-scope-package"
I traced where that
name
field goes, and the only place it's modified is this lineRepo with minimum reproduction
Logs
System Info
Severity
annoyance
Additional Information
This is working for me, though it's possible these simple lookbehinds miss a rare use case;
The text was updated successfully, but these errors were encountered: