rsf-zero 0.1.1 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +49 -0
  2. package/package.json +3 -2
package/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # RSF Zero
2
+
3
+ A minimal micro-framework with React Server Functions support.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ yarn add rsf-zero
9
+ # or
10
+ pnpm add rsf-zero
11
+ # or
12
+ npm install rsf-zero
13
+ ```
14
+
15
+ Then follow [setup](https://github.com/IgorNadj/rsf-zero/tree/main/docs/setup.md#Setup).
16
+
17
+ ## Quick intro to Server Functions
18
+ React Server Functions allow you to mark functions to run on the server:
19
+
20
+ ```tsx
21
+ 'use server';
22
+
23
+ // Server function
24
+ export const addComment = async (comment: Comment) => {
25
+ await db.comment.create(comment);
26
+ }
27
+ ```
28
+
29
+ ```tsx
30
+ import { addComment } from './addComment.ts';
31
+
32
+ export const AddCommentButton = (comment: Comment) =>
33
+ <Button onClick={() => addComment(comment)} />
34
+ ```
35
+
36
+ ### More examples
37
+ See [/example/src/App.tsx](https://github.com/IgorNadj/rsf-zero/tree/main/example/src/App.tsx).
38
+
39
+ ### Reference Docs
40
+ - [React Server Functions](https://react.dev/reference/rsc/server-functions)
41
+ - Note: only the top-level `'use server'` is implemented by this framework.
42
+
43
+ ## Motivation
44
+
45
+ **RSF Zero** is designed to be a dead simple micro-framework.
46
+
47
+ 🕊 **Minimal**: Add whatever you want on top, nothing bundled that you don't use\
48
+ 🕊 **Simple**: Add `'use server'` to run something on the server, and you're done, nothing new to learn\
49
+ 🕊️ **Done**: Instead, spend your spare time sipping a nice coffee or looking at a bird
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A minimal micro-framework with React Server Functions support",
4
4
  "author": "Igor Nadj",
5
5
  "type": "module",
6
- "version": "0.1.1",
6
+ "version": "0.1.4",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/IgorNadj/rsf-zero.git",
@@ -12,7 +12,8 @@
12
12
  "scripts": {
13
13
  "build": "rm -rf ./dist && tsc",
14
14
  "test": "vitest run",
15
- "test:watch": "vitest"
15
+ "test:watch": "vitest",
16
+ "prepublishOnly": "npm run build && npm run test && cp ../README.md ."
16
17
  },
17
18
  "dependencies": {
18
19
  "@swc/core": "^1.12.1",