Skip to content

Commit d3c402b

Browse files
committed
docs(demo): use multiple entry files
Each flavor has its own index.html file https://vitejs.dev/guide/build.html#multi-page-app
1 parent 2692488 commit d3c402b

25 files changed

+287
-98
lines changed

demo/index.html renamed to demo/ant/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
</head>
99
<body>
1010
<div id="app"></div>
11-
<script type="module" src="/src/main.ts"></script>
11+
<script type="module" src="/src/ant-main.ts"></script>
1212
</body>
1313
</html>

demo/element-plus/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<link rel="icon" href="/favicon.ico">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Vite App</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="/src/element-plus-main.ts"></script>
12+
</body>
13+
</html>

demo/env.d.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
/// <reference types="vite/client" />
22

3-
interface ImportMetaEnv {
4-
readonly VITE_FLAVOR: string
5-
}
6-
73
interface ImportMeta {
84
readonly env: ImportMetaEnv
95
}

demo/light/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<link rel="icon" href="/favicon.ico">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Vite App</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="/src/light-main.ts"></script>
12+
</body>
13+
</html>

demo/package.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@
88
"preview": "vite preview",
99
"build-only": "vite build",
1010
"type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
11-
"generate": "npx cron-cli demo-setup ./src/setup",
12-
"build-ant": "VITE_FLAVOR=ant npm run build",
13-
"build-light": "VITE_FLAVOR=light npm run build",
14-
"build-element-plus": "VITE_FLAVOR=element-plus npm run build",
15-
"build-quasar": "VITE_FLAVOR=quasar npm run build",
16-
"build-vuetify": "VITE_FLAVOR=vuetify npm run build",
17-
"build-all": "npm run build-ant && npm run build-light && npm run build-element-plus && npm run build-quasar && npm run build-vuetify"
11+
"generate": "npx cron-cli demo-setup ."
1812
},
1913
"dependencies": {
2014
"vue": "^3.3.4",

demo/quasar/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<link rel="icon" href="/favicon.ico">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Vite App</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="/src/quasar-main.ts"></script>
12+
</body>
13+
</html>

demo/src/ant-main.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Generated file, do not modify
2+
import './assets/main.css'
3+
import { createApp } from 'vue'
4+
import App from './App.vue'
5+
import type { App as VueApp } from 'vue'
6+
import { customSetup } from './setup'
7+
8+
export async function setup(app: VueApp) {
9+
// imports
10+
11+
// uses
12+
let module = null
13+
module = await import('ant-design-vue')
14+
// @ts-ignore
15+
app.use(module.default)
16+
17+
// register cron component
18+
await import('@vue-js-cron/ant/dist/ant.css')
19+
module = await import('@vue-js-cron/ant')
20+
app.component('cron-editor', module['CronAnt'])
21+
}
22+
23+
async function main() {
24+
const app = createApp(App)
25+
await setup(app)
26+
await customSetup('ant', app)
27+
app.mount('#app')
28+
}
29+
30+
main()

demo/src/setup/element-plus.ts renamed to demo/src/element-plus-main.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
// Generated file, do not modify
2+
import './assets/main.css'
3+
import { createApp } from 'vue'
4+
import App from './App.vue'
5+
import type { App as VueApp } from 'vue'
6+
import { customSetup } from './setup'
27

3-
import type { App } from 'vue'
4-
5-
export async function setup(app: App) {
8+
export async function setup(app: VueApp) {
69
// imports
710
await import('element-plus/dist/index.css')
811

@@ -17,3 +20,12 @@ export async function setup(app: App) {
1720
module = await import('@vue-js-cron/element-plus')
1821
app.component('cron-editor', module['CronElementPlus'])
1922
}
23+
24+
async function main() {
25+
const app = createApp(App)
26+
await setup(app)
27+
await customSetup('element-plus', app)
28+
app.mount('#app')
29+
}
30+
31+
main()

demo/src/light-main.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Generated file, do not modify
2+
import './assets/main.css'
3+
import { createApp } from 'vue'
4+
import App from './App.vue'
5+
import type { App as VueApp } from 'vue'
6+
import { customSetup } from './setup'
7+
8+
export async function setup(app: VueApp) {
9+
// imports
10+
11+
// uses
12+
let module = null
13+
14+
// register cron component
15+
await import('@vue-js-cron/light/dist/light.css')
16+
module = await import('@vue-js-cron/light')
17+
app.component('cron-editor', module['CronLight'])
18+
}
19+
20+
async function main() {
21+
const app = createApp(App)
22+
await setup(app)
23+
await customSetup('light', app)
24+
app.mount('#app')
25+
}
26+
27+
main()

demo/src/main.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)