diff --git a/README.md b/README.md index e543ef9..bfdb060 100644 --- a/README.md +++ b/README.md @@ -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 `` 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. diff --git a/examples/README.md b/examples/README.md index 957582a..75c72da 100644 --- a/examples/README.md +++ b/examples/README.md @@ -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 `` element) -**Setup Examples:** +**Setup Examples (TypeScript):** - [bun](./examples/bun/) - [bun (classic mode)](./examples/bun-classic/) - [Next.js](./examples/next/) @@ -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/) diff --git a/examples/swc-js-classic/.gitignore b/examples/swc-js-classic/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/examples/swc-js-classic/.gitignore @@ -0,0 +1 @@ +build diff --git a/examples/swc-js-classic/.swcrc b/examples/swc-js-classic/.swcrc new file mode 100644 index 0000000..4d7ebfe --- /dev/null +++ b/examples/swc-js-classic/.swcrc @@ -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" + } +} diff --git a/examples/swc-js-classic/package.json b/examples/swc-js-classic/package.json new file mode 100644 index 0000000..ede2cb8 --- /dev/null +++ b/examples/swc-js-classic/package.json @@ -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" + } +} diff --git a/examples/swc-js-classic/source/Prompt.jsx b/examples/swc-js-classic/source/Prompt.jsx new file mode 100644 index 0000000..3caba50 --- /dev/null +++ b/examples/swc-js-classic/source/Prompt.jsx @@ -0,0 +1,7 @@ +import Prxmpt from "prxmpt"; + +export default function Prompt() { + return ( + Hello from Prxmpt! + ); +} diff --git a/examples/swc-js-classic/source/index.js b/examples/swc-js-classic/source/index.js new file mode 100644 index 0000000..84bfb53 --- /dev/null +++ b/examples/swc-js-classic/source/index.js @@ -0,0 +1,5 @@ +import Prompt from "./Prompt.js"; + +const string = Prompt(); + +console.log(string); diff --git a/examples/swc-js/.gitignore b/examples/swc-js/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/examples/swc-js/.gitignore @@ -0,0 +1 @@ +build diff --git a/examples/swc-js/.swcrc b/examples/swc-js/.swcrc new file mode 100644 index 0000000..465af50 --- /dev/null +++ b/examples/swc-js/.swcrc @@ -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" + } +} diff --git a/examples/swc-js/package.json b/examples/swc-js/package.json new file mode 100644 index 0000000..8f06981 --- /dev/null +++ b/examples/swc-js/package.json @@ -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" + } +} diff --git a/examples/swc-js/source/Prompt.jsx b/examples/swc-js/source/Prompt.jsx new file mode 100644 index 0000000..2379702 --- /dev/null +++ b/examples/swc-js/source/Prompt.jsx @@ -0,0 +1,6 @@ + +export default function Prompt() { + return ( + Hello from Prxmpt! + ); +} diff --git a/examples/swc-js/source/index.js b/examples/swc-js/source/index.js new file mode 100644 index 0000000..84bfb53 --- /dev/null +++ b/examples/swc-js/source/index.js @@ -0,0 +1,5 @@ +import Prompt from "./Prompt.js"; + +const string = Prompt(); + +console.log(string);