@vertesia/create-plugin 0.67.0 → 0.68.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.
@@ -1 +1 @@
1
- {"version":3,"file":"WebTemplateInit.d.ts","sourceRoot":"","sources":["../src/WebTemplateInit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG9D,qBAAa,eAAgB,SAAQ,YAAY;gBACjC,OAAO,EAAE,WAAW;IAIhC,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAO9B,cAAc,IAAI,WAAW;IAgC7B,kBAAkB,IAAI,MAAM,EAAE;IAuB9B,sBAAsB,IAAI,MAAM,EAAE;CAOrC"}
1
+ {"version":3,"file":"WebTemplateInit.d.ts","sourceRoot":"","sources":["../src/WebTemplateInit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG9D,qBAAa,eAAgB,SAAQ,YAAY;gBACjC,OAAO,EAAE,WAAW;IAIhC,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAO9B,cAAc,IAAI,WAAW;IAkC7B,kBAAkB,IAAI,MAAM,EAAE;IAuB9B,sBAAsB,IAAI,MAAM,EAAE;CAOrC"}
@@ -23,8 +23,10 @@ export class WebTemplateInit extends TemplateInit {
23
23
  "dist"
24
24
  ],
25
25
  scripts: {
26
- "dev": "vite",
27
- "build": "vite build",
26
+ "dev": "vite dev",
27
+ "build:app": "vite build --mode app",
28
+ "build:lib": "vite build --mode lib",
29
+ "build": "vite build --mode app && vite build --mode lib",
28
30
  "lint": "eslint .",
29
31
  "preview": "vite preview"
30
32
  },
@@ -42,13 +44,14 @@ export class WebTemplateInit extends TemplateInit {
42
44
  }
43
45
  getDevDependencies() {
44
46
  return [
45
- "@vertesia/plugin-builder",
46
47
  "@eslint/js",
48
+ "@vertesia/plugin-builder",
49
+ "@vitejs/plugin-basic-ssl",
50
+ "@vitejs/plugin-react",
47
51
  "@tailwindcss/vite",
48
52
  "@types/node",
49
53
  "@types/react",
50
54
  "@types/react-dom",
51
- "@vitejs/plugin-react",
52
55
  "eslint",
53
56
  "eslint-plugin-react-hooks",
54
57
  "eslint-plugin-react-refresh",
@@ -59,7 +62,6 @@ export class WebTemplateInit extends TemplateInit {
59
62
  "typescript",
60
63
  "typescript-eslint",
61
64
  "vite",
62
- "vite-plugin-dts",
63
65
  ];
64
66
  }
65
67
  getRuntimeDependencies() {
@@ -1 +1 @@
1
- {"version":3,"file":"WebTemplateInit.js","sourceRoot":"","sources":["../src/WebTemplateInit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAe,MAAM,mBAAmB,CAAC;AAG9D,MAAM,OAAO,eAAgB,SAAQ,YAAY;IAC7C,YAAY,OAAoB;QAC5B,KAAK,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IAED,OAAO;QACH,OAAO;YACH,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;YACnC,eAAe,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,GAAG,QAAQ;SACzD,CAAA;IACL,CAAC;IAED,cAAc;QACV,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,OAAO;YACH,IAAI,EAAE,MAAM,CAAC,WAAW;YACxB,OAAO,EAAE,MAAM,CAAC,cAAc,IAAI,OAAO;YACzC,WAAW,EAAE,MAAM,CAAC,kBAAkB,IAAI,EAAE;YAC5C,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ,MAAM,CAAC,WAAW,KAAK;YACrC,MAAM,EAAE,QAAQ,MAAM,CAAC,WAAW,KAAK;YACvC,KAAK,EAAE,iBAAiB;YACxB,KAAK,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
- "version": "0.67.0",
3
+ "version": "0.68.0",
4
4
  "description": "Initialize a Vertesia plugin package",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,20 @@
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: false,
8
+ type: "development",
9
+ endpoints: {
10
+ studio: "http://127.0.0.1:8091",
11
+ zeno: "http://127.0.0.1:8092",
12
+ },
13
+ firebase: {
14
+ apiKey: import.meta.env.VITE_FIREBASE_API_KEY,
15
+ authDomain: window.location.host,
16
+ projectId: "dengenlabs",
17
+ appId: "1:265888598630:web:6e5e76c8ecde887e5afba7"
18
+ },
19
+ datadog: false,
20
+ });
@@ -1,10 +1,18 @@
1
+ import { VertesiaShell } from '@vertesia/ui/shell'
1
2
  import { StrictMode } from 'react'
2
3
  import { createRoot } from 'react-dom/client'
3
- import ${ PluginComponent } from './index.tsx'
4
4
  import './index.css'
5
+ import ${ PluginComponent } from './plugin'
6
+ // initialize dev environment
7
+ import { RouterProvider } from '@vertesia/ui/router'
8
+ import "./env"
5
9
 
6
10
  createRoot(document.getElementById('root')!).render(
7
11
  <StrictMode>
8
- <${PluginComponent} slot="page" />
12
+ <VertesiaShell>
13
+ <RouterProvider routes={[]}>
14
+ <${ PluginComponent} slot="page" />
15
+ </RouterProvider>
16
+ </VertesiaShell>
9
17
  </StrictMode>,
10
18
  )
@@ -1,47 +1,92 @@
1
1
  import tailwindcss from '@tailwindcss/vite';
2
- import react from '@vitejs/plugin-react';
3
- import { defineConfig } from 'vite';
4
- import dts from 'vite-plugin-dts'; // Generates TypeScript declarations
5
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
6
 
7
+ /**
8
+ * List of external dependencies that should not be bundled when
9
+ * buildiong the plugin library
10
+ */
7
11
  const EXTERNALS = [
8
- 'react',
9
- 'react-dom',
10
- 'react/jsx-runtime',
11
- 'react-dom/client',
12
- '@vertesia/ui',
13
- /^@vertesia\/ui\/.*/,
14
- // add any other external dependencies here
12
+ 'react',
13
+ 'react-dom',
14
+ 'react/jsx-runtime',
15
+ 'react-dom/client',
16
+ '@vertesia/common',
17
+ '@vertesia/ui',
18
+ /^@vertesia\/ui\/.*/,
19
+ // add any other external dependencies here
15
20
  ];
16
21
 
17
- // https://vite.dev/config/
18
- export default defineConfig(({ command }) => {
19
- // Check if we're running "vite build"
20
- const isBuildMode = command === 'build';
21
-
22
- return {
23
- plugins: [
24
- tailwindcss(),
25
- react(),
26
- dts({
27
- rollupTypes: true,
28
- tsconfigPath: './tsconfig.app.json',
29
- logLevel: 'info'
30
- }),
31
- vertesiaPluginBuilder(),
32
- ],
33
- optimizeDeps: isBuildMode ? {
34
- } : undefined,
35
- build: {
36
- lib: isBuildMode ? {
37
- entry: './src/index.tsx', // Main entry point of your library
38
- formats: ['es'], // Build ESM versions
39
- fileName: "plugin",
40
- } : undefined,
41
- minify: false,
42
- rollupOptions: {
43
- external: isBuildMode ? EXTERNALS : [],
44
- }
22
+ /**
23
+ * Vite configuration to build the plugin as a library or as a standalone application or to run the application in dev mode.
24
+ * Use `vite build --mode lib` to build a library (plugin)
25
+ * Use `vite build` or `vite build --mode app`to build a standalone application
26
+ * Use `vite dev` to run the applicaiton in dev mode.
27
+ */
28
+ export default defineConfig((env) => {
29
+ if (env.mode === 'lib') {
30
+ return defineLibConfig(env);
31
+ } else {
32
+ return defineAppConfig();
45
33
  }
46
- }
47
34
  })
35
+
36
+ /**
37
+ * Vite configuration to build a library (plugin).
38
+ * @param env - Vite configuration environment
39
+ * @returns
40
+ */
41
+ function defineLibConfig({ command }: ConfigEnv): UserConfig {
42
+ const isBuildMode = command === 'build';
43
+ if (!isBuildMode) {
44
+ throw new Error("Library config is only available in 'build' mode. Please use 'lib' mode for library builds.");
45
+ }
46
+ return {
47
+ plugins: [
48
+ tailwindcss(),
49
+ react(),
50
+ vertesiaPluginBuilder(),
51
+ ],
52
+ build: {
53
+ outDir: 'lib', // the plugin will be generated in the `lib` directory
54
+ lib: {
55
+ entry: './src/plugin.tsx', // Main entry point of your library
56
+ formats: ['es'], // Build ESM versions
57
+ fileName: "plugin",
58
+ },
59
+ minify: true,
60
+ sourcemap: true,
61
+ rollupOptions: {
62
+ external: EXTERNALS,
63
+ }
64
+ }
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Vite configuration to run the applicaiton in dev mode
70
+ * or to build a standalone application.
71
+ * @returns
72
+ */
73
+ function defineAppConfig(): UserConfig {
74
+
75
+ return {
76
+ plugins: [
77
+ tailwindcss(),
78
+ react(),
79
+ // we need to use https for the firebase authentication to work
80
+ basicSsl()
81
+ ],
82
+ // for authentication with Firebase
83
+ server: {
84
+ proxy: {
85
+ '/__/auth': {
86
+ target: 'https://dengenlabs.firebaseapp.com',
87
+ changeOrigin: true,
88
+ }
89
+ }
90
+ },
91
+ }
92
+ }