Giter VIP home page Giter VIP logo

sveltelab's Introduction

A mockup of a phone with a Screenshot of SvelteLab opened. SvelteLab: A REPL for SvelteKit projects: quickly spin up a SvelteKit Projects and share it with the world!


โœจ Features:

  • ๐ŸŒ— Light / Dark Mode
  • ๐Ÿšจ TypeScript Errors
  • ๐ŸŽจ Command Palette: Ctrl / CMD + Shift + P
  • ๐Ÿงน Code Formatting
  • ๐Ÿ“’ Templates (TypeScript, Tailwind, mdsvex)
  • ๐Ÿ“„ SvelteKit File Icons
  • ๐Ÿ›ค๏ธ SvelteKit Route Generation
  • โž• Svelte Add integration
  • ๐Ÿ“ฆ Install Packages
  • โŒจ๏ธ Vim Keybindings
  • ๐Ÿ‘ป Hide Config Clutter (show file tree from /src)
  • ๐Ÿ’Œ Share Code via Hash or Share Project via ID
  • ๐Ÿ™ Import from GitHub
  • ๐Ÿ“ฆ Download Projects
  • ๐Ÿ’ป CLI
  • ๐Ÿ”ง Editor Preferences

๐Ÿงก Made with Svelte, for Svelte, by Svelte lovers!

๐Ÿ”Œ Powered by SvelteKit, WebContainers, CodeMirror, Xterm.js and PocketBase


๐Ÿงช Try it out now on sveltelab.dev!

Read the Docs

Create an Issue

Join the Discord

Twitter: @PaoloRicciuti, @SarcevicAntonio


Development

default branch is now main if you have a local master branch you can update it like this:

git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a
  1. download fitting pocketbase binary and place in root
  2. cp .env.sample .env
  3. pnpm i
  4. ./pocketbase serve
  5. go to http://127.0.0.1:8090/_/ and setup your PocketBase Admin
  6. pnpm dev

sveltelab's People

Contributors

adriangonz97 avatar fabian9799 avatar joshnuss avatar k-sato1995 avatar paoloricciuti avatar puruvj avatar sarcevicantonio avatar sveltelab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

sveltelab's Issues

[Terminal] recent commands

Not super needed for the hackathon but a nice to have feature. Press up to go through the list of recent commands.

Also mentioned in #2

Code Editor

We probably want a 'real' code editor like CodeMirror or Monaco, so we can have syntax highlighting and maybe even autocomplete.

Part one of this task would probably research and evaluation of the different options.

Cache basic sveltekit npm deps

What we can try is to get the node modules files from the container once and stick them in an edge function with a super high cache.

When we start the project before npm I we can mount those deps in the file system so that the installation should be way faster.

We need to benchmark this tho.

Icon library

We need an icon library, specifically we need to chose one that ideally has a lot of programming related icons.

npm create command fails

typing npm create svelte@latest retults in the prompt saying npm create svelte@atest and erroring out afterwards with ERR!: Could not fetch dependencies 'create-sveltelatest': Not found error Command failed with exit code 1

UI

we said we wanted a minimal ui that can get more complex if you want (i.e. showing folders etc)

UI wishes:

  • light/dark themes
  • svelte orange
  • could resemble REPL

Tabs

Editor should have tabs and query param state would be very nice for sharing code examples!

Mark as unsaved

Mark as unsaved when we

  • write to a file
  • delete a file/folder
  • create a file/folder

Resizable Panes

we proabably want to be able to resize console, editor and preview.

maybe we can use Svelte-Splitpanes or similar library

Menu to create a route

Much like the svelte extension for vscode would be cool to have a button to create a route. The use input the route and we create every folder needed + the +page.ts, +page.svelte etc that the user selects.

Share as url

I just learned that the hash doesn't count towards the maximum character length of 2048 for the url. This means that if we share our code as a lz-string inside the hash we can share way longer code

For example this url from the typescript playground has 2400ish characters and it works just fine.

Typescript playground url

