ruff/playground
konsti d376cb4c2a
Improve formatter contributor docs (#6776)
The docs were out of date, and the new version incorporates some
feedback.

I tried to keep the language concise and the information ordered by how
early you need it, so people can get the relevant information quickly
before jumping into the code.

I did some minor format_dev changes for consistency in the docs.

---------

Co-authored-by: Micha Reiser <micha@reiser.io>
2023-08-24 10:45:08 +00:00
..
api Enable short URLs in the playground (#6383) 2023-08-11 02:31:09 +00:00
public playground: Add left panel and use brand colors (#5838) 2023-07-19 16:33:32 +02:00
src Avoid JSON parse error on playground load (#6519) 2023-08-12 04:11:44 +00:00
.eslintrc Enable Quick Fix in the playground (#1395) 2022-12-26 19:25:50 -05:00
.gitignore Add ESLint, Prettier, and TypeScript checks (#1384) 2022-12-26 15:08:22 -05:00
.prettierignore Upgrade playground dependencies (#5830) 2023-07-18 08:00:54 +02:00
.prettierrc.json Use trailingComma: 'all' (#1457) 2022-12-29 19:36:51 -05:00
index.html playground: Add left panel and use brand colors (#5838) 2023-07-19 16:33:32 +02:00
package-lock.json Enable short URLs in the playground (#6383) 2023-08-11 02:31:09 +00:00
package.json Enable short URLs in the playground (#6383) 2023-08-11 02:31:09 +00:00
postcss.config.cjs Re-style the Ruff playground (#1438) 2022-12-29 11:47:27 -05:00
README.md Improve formatter contributor docs (#6776) 2023-08-24 10:45:08 +00:00
tailwind.config.cjs playground: Add left panel and use brand colors (#5838) 2023-07-19 16:33:32 +02:00
tsconfig.json Web playground with WASM (#1279) 2022-12-26 12:09:17 -05:00
tsconfig.node.json Web playground with WASM (#1279) 2022-12-26 12:09:17 -05:00
vite.config.ts Web playground with WASM (#1279) 2022-12-26 12:09:17 -05:00

playground

In-browser playground for Ruff. Available https://play.ruff.rs/.

Getting started

First, build the WASM module by running npm run build:wasm (release build) or npm run build:wasm (debug build) from the ./playground directory.

Then, install TypeScript dependencies with npm install, and run the development server with npm run dev.

To run the datastore, which is based on Workers KV, install the Wrangler CLI, then run npx wrangler dev --local from the ./playground/db directory. Note that the datastore is only required to generate shareable URLs for code snippets. The development datastore does not require Cloudflare authentication or login, but in turn only persists data locally.

Architecture

The playground is implemented as a single-page React application powered by Vite, with the editor experience itself powered by Monaco.

The playground stores state in localStorage, but supports persisting code snippets to a persistent datastore based on Workers KV and exposed via a Cloudflare Worker.

The playground design is originally based on Tailwind Play, with additional inspiration from the Rome Tools Playground.