• Stars
    star
    198
  • Rank 190,559 (Top 4 %)
  • Language
    JavaScript
  • Created over 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

ready. set. go!

ratpack

[work in progress]

npm install ratpack -g

or download the latest release

ratpack

ratpack is for beginners, tinkerers, ents, cylons.

quickstart

  • write a javascript file, say script.js, and save it somewhere. maybe it looks like this -

      require('react-dom').render(
        <div>hello world</div>, 
        document.getElementById('root'))
  • drag it on to the app, or run ratpack script.js

  • magic

more

ratpack gets rid of all the starting boilerplate for building and running the so-called 'modern' javascript stack, letting you immediately jump into the core of your problem.

  • steals a bunch of code/tools from create-react-app for live reloading, in-browser error messaging, file loaders for css, images, etc, and you can load your own loaders with js pragmas
  • comes with liberal babel defaults, including future facing extensions (and decorators!). You can also use a local .babelrc file (experimental).
  • preloads libraries like react, react-router@4, and glamor. It'll also use modules from your own node_modules folder, and you can add your own 'globally' by installing with npm/yarn to ~/.ratpack
  • use a local public folder to serve static assets that can't be imported (todo - and / or to serve a custom index.html)
  • use pragmas at the top of your file to configure ratpack
  • todo - will autoupdate itself whenever I make a 'release', so you're using the latest versions of presets and packaged libs almost as soon they're out
  • todo - a preferences pane to edit 'global' settings; toggle presets, add libs, etc

long, rambly rationale

tl;dr - old school flow, new age ride.

So, you're reading a tutorial on requestIdleCallback / render callbacks with react / javascript thoughtlording. Or you've just had an idea for a new algorithm for reversing a binary tree. Or maybe you need to write a shitty benchmark to convince your boss that yes, immutable data is fast enough. In any case, you need to quickly write and run some code. What do you do?

These first 2 minutes are critical. The idea you've just had is ephemeral, and needs to be written down fast. It'll be dirty, and you might just throw it away later. At this point, you don't care about the framework wars and modularity shaming and whatever. This is all about you.

Back in my day, I would write a javascript file (and a dumb html holder), and just run it in a browser. Sure, I had a bajillion other problems, but I liked the brutal efficiency of being seconds away from taking a random idea and turning it into pixels. Bikeshedding over 'build systems' was never the first step.

Mind you, we still had build systems, and we bikeshedded a lot over them and how we built our apps, but those 'apps' were a different context; built for teams and stability. Indeed, deep inside those app folders it wasn't uncommon to find 'demo' pages and .md scratchpads for ideas.

But 'personal' coding? Totally different rules. For one, you'd usually want the latest versions of libs. You want as little boilerplate as possible, to jump into the meat of the problem immediately. Maybe you'd have a little /code folder with all your commonly used libs and personal experiments. Even in the context of a larger project, maybe you want to work on a component in isolation, but don't want / need to use the project's main infrastructure.

Times change.

Transpiled languages rose as a way of papering over some javascript's problems, and to use and experiment with future features in browsers that don't support it yet. And it's been absolutely fantastic. The pipeline of new features should keep us busy for a couple of years, if not more. Extensions like JSX and TypeScript make writing code an absolute joy (...well, mostly). I'll be blunt - I can't do UI programming without JSX anymore; having a first class UI construct in your programming language makes soooo much sense. Further, having a React dialect at arm's length means I'm not spending any mindspace on dom mutations. It's the small things, y'know?

The setup process to use transpiled languages though... not so great. You need to install and configure a pipeline of tools, usually cli + node based, in a terminal, and pay this cost almost every time you need to run a new file. nwb, create-react-app, etc get so close, but by nature of their being designed for 'apps', don't achieve the lightweight, experimental feel I'm looking for. Also, CLIs, ick.