Now...I still think we should have a db and a way shorter url to share but given that this is easily exploitable (a simple DDoS could fill up our db and skyrocket our expenses) I was thinking we could allow to actually save just logged in users and if you want to share without logging in you can copy the hash url (as a button).

Sharing as hash is still a simple enough thing to do that I still think we should do this (I might give it a shot right now actually)

Rename Files

I think this is kind of a Must since the REPL has it, and also in SvelteKit you do run into times where you rename +page.js to +page.server.js etc.

Prettier

i want to format my code because i like it pretty but am lazy

Add route info in tabs

In vscode you can set things up to show the folder of the file which is useful for all the +page.svelte/ts/js files that one opens in sveltekit...we can take this a step further giving we now a project is probably sveltekit and add the actual route you are looking for

File tree

Add the ability to see the file system and interact with it

Share drop-menu

From the share button we can have a dropdown menu to select which method you want to use (hash or url).

@SarcevicAntonio i'm a bit thorned on moving the download as zip there too because i feel it will be kinda unrelated to sharing and might not be the best place for discoveravility

Show Svelte compiler warnings and errors

One thing the repl does better is showing the errors and warnings of the compiler clearly and plainly in the code editor. Like in repl would be good enough but if code mirror lets us inline errors would be even better!

Problems with npm scripts that could change the file system

If an npm scripts change the inner file system we should re sync the inner file system and the store.

In theory we can do this every time an npm script exit but it's not the most ideal solution. The best thing would be being able to detect a change in the file system from an npm script.

I'll try to look into this

rework file handling

the code of repls is what is shared. I want the current file as soon as possible and at best without javascript (progressive enhancement)

we store the files outside the container as a single source of truth that gets filled by the server initially and is used after web contaienr boot.

if the user never changed a config, there is no need to store them. the config toggle enables us to skip saving the root and only storing the src in 80 % of cases.

Keep the project while logging in

Right now if you wrote a massive project and you try to login to save it will loose your progress. We might use the snapshot capabilities to restore the project while navigating the github login flow.

Enable terminal even if process is running

Some processes request user input...for example if you want to create a svelte app from completely blank project right now this would be impossible because if there's a process running we don't do anything in the terminal.

This might be very very tricky tho because for some processes we don't want the user to randomly type in or move the cursor around. I have to try because maybe it's all handled by the underlying process (for example maybe create-svelte-app intercept the arrow and instead of writing the ansi code to move the cursor to the stream of the terminal writes another command to delete the old screen and paint a new one but I bave to check this).

In some way or another we have to figure this out before the end of the hackathon because some packages are literally un-usable without terminal functionality (actually most of them since they ask you to write the location of a file for example)

Terminal Features

features we maybe want?

  • virtual list
  • quitable (ctrl-c)
  • typeable
  • recent commands (up-arrow)

dependency caching

can we use pnpm and some borwser sotrage feature to cache dependencies in the browser for faster initial startups on repeat visits?

Download as zip

I think we should focus on getting the experience for small to mid sized projects. If you plan to build bigger you probably want to switch to other tools. To make the switch possible we probably want a feature to Export and download a zip at least or even to a github repo?

[Terminal] writable

We could make so that the console is writable...if we want to go light on ourself we could also avoid this and propose a set of commands + an input to install packages.

Also mentioned in #2

Startup performance / general optimization

we want new sveltekit projects to have the best startup experience possible.

current approach also has frequent issues with npm i or npm run dev failing.

I think we want to have a sveltekit minimal repo zipped up with dependencies as an asset to make init more snappy.

Commands runner

One thing I like to do in vscode is Ctrl+e to navigate to a specific .svelte file for a route. We can create a "command" component (something like ray cast) where we can run various commands...I'll open a series of issues with ideas about commands and link back to this issue here. Ideas that comes to mind is

  • Search file by route
  • Svelte-add thing
  • Duplicates of buttons command (switch theme, save, fork, share)
  • Create route

Config Toggle

Should the Config Toggle hide the root (i.e. show tree from src) or hide pre-determined config files?

Issue with the second option is if people add config files, we didn't anticipate the toggle is almost useless, that's why I prefer the first option.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.