@vertesia/create-plugin 0.80.0-dev.20251121 → 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/README.md +123 -66
- package/lib/configuration.d.ts +63 -0
- package/lib/configuration.d.ts.map +1 -0
- package/lib/configuration.js +68 -0
- package/lib/configuration.js.map +1 -0
- package/lib/download-template.d.ts +5 -0
- package/lib/download-template.d.ts.map +1 -0
- package/lib/download-template.js +33 -0
- package/lib/download-template.js.map +1 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +159 -0
- package/lib/index.js.map +1 -0
- package/lib/package-manager.d.ts +10 -0
- package/lib/package-manager.d.ts.map +1 -0
- package/lib/package-manager.js +74 -0
- package/lib/package-manager.js.map +1 -0
- package/lib/process-template.d.ts +25 -0
- package/lib/process-template.d.ts.map +1 -0
- package/lib/process-template.js +186 -0
- package/lib/process-template.js.map +1 -0
- package/lib/prompts.d.ts +6 -0
- package/lib/prompts.d.ts.map +1 -0
- package/lib/prompts.js +54 -0
- package/lib/prompts.js.map +1 -0
- package/lib/template-config.d.ts +87 -0
- package/lib/template-config.d.ts.map +1 -0
- package/lib/template-config.js +23 -0
- package/lib/template-config.js.map +1 -0
- package/lib/template-selector.d.ts +7 -0
- package/lib/template-selector.d.ts.map +1 -0
- package/lib/template-selector.js +56 -0
- package/lib/template-selector.js.map +1 -0
- package/lib/transforms.d.ts +33 -0
- package/lib/transforms.d.ts.map +1 -0
- package/lib/transforms.js +81 -0
- package/lib/transforms.js.map +1 -0
- package/package.json +22 -32
- package/bin/create-plugin.mjs +0 -2
- package/lib/Package.d.ts +0 -42
- package/lib/Package.d.ts.map +0 -1
- package/lib/Package.js +0 -52
- package/lib/Package.js.map +0 -1
- package/lib/TemplateInit.d.ts +0 -30
- package/lib/TemplateInit.d.ts.map +0 -1
- package/lib/TemplateInit.js +0 -48
- package/lib/TemplateInit.js.map +0 -1
- package/lib/ToolTemplateInit.d.ts +0 -10
- package/lib/ToolTemplateInit.d.ts.map +0 -1
- package/lib/ToolTemplateInit.js +0 -58
- package/lib/ToolTemplateInit.js.map +0 -1
- package/lib/WebTemplateInit.d.ts +0 -10
- package/lib/WebTemplateInit.d.ts.map +0 -1
- package/lib/WebTemplateInit.js +0 -68
- package/lib/WebTemplateInit.js.map +0 -1
- package/lib/copy.d.ts +0 -12
- package/lib/copy.d.ts.map +0 -1
- package/lib/copy.js +0 -45
- package/lib/copy.js.map +0 -1
- package/lib/deps.d.ts +0 -3
- package/lib/deps.d.ts.map +0 -1
- package/lib/deps.js +0 -20
- package/lib/deps.js.map +0 -1
- package/lib/hasBin.d.ts +0 -2
- package/lib/hasBin.d.ts.map +0 -1
- package/lib/hasBin.js +0 -14
- package/lib/hasBin.js.map +0 -1
- package/lib/init.d.ts +0 -2
- package/lib/init.d.ts.map +0 -1
- package/lib/init.js +0 -124
- package/lib/init.js.map +0 -1
- package/lib/main.d.ts +0 -2
- package/lib/main.d.ts.map +0 -1
- package/lib/main.js +0 -8
- package/lib/main.js.map +0 -1
- package/lib/template.d.ts +0 -4
- package/lib/template.d.ts.map +0 -1
- package/lib/template.js +0 -16
- package/lib/template.js.map +0 -1
- package/lib/types.d.ts +0 -12
- package/lib/types.d.ts.map +0 -1
- package/lib/types.js +0 -20
- package/lib/types.js.map +0 -1
- package/lib/utils.d.ts +0 -2
- package/lib/utils.d.ts.map +0 -1
- package/lib/utils.js +0 -7
- package/lib/utils.js.map +0 -1
- package/templates/tool/.env.example +0 -6
- package/templates/tool/.vscode/launch.json +0 -24
- package/templates/tool/README.md +0 -190
- package/templates/tool/api/index.ts +0 -8
- package/templates/tool/gitignore +0 -26
- package/templates/tool/rollup.config.js +0 -30
- package/templates/tool/src/collections/example/icon.svg.ts +0 -6
- package/templates/tool/src/collections/example/index.ts +0 -14
- package/templates/tool/src/collections/example/weather/WeatherTool.ts +0 -32
- package/templates/tool/src/collections/example/weather/manifest.ts +0 -16
- package/templates/tool/src/collections/index.ts +0 -7
- package/templates/tool/src/index.ts +0 -5
- package/templates/tool/src/server.ts +0 -71
- package/templates/tool/tsconfig.json +0 -24
- package/templates/tool/vite.config.js +0 -48
- package/templates/web/README.md +0 -156
- package/templates/web/eslint.config.js +0 -29
- package/templates/web/gitignore +0 -25
- package/templates/web/index.html.tmpl +0 -26
- package/templates/web/src/app.tsx +0 -8
- package/templates/web/src/assets.ts +0 -26
- package/templates/web/src/env.ts.tmpl +0 -14
- package/templates/web/src/index.css +0 -21
- package/templates/web/src/main.tsx.tmpl +0 -21
- package/templates/web/src/pages.tsx +0 -31
- package/templates/web/src/plugin.tsx.tmpl +0 -18
- package/templates/web/src/routes.tsx +0 -17
- package/templates/web/src/vite-env.d.ts +0 -1
- package/templates/web/tsconfig.app.json +0 -51
- package/templates/web/tsconfig.json +0 -7
- package/templates/web/tsconfig.node.json +0 -27
- package/templates/web/vite.config.ts.tmpl +0 -128
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { ToolCollection } from "@vertesia/tools-sdk";
|
|
2
|
-
import { Context, Hono } from "hono";
|
|
3
|
-
import { cors } from "hono/cors";
|
|
4
|
-
import { collections } from "./collections/index.js";
|
|
5
|
-
import { HTTPException } from "hono/http-exception";
|
|
6
|
-
|
|
7
|
-
function createServer(collections: ToolCollection[], prefix = '/api') {
|
|
8
|
-
prefix = prefix.trim();
|
|
9
|
-
const app = new Hono();
|
|
10
|
-
|
|
11
|
-
// Add CORS middleware globally
|
|
12
|
-
app.use('*', cors({ origin: '*', allowMethods: ['GET', 'POST', 'OPTIONS'] }));
|
|
13
|
-
|
|
14
|
-
// Add base API route
|
|
15
|
-
app.get(prefix, (c) => {
|
|
16
|
-
return c.json({
|
|
17
|
-
message: 'Tool Collections API',
|
|
18
|
-
version: '1.0.0',
|
|
19
|
-
endpoints: {
|
|
20
|
-
collections: collections.map(col => `${prefix}/${col.name}`)
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// Create endpoints for tool collections
|
|
26
|
-
for (const col of collections) {
|
|
27
|
-
app.route(`${prefix}/${col.name}`, createCollectionEndpoints(col));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Global error handler
|
|
31
|
-
app.onError((err, c) => {
|
|
32
|
-
if (err instanceof HTTPException) {
|
|
33
|
-
return c.json({
|
|
34
|
-
error: err.message,
|
|
35
|
-
}, err.status);
|
|
36
|
-
}
|
|
37
|
-
console.error('Uncaught Error:', err);
|
|
38
|
-
return c.json({
|
|
39
|
-
error: 'Internal Server Error',
|
|
40
|
-
}, 500)
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
return app;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const server = createServer(collections);
|
|
47
|
-
|
|
48
|
-
export default server;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Create endpoints for a tool collection
|
|
52
|
-
*/
|
|
53
|
-
function createCollectionEndpoints(coll: ToolCollection) {
|
|
54
|
-
const endpoint = new Hono();
|
|
55
|
-
|
|
56
|
-
// POST endpoint to execute tools
|
|
57
|
-
endpoint.post('/', (c: Context) => {
|
|
58
|
-
return coll.execute(c);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
// GET endpoint to retrieve collection metadata and tool definitions
|
|
62
|
-
endpoint.get('/', (c) => {
|
|
63
|
-
return c.json({
|
|
64
|
-
title: coll.title || coll.name,
|
|
65
|
-
description: coll.description,
|
|
66
|
-
tools: coll.getToolDefinitions()
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
return endpoint;
|
|
71
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "Bundler",
|
|
6
|
-
"esModuleInterop": true,
|
|
7
|
-
"strict": true,
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
"resolveJsonModule": true,
|
|
10
|
-
"allowSyntheticDefaultImports": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"noUnusedLocals": true,
|
|
13
|
-
"noUnusedParameters": true,
|
|
14
|
-
"noImplicitReturns": true,
|
|
15
|
-
"outDir": "dist"
|
|
16
|
-
},
|
|
17
|
-
"include": [
|
|
18
|
-
"src/**/*"
|
|
19
|
-
],
|
|
20
|
-
"exclude": [
|
|
21
|
-
"node_modules",
|
|
22
|
-
"dist"
|
|
23
|
-
]
|
|
24
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import devServer from '@hono/vite-dev-server';
|
|
2
|
-
import { defineConfig, loadEnv } from 'vite';
|
|
3
|
-
|
|
4
|
-
export default defineConfig(({ mode }) => {
|
|
5
|
-
// Load env files
|
|
6
|
-
const env = loadEnv(mode, process.cwd(), '');
|
|
7
|
-
|
|
8
|
-
// Dev config
|
|
9
|
-
if (mode === 'development') {
|
|
10
|
-
return {
|
|
11
|
-
plugins: [
|
|
12
|
-
devServer({
|
|
13
|
-
prefix: '/api', // mount the tool endpoints under /api
|
|
14
|
-
entry: './src/server.ts',
|
|
15
|
-
}),
|
|
16
|
-
],
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Build config
|
|
21
|
-
return {
|
|
22
|
-
build: {
|
|
23
|
-
minify: false,
|
|
24
|
-
lib: {
|
|
25
|
-
entry: {
|
|
26
|
-
server: './src/server.ts',
|
|
27
|
-
},
|
|
28
|
-
formats: ['es']
|
|
29
|
-
},
|
|
30
|
-
rollupOptions: {
|
|
31
|
-
external: (id) => {
|
|
32
|
-
// Keep relative imports as part of the bundle
|
|
33
|
-
if (id.startsWith('.') || id.startsWith('/')) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
// Externalize all node modules and absolute imports
|
|
37
|
-
return true;
|
|
38
|
-
},
|
|
39
|
-
output: {
|
|
40
|
-
preserveModules: true,
|
|
41
|
-
preserveModulesRoot: 'src',
|
|
42
|
-
entryFileNames: '[name].js'
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
outDir: 'dist'
|
|
46
|
-
},
|
|
47
|
-
}
|
|
48
|
-
});
|
package/templates/web/README.md
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
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.
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import js from '@eslint/js'
|
|
2
|
-
import globals from 'globals'
|
|
3
|
-
import reactHooks from 'eslint-plugin-react-hooks'
|
|
4
|
-
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
5
|
-
import tseslint from 'typescript-eslint'
|
|
6
|
-
import { defineConfig } from 'eslint/config';
|
|
7
|
-
|
|
8
|
-
export default defineConfig(
|
|
9
|
-
{ ignores: ['dist'] },
|
|
10
|
-
{
|
|
11
|
-
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
|
12
|
-
files: ['**/*.{ts,tsx}'],
|
|
13
|
-
languageOptions: {
|
|
14
|
-
ecmaVersion: 2020,
|
|
15
|
-
globals: globals.browser,
|
|
16
|
-
},
|
|
17
|
-
plugins: {
|
|
18
|
-
'react-hooks': reactHooks,
|
|
19
|
-
'react-refresh': reactRefresh,
|
|
20
|
-
},
|
|
21
|
-
rules: {
|
|
22
|
-
...reactHooks.configs.recommended.rules,
|
|
23
|
-
'react-refresh/only-export-components': [
|
|
24
|
-
'warn',
|
|
25
|
-
{ allowConstantExport: true },
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
)
|
package/templates/web/gitignore
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# Logs
|
|
2
|
-
logs
|
|
3
|
-
*.log
|
|
4
|
-
npm-debug.log*
|
|
5
|
-
yarn-debug.log*
|
|
6
|
-
yarn-error.log*
|
|
7
|
-
pnpm-debug.log*
|
|
8
|
-
lerna-debug.log*
|
|
9
|
-
|
|
10
|
-
node_modules
|
|
11
|
-
dist
|
|
12
|
-
dist-ssr
|
|
13
|
-
lib
|
|
14
|
-
*.local
|
|
15
|
-
|
|
16
|
-
# Editor directories and files
|
|
17
|
-
.vscode/*
|
|
18
|
-
!.vscode/extensions.json
|
|
19
|
-
.idea
|
|
20
|
-
.DS_Store
|
|
21
|
-
*.suo
|
|
22
|
-
*.ntvs*
|
|
23
|
-
*.njsproj
|
|
24
|
-
*.sln
|
|
25
|
-
*.sw?
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8" />
|
|
6
|
-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
7
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
8
|
-
<title>${plugin_title}</title>
|
|
9
|
-
<script type="importmap">
|
|
10
|
-
{
|
|
11
|
-
"imports": {
|
|
12
|
-
"react": "https://esm.sh/react@19.0.0",
|
|
13
|
-
"react-dom": "https://esm.sh/react-dom@19.0.0",
|
|
14
|
-
"react-dom/client": "https://esm.sh/react-dom@19.0.0/client",
|
|
15
|
-
"react/jsx-runtime": "https://esm.sh/react@19.0.0/jsx-runtime"
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
</script>
|
|
19
|
-
</head>
|
|
20
|
-
|
|
21
|
-
<body>
|
|
22
|
-
<div id="root"></div>
|
|
23
|
-
<script type="module" src="/src/main.tsx"></script>
|
|
24
|
-
</body>
|
|
25
|
-
|
|
26
|
-
</html>
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
let _usePluginAssets = true;
|
|
3
|
-
|
|
4
|
-
export function setUsePluginAssets(usePluginAssets: boolean) {
|
|
5
|
-
_usePluginAssets = usePluginAssets
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Correctly resolve the URL to an asset so that it works in dev mode but also in prod as a standalone app or plugin.
|
|
10
|
-
* Assets must be put inside /public/assets folder so the given `path` will be resolved as /assets/path in the right context
|
|
11
|
-
* @param path
|
|
12
|
-
*/
|
|
13
|
-
export function useAsset(path: string) {
|
|
14
|
-
if (path.startsWith('/')) {
|
|
15
|
-
path = path.substring(1);
|
|
16
|
-
} else if (path.startsWith('./')) {
|
|
17
|
-
path = path.substring(2);
|
|
18
|
-
}
|
|
19
|
-
if (_usePluginAssets) {
|
|
20
|
-
// the plugin.js file is in lib/ directory and we need to serve from assets/ directory
|
|
21
|
-
path = `../assets/${path}`;
|
|
22
|
-
return new URL(path, import.meta.url).href;
|
|
23
|
-
} else {
|
|
24
|
-
return `/assets/${path}`;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Env } from "@vertesia/ui/env";
|
|
2
|
-
|
|
3
|
-
Env.init({
|
|
4
|
-
name: "${plugin_title}",
|
|
5
|
-
version: "1.0.0",
|
|
6
|
-
isLocalDev: true,
|
|
7
|
-
isDocker: true,
|
|
8
|
-
type: "development",
|
|
9
|
-
endpoints: {
|
|
10
|
-
studio: "https://api.vertesia.io",
|
|
11
|
-
zeno: "https://api.vertesia.io",
|
|
12
|
-
sts: "https://sts.vertesia.io",
|
|
13
|
-
}
|
|
14
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
@import "tailwindcss";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The login form use this for inputs
|
|
5
|
-
*/
|
|
6
|
-
@plugin '@tailwindcss/forms';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Scan typescript sources
|
|
10
|
-
*/
|
|
11
|
-
@source "./";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Scan the index.html for tailwind CSS
|
|
15
|
-
*/
|
|
16
|
-
@source "../index.html";
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Scan @vertesia/ui dependency for tailwind classes
|
|
20
|
-
*/
|
|
21
|
-
@source "../node_modules/@vertesia/ui/src";
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { StandaloneApp, VertesiaShell } from '@vertesia/ui/shell'
|
|
2
|
-
import { StrictMode } from 'react'
|
|
3
|
-
import { createRoot } from 'react-dom/client'
|
|
4
|
-
import './index.css'
|
|
5
|
-
// initialize dev environment
|
|
6
|
-
import { RouterProvider } from '@vertesia/ui/router'
|
|
7
|
-
import { App } from './app'
|
|
8
|
-
import "./env"
|
|
9
|
-
import { setUsePluginAssets } from './assets'
|
|
10
|
-
|
|
11
|
-
setUsePluginAssets(false);
|
|
12
|
-
|
|
13
|
-
createRoot(document.getElementById('root')!).render(
|
|
14
|
-
<StrictMode>
|
|
15
|
-
<VertesiaShell>
|
|
16
|
-
<StandaloneApp name={import.meta.env.VITE_APP_NAME}> {/* <---- define VITE_APP_NAME en var in .env.local */}
|
|
17
|
-
<RouterProvider routes={[{ path: "*", Component: App }]} />
|
|
18
|
-
</StandaloneApp>
|
|
19
|
-
</VertesiaShell>
|
|
20
|
-
</StrictMode>,
|
|
21
|
-
)
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { useNavigate } from "@vertesia/ui/router";
|
|
2
|
-
import { useUserSession } from "@vertesia/ui/session";
|
|
3
|
-
import type { ReactNode } from "react";
|
|
4
|
-
|
|
5
|
-
export function HomePage() {
|
|
6
|
-
const { user } = useUserSession();
|
|
7
|
-
return (
|
|
8
|
-
<div className='p-4'>
|
|
9
|
-
<h1 className='pb-4'>Hello {user?.email}!</h1>
|
|
10
|
-
<NavButton href='/next'>Go to next page</NavButton>
|
|
11
|
-
</div>
|
|
12
|
-
)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function NextPage() {
|
|
16
|
-
return (
|
|
17
|
-
<div className='p-4'>
|
|
18
|
-
<h1 className='pb-4'>Hello again!</h1>
|
|
19
|
-
<NavButton href='/'>Go to previous page</NavButton>
|
|
20
|
-
</div>
|
|
21
|
-
)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function NavButton({ href, children }: { href: string, children: ReactNode }) {
|
|
25
|
-
const navigate = useNavigate();
|
|
26
|
-
return (
|
|
27
|
-
<button className="bg-blue-500 text-white px-4 py-2 rounded cursor-pointer" onClick={() => navigate(href)}>
|
|
28
|
-
{children}
|
|
29
|
-
</button>
|
|
30
|
-
)
|
|
31
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { PortalContainerProvider } from "@vertesia/ui/core";
|
|
2
|
-
import { App } from "./app";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Export the plugin component.
|
|
6
|
-
*/
|
|
7
|
-
export default function ${ PluginComponent } ({ slot }: { slot: string }) {
|
|
8
|
-
if (slot === "page") {
|
|
9
|
-
return (
|
|
10
|
-
<PortalContainerProvider>
|
|
11
|
-
<App />
|
|
12
|
-
</PortalContainerProvider>
|
|
13
|
-
);
|
|
14
|
-
} else {
|
|
15
|
-
console.warn('No component found for slot', slot);
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { HomePage, NextPage } from "./pages";
|
|
2
|
-
|
|
3
|
-
export const routes = [
|
|
4
|
-
{
|
|
5
|
-
path: '/',
|
|
6
|
-
Component: HomePage,
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
path: '/next',
|
|
10
|
-
Component: NextPage,
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
path: '*',
|
|
14
|
-
Component: () => <div className="text-red-800 p-4">Not found</div>,
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
4
|
-
"target": "ES2020",
|
|
5
|
-
"useDefineForClassFields": true,
|
|
6
|
-
"lib": [
|
|
7
|
-
"ES2020",
|
|
8
|
-
"DOM",
|
|
9
|
-
"DOM.Iterable"
|
|
10
|
-
],
|
|
11
|
-
"module": "ESNext",
|
|
12
|
-
"skipLibCheck": true,
|
|
13
|
-
/* Bundler mode */
|
|
14
|
-
"moduleResolution": "bundler",
|
|
15
|
-
"allowImportingTsExtensions": true,
|
|
16
|
-
"verbatimModuleSyntax": true,
|
|
17
|
-
"moduleDetection": "force",
|
|
18
|
-
"noEmit": true,
|
|
19
|
-
"jsx": "react-jsx",
|
|
20
|
-
"baseUrl": ".",
|
|
21
|
-
"paths": {
|
|
22
|
-
"@vertesia/common": [
|
|
23
|
-
"./node_modules/@vertesia/common/src/index.ts"
|
|
24
|
-
],
|
|
25
|
-
"@vertesia/client": [
|
|
26
|
-
"./node_modules/@vertesia/client/src/index.ts",
|
|
27
|
-
],
|
|
28
|
-
"@vertesia/ui/*": [
|
|
29
|
-
"./node_modules/@vertesia/ui/src/*"
|
|
30
|
-
]
|
|
31
|
-
},
|
|
32
|
-
/* Linting */
|
|
33
|
-
"strict": true,
|
|
34
|
-
"noUnusedLocals": true,
|
|
35
|
-
"noUnusedParameters": true,
|
|
36
|
-
"erasableSyntaxOnly": false,
|
|
37
|
-
"noFallthroughCasesInSwitch": true,
|
|
38
|
-
"noUncheckedSideEffectImports": true
|
|
39
|
-
},
|
|
40
|
-
"include": [
|
|
41
|
-
"src"
|
|
42
|
-
],
|
|
43
|
-
"references": [
|
|
44
|
-
{
|
|
45
|
-
"path": "./node_modules/@vertesia/common/tsconfig.dist.json"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"path": "./node_modules/@vertesia/ui/tsconfig.dist.json"
|
|
49
|
-
}
|
|
50
|
-
]
|
|
51
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
-
"target": "ES2022",
|
|
5
|
-
"lib": [
|
|
6
|
-
"ES2023"
|
|
7
|
-
],
|
|
8
|
-
"module": "ESNext",
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
/* Bundler mode */
|
|
11
|
-
"moduleResolution": "bundler",
|
|
12
|
-
"allowImportingTsExtensions": true,
|
|
13
|
-
"verbatimModuleSyntax": true,
|
|
14
|
-
"moduleDetection": "force",
|
|
15
|
-
"noEmit": true,
|
|
16
|
-
/* Linting */
|
|
17
|
-
"strict": true,
|
|
18
|
-
"noUnusedLocals": true,
|
|
19
|
-
"noUnusedParameters": true,
|
|
20
|
-
"erasableSyntaxOnly": false,
|
|
21
|
-
"noFallthroughCasesInSwitch": true,
|
|
22
|
-
"noUncheckedSideEffectImports": true
|
|
23
|
-
},
|
|
24
|
-
"include": [
|
|
25
|
-
"vite.config.ts"
|
|
26
|
-
]
|
|
27
|
-
}
|