@vertesia/create-plugin 0.80.0-dev.20251121 → 0.81.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.
Files changed (123) hide show
  1. package/README.md +123 -66
  2. package/lib/configuration.d.ts +63 -0
  3. package/lib/configuration.d.ts.map +1 -0
  4. package/lib/configuration.js +72 -0
  5. package/lib/configuration.js.map +1 -0
  6. package/lib/download-template.d.ts +5 -0
  7. package/lib/download-template.d.ts.map +1 -0
  8. package/lib/download-template.js +33 -0
  9. package/lib/download-template.js.map +1 -0
  10. package/lib/index.d.ts +9 -0
  11. package/lib/index.d.ts.map +1 -0
  12. package/lib/index.js +182 -0
  13. package/lib/index.js.map +1 -0
  14. package/lib/package-manager.d.ts +11 -0
  15. package/lib/package-manager.d.ts.map +1 -0
  16. package/lib/package-manager.js +83 -0
  17. package/lib/package-manager.js.map +1 -0
  18. package/lib/post-install.d.ts +11 -0
  19. package/lib/post-install.d.ts.map +1 -0
  20. package/lib/post-install.js +144 -0
  21. package/lib/post-install.js.map +1 -0
  22. package/lib/process-template.d.ts +30 -0
  23. package/lib/process-template.d.ts.map +1 -0
  24. package/lib/process-template.js +233 -0
  25. package/lib/process-template.js.map +1 -0
  26. package/lib/prompts.d.ts +6 -0
  27. package/lib/prompts.d.ts.map +1 -0
  28. package/lib/prompts.js +97 -0
  29. package/lib/prompts.js.map +1 -0
  30. package/lib/template-config.d.ts +139 -0
  31. package/lib/template-config.d.ts.map +1 -0
  32. package/lib/template-config.js +23 -0
  33. package/lib/template-config.js.map +1 -0
  34. package/lib/template-selector.d.ts +7 -0
  35. package/lib/template-selector.d.ts.map +1 -0
  36. package/lib/template-selector.js +56 -0
  37. package/lib/template-selector.js.map +1 -0
  38. package/lib/transforms.d.ts +37 -0
  39. package/lib/transforms.d.ts.map +1 -0
  40. package/lib/transforms.js +87 -0
  41. package/lib/transforms.js.map +1 -0
  42. package/package.json +22 -32
  43. package/bin/create-plugin.mjs +0 -2
  44. package/lib/Package.d.ts +0 -42
  45. package/lib/Package.d.ts.map +0 -1
  46. package/lib/Package.js +0 -52
  47. package/lib/Package.js.map +0 -1
  48. package/lib/TemplateInit.d.ts +0 -30
  49. package/lib/TemplateInit.d.ts.map +0 -1
  50. package/lib/TemplateInit.js +0 -48
  51. package/lib/TemplateInit.js.map +0 -1
  52. package/lib/ToolTemplateInit.d.ts +0 -10
  53. package/lib/ToolTemplateInit.d.ts.map +0 -1
  54. package/lib/ToolTemplateInit.js +0 -58
  55. package/lib/ToolTemplateInit.js.map +0 -1
  56. package/lib/WebTemplateInit.d.ts +0 -10
  57. package/lib/WebTemplateInit.d.ts.map +0 -1
  58. package/lib/WebTemplateInit.js +0 -68
  59. package/lib/WebTemplateInit.js.map +0 -1
  60. package/lib/copy.d.ts +0 -12
  61. package/lib/copy.d.ts.map +0 -1
  62. package/lib/copy.js +0 -45
  63. package/lib/copy.js.map +0 -1
  64. package/lib/deps.d.ts +0 -3
  65. package/lib/deps.d.ts.map +0 -1
  66. package/lib/deps.js +0 -20
  67. package/lib/deps.js.map +0 -1
  68. package/lib/hasBin.d.ts +0 -2
  69. package/lib/hasBin.d.ts.map +0 -1
  70. package/lib/hasBin.js +0 -14
  71. package/lib/hasBin.js.map +0 -1
  72. package/lib/init.d.ts +0 -2
  73. package/lib/init.d.ts.map +0 -1
  74. package/lib/init.js +0 -124
  75. package/lib/init.js.map +0 -1
  76. package/lib/main.d.ts +0 -2
  77. package/lib/main.d.ts.map +0 -1
  78. package/lib/main.js +0 -8
  79. package/lib/main.js.map +0 -1
  80. package/lib/template.d.ts +0 -4
  81. package/lib/template.d.ts.map +0 -1
  82. package/lib/template.js +0 -16
  83. package/lib/template.js.map +0 -1
  84. package/lib/types.d.ts +0 -12
  85. package/lib/types.d.ts.map +0 -1
  86. package/lib/types.js +0 -20
  87. package/lib/types.js.map +0 -1
  88. package/lib/utils.d.ts +0 -2
  89. package/lib/utils.d.ts.map +0 -1
  90. package/lib/utils.js +0 -7
  91. package/lib/utils.js.map +0 -1
  92. package/templates/tool/.env.example +0 -6
  93. package/templates/tool/.vscode/launch.json +0 -24
  94. package/templates/tool/README.md +0 -190
  95. package/templates/tool/api/index.ts +0 -8
  96. package/templates/tool/gitignore +0 -26
  97. package/templates/tool/rollup.config.js +0 -30
  98. package/templates/tool/src/collections/example/icon.svg.ts +0 -6
  99. package/templates/tool/src/collections/example/index.ts +0 -14
  100. package/templates/tool/src/collections/example/weather/WeatherTool.ts +0 -32
  101. package/templates/tool/src/collections/example/weather/manifest.ts +0 -16
  102. package/templates/tool/src/collections/index.ts +0 -7
  103. package/templates/tool/src/index.ts +0 -5
  104. package/templates/tool/src/server.ts +0 -71
  105. package/templates/tool/tsconfig.json +0 -24
  106. package/templates/tool/vite.config.js +0 -48
  107. package/templates/web/README.md +0 -156
  108. package/templates/web/eslint.config.js +0 -29
  109. package/templates/web/gitignore +0 -25
  110. package/templates/web/index.html.tmpl +0 -26
  111. package/templates/web/src/app.tsx +0 -8
  112. package/templates/web/src/assets.ts +0 -26
  113. package/templates/web/src/env.ts.tmpl +0 -14
  114. package/templates/web/src/index.css +0 -21
  115. package/templates/web/src/main.tsx.tmpl +0 -21
  116. package/templates/web/src/pages.tsx +0 -31
  117. package/templates/web/src/plugin.tsx.tmpl +0 -18
  118. package/templates/web/src/routes.tsx +0 -17
  119. package/templates/web/src/vite-env.d.ts +0 -1
  120. package/templates/web/tsconfig.app.json +0 -51
  121. package/templates/web/tsconfig.json +0 -7
  122. package/templates/web/tsconfig.node.json +0 -27
  123. package/templates/web/vite.config.ts.tmpl +0 -128
