create-vitrify 0.1.0 → 0.3.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/dist/cli.js +74 -0
- package/dist/index.js +83 -0
- package/dist/templates.js +20 -0
- package/dist/types/cli.d.ts +1 -0
- package/dist/types/index.d.ts +16 -0
- package/dist/types/templates.d.ts +20 -0
- package/package.json +30 -10
- package/templates/quasar/.vscode/extensions.json +3 -0
- package/templates/quasar/_gitignore +3 -0
- package/templates/quasar/package.json.hbs +27 -0
- package/templates/quasar/src/App.test.js +3 -0
- package/templates/quasar/src/App.vue +9 -0
- package/templates/quasar/src/assets/quasar-logo-vertical.svg +15 -0
- package/templates/quasar/src/components/HelloWorld.vue +16 -0
- package/templates/quasar/src/layouts/MainLayout.vue +42 -0
- package/templates/quasar/src/pages/Error404.vue +25 -0
- package/templates/quasar/src/pages/Index.vue +9 -0
- package/templates/quasar/src/router/index.ts +17 -0
- package/templates/quasar/src/router/routes.ts +18 -0
- package/templates/quasar/tsconfig.json +15 -0
- package/templates/quasar/vitrify.config.js +21 -0
- package/templates/quasar-monorepo/package.json +11 -0
- package/templates/quasar-monorepo/packages/quasar/.vscode/extensions.json +3 -0
- package/templates/quasar-monorepo/packages/quasar/_gitignore +3 -0
- package/templates/quasar-monorepo/packages/quasar/package.json.hbs +28 -0
- package/templates/quasar-monorepo/packages/quasar/src/App.test.js +3 -0
- package/templates/quasar-monorepo/packages/quasar/src/App.vue +9 -0
- package/templates/quasar-monorepo/packages/quasar/src/assets/quasar-logo-vertical.svg +15 -0
- package/templates/quasar-monorepo/packages/quasar/src/components/HelloWorld.vue +16 -0
- package/templates/quasar-monorepo/packages/quasar/src/layouts/MainLayout.vue +42 -0
- package/templates/quasar-monorepo/packages/quasar/src/pages/Error404.vue +25 -0
- package/templates/quasar-monorepo/packages/quasar/src/pages/Index.vue.hbs +13 -0
- package/templates/quasar-monorepo/packages/quasar/src/router/index.ts +17 -0
- package/templates/quasar-monorepo/packages/quasar/src/router/routes.ts +18 -0
- package/templates/quasar-monorepo/packages/quasar/tsconfig.json +15 -0
- package/templates/quasar-monorepo/packages/quasar/vitrify.config.js.hbs +29 -0
- package/templates/quasar-monorepo/packages/quasar-plugin/_gitignore +3 -0
- package/templates/quasar-monorepo/packages/quasar-plugin/package.json.hbs +47 -0
- package/templates/quasar-monorepo/packages/quasar-plugin/run/install.ts +6 -0
- package/templates/quasar-monorepo/packages/quasar-plugin/run/render.ts +9 -0
- package/templates/quasar-monorepo/packages/quasar-plugin/src/ui/components/HelloWorld.vue +9 -0
- package/templates/quasar-monorepo/packages/quasar-plugin/src/ui/index.ts +8 -0
- package/templates/quasar-monorepo/packages/quasar-plugin/src/ui/lang/en-us.ts +9 -0
- package/templates/quasar-monorepo/packages/quasar-plugin/src/ui/lang.ts +32 -0
- package/templates/quasar-monorepo/packages/quasar-plugin/src/ui/shims-vue.d.ts +6 -0
- package/templates/quasar-monorepo/packages/quasar-plugin/src/ui/utils/helpers.ts +1 -0
- package/templates/quasar-monorepo/packages/quasar-plugin/src/ui/vue-plugin.ts +10 -0
- package/templates/quasar-monorepo/packages/quasar-plugin/src/vite-plugin.ts.hbs +19 -0
- package/templates/quasar-monorepo/packages/quasar-plugin/tsconfig.build.plugin.json +12 -0
- package/templates/quasar-monorepo/packages/quasar-plugin/tsconfig.build.run.json +9 -0
- package/templates/quasar-monorepo/packages/quasar-plugin/tsconfig.json +29 -0
- package/templates/quasar-monorepo/packages/quasar-plugin/tsconfig.node.json +10 -0
- package/templates/quasar-monorepo/packages/quasar-plugin/tsconfig.types.json +17 -0
- package/templates/quasar-monorepo/packages/quasar-plugin/vite.config.ts +32 -0
- package/templates/quasar-monorepo/pnpm-workspace.yaml +2 -0
- package/templates/quasar-plugin/_gitignore +3 -0
- package/templates/quasar-plugin/package.json.hbs +47 -0
- package/templates/quasar-plugin/run/install.ts +6 -0
- package/templates/quasar-plugin/run/render.ts +9 -0
- package/templates/quasar-plugin/src/ui/components/HelloWorld.vue +9 -0
- package/templates/quasar-plugin/src/ui/index.ts +8 -0
- package/templates/quasar-plugin/src/ui/lang/en-us.ts +9 -0
- package/templates/quasar-plugin/src/ui/lang.ts +32 -0
- package/templates/quasar-plugin/src/ui/shims-vue.d.ts +6 -0
- package/templates/quasar-plugin/src/ui/utils/helpers.ts +1 -0
- package/templates/quasar-plugin/src/ui/vue-plugin.ts +10 -0
- package/templates/quasar-plugin/src/vite-plugin.ts.hbs +19 -0
- package/templates/quasar-plugin/tsconfig.build.plugin.json +12 -0
- package/templates/quasar-plugin/tsconfig.build.run.json +9 -0
- package/templates/quasar-plugin/tsconfig.json +29 -0
- package/templates/quasar-plugin/tsconfig.node.json +10 -0
- package/templates/quasar-plugin/tsconfig.types.json +17 -0
- package/templates/quasar-plugin/vite.config.ts +32 -0
- package/templates/vite-project/_gitignore +3 -0
- package/templates/vite-project/index.html +13 -0
- package/templates/vite-project/package.json.hbs +25 -0
- package/templates/vite-project/src/App.vue +9 -0
- package/templates/vite-project/src/assets/quasar-logo-vertical.svg +15 -0
- package/templates/vite-project/src/components/HelloWorld.vue +16 -0
- package/templates/vite-project/src/env.d.ts +8 -0
- package/templates/vite-project/src/layouts/MainLayout.vue +42 -0
- package/templates/vite-project/src/main.ts +17 -0
- package/templates/vite-project/src/pages/Error404.vue +25 -0
- package/templates/vite-project/src/pages/Index.vue +9 -0
- package/templates/vite-project/src/router/index.ts +15 -0
- package/templates/vite-project/src/router/routes.ts +18 -0
- package/templates/vite-project/tsconfig.json +15 -0
- 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
|
+
hooks: {
|
|
10
|
+
// Vitrify hooks
|
|
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,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.4.0",
|
|
39
|
+
"@types/node": "^16.11.11",
|
|
40
|
+
"@types/ws": "^8.5.3",
|
|
41
|
+
"@vitejs/plugin-vue": "^3.0.0-alpha.1",
|
|
42
|
+
"typescript": "^4.6.2",
|
|
43
|
+
"vite": "^3.0.0-alpha.9",
|
|
44
|
+
"vue": "^3.2.37",
|
|
45
|
+
"vue-tsc": "^0.33.9"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -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 @@
|
|
|
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,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,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,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.4.0",
|
|
39
|
+
"@types/node": "^16.11.11",
|
|
40
|
+
"@types/ws": "^8.5.3",
|
|
41
|
+
"@vitejs/plugin-vue": "^3.0.0-alpha.1",
|
|
42
|
+
"typescript": "^4.6.2",
|
|
43
|
+
"vite": "^3.0.0-alpha.9",
|
|
44
|
+
"vue": "^3.2.37",
|
|
45
|
+
"vue-tsc": "^0.33.9"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -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 @@
|
|
|
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
|
+
}
|