-
-
Notifications
You must be signed in to change notification settings - Fork 48
feat(cli): sv create --from-playground
#662
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 1eabc91 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
This is exciting 🤩 I have this one that could show a few things: https://svelte.dev/playground/770bbef086034b9f8e337bab57efe8d8
![]() +layout.svelte example<script lang="ts"> import favicon from '$lib/assets/favicon.svg'; |
This is perfect, and i was able to get it fully working from the tests.
Not sure, I'm a fan of this. The current "download app" button does nothing like this. Also, I'm not sure if this provides any additional value to the user, or just causes styling problems because of the added css. We can always add this later if users want this. |
Great progress 🚀🚀🚀 Nice
The cool thing about a layout like this is that:
Yes, I love this idea 😜 Anyhow, very nice job |
Updated pr description, this is working now. Let me know what you think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments in random order:
- I find it strange to have the "Template content" coming from a playground. Maybe
+page.svelte
should have ONLY<App />
, nothing else ? - I still like the playground layout idea :p
- Maybe a default folder name could be proposed "svelte-playground-slug-name-of-playgound" ?
- Maybe the
readme.md
could mention the origin of the playground ? - If some extra deps are needed, prompt it in CLI and add it to readme.md ?
It's probably nitpicking, because it's working well already.
Great work 🎉🎉🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds functionality to create SvelteKit projects from Svelte playground URLs using the --from-playground
flag. Users can now run sv create --from-playground=<url>
to generate a project based on playground code with automatic dependency detection and installation.
Key changes:
- Added playground URL validation and parsing functionality
- Implemented automatic detection and installation of external dependencies
- Created comprehensive test suite for playground functionality
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
rolldown.config.js | Added playground.ts to the build inputs for the create package |
packages/create/test/playground.ts | Added comprehensive tests for playground URL validation, parsing, and project creation |
packages/create/playground.ts | Core implementation for playground functionality including URL validation, data download, and project setup |
packages/create/package.json | Added export for playground module and cli-core dependency |
packages/cli/commands/create.ts | Integrated playground functionality into the create command with user prompts and validation |
.changeset/brown-comics-take.md | Added changeset entry documenting the new feature |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
Agree, modified.
That would leave us to handle all that characters that cannot be directly translated into a directory name. Also, most of the repls I would personally download would have the name "Hello world (edited)" so I don't think this is super important. Can always be added later without any problems.
I understand, but I'm hesitant about this. Adding it near the top / somewhere in the middle is going to be hard, adding it at the end is easy, but probably nobody would notice. Would leave this open and wait for user feedback.
Totally agree and implemented The only major thing left is detecting and using the svelte version parameter from the playground url. And more testing. Let me know what you think about the code. Also if you have a 3-5 more real playground urls to test this again, that would be great. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Closes #602
You can now run
pnpx https://pkg.pr.new/sveltejs/cli/sv@662 create --from-playground=https://svelte.dev/playground/hello-world
. This is currently doing more or less the same the stuff theDownload App
button in the playground is doing. Apart from that, you can choose additional addons,ts
vsjs
and install deps. External dependencies are auto-detected and installed into thepackage.json
Todos:
svelte
-?version=
parameter from the playground urldominikg
: one thing to remember is that this is untrusted input basically, the playground could reference malicious packages, so installation with --ignore-scripts and making users aware that they have to check the content beforehand would be good.