Refactor(template): Remove unused templates
This commit is contained in:
@@ -14,17 +14,6 @@ export interface IFiles {
|
|||||||
[key: string]: IFile
|
[key: string]: IFile
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITemplate {
|
|
||||||
name: string
|
|
||||||
tsconfig: ITsconfig
|
|
||||||
importMap: IImportMap
|
|
||||||
files: IFiles
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ITemplates {
|
|
||||||
[key: string]: ITemplate
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IImportMap {
|
export interface IImportMap {
|
||||||
imports: Record<string, string>
|
imports: Record<string, string>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
import { ITemplates } from '@/components/Playground/shared'
|
|
||||||
import { ENTRY_FILE_NAME, MAIN_FILE_NAME } from '@/components/Playground/files'
|
|
||||||
|
|
||||||
import baseTsconfig from '@/components/Playground/templates/base/tsconfig.json'
|
|
||||||
import baseImportMap from '@/components/Playground/templates/base/import-map.json'
|
|
||||||
import baseMain from '@/components/Playground/templates/base/main.tsx?raw'
|
|
||||||
import baseApp from '@/components/Playground/templates/base/App.tsx?raw'
|
|
||||||
|
|
||||||
import demoTsconfig from '@/components/Playground/templates/demo/tsconfig.json'
|
|
||||||
import demoImportMap from '@/components/Playground/templates/demo/import-map.json'
|
|
||||||
import demoMain from '@/components/Playground/templates/demo/main.tsx?raw'
|
|
||||||
import demoApp from '@/components/Playground/templates/demo/App.tsx?raw'
|
|
||||||
import demoAppCSS from '@/components/Playground/templates/demo/App.css?raw'
|
|
||||||
|
|
||||||
const templates: ITemplates = {
|
|
||||||
base: {
|
|
||||||
name: '基础',
|
|
||||||
tsconfig: baseTsconfig,
|
|
||||||
importMap: baseImportMap,
|
|
||||||
files: {
|
|
||||||
[ENTRY_FILE_NAME]: {
|
|
||||||
name: ENTRY_FILE_NAME,
|
|
||||||
language: 'typescript',
|
|
||||||
value: baseMain,
|
|
||||||
hidden: true
|
|
||||||
},
|
|
||||||
[MAIN_FILE_NAME]: {
|
|
||||||
name: MAIN_FILE_NAME,
|
|
||||||
language: 'typescript',
|
|
||||||
value: baseApp
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
demo: {
|
|
||||||
name: 'Demo',
|
|
||||||
tsconfig: demoTsconfig,
|
|
||||||
importMap: demoImportMap,
|
|
||||||
files: {
|
|
||||||
[ENTRY_FILE_NAME]: {
|
|
||||||
name: ENTRY_FILE_NAME,
|
|
||||||
language: 'typescript',
|
|
||||||
value: demoMain,
|
|
||||||
hidden: true
|
|
||||||
},
|
|
||||||
[MAIN_FILE_NAME]: {
|
|
||||||
name: MAIN_FILE_NAME,
|
|
||||||
language: 'typescript',
|
|
||||||
value: demoApp
|
|
||||||
},
|
|
||||||
['App.css']: {
|
|
||||||
name: 'App.css',
|
|
||||||
language: 'css',
|
|
||||||
value: demoAppCSS
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default templates
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
const App = () => {
|
|
||||||
return <></>
|
|
||||||
}
|
|
||||||
|
|
||||||
export default App
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"imports": {
|
|
||||||
"react": "https://esm.sh/react@18.2.0",
|
|
||||||
"react-dom/client": "https://esm.sh/react-dom@18.2.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import React from 'react'
|
|
||||||
import ReactDOM from 'react-dom/client'
|
|
||||||
|
|
||||||
import App from './App'
|
|
||||||
|
|
||||||
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
||||||
<React.StrictMode>
|
|
||||||
<App />
|
|
||||||
</React.StrictMode>
|
|
||||||
)
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": 7,
|
|
||||||
"useDefineForClassFields": true,
|
|
||||||
"module": 99,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"moduleResolution": 2,
|
|
||||||
"allowImportingTsExtensions": true,
|
|
||||||
"resolveJsonModule": true,
|
|
||||||
"isolatedModules": true,
|
|
||||||
"noEmit": true,
|
|
||||||
"jsx": 4,
|
|
||||||
"strict": true,
|
|
||||||
"noUnusedLocals": true,
|
|
||||||
"noUnusedParameters": true,
|
|
||||||
"noFallthroughCasesInSwitch": true,
|
|
||||||
"composite": true,
|
|
||||||
"types": ["node"],
|
|
||||||
"allowSyntheticDefaultImports": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
:root {
|
|
||||||
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
font-weight: 400;
|
|
||||||
line-height: 1.5;
|
|
||||||
color: rgb(255 255 255 / 87%);
|
|
||||||
text-rendering: optimizelegibility;
|
|
||||||
text-size-adjust: 100%;
|
|
||||||
background-color: #242424;
|
|
||||||
color-scheme: light dark;
|
|
||||||
font-synthesis: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#root {
|
|
||||||
max-width: 1280px;
|
|
||||||
padding: 2rem;
|
|
||||||
margin: 0 auto;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
display: flex;
|
|
||||||
min-width: 320px;
|
|
||||||
min-height: 100vh;
|
|
||||||
margin: 0;
|
|
||||||
place-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 3.2em;
|
|
||||||
line-height: 1.1;
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
padding: 0.6em 1.2em;
|
|
||||||
font-family: inherit;
|
|
||||||
font-size: 1em;
|
|
||||||
font-weight: 500;
|
|
||||||
cursor: pointer;
|
|
||||||
background-color: #1a1a1a;
|
|
||||||
border: 1px solid transparent;
|
|
||||||
border-radius: 8px;
|
|
||||||
transition: border-color 0.25s;
|
|
||||||
}
|
|
||||||
|
|
||||||
button:hover {
|
|
||||||
border-color: #646cff;
|
|
||||||
}
|
|
||||||
|
|
||||||
button:focus,
|
|
||||||
button:focus-visible {
|
|
||||||
outline: 4px auto -webkit-focus-ring-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: light) {
|
|
||||||
:root {
|
|
||||||
color: #213547;
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
background-color: #f9f9f9;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
import { useState } from 'react'
|
|
||||||
import './App.css'
|
|
||||||
|
|
||||||
const App = () => {
|
|
||||||
const [count, setCount] = useState(0)
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<h1>Hello World</h1>
|
|
||||||
<div className="card">
|
|
||||||
<button onClick={() => setCount((count) => count + 1)}>count is {count}</button>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default App
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"imports": {
|
|
||||||
"react": "https://esm.sh/react@18.2.0",
|
|
||||||
"react-dom/client": "https://esm.sh/react-dom@18.2.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import React from 'react'
|
|
||||||
import ReactDOM from 'react-dom/client'
|
|
||||||
|
|
||||||
import App from './App'
|
|
||||||
|
|
||||||
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
||||||
<React.StrictMode>
|
|
||||||
<App />
|
|
||||||
</React.StrictMode>
|
|
||||||
)
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": 7,
|
|
||||||
"useDefineForClassFields": true,
|
|
||||||
"module": 99,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"moduleResolution": 2,
|
|
||||||
"allowImportingTsExtensions": true,
|
|
||||||
"resolveJsonModule": true,
|
|
||||||
"isolatedModules": true,
|
|
||||||
"noEmit": true,
|
|
||||||
"jsx": 4,
|
|
||||||
"strict": true,
|
|
||||||
"noUnusedLocals": true,
|
|
||||||
"noUnusedParameters": true,
|
|
||||||
"noFallthroughCasesInSwitch": true,
|
|
||||||
"composite": true,
|
|
||||||
"types": ["node"],
|
|
||||||
"allowSyntheticDefaultImports": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user