We're UI developers. We can do better. By building beginner/tinkerer friendly tooling, we can automate some of our own pain away, and increase how inclusive we are as a community and as a technology. Here's my attempt.

First, some of my 'requirements' -

  • I'd like to be able to write a javascript file, with es6 and jsx and whatnot, and just run it in a browser. This could be on my desktop, my downloads folder, wherever.
  • I do not want to have to install or configure anything 'build' related every time.
  • I'd like some liberal defaults, and include some prepackaged libraries like react, react-router, glamor, polyfills for fetch etc.
  • maybe I'll have a local node_modules, or in a folder higher up my path
  • perhaps I'll have a local public folder too, with images and css or whatever I'll need
  • perchance if I need to, I'd like a custom babel config to mess with a plugin or preset

Let's imagine the core experience - I'd like to have an app (like a legit, macOS/windows/linux desktop app), and I'd like to drag and drop my .js file into it / onto its dock icon, and it would "just work". It could open a browser tab to that file running in a simple html page, and reload whenever I make file changes. A list of previously opened files would be nice.

Hence... drum roll... ratpack. Hope you like it. Lemme know what I could do better, and what you'd like to see!

feature wishlist

  • better design
  • frictionless mobile web dev
  • build / deploy to now / surge / etc
  • the service worker treatment
  • end to end encrypted share ala ngrok
  • multiple languages; flow, reason, node, whatevs
  • eject config, for carrying on a 'real' project
  • a smaller package

the shoulders of giants

this couldn't exist without the work of thousands of people in the OSS world. Some projects specifically -

  • nwb, create-react-app, and the whole family of CLI apps to bootstrap, run and build your javascript apps
  • webpack2, the giant swiss army knife of javascript bundlers
  • babel, for all your javascript transformation needs
  • electron, giving a truly desirable target for building javascript tooling
  • and of course, react and its entire ecosystem.

project status

This is stil very early work, with a large number of todos to get through before it's 'production ready'. That said, this is already pretty useful. If you'd like to try it out, either try out the prototype mac release, or clone this repo and run npm run && npm run package-app to generate the binary for your computer. Have fun!

More Repositories

1

glamor

inline css for react et al
JavaScript
3,659
star
2

markdown-in-js

inline markdown for react/jsx
JavaScript
788
star
3

react-act-examples

Notes and examples on ReactTestUtils.act(...)
JavaScript
517
star
4

glam

crazy good css in your js
JavaScript
504
star
5

css-suspense

css loading for react
JavaScript
310
star
6

rakt

fast websites, by default
JavaScript
292
star
7

freezus

magic component for transitions between screens
JavaScript
188
star
8

bs-nice

css-in-reason
OCaml
182
star
9

react-modules

code splitting as a component
JavaScript
171
star
10

react-springs

react+rebound
JavaScript
91
star
11

react-tpl

abusing the platform
JavaScript
81
star
12

favre

jsx -> favicon
JavaScript
75
star
13

react-lazy-ssr-workers

react 18's streams running on cloudflare workers
JavaScript
67
star
14

react-redux-saga

react components for redux-saga
JavaScript
67
star
15

disto

mildly opinionated flux
JavaScript
65
star
16

react-ease

animations for react
JavaScript
53
star
17

glamor-stream

streaming inline glamor for your html
JavaScript
50
star
18

esjest-transform

A fast jest transform
JavaScript
45
star
19

y-workers

A Yjs backend on Cloudflare Workers
CSS
36
star
20

react-state

localized react state component
JavaScript
34
star
21

es-grid-kiss

es6 tagged literals + css grids
JavaScript
33
star
22

jsxn

jsx notation for json trees
JavaScript
32
star
23

require.import

sync-friendly code splits for webpack
JavaScript
26
star
24

react-superagent

universal ajax as a react component
JavaScript
26
star
25

react-loadscript

script tag as a react component
JavaScript
25
star
26

kv

a fast, immutable key-value store
JavaScript
24
star
27

