ui-plugin-template 0.80.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2024 Composable Prompts
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,156 @@
1
+ # Vertesia Custom App Sample
2
+
3
+ A sample project demonstrating how to build a custom app/plugin for the Vertesia platform using React, TypeScript, and Vite.
4
+
5
+ ## Overview
6
+
7
+ This project serves as a template for building Vertesia plugins that can be integrated into the Vertesia platform. It includes:
8
+
9
+ - React 19 with TypeScript for type-safe component development
10
+ - Tailwind CSS for styling
11
+ - Vite for fast development and optimized builds
12
+ - Dual build modes: standalone app and plugin library
13
+
14
+ ## Project Structure
15
+
16
+ ```txt
17
+ src/
18
+ ├── app.tsx # Main app component with router
19
+ ├── plugin.tsx # Plugin entry point for Vertesia integration
20
+ ├── routes.tsx # Application route definitions
21
+ ├── pages.tsx # Page components
22
+ └── main.tsx # Dev mode entry point
23
+ ```
24
+
25
+ ## Getting Started
26
+
27
+ ### Installation
28
+
29
+ ```bash
30
+ pnpm install
31
+ ```
32
+
33
+ ### Development
34
+
35
+ Run the app in development mode with hot module replacement:
36
+
37
+ ```bash
38
+ pnpm dev
39
+ ```
40
+
41
+ The app will be available at `https://localhost:5173`.
42
+
43
+ ### Building
44
+
45
+ Build both standalone app and plugin library:
46
+
47
+ ```bash
48
+ pnpm build
49
+ ```
50
+
51
+ Or build individually:
52
+
53
+ ```bash
54
+ # Build standalone app
55
+ pnpm build:app
56
+
57
+ # Build plugin library
58
+ pnpm build:lib
59
+ ```
60
+
61
+ The plugin library will be output to the `dist/lib/` directory.
62
+
63
+ ## Deployment
64
+
65
+ Since this is a standard web application, you can deploy it to any static hosting provider (Vercel, Netlify, Cloudflare Pages, AWS S3, etc.).
66
+
67
+ ### Deploying to Vercel
68
+
69
+ Vercel is a practical deployment option with a generous free tier. You can very simply deploy your standalone app using the Vercel CLI.
70
+
71
+ #### Setup
72
+
73
+ Install the Vercel CLI globally:
74
+
75
+ ```bash
76
+ npm i -g vercel
77
+ ```
78
+
79
+ #### Deployment Steps
80
+
81
+ 1. **Login to Vercel**:
82
+
83
+ ```bash
84
+ vercel login
85
+ ```
86
+
87
+ 2. **Deploy to preview**:
88
+
89
+ ```bash
90
+ vercel
91
+ ```
92
+
93
+ This will create a preview deployment and provide you with a URL to test your app.
94
+
95
+ 3. **Deploy to production**:
96
+
97
+ ```bash
98
+ vercel --prod
99
+ ```
100
+
101
+ For more information, visit the [Vercel CLI documentation](https://vercel.com/docs/cli).
102
+
103
+ #### Update App Manifest with Deployment URL
104
+
105
+ After deploying to Vercel, update your app manifest to point to the deployed URL using the vertesia CLI:
106
+
107
+ ```bash
108
+ vertesia apps update <appId> --manifest '{
109
+ "name": "my-app",
110
+ "title": "My App",
111
+ "description": "A sample app",
112
+ "publisher": "your-org",
113
+ "private": true,
114
+ "status": "beta",
115
+ "ui": {
116
+ "src": "https://your-app.vercel.app/lib/plugin.js",
117
+ "isolation": "shadow"
118
+ }
119
+ }'
120
+ ```
121
+
122
+ Replace `appId` by the actual ID and `https://your-app.vercel.app` with your actual Vercel deployment URL.
123
+
124
+ ## Key Features
125
+
126
+ ### Dual Build Modes
127
+
128
+ - **App Mode**: Builds a standalone application for development and testing
129
+ - **Library Mode**: Builds a plugin that can be integrated into the Vertesia platform
130
+
131
+ ### External Dependencies
132
+
133
+ When building as a plugin, React and Vertesia dependencies are externalized to prevent duplication:
134
+
135
+ - `react` / `react-dom`
136
+ - `@vertesia/common`
137
+ - `@vertesia/ui`
138
+
139
+ ## Tech Stack
140
+
141
+ - **React 19** - UI framework
142
+ - **TypeScript** - Type safety
143
+ - **Vite** - Build tool and dev server
144
+ - **Tailwind CSS 4** - Styling
145
+ - **@vertesia/ui** - Vertesia UI components
146
+ - **@vertesia/plugin-builder** - Plugin build utilities
147
+
148
+ ## Development Notes
149
+
150
+ - The dev server uses HTTPS (via `@vitejs/plugin-basic-ssl`)
151
+ - CSS can be inlined in the plugin bundle or kept separate (configured in [vite.config.ts](vite.config.ts))
152
+ - For debugging Vertesia UI sources, set `VERTESIA_UI_PATH` in [vite.config.ts](vite.config.ts)
153
+
154
+ ## License
155
+
156
+ See package.json for license information.