Skip to content

Commit

Permalink
docs: add JS examples
Browse files Browse the repository at this point in the history
  • Loading branch information
bconnorwhite committed Oct 3, 2023
1 parent 1caf024 commit 991faae
Show file tree
Hide file tree
Showing 12 changed files with 126 additions and 11 deletions.
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,16 +206,20 @@ Several examples are provided in the [examples](https://github.com/AutosseyAI/pr
- [kitchen sink](https://github.com/AutosseyAI/prxmpt/blob/main/examples/kitchen-sink/source/Prompt.tsx) (Showcases many elements)
- [priority](https://github.com/AutosseyAI/prxmpt/tree/main/examples/priority/) (A few examples of the `<priority>` element)

**Setup Examples:**
- [bun](https://github.com/AutosseyAI/prxmpt/tree/main/examples/bun/)
- [bun (classic mode)](https://github.com/AutosseyAI/prxmpt/tree/main/examples/bun-classic/)
- [Next.js](https://github.com/AutosseyAI/prxmpt/tree/main/examples/next/)
- [swc](https://github.com/AutosseyAI/prxmpt/tree/main/examples/swc/)
- [swc (classic mode)](https://github.com/AutosseyAI/prxmpt/tree/main/examples/swc-classic/)
- [ts-node](https://github.com/AutosseyAI/prxmpt/tree/main/examples/ts-node/)
- [ts-node (classic mode)](https://github.com/AutosseyAI/prxmpt/tree/main/examples/ts-node-classic/)
- [tsc](https://github.com/AutosseyAI/prxmpt/tree/main/examples/tsc/)
- [tsc (classic mode)](https://github.com/AutosseyAI/prxmpt/tree/main/examples/tsc-classic/)
**Setup Examples (TypeScript):**
- [bun](./examples/bun/)
- [bun (classic mode)](./examples/bun-classic/)
- [Next.js](./examples/next/)
- [swc](./examples/swc/)
- [swc (classic mode)](./examples/swc-classic/)
- [ts-node](./examples/ts-node/)
- [ts-node (classic mode)](./examples/ts-node-classic/)
- [tsc](./examples/tsc/)
- [tsc (classic mode)](./examples/tsc-classic/)

**Setup Examples (JavaScript):**
- [swc](./examples/swc-js/)
- [swc (classic mode)](./examples/swc-js-classic/)

For examples of how to use specific elements, the [tests](https://github.com/AutosseyAI/prxmpt/tree/main/test/) show more usecases.

Expand Down
6 changes: 5 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This directory contains examples of using `Prxmpt` in various situations.
- [kitchen sink](./examples/kitchen-sink/source/Prompt.tsx) (Showcases many elements)
- [priority](./examples/priority/) (A few examples of the `<priority>` element)

**Setup Examples:**
**Setup Examples (TypeScript):**
- [bun](./examples/bun/)
- [bun (classic mode)](./examples/bun-classic/)
- [Next.js](./examples/next/)
Expand All @@ -22,3 +22,7 @@ This directory contains examples of using `Prxmpt` in various situations.
- [ts-node (classic mode)](./examples/ts-node-classic/)
- [tsc](./examples/tsc/)
- [tsc (classic mode)](./examples/tsc-classic/)

**Setup Examples (JavaScript):**
- [swc](./examples/swc-js/)
- [swc (classic mode)](./examples/swc-js-classic/)
1 change: 1 addition & 0 deletions examples/swc-js-classic/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
20 changes: 20 additions & 0 deletions examples/swc-js-classic/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://json.schemastore.org/swcrc.json",
"jsc": {
"parser": {
"syntax": "ecmascript",
"jsx": true
},
"target": "es2022",
"transform": {
"react": {
"pragma": "Prxmpt.createElement",
"pragmaFrag": "Prxmpt.Fragment"
}
}
},
"module": {
"resolveFully": true,
"type": "es6"
}
}
21 changes: 21 additions & 0 deletions examples/swc-js-classic/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "prxmpt-example-swc-js-classic",
"version": "1.0.0",
"description": "Prxmpt SWC Example",
"license": "MIT",
"private": true,
"author": "Connor White",
"type": "module",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"scripts": {
"build": "swc source --config-file .swcrc --copy-files --delete-dir-on-start --out-dir build",
"start": "node build/index.js"
},
"dependencies": {
"@autossey/prxmpt": "*"
},
"devDependencies": {
"swc": "^1.0.11"
}
}
7 changes: 7 additions & 0 deletions examples/swc-js-classic/source/Prompt.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Prxmpt from "prxmpt";

export default function Prompt() {
return (
<text>Hello from Prxmpt!</text>
);
}
5 changes: 5 additions & 0 deletions examples/swc-js-classic/source/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Prompt from "./Prompt.js";

const string = Prompt();

console.log(string);
1 change: 1 addition & 0 deletions examples/swc-js/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
20 changes: 20 additions & 0 deletions examples/swc-js/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://json.schemastore.org/swcrc.json",
"jsc": {
"parser": {
"syntax": "ecmascript",
"jsx": true
},
"target": "es2022",
"transform": {
"react": {
"runtime": "automatic",
"importSource": "@autossey/prxmpt"
}
}
},
"module": {
"resolveFully": true,
"type": "es6"
}
}
21 changes: 21 additions & 0 deletions examples/swc-js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "prxmpt-example-swc-js",
"version": "1.0.0",
"description": "Prxmpt SWC Example",
"license": "MIT",
"private": true,
"author": "Connor White",
"type": "module",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"scripts": {
"build": "swc source --config-file .swcrc --copy-files --delete-dir-on-start --out-dir build",
"start": "node build/index.js"
},
"dependencies": {
"@autossey/prxmpt": "*"
},
"devDependencies": {
"swc": "^1.0.11"
}
}
6 changes: 6 additions & 0 deletions examples/swc-js/source/Prompt.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

export default function Prompt() {
return (
<text>Hello from Prxmpt!</text>
);
}
5 changes: 5 additions & 0 deletions examples/swc-js/source/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Prompt from "./Prompt.js";

const string = Prompt();

console.log(string);

0 comments on commit 991faae

Please sign in to comment.