userquin 2 лет назад
Родитель
Сommit
b919b1f445

+ 35 - 0
plugins/vite-plugin-tres/package.json

@@ -0,0 +1,35 @@
+{
+  "name": "client",
+  "private": true,
+  "version": "0.0.0",
+  "type": "module",
+  "scripts": {
+    "dev": "vite src/client",
+    "build": "unbuild && vite build src/client",
+    "preview": "vite preview src/client"
+  },
+  "bin": {
+    "tres": "./bin/tres.mjs"
+  },
+  "files": [
+    "bin",
+    "dist"
+  ],
+  "dependencies": {
+    "sirv": "^2.0.3",
+    "unconfig": "^0.3.9"
+  },
+  "devDependencies": {
+    "@types/node": "^18.16.18",
+    "@vitejs/plugin-vue": "^4.1.0",
+    "cac": "^6.7.14",
+    "colorette": "^2.0.20",
+    "consola": "^3.1.0",
+    "pathe": "^1.1.1",
+    "typescript": "^5.0.2",
+    "unbuild": "^1.2.1",
+    "vue": "^3.2.47",
+    "vite": "^4.3.9",
+    "vue-tsc": "^1.4.2"
+  }
+}

+ 6 - 6
plugins/vite-plugin-tres/src/client/index.html

@@ -1,13 +1,13 @@
 <!DOCTYPE html>
 <html lang="en">
-  <head>
+<head>
     <meta charset="UTF-8" />
     <link rel="icon" type="image/svg+xml" href="/vite.svg" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
     <title>Vite + Vue + TS</title>
-  </head>
-  <body>
-    <div id="app"></div>
-    <script type="module" src="/src/main.ts"></script>
-  </body>
+</head>
+<body>
+<div id="app"></div>
+<script type="module" src="/test/main.ts"></script>
+</body>
 </html>

+ 0 - 20
plugins/vite-plugin-tres/src/client/package.json

@@ -1,20 +0,0 @@
-{
-  "name": "client",
-  "private": true,
-  "version": "0.0.0",
-  "type": "module",
-  "scripts": {
-    "dev": "vite",
-    "build": "vue-tsc && vite build",
-    "preview": "vite preview"
-  },
-  "dependencies": {
-    "vue": "^3.2.47"
-  },
-  "devDependencies": {
-    "@vitejs/plugin-vue": "^4.1.0",
-    "typescript": "^5.0.2",
-    "vite": "^4.3.9",
-    "vue-tsc": "^1.4.2"
-  }
-}

+ 4 - 18
plugins/vite-plugin-tres/src/client/src/App.vue

@@ -1,21 +1,7 @@
-<script setup lang="ts">
-</script>
+<script setup lang="ts"></script>
 
 <template>
-    Lo hemos logrado paco
+  <main>
+    <div>Visor Actividad</div>
+  </main>
 </template>
-
-<style scoped>
-.logo {
-  height: 6em;
-  padding: 1.5em;
-  will-change: filter;
-  transition: filter 300ms;
-}
-.logo:hover {
-  filter: drop-shadow(0 0 2em #646cffaa);
-}
-.logo.vue:hover {
-  filter: drop-shadow(0 0 2em #42b883aa);
-}
-</style>

+ 3 - 6
plugins/vite-plugin-tres/src/client/test/index.html → plugins/vite-plugin-tres/src/client/test/App.vue

@@ -1,9 +1,6 @@
-<script setup lang="ts">
-</script>
+<script setup lang="ts"></script>
 
-<template>
-    Lo hemos logrado paco
-</template>
+<template>Lo hemos logrado paco</template>
 
 <style scoped>
 .logo {
@@ -18,4 +15,4 @@
 .logo.vue:hover {
   filter: drop-shadow(0 0 2em #42b883aa);
 }
-</style>
+</style>

+ 4 - 0
plugins/vite-plugin-tres/src/client/test/main.ts

@@ -0,0 +1,4 @@
+import { createApp } from 'vue'
+import App from './App.vue'
+
+createApp(App).mount('#app')

+ 1 - 0
plugins/vite-plugin-tres/src/client/test/vite-env.d.ts

@@ -0,0 +1 @@
+/// <reference types="vite/client" />

+ 61 - 0
plugins/vite-plugin-tres/src/client/tres-ci.html

@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8" />
+    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <title>TresCI</title>
+    <style>
+        html {
+            overflow: hidden;
+            padding: 0;
+            margin: 0;
+            display: block;
+            view-transition-name: root;
+            font-family: Readex Pro,sans-serif;
+        }
+        body {
+            padding: 0;
+            margin: 0;
+            display: grid;
+            grid-template-columns: 1fr;
+            grid-row-gap: 0;
+        }
+        main {
+            width: 100vw;
+            height: 100vh;
+            display: grid;
+            grid-template-columns: 3fr 1fr;
+            grid-template-rows: min-content 1fr;
+        }
+        main header {
+            height: 40px;
+            grid-column: 1 / span 2;
+            padding: 0 0.5rem;
+            margin: 0;
+            border-bottom-width: 1px;
+            grid-gap: 0.5rem;
+            gap: 0.5rem;
+            align-items: center;
+            display: flex;
+            height: 40px;
+            background-color: #6b72800d;
+            border-color: #6b72801a;
+        }
+        #tres-target-app, #tres-ci-app {
+            height: calc(100vh - 40px);
+            border: none;
+            z-index: 1;
+        }
+    </style>
+</head>
+<body>
+<main>
+    <header>
+        <h1>TresCLI</h1>
+    </header>
+    <iframe id="tres-target-app" src="__tres__ci__target__.html"></iframe>
+    <iframe id="tres-ci-app" src="__tres__ci__.html"></iframe>
+</main>
+</body>
+</html>

+ 13 - 0
plugins/vite-plugin-tres/src/client/tres.html

@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <title>TresCLI</title>
+  </head>
+  <body>
+    <div id="app"></div>
+    <script type="module" src="/src/main.ts"></script>
+  </body>
+</html>

+ 3 - 1
plugins/vite-plugin-tres/src/client/tsconfig.json

@@ -20,6 +20,8 @@
     "noUnusedParameters": true,
     "noFallthroughCasesInSwitch": true
   },
-  "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
+  "include": [
+    "src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"
+  ],
   "references": [{ "path": "./tsconfig.node.json" }]
 }

+ 22 - 2
plugins/vite-plugin-tres/src/client/vite.config.ts

@@ -1,8 +1,28 @@
 import { defineConfig } from 'vite'
 import vue from '@vitejs/plugin-vue'
-import TresPlugin from '../node'
+import { TresPlugin } from '../node/plugin'
+import { resolve } from 'pathe'
+import { fileURLToPath } from 'node:url'
 
 // https://vitejs.dev/config/
 export default defineConfig({
-  plugins: [vue(), TresPlugin()],
+  build: {
+    rollupOptions: {
+      input: {
+        tres: resolve(fileURLToPath(import.meta.url), '../tres.html'),
+        'tres-ci': resolve(fileURLToPath(import.meta.url), '../tres-ci.html'),
+      },
+    },
+    outDir: '../../dist/client',
+  },
+  plugins: [
+    vue(),
+    TresPlugin(false, {
+      vite: {
+        server: {
+          open: true,
+        },
+      },
+    }),
+  ],
 })