mirror of
https://github.com/smartxworks/sunmao-ui.git
synced 2025-01-18 16:54:00 +08:00
init runtime with playground
This commit is contained in:
parent
a200468dbb
commit
2fc08d5687
5
packages/runtime/.gitignore
vendored
Normal file
5
packages/runtime/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
node_modules
|
||||
.DS_Store
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
12
packages/runtime/example/delete-button/index.html
Normal file
12
packages/runtime/example/delete-button/index.html
Normal file
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>meta-ui runtime example: delete button</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="../../src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
18
packages/runtime/package.json
Normal file
18
packages/runtime/package.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "@meta-ui/runtime",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"dev": "vite"
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^17.0.0",
|
||||
"react-dom": "^17.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^17.0.0",
|
||||
"@types/react-dom": "^17.0.0",
|
||||
"@vitejs/plugin-react-refresh": "^1.3.1",
|
||||
"typescript": "^4.3.2",
|
||||
"vite": "^2.3.8"
|
||||
}
|
||||
}
|
19
packages/runtime/src/App.tsx
Normal file
19
packages/runtime/src/App.tsx
Normal file
@ -0,0 +1,19 @@
|
||||
import React, { useState } from "react";
|
||||
|
||||
function App() {
|
||||
const [count, setCount] = useState(0);
|
||||
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<p>
|
||||
<button type="button" onClick={() => setCount((count) => count + 1)}>
|
||||
count is: {count}
|
||||
</button>
|
||||
</p>
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
10
packages/runtime/src/main.tsx
Normal file
10
packages/runtime/src/main.tsx
Normal file
@ -0,0 +1,10 @@
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import App from "./App";
|
||||
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
document.getElementById("root")
|
||||
);
|
1
packages/runtime/src/vite-env.d.ts
vendored
Normal file
1
packages/runtime/src/vite-env.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
/// <reference types="vite/client" />
|
19
packages/runtime/tsconfig.json
Normal file
19
packages/runtime/tsconfig.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
||||
"allowJs": false,
|
||||
"skipLibCheck": false,
|
||||
"esModuleInterop": false,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"include": ["./src"]
|
||||
}
|
7
packages/runtime/vite.config.ts
Normal file
7
packages/runtime/vite.config.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { defineConfig } from "vite";
|
||||
import reactRefresh from "@vitejs/plugin-react-refresh";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [reactRefresh()],
|
||||
});
|
Loading…
Reference in New Issue
Block a user