Skip to content
This repository has been archived by the owner on Sep 21, 2024. It is now read-only.

Commit

Permalink
docs(playground): update example
Browse files Browse the repository at this point in the history
  • Loading branch information
r17x committed Jun 26, 2024
1 parent 9ea0390 commit 0bea8e4
Show file tree
Hide file tree
Showing 10 changed files with 3,054 additions and 29 deletions.
7 changes: 5 additions & 2 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.2/schema.json",
"files": {
"ignoreUnknown": true,
"include": ["src/**/*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}"]
"ignore": ["build", "out", "dist", "lib/bs"],
"include": [
"src/**/*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}",
"playground/src/**/*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}"
]
},
"organizeImports": {
"enabled": true
Expand Down
1 change: 1 addition & 0 deletions playground/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
**/lib/
**/*.res.js
23 changes: 2 additions & 21 deletions playground/farm.config.mts
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
import { defineConfig } from "@farmfe/core";
import UnpluginVite from "../src/vite";
import Unplugin from "../src/farm";

//const createVitePlugin = () => ({
// vitePlugin: UnpluginVite(),
// filters: {
// moduleTypes: ['ts', 'tsx'],
// },
//})
import ReScript from "../src/farm";

export default defineConfig({
root: process.cwd(), // compiled root directory
// compile options
compilation: {
input: {
index: "./index.html",
},
},
plugins: [Unplugin()],
vitePlugins: [
// plugin configuration
// createVitePlugin
],
plugins: [ReScript()],
});
3 changes: 2 additions & 1 deletion playground/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
</head>
<body>
<div id="app"></div>
<a href="/__inspect/#/module?id=./main.ts&index=2" target="_blank" style="text-decoration: none; margin-top:10px; display: block;">visit /__inspect/ to inspect the intermediate state</a>
<a href="/__inspect/#/module?id=./src/index.res.js" target="_blank" style="text-decoration: none; margin-top:10px; display: block;">visit /__inspect/ to inspect the intermediate state</a>
<!-- [Tested in Vite] src/index.res will be compiled to src/index.res.js -->
<script type="module">
import "./src/index.res"
</script>
Expand Down
7 changes: 7 additions & 0 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,23 @@
"private": true,
"scripts": {
"clean": "rescript clean -with-deps",
"dev:vite": "vite dev",
"dev:farm": "farm dev",
"build:vite": "vite build",
"build:farm": "farm build"
},
"devDependencies": {
"@farmfe/cli": "^1.0.2",
"@farmfe/core": "^1.2.0",
"@rescript/core": "1.5.0",
"@rescript/react": "^0.12.2",
"rescript": "11.1.1",
"unplugin-rescript": "workspace:*",
"vite": "^5.0.4",
"vite-plugin-inspect": "^0.8.1"
},
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1"
}
}
6 changes: 5 additions & 1 deletion playground/rescript.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
}
],
"suffix": ".res.js",
"bs-dependencies": ["@rescript/core"],
"jsx": {
"version": 4,
"mode": "automatic"
},
"bs-dependencies": ["@rescript/core", "@rescript/react"],
"bsc-flags": ["-open RescriptCore"]
}
1 change: 0 additions & 1 deletion playground/src/a.res

This file was deleted.

Loading

0 comments on commit 0bea8e4

Please sign in to comment.