@@ -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,8 +0,0 @@
1
- import { NestedRouterProvider } from "@vertesia/ui/router";
2
- import { routes } from "./routes";
3
-
4
- export function App() {
5
- return (
6
- <NestedRouterProvider routes={routes} />
7
- )
8
- }
@@ -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,7 +0,0 @@
1
- {
2
- "files": [],
3
- "references": [
4
- { "path": "./tsconfig.app.json" },
5
- { "path": "./tsconfig.node.json" }
6
- ]
7
- }
@@ -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
- }
@@ -1,128 +0,0 @@
1
- import tailwindcss from '@tailwindcss/vite';
2
- import { vertesiaPluginBuilder } from '@vertesia/plugin-builder';
3
- import basicSsl from '@vitejs/plugin-basic-ssl';
4
- import react from '@vitejs/plugin-react';
5
- import { defineConfig, type ConfigEnv, type UserConfig } from 'vite';
6
- import serveStatic from "vite-plugin-serve-static";
7
-
8
-
9
- /**
10
- * List of dependencies that must be bundled in the plugin bundle
11
- */
12
- const INTERNALS: (string | RegExp)[] = [
13
- ];
14
-
15
- function isExternal(id: string) {
16
- // If it matches INTERNALS → bundle it
17
- if (INTERNALS.some(pattern =>
18
- pattern instanceof RegExp ? pattern.test(id) : id === pattern
19
- )) {
20
- return false;
21
- }
22
-
23
- // Otherwise → treat all bare imports (node_modules deps) as external
24
- return !id.startsWith('.') && !id.startsWith('/') && !id.startsWith('@/') && !id.startsWith('virtual:');
25
- }
26
-
27
-
28
- /**
29
- * if you want to debug vertesia ui sources define a relative path to the vertesia ui package root
30
- */
31
- const VERTESIA_UI_PATH = ""
32
-
33
- /**
34
- * Set to true to extract the css utility layer and inject it in the plugin js file.
35
- * If you use shadow dom isolation for the plugin you must set this to false.
36
- */
37
- const inlineCss = ${ inlineCss };
38
-
39
- /**
40
- * Vite configuration to build the plugin as a library or as a standalone application or to run the application in dev mode.
41
- * Use `vite build --mode lib` to build a library (plugin)
42
- * Use `vite build` or `vite build --mode app`to build a standalone application
43
- * Use `vite dev` to run the application in dev mode.
44
- */
45
- export default defineConfig((env) => {
46
- if (env.mode === 'lib') {
47
- return defineLibConfig(env);
48
- } else {
49
- return defineAppConfig();
50
- }
51
- })
52
-
53
- /**
54
- * Vite configuration to build a library (plugin).
55
- * @param env - Vite configuration environment
56
- * @returns
57
- */
58
- function defineLibConfig({ command }: ConfigEnv): UserConfig {
59
- const isBuildMode = command === 'build';
60
- if (!isBuildMode) {
61
- throw new Error("Library config is only available in 'build' mode. Please use 'lib' mode for library builds.");
62
- }
63
- return {
64
- plugins: [
65
- tailwindcss(),
66
- react(),
67
- vertesiaPluginBuilder({ inlineCss })
68
- ],
69
- build: {
70
- outDir: 'dist/lib', // the plugin will be generated in the `dist/lib` directory
71
- lib: {
72
- entry: './src/plugin.tsx', // Main entry point of your library
73
- formats: ['es'], // Build ESM versions
74
- fileName: "plugin",
75
- },
76
- minify: true,
77
- sourcemap: true,
78
- rollupOptions: {
79
- external: isExternal,
80
- }
81
- }
82
- }
83
- }
84
-
85
- /**
86
- * Vite configuration to run the application in dev mode
87
- * or to build a standalone application.
88
- * @returns
89
- */
90
- function defineAppConfig(): UserConfig {
91
-
92
- return {
93
- plugins: [
94
- tailwindcss(),
95
- react(),
96
- // we need to use https for the firebase authentication to work
97
- basicSsl(),
98
- // serve lib/plugin.js content in dev mode
99
- serveStatic([
100
- {
101
- pattern: new RegExp("/plugin.(js|css)"),
102
- resolve: (groups: string[]) => `./dist/lib/plugin.${groups[1]}`
103
- },
104
- ]),
105
- ],
106
- // for authentication with Firebase
107
- server: {
108
- proxy: {
109
- '/__/auth': {
110
- target: 'https://dengenlabs.firebaseapp.com',
111
- changeOrigin: true,
112
- }
113
- }
114
- },
115
- resolve: {
116
- // For debug support in vertesia ui sources - link to the vertesia/ui location
117
- alias: VERTESIA_UI_PATH ? {
118
- "@vertesia/ui": resolve(`${VERTESIA_UI_PATH}/src`)
119
- } : undefined,
120
- // Deduplicate React to prevent multiple instances
121
- dedupe: ['react', 'react-dom']
122
- }
123
- }
124
- }
125
-
126
- function resolve(path: string) {
127
- return new URL(path, import.meta.url).pathname
128
- }