routah

yet another router for react
JavaScript
22
star
28

iso-gol

conway's game of life, projected onto isometric 3d space in css
JavaScript
21
star
29

vite-plugin-react-jsx

A Vite plugin that enhances jsx transformation for React
TypeScript
18
star
30

glamor-inline

inlined css in your html
JavaScript
15
star
31

hotrod

JavaScript
12
star
32

babel-macros

macros for babel. I think.
12
star
33

react-router-modules

react-modules + react-router + 🌈
JavaScript
12
star
34

pretty.fly

yet another async thing
JavaScript
12
star
35

proposal-error-assert

Error.assert() proposal for ECMAScript
TypeScript
11
star
36

oia

yet another lisp that compiles to javascript
JavaScript
9
star
37

xen

jsx+generators+p5.js
JavaScript
9
star
38

react-animated-web-bootleg

JavaScript
9
star
39

asyncstorage-mock

a mock for react-native's asyncstorage api. useful for testing.
JavaScript
9
star
40

falcro

falcor + react. hype!
JavaScript
7
star
41

built-devtools

chrome's devtools frontend, built.
JavaScript
7
star
42

react-debounce

debounce as a component
JavaScript
7
star
43

itree

trees with immutable.js
JavaScript
7
star
44

css-in-js-workshop

css, in your js, in your head, in your heart
JavaScript
6
star
45

max-payge

for max, because he asked
JavaScript
6
star
46

threepointone

VALUE
JavaScript
5
star
47

vite-jest

A configuration for runing jest tests inside vite
TypeScript
5
star
48

react-timing

timing as a component
JavaScript
4
star
49

twain

dynamic tweening engine
JavaScript
4
star
50

dahi

kefir, for js-csp
HTML
4
star
51

react-act-example

For Jason - https://twitter.com/CarrickJason/status/1171156605234077696
JavaScript
4
star
52

myxtape

content management systems for the new world
JavaScript
4
star
53

genno

async transforms / flow control with js-csp
JavaScript
3
star
54

riki

evil markup for documents
JavaScript
3
star
55

k

build systems, revisited
JavaScript
3
star
56

disto-example

disto examples, with hot loading of stores/views
CSS
3
star
57

prpl-with-react-example

whatevs dawg
JavaScript
2
star
58

shuffle

do the dom shuffle
JavaScript
2
star
59

progress

progress bar, alΓ‘ youtube
JavaScript
2
star
60

react-metronome

tick-tock as a component
CSS
2
star
61

bus

global event bus
JavaScript
2
star
62

vure

2
star
63

disto-hot-loader

hot load disto/flux stores
JavaScript
2
star
64

fn

tiny lib of functional helpers for personal projects
JavaScript
2
star
65

traced

JavaScript
2
star
66

times

functional times/map.
JavaScript
1
star
67

sandbox

sandboxed modules, ala YUI
JavaScript
1
star
68

iso

isometric math helpers
JavaScript
1
star
69

rust_project

Rust
1
star
70

game-of-life

generic game of life algorithm implementation in javascript
JavaScript
1
star
71

braid

experiments in clojurescript
JavaScript
1
star
72

lepton-labs-multiplayer

TypeScript
1
star
73

iso-grid

JavaScript
1
star
74

beam

funky get/set styles. WORK IN PROGRESS.
JavaScript
1
star
75

glamor-perf

HTML
1
star
76

async-act-test-21-11

Created with CodeSandbox
JavaScript
1
star
77

react-redux-optimist

react bindings for redux-optimist
JavaScript
1
star
78

zoui

HTML
1
star
79

Sangam

Static asset package generation and management
JavaScript
1
star
80

native-markup

JavaScript
1
star
81

scripts

useful (to me)
Ruby
1
star
82

oiarepl

a repl for oia
JavaScript
1
star
83

claw

css transforms without the heartache
JavaScript
1
star