create-vitrify 0.1.0 → 0.1.1

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 (88) hide show
  1. package/dist/cli.js +74 -0
  2. package/dist/index.js +83 -0
  3. package/dist/templates.js +20 -0
  4. package/dist/types/cli.d.ts +1 -0
  5. package/dist/types/index.d.ts +16 -0
  6. package/dist/types/templates.d.ts +20 -0
  7. package/package.json +29 -9
  8. package/templates/quasar/.vscode/extensions.json +3 -0
  9. package/templates/quasar/_gitignore +3 -0
  10. package/templates/quasar/package.json.hbs +29 -0
  11. package/templates/quasar/src/App.test.js +3 -0
  12. package/templates/quasar/src/App.vue +9 -0
  13. package/templates/quasar/src/assets/quasar-logo-vertical.svg +15 -0
  14. package/templates/quasar/src/components/HelloWorld.vue +16 -0
  15. package/templates/quasar/src/layouts/MainLayout.vue +42 -0
  16. package/templates/quasar/src/pages/Error404.vue +25 -0
  17. package/templates/quasar/src/pages/Index.vue +9 -0
  18. package/templates/quasar/src/router/index.ts +17 -0
  19. package/templates/quasar/src/router/routes.ts +18 -0
  20. package/templates/quasar/tsconfig.json +15 -0
  21. package/templates/quasar/vitrify.config.js +21 -0
  22. package/templates/quasar-monorepo/package.json +11 -0
  23. package/templates/quasar-monorepo/packages/quasar/.vscode/extensions.json +3 -0
  24. package/templates/quasar-monorepo/packages/quasar/_gitignore +3 -0
  25. package/templates/quasar-monorepo/packages/quasar/package.json.hbs +30 -0
  26. package/templates/quasar-monorepo/packages/quasar/src/App.test.js +3 -0
  27. package/templates/quasar-monorepo/packages/quasar/src/App.vue +9 -0
  28. package/templates/quasar-monorepo/packages/quasar/src/assets/quasar-logo-vertical.svg +15 -0
  29. package/templates/quasar-monorepo/packages/quasar/src/components/HelloWorld.vue +16 -0
  30. package/templates/quasar-monorepo/packages/quasar/src/layouts/MainLayout.vue +42 -0
  31. package/templates/quasar-monorepo/packages/quasar/src/pages/Error404.vue +25 -0
  32. package/templates/quasar-monorepo/packages/quasar/src/pages/Index.vue.hbs +13 -0
  33. package/templates/quasar-monorepo/packages/quasar/src/router/index.ts +17 -0
  34. package/templates/quasar-monorepo/packages/quasar/src/router/routes.ts +18 -0
  35. package/templates/quasar-monorepo/packages/quasar/tsconfig.json +15 -0
  36. package/templates/quasar-monorepo/packages/quasar/vitrify.config.js.hbs +29 -0
  37. package/templates/quasar-monorepo/packages/quasar-plugin/_gitignore +3 -0
  38. package/templates/quasar-monorepo/packages/quasar-plugin/package.json.hbs +47 -0
  39. package/templates/quasar-monorepo/packages/quasar-plugin/run/install.ts +6 -0
  40. package/templates/quasar-monorepo/packages/quasar-plugin/run/render.ts +9 -0
  41. package/templates/quasar-monorepo/packages/quasar-plugin/src/ui/components/HelloWorld.vue +9 -0
  42. package/templates/quasar-monorepo/packages/quasar-plugin/src/ui/index.ts +8 -0
  43. package/templates/quasar-monorepo/packages/quasar-plugin/src/ui/lang/en-us.ts +9 -0
  44. package/templates/quasar-monorepo/packages/quasar-plugin/src/ui/lang.ts +32 -0
  45. package/templates/quasar-monorepo/packages/quasar-plugin/src/ui/shims-vue.d.ts +6 -0
  46. package/templates/quasar-monorepo/packages/quasar-plugin/src/ui/utils/helpers.ts +1 -0
  47. package/templates/quasar-monorepo/packages/quasar-plugin/src/ui/vue-plugin.ts +10 -0
  48. package/templates/quasar-monorepo/packages/quasar-plugin/src/vite-plugin.ts.hbs +19 -0
  49. package/templates/quasar-monorepo/packages/quasar-plugin/tsconfig.build.plugin.json +12 -0
  50. package/templates/quasar-monorepo/packages/quasar-plugin/tsconfig.build.run.json +9 -0
  51. package/templates/quasar-monorepo/packages/quasar-plugin/tsconfig.json +29 -0
  52. package/templates/quasar-monorepo/packages/quasar-plugin/tsconfig.node.json +10 -0
  53. package/templates/quasar-monorepo/packages/quasar-plugin/tsconfig.types.json +17 -0
  54. package/templates/quasar-monorepo/packages/quasar-plugin/vite.config.ts +32 -0
  55. package/templates/quasar-monorepo/pnpm-workspace.yaml +2 -0
  56. package/templates/quasar-plugin/_gitignore +3 -0
  57. package/templates/quasar-plugin/package.json.hbs +47 -0
  58. package/templates/quasar-plugin/run/install.ts +6 -0
  59. package/templates/quasar-plugin/run/render.ts +9 -0
  60. package/templates/quasar-plugin/src/ui/components/HelloWorld.vue +9 -0
  61. package/templates/quasar-plugin/src/ui/index.ts +8 -0
  62. package/templates/quasar-plugin/src/ui/lang/en-us.ts +9 -0
  63. package/templates/quasar-plugin/src/ui/lang.ts +32 -0
  64. package/templates/quasar-plugin/src/ui/shims-vue.d.ts +6 -0
  65. package/templates/quasar-plugin/src/ui/utils/helpers.ts +1 -0
  66. package/templates/quasar-plugin/src/ui/vue-plugin.ts +10 -0
  67. package/templates/quasar-plugin/src/vite-plugin.ts.hbs +19 -0
  68. package/templates/quasar-plugin/tsconfig.build.plugin.json +12 -0
  69. package/templates/quasar-plugin/tsconfig.build.run.json +9 -0
  70. package/templates/quasar-plugin/tsconfig.json +29 -0
  71. package/templates/quasar-plugin/tsconfig.node.json +10 -0
  72. package/templates/quasar-plugin/tsconfig.types.json +17 -0
  73. package/templates/quasar-plugin/vite.config.ts +32 -0
  74. package/templates/vite-project/_gitignore +3 -0
  75. package/templates/vite-project/index.html +13 -0
  76. package/templates/vite-project/package.json.hbs +25 -0
  77. package/templates/vite-project/src/App.vue +9 -0
  78. package/templates/vite-project/src/assets/quasar-logo-vertical.svg +15 -0
  79. package/templates/vite-project/src/components/HelloWorld.vue +16 -0
  80. package/templates/vite-project/src/env.d.ts +8 -0
  81. package/templates/vite-project/src/layouts/MainLayout.vue +42 -0
  82. package/templates/vite-project/src/main.ts +17 -0
  83. package/templates/vite-project/src/pages/Error404.vue +25 -0
  84. package/templates/vite-project/src/pages/Index.vue +9 -0
  85. package/templates/vite-project/src/router/index.ts +15 -0
  86. package/templates/vite-project/src/router/routes.ts +18 -0
  87. package/templates/vite-project/tsconfig.json +15 -0
  88. package/templates/vite-project/vite.config.ts +17 -0
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <q-layout view="lHh Lpr lFf">
3
+ <q-header elevated>
4
+ <q-toolbar>
5
+ <q-btn
6
+ flat
7
+ dense
8
+ round
9
+ icon="menu"
10
+ aria-label="Menu"
11
+ @click="toggleLeftDrawer"
12
+ />
13
+
14
+ <q-toolbar-title> Quasar App </q-toolbar-title>
15
+
16
+ <div>Quasar v{{ $q.version }}</div>
17
+ </q-toolbar>
18
+ </q-header>
19
+
20
+ <q-drawer v-model="leftDrawerOpen" show-if-above bordered>
21
+ <q-list>
22
+ <q-item-label header> Essential Links </q-item-label>
23
+ </q-list>
24
+ </q-drawer>
25
+
26
+ <q-page-container>
27
+ <router-view />
28
+ </q-page-container>
29
+ </q-layout>
30
+ </template>
31
+
32
+ <script setup lang="ts">
33
+ import { ref } from 'vue'
34
+ import { useQuasar } from 'quasar'
35
+
36
+ const $q = useQuasar()
37
+ const leftDrawerOpen = ref(false)
38
+
39
+ const toggleLeftDrawer = () => {
40
+ leftDrawerOpen.value = !leftDrawerOpen.value
41
+ }
42
+ </script>
@@ -0,0 +1,25 @@
1
+ <template>
2
+ <div
3
+ class="fullscreen bg-blue text-white text-center q-pa-md flex flex-center"
4
+ >
5
+ <div>
6
+ <div style="font-size: 30vh">404</div>
7
+
8
+ <div class="text-h2" style="opacity: 0.4">Oops. Nothing here...</div>
9
+
10
+ <q-btn
11
+ class="q-mt-xl"
12
+ color="white"
13
+ text-color="blue"
14
+ unelevated
15
+ to="/"
16
+ label="Go Home"
17
+ no-caps
18
+ />
19
+ </div>
20
+ </div>
21
+ </template>
22
+
23
+ <script setup lang="ts">
24
+ const name = 'Error404'
25
+ </script>
@@ -0,0 +1,13 @@
1
+ <template>
2
+ <q-page class="row items-center justify-evenly">
3
+ <hello-world>
4
+ </hello-world>
5
+ <plugin-hello-world>
6
+ </plugin-hello-world>
7
+ </q-page>
8
+ </template>
9
+
10
+ <script setup lang="ts">
11
+ import HelloWorld from 'src/components/HelloWorld.vue';
12
+ import { HelloWorld as PluginHelloWorld } from 'quasar-plugin-{{ name }}'
13
+ </script>
@@ -0,0 +1,17 @@
1
+ import {
2
+ createMemoryHistory,
3
+ createRouter as _createRouter,
4
+ createWebHistory
5
+ } from 'vue-router'
6
+ import routes from './routes'
7
+
8
+ export default function createRouter() {
9
+ return _createRouter({
10
+ // use appropriate history implementation for server/client
11
+ // import.meta.env.SSR is injected by Vite.
12
+ history: import.meta.env.SSR
13
+ ? createMemoryHistory(__BASE_URL__)
14
+ : createWebHistory(__BASE_URL__),
15
+ routes
16
+ })
17
+ }
@@ -0,0 +1,18 @@
1
+ import { RouteRecordRaw } from 'vue-router'
2
+
3
+ const routes: RouteRecordRaw[] = [
4
+ {
5
+ path: '/',
6
+ component: () => import('src/layouts/MainLayout.vue'),
7
+ children: [{ path: '', component: () => import('src/pages/Index.vue') }]
8
+ },
9
+
10
+ // Always leave this as last one,
11
+ // but you can also remove it
12
+ {
13
+ path: '/:catchAll(.*)*',
14
+ component: () => import('src/pages/Error404.vue')
15
+ }
16
+ ]
17
+
18
+ export default routes
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "esnext",
4
+ "useDefineForClassFields": true,
5
+ "module": "esnext",
6
+ "moduleResolution": "node",
7
+ "strict": true,
8
+ "jsx": "preserve",
9
+ "sourceMap": true,
10
+ "resolveJsonModule": true,
11
+ "esModuleInterop": true,
12
+ "lib": ["esnext", "dom"]
13
+ },
14
+ "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
15
+ }
@@ -0,0 +1,29 @@
1
+ import VitePlugin from 'quasar-plugin-{{ name }}/vite-plugin'
2
+
3
+ export default function ({ mode, command }) {
4
+ return {
5
+ plugins: [
6
+ VitePlugin()
7
+ ],
8
+ vitrify: {
9
+ fastify: {
10
+ // Fastify configuration for SSR
11
+ },
12
+ sassVariables: {
13
+ '$primary': '#000000'
14
+ }
15
+ },
16
+ quasar: {
17
+ extras: [
18
+ 'material-icons'
19
+ ],
20
+ framework: {
21
+ components: [
22
+ // Deprecated
23
+ ],
24
+ plugins: [
25
+ ]
26
+ },
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,3 @@
1
+ node_modules
2
+ dist
3
+ *.local
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "quasar-plugin-{{ name }}",
3
+ "description": "{{ description }}",
4
+ "author": "{{ author }}",
5
+ "version": "0.1.0",
6
+ "type": "module",
7
+ "exports": {
8
+ ".": "./dist/quasar-plugin-{{ name }}.es.js",
9
+ "./run/*": "./dist/run/*.js",
10
+ "./vite-plugin": "./dist/vite-plugin.js"
11
+ },
12
+ "typesVersions": {
13
+ "*": {
14
+ "*": [
15
+ "./dist/types/index.d.ts"
16
+ ],
17
+ "vite-plugin": [
18
+ "./dist/vite-plugin.d.ts"
19
+ ],
20
+ "run/*": [
21
+ "./dist/run/*.d.ts"
22
+ ]
23
+ }
24
+ },
25
+ "scripts": {
26
+ "build:plugin": "vite build",
27
+ "build:run": "tsc -p tsconfig.build.run.json",
28
+ "build:vite-plugin": "tsc -p tsconfig.build.plugin.json",
29
+ "generate:types": "vue-tsc -p tsconfig.types.json",
30
+ "build": "pnpm run build:plugin && pnpm run build:run && pnpm run build:vite-plugin && pnpm run generate:types",
31
+ "install:plugin": "./dist/run/install.js",
32
+ "render": "./dist/run/render.js"
33
+ },
34
+ "dependencies": {
35
+ "unplugin-vue-components": "^0.18.5"
36
+ },
37
+ "devDependencies": {
38
+ "vitrify": "^0.1.0",
39
+ "@types/node": "^16.11.11",
40
+ "@types/ws": "^8.5.3",
41
+ "@vitejs/plugin-vue": "^2.2.4",
42
+ "typescript": "^4.6.2",
43
+ "vite": "^2.9.1",
44
+ "vue": "^3.2.31",
45
+ "vue-tsc": "^0.33.9"
46
+ }
47
+ }
@@ -0,0 +1,6 @@
1
+ import type { VitrifyContext } from 'vitrify'
2
+ import { render } from './render.js'
3
+
4
+ export async function run(args: VitrifyContext) {
5
+ await render()
6
+ }
@@ -0,0 +1,9 @@
1
+ import { VitrifyContext } from 'vitrify'
2
+
3
+ export const render = async () => {
4
+ console.log('Nothing to be rendered')
5
+ }
6
+
7
+ export async function run(args: VitrifyContext) {
8
+ await render()
9
+ }
@@ -0,0 +1,9 @@
1
+ <template>
2
+ <q-btn :label="lang.myQuasarPlugin.changeMe"></q-btn>
3
+ </template>
4
+
5
+ <script setup lang="ts">
6
+ import { useLang } from '../lang'
7
+
8
+ const lang = useLang()
9
+ </script>
@@ -0,0 +1,8 @@
1
+ import * as VuePlugin from './vue-plugin.js'
2
+ import HelloWorld from './components/HelloWorld.vue'
3
+
4
+ export * from './utils/helpers.js'
5
+ export * from './lang.js'
6
+ export { HelloWorld }
7
+
8
+ export default VuePlugin
@@ -0,0 +1,9 @@
1
+ import type { Language } from '../lang'
2
+
3
+ const lang: Language = {
4
+ myQuasarPlugin: {
5
+ changeMe: 'Change me'
6
+ }
7
+ }
8
+
9
+ export default lang
@@ -0,0 +1,32 @@
1
+ export interface Language {
2
+ myQuasarPlugin: {
3
+ changeMe: string
4
+ }
5
+ }
6
+
7
+ import { ref, Ref } from 'vue'
8
+ import en from './lang/en-us'
9
+ export const lang = ref(en)
10
+ // @ts-ignore
11
+ const locales = import.meta.glob('./lang/*.ts')
12
+
13
+ export const defineLang = (lang: Language) => {
14
+ return lang
15
+ }
16
+
17
+ export const useLang = () => {
18
+ return lang as Ref<Language>
19
+ }
20
+
21
+ export const loadLang = async (locale: string) => {
22
+ try {
23
+ const data = (await locales[`./lang/${locale}.ts`]()).default
24
+
25
+ if (data) {
26
+ lang.value = data
27
+ }
28
+ } catch (e) {
29
+ console.log(e)
30
+ throw new Error(`Failed to load ${locale} locale.`)
31
+ }
32
+ }
@@ -0,0 +1,6 @@
1
+ // Mocks all files ending in `.vue` showing them as plain Vue instances
2
+ declare module '*.vue' {
3
+ import { ComponentOptions } from 'vue'
4
+ const component: ComponentOptions
5
+ export default component
6
+ }
@@ -0,0 +1,10 @@
1
+ import HelloWorld from './components/HelloWorld.vue'
2
+
3
+ import { loadLang } from './lang.js'
4
+
5
+ function install(app: any, options: { lang: string }) {
6
+ loadLang(options?.lang || 'en-us')
7
+ app.component(HelloWorld.name, HelloWorld)
8
+ }
9
+
10
+ export { install }
@@ -0,0 +1,19 @@
1
+ import type { Plugin } from 'vite'
2
+
3
+ export default async function QuasarVitePlugin (): Promise<Plugin> {
4
+ console.log('Running Quasar Vite Plugin')
5
+ return {
6
+ name: 'quasar-plugin-{{ name }}',
7
+ // @ts-ignore
8
+ config: async (config, { command }) => ({
9
+ quasar: {
10
+ // Extend quasar.conf
11
+ },
12
+ resolve: {
13
+ alias: [
14
+ { find: 'quasar-plugin-{{ name }}', replacement: new URL('../', import.meta.url) }
15
+ ]
16
+ }
17
+ })
18
+ }
19
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "rootDir": "src/"
4
+ },
5
+ "extends": "./tsconfig.node.json",
6
+ "include": ["src/vite-plugin.ts"],
7
+ "references": [
8
+ {
9
+ "path": "./tsconfig.node.json"
10
+ }
11
+ ]
12
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "./tsconfig.node.json",
3
+ "include": ["run/**/*.ts"],
4
+ "references": [
5
+ {
6
+ "path": "./tsconfig.node.json"
7
+ }
8
+ ]
9
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "esnext",
4
+ "useDefineForClassFields": true,
5
+ "module": "esnext",
6
+ "moduleResolution": "node",
7
+ "strict": true,
8
+ "jsx": "preserve",
9
+ "sourceMap": true,
10
+ "resolveJsonModule": true,
11
+ "esModuleInterop": true,
12
+ "declaration": true,
13
+ "lib": ["esnext", "dom"],
14
+ "types": ["vite/client"],
15
+ "outDir": "./dist"
16
+ },
17
+ "include": [
18
+ "run/**/*.ts",
19
+ "src/**/*.ts",
20
+ "src/**/*.d.ts",
21
+ "src/**/*.tsx",
22
+ "src/**/*.vue"
23
+ ],
24
+ "references": [
25
+ {
26
+ "path": "./tsconfig.node.json"
27
+ }
28
+ ]
29
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "module": "esnext",
5
+ "moduleResolution": "node",
6
+ "outDir": "./dist",
7
+ "declaration": true
8
+ },
9
+ "include": ["vite.config.ts"]
10
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "esnext",
4
+ "module": "esnext",
5
+ "lib": ["esnext", "DOM"],
6
+ "strict": true,
7
+ "skipLibCheck": true,
8
+ "moduleResolution": "node",
9
+ "declaration": true,
10
+ "outDir": "dist",
11
+ "emitDeclarationOnly": true,
12
+ "declarationDir": "./dist/types",
13
+ "isolatedModules": true,
14
+ "types": ["vite/client"]
15
+ },
16
+ "include": ["./src/ui"]
17
+ }
@@ -0,0 +1,32 @@
1
+ import { defineConfig } from 'vite'
2
+ import vue from '@vitejs/plugin-vue'
3
+ import Components from 'unplugin-vue-components/vite'
4
+ import { QuasarResolver } from 'unplugin-vue-components/resolvers'
5
+
6
+ export default defineConfig(async ({ command, mode }) => ({
7
+ plugins: [
8
+ vue(),
9
+ Components({
10
+ resolvers: [QuasarResolver()]
11
+ })
12
+ ],
13
+ css: {
14
+ preprocessorOptions: {
15
+ sass: {
16
+ additionalData: `@import "quasar/src/css/index"`
17
+ }
18
+ }
19
+ },
20
+ build: {
21
+ // minify: false,
22
+ lib: {
23
+ // UMD not supported for code-splitting builds
24
+ formats: ['es'],
25
+ entry: './src/ui/index.ts'
26
+ },
27
+ emptyOutDir: true,
28
+ rollupOptions: {
29
+ external: ['vue', 'vue-router', 'quasar']
30
+ }
31
+ }
32
+ }))
@@ -0,0 +1,2 @@
1
+ packages:
2
+ - 'packages/*'
@@ -0,0 +1,3 @@
1
+ node_modules
2
+ dist
3
+ *.local
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "quasar-plugin-{{ name }}",
3
+ "description": "{{ description }}",
4
+ "author": "{{ author }}",
5
+ "version": "0.1.0",
6
+ "type": "module",
7
+ "exports": {
8
+ ".": "./dist/quasar-plugin-{{ name }}.es.js",
9
+ "./run/*": "./dist/run/*.js",
10
+ "./vite-plugin": "./dist/vite-plugin.js"
11
+ },
12
+ "typesVersions": {
13
+ "*": {
14
+ "*": [
15
+ "./dist/types/index.d.ts"
16
+ ],
17
+ "vite-plugin": [
18
+ "./dist/vite-plugin.d.ts"
19
+ ],
20
+ "run/*": [
21
+ "./dist/run/*.d.ts"
22
+ ]
23
+ }
24
+ },
25
+ "scripts": {
26
+ "build:plugin": "vite build",
27
+ "build:run": "tsc -p tsconfig.build.run.json",
28
+ "build:vite-plugin": "tsc -p tsconfig.build.plugin.json",
29
+ "generate:types": "vue-tsc -p tsconfig.types.json",
30
+ "build": "pnpm run build:plugin && pnpm run build:run && pnpm run build:vite-plugin && pnpm run generate:types",
31
+ "install:plugin": "./dist/run/install.js",
32
+ "render": "./dist/run/render.js"
33
+ },
34
+ "dependencies": {
35
+ "unplugin-vue-components": "^0.18.5"
36
+ },
37
+ "devDependencies": {
38
+ "vitrify": "^0.1.0",
39
+ "@types/node": "^16.11.11",
40
+ "@types/ws": "^8.5.3",
41
+ "@vitejs/plugin-vue": "^2.2.4",
42
+ "typescript": "^4.6.2",
43
+ "vite": "^2.9.1",
44
+ "vue": "^3.2.31",
45
+ "vue-tsc": "^0.33.9"
46
+ }
47
+ }
@@ -0,0 +1,6 @@
1
+ import type { VitrifyContext } from 'vitrify'
2
+ import { render } from './render.js'
3
+
4
+ export async function run(args: VitrifyContext) {
5
+ await render()
6
+ }
@@ -0,0 +1,9 @@
1
+ import { VitrifyContext } from 'vitrify'
2
+
3
+ export const render = async () => {
4
+ console.log('Nothing to be rendered')
5
+ }
6
+
7
+ export async function run(args: VitrifyContext) {
8
+ await render()
9
+ }
@@ -0,0 +1,9 @@
1
+ <template>
2
+ <q-btn :label="lang.myQuasarPlugin.changeMe"></q-btn>
3
+ </template>
4
+
5
+ <script setup lang="ts">
6
+ import { useLang } from '../lang'
7
+
8
+ const lang = useLang()
9
+ </script>
@@ -0,0 +1,8 @@
1
+ import * as VuePlugin from './vue-plugin.js'
2
+ import HelloWorld from './components/HelloWorld.vue'
3
+
4
+ export * from './utils/helpers.js'
5
+ export * from './lang.js'
6
+ export { HelloWorld }
7
+
8
+ export default VuePlugin
@@ -0,0 +1,9 @@
1
+ import type { Language } from '../lang'
2
+
3
+ const lang: Language = {
4
+ myQuasarPlugin: {
5
+ changeMe: 'Change me'
6
+ }
7
+ }
8
+
9
+ export default lang
@@ -0,0 +1,32 @@
1
+ export interface Language {
2
+ myQuasarPlugin: {
3
+ changeMe: string
4
+ }
5
+ }
6
+
7
+ import { ref, Ref } from 'vue'
8
+ import en from './lang/en-us'
9
+ export const lang = ref(en)
10
+ // @ts-ignore
11
+ const locales = import.meta.glob('./lang/*.ts')
12
+
13
+ export const defineLang = (lang: Language) => {
14
+ return lang
15
+ }
16
+
17
+ export const useLang = () => {
18
+ return lang as Ref<Language>
19
+ }
20
+
21
+ export const loadLang = async (locale: string) => {
22
+ try {
23
+ const data = (await locales[`./lang/${locale}.ts`]()).default
24
+
25
+ if (data) {
26
+ lang.value = data
27
+ }
28
+ } catch (e) {
29
+ console.log(e)
30
+ throw new Error(`Failed to load ${locale} locale.`)
31
+ }
32
+ }
@@ -0,0 +1,6 @@
1
+ // Mocks all files ending in `.vue` showing them as plain Vue instances
2
+ declare module '*.vue' {
3
+ import { ComponentOptions } from 'vue'
4
+ const component: ComponentOptions
5
+ export default component
6
+ }
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1,10 @@
1
+ import HelloWorld from './components/HelloWorld.vue'
2
+
3
+ import { loadLang } from './lang.js'
4
+
5
+ function install(app: any, options: { lang: string }) {
6
+ loadLang(options?.lang || 'en-us')
7
+ app.component(HelloWorld.name, HelloWorld)
8
+ }
9
+
10
+ export { install }
@@ -0,0 +1,19 @@
1
+ import type { Plugin } from 'vite'
2
+
3
+ export default async function QuasarVitePlugin (): Promise<Plugin> {
4
+ console.log('Running Quasar Vite Plugin')
5
+ return {
6
+ name: 'quasar-plugin-{{ name }}',
7
+ // @ts-ignore
8
+ config: async (config, { command }) => ({
9
+ quasar: {
10
+ // Extend quasar.conf
11
+ },
12
+ resolve: {
13
+ alias: [
14
+ { find: 'quasar-plugin-{{ name }}', replacement: new URL('../', import.meta.url) }
15
+ ]
16
+ }
17
+ })
18
+ }
19
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "rootDir": "src/"
4
+ },
5
+ "extends": "./tsconfig.node.json",
6
+ "include": ["src/vite-plugin.ts"],
7
+ "references": [
8
+ {
9
+ "path": "./tsconfig.node.json"
10
+ }
11
+ ]
12
+ }