create-bc-app 1.0.9 → 1.1.2
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/index.mjs +9 -9
- package/package.json +37 -32
- package/template-docs-vitepress/.vitepress/cache/deps/@theme_index.js +259 -0
- package/template-docs-vitepress/.vitepress/cache/deps/@theme_index.js.map +7 -0
- package/template-docs-vitepress/.vitepress/cache/deps/_metadata.json +40 -0
- package/template-docs-vitepress/.vitepress/cache/deps/chunk-2MKPR7PC.js +9172 -0
- package/template-docs-vitepress/.vitepress/cache/deps/chunk-2MKPR7PC.js.map +7 -0
- package/template-docs-vitepress/.vitepress/cache/deps/chunk-ZXJI2PUM.js +11482 -0
- package/template-docs-vitepress/.vitepress/cache/deps/chunk-ZXJI2PUM.js.map +7 -0
- package/template-docs-vitepress/.vitepress/cache/deps/package.json +3 -0
- package/template-docs-vitepress/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +4347 -0
- package/template-docs-vitepress/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +7 -0
- package/template-docs-vitepress/.vitepress/cache/deps/vitepress___@vueuse_core.js +567 -0
- package/template-docs-vitepress/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +7 -0
- package/template-docs-vitepress/.vitepress/cache/deps/vue.js +323 -0
- package/template-docs-vitepress/.vitepress/cache/deps/vue.js.map +7 -0
- package/template-docs-vitepress/.vitepress/config.mts +28 -0
- package/template-docs-vitepress/api-examples.md +49 -0
- package/template-docs-vitepress/index.md +25 -0
- package/template-docs-vitepress/markdown-examples.md +85 -0
- package/template-docs-vitepress/package-lock.json +1742 -0
- package/template-docs-vitepress/package.json +10 -0
- package/template-docs-vuepress/docs/.vuepress/.cache/deps/@vue_devtools-api.js +11 -0
- package/template-docs-vuepress/docs/.vuepress/.cache/deps/@vue_devtools-api.js.map +7 -0
- package/template-docs-vuepress/docs/.vuepress/.cache/deps/@vuepress_shared.js +136 -0
- package/template-docs-vuepress/docs/.vuepress/.cache/deps/@vuepress_shared.js.map +7 -0
- package/template-docs-vuepress/docs/.vuepress/.cache/deps/_metadata.json +40 -0
- package/template-docs-vuepress/docs/.vuepress/.cache/deps/chunk-5K23BRP6.js +11482 -0
- package/template-docs-vuepress/docs/.vuepress/.cache/deps/chunk-5K23BRP6.js.map +7 -0
- package/template-docs-vuepress/docs/.vuepress/.cache/deps/chunk-UKCZNIRO.js +164 -0
- package/template-docs-vuepress/docs/.vuepress/.cache/deps/chunk-UKCZNIRO.js.map +7 -0
- package/template-docs-vuepress/docs/.vuepress/.cache/deps/package.json +3 -0
- package/template-docs-vuepress/docs/.vuepress/.cache/deps/vue-router.js +2744 -0
- package/template-docs-vuepress/docs/.vuepress/.cache/deps/vue-router.js.map +7 -0
- package/template-docs-vuepress/docs/.vuepress/.cache/deps/vue.js +323 -0
- package/template-docs-vuepress/docs/.vuepress/.cache/deps/vue.js.map +7 -0
- package/template-docs-vuepress/docs/.vuepress/.temp/internal/clientConfigs.js +19 -0
- package/template-docs-vuepress/docs/.vuepress/.temp/internal/routes.js +24 -0
- package/template-docs-vuepress/docs/.vuepress/.temp/internal/siteData.js +14 -0
- package/template-docs-vuepress/docs/.vuepress/.temp/internal/themeData.js +14 -0
- package/template-docs-vuepress/docs/.vuepress/.temp/pages/404.html.js +16 -0
- package/template-docs-vuepress/docs/.vuepress/.temp/pages/404.html.vue +4 -0
- package/template-docs-vuepress/docs/.vuepress/.temp/pages/get-started.html.js +16 -0
- package/template-docs-vuepress/docs/.vuepress/.temp/pages/get-started.html.vue +23 -0
- package/template-docs-vuepress/docs/.vuepress/.temp/pages/index.html.js +16 -0
- package/template-docs-vuepress/docs/.vuepress/.temp/pages/index.html.vue +4 -0
- package/template-docs-vuepress/docs/.vuepress/.temp/prismjs/config.js +3 -0
- package/template-docs-vuepress/docs/.vuepress/.temp/styles/index.scss +0 -0
- package/template-docs-vuepress/docs/.vuepress/.temp/styles/palette.scss +0 -0
- package/template-docs-vuepress/docs/.vuepress/.temp/vite-root/index.html +13 -0
- package/template-docs-vuepress/docs/.vuepress/config.js +18 -0
- package/template-docs-vuepress/docs/README.md +33 -0
- package/template-docs-vuepress/docs/get-started.md +46 -0
- package/template-docs-vuepress/package-lock.json +3380 -0
- package/template-docs-vuepress/package.json +19 -0
- package/template-protocut-2d/.eslintrc.cjs +203 -0
- package/template-protocut-2d/.gitignore +24 -0
- package/template-protocut-2d/.gitlab-ci.yml +41 -0
- package/template-protocut-2d/README.md +17 -0
- package/template-protocut-2d/image.png +0 -0
- package/template-protocut-2d/index.html +13 -0
- package/template-protocut-2d/package-lock.json +4917 -0
- package/template-protocut-2d/package.json +41 -0
- package/template-protocut-2d/public/vite.svg +1 -0
- package/template-protocut-2d/src/App.vue +12 -0
- package/template-protocut-2d/src/assets/vue.svg +1 -0
- package/template-protocut-2d/src/components/Example.vue +36 -0
- package/template-protocut-2d/src/main.ts +43 -0
- package/template-protocut-2d/src/style.css +5 -0
- package/template-protocut-2d/src/utils/plugins/watchNodeModules.js +24 -0
- package/template-protocut-2d/src/views/Home.vue +143 -0
- package/template-protocut-2d/src/vite-env.d.ts +1 -0
- package/template-protocut-2d/test/App.test.ts +16 -0
- package/template-protocut-2d/test/Example.test.ts +21 -0
- package/template-protocut-2d/tsconfig.app.json +27 -0
- package/template-protocut-2d/tsconfig.json +33 -0
- package/template-protocut-2d/tsconfig.node.json +11 -0
- package/template-protocut-2d/vite-env.d.ts +15 -0
- package/template-protocut-2d/vite.config.ts +55 -0
- package/template-protocut-2d/window.d.ts +6 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "example_project",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite --host",
|
|
8
|
+
"build": "vue-tsc -b && vite build",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"lint": "eslint . --ext .vue,.js,.ts,.jsx,.cjs,.mjs --ignore-path .gitignore",
|
|
11
|
+
"test": "vitest --ui"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@fscut/bochui": "^0.1.4",
|
|
15
|
+
"@fsdev/cadui-2d": "^0.0.2",
|
|
16
|
+
"@fsdev/cutui-2d": "^0.0.2",
|
|
17
|
+
"@fsdev/fs-utils": "1.1.2",
|
|
18
|
+
"@fsdev/element-plus": "^2.7.3",
|
|
19
|
+
"@fsdev/webcad-js": "1.1.0",
|
|
20
|
+
"less": "^4.2.0",
|
|
21
|
+
"less-loader": "^12.2.0",
|
|
22
|
+
"vue": "^3.4.29"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@babel/preset-typescript": "^7.24.7",
|
|
26
|
+
"@rushstack/eslint-patch": "^1.5.1",
|
|
27
|
+
"@typescript-eslint/eslint-plugin": "^7.15.0",
|
|
28
|
+
"@typescript-eslint/parser": "^7.15.0",
|
|
29
|
+
"@vitejs/plugin-vue": "^5.0.5",
|
|
30
|
+
"@vitest/ui": "^1.6.0",
|
|
31
|
+
"@vue/test-utils": "^2.4.6",
|
|
32
|
+
"eslint": "^8.57.0",
|
|
33
|
+
"eslint-plugin-vue": "^9.26.0",
|
|
34
|
+
"happy-dom": "^14.12.3",
|
|
35
|
+
"typescript": "^5.2.2",
|
|
36
|
+
"vite": "^5.3.1",
|
|
37
|
+
"vite-plugin-static-copy": "^1.0.1",
|
|
38
|
+
"vitest": "^1.6.0",
|
|
39
|
+
"vue-tsc": "^2.0.21"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
defineOptions({
|
|
5
|
+
name: 'Example'
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
defineProps<{ msg: string }>()
|
|
9
|
+
const count = ref(0)
|
|
10
|
+
function changeCount () {
|
|
11
|
+
count.value = 1
|
|
12
|
+
}
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<fs-button
|
|
17
|
+
v-bind="{
|
|
18
|
+
disabled:false,
|
|
19
|
+
type:'primary',
|
|
20
|
+
title:'Vite + Vue + TS example project',
|
|
21
|
+
iconName:'placeholder',
|
|
22
|
+
icon:'iconBefore',
|
|
23
|
+
textAdapt:'omit',
|
|
24
|
+
maxWidth: 300
|
|
25
|
+
}"
|
|
26
|
+
@click="changeCount"
|
|
27
|
+
/>
|
|
28
|
+
<div>Count: {{ count }}</div>
|
|
29
|
+
<h1>{{ msg }}</h1>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<style scoped lang="less">
|
|
33
|
+
h1{
|
|
34
|
+
color: #000;
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createApp } from 'vue'
|
|
2
|
+
import axios from 'axios'
|
|
3
|
+
import './style.css'
|
|
4
|
+
import App from './App.vue'
|
|
5
|
+
import ElementPlus from '@fsdev/element-plus'
|
|
6
|
+
import '@fsdev/element-plus/dist/index.css'
|
|
7
|
+
import BochUI from '@fscut/bochui'
|
|
8
|
+
import Cutui2D from '@fsdev/cutui-2d'
|
|
9
|
+
import CADui2D from '@fsdev/cadui-2d'
|
|
10
|
+
import '@fsdev/bochui/lib/style.css'
|
|
11
|
+
import '@fsdev/cutui-2d/lib/style.css'
|
|
12
|
+
import '@fsdev/cadui-2d/lib/style.css'
|
|
13
|
+
|
|
14
|
+
import WebCAD from '@fsdev/webcad-js'
|
|
15
|
+
(window as any).axios = axios
|
|
16
|
+
|
|
17
|
+
import { registerEventManager } from '@fsdev/fs-utils'
|
|
18
|
+
registerEventManager()
|
|
19
|
+
|
|
20
|
+
axios.defaults.baseURL = 'https://webapp/'
|
|
21
|
+
Cutui2D.http._defaults.baseURL = 'https://webapp/'
|
|
22
|
+
CADui2D.http._defaults.baseURL = 'https://webapp/'
|
|
23
|
+
|
|
24
|
+
window.WebCAD = WebCAD
|
|
25
|
+
// 合并语言包
|
|
26
|
+
try {
|
|
27
|
+
if (Cutui2D.i18n) {
|
|
28
|
+
Cutui2D.i18n.global.mergeLocaleMessage('zh', CADui2D.lang.zh)
|
|
29
|
+
Cutui2D.i18n.global.mergeLocaleMessage('en', CADui2D.lang.en)
|
|
30
|
+
Cutui2D.i18n.global.mergeLocaleMessage('ru', CADui2D.lang.ru)
|
|
31
|
+
}
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.error(e)
|
|
34
|
+
}
|
|
35
|
+
window.i18n = Cutui2D.i18n
|
|
36
|
+
|
|
37
|
+
createApp(App)
|
|
38
|
+
.use(ElementPlus)
|
|
39
|
+
.use(BochUI)
|
|
40
|
+
.use(Cutui2D)
|
|
41
|
+
// 生产模式去掉警告
|
|
42
|
+
.use(CADui2D)
|
|
43
|
+
.mount('#app')
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function pluginWatchNodeModules (modules) {
|
|
2
|
+
return {
|
|
3
|
+
name: 'watch-node-modules',
|
|
4
|
+
configureServer: (server) => {
|
|
5
|
+
const regexp = `/node_modules\\/(?!${modules.join('|')}).*/`
|
|
6
|
+
server.watcher.options = {
|
|
7
|
+
...server.watcher.options,
|
|
8
|
+
ignored: [
|
|
9
|
+
'**/.git/**',
|
|
10
|
+
'**/test-results/**',
|
|
11
|
+
new RegExp(regexp)
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
server.watcher._userIgnored = undefined
|
|
15
|
+
},
|
|
16
|
+
config () {
|
|
17
|
+
return {
|
|
18
|
+
optimizeDeps: {
|
|
19
|
+
exclude: modules
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="fs-protocut-home">
|
|
3
|
+
<!-- CADView区域注册 -->
|
|
4
|
+
<div id="cadview" class="cadview-container" style="position:relative; height: 100%">
|
|
5
|
+
<!-- 动态输入DOM -->
|
|
6
|
+
<!-- <fs-dynamic-input /> -->
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<div class="job-center">
|
|
10
|
+
<div class="template">
|
|
11
|
+
全局顶部栏
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="global-header">
|
|
15
|
+
<div class="template">
|
|
16
|
+
任务中心
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="cad-toolbar">
|
|
20
|
+
<div class="template">
|
|
21
|
+
图形工具栏
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="control-center">
|
|
25
|
+
<div class="template">
|
|
26
|
+
控制中心
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="main-toolbar">
|
|
30
|
+
<div class="template">
|
|
31
|
+
主界面工具栏
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script setup lang="ts">
|
|
38
|
+
import '../../window.d.ts'
|
|
39
|
+
import { onMounted, ref, computed } from 'vue'
|
|
40
|
+
import { addFsEventListener } from '@fsdev/fs-utils'
|
|
41
|
+
import Cadui2D from '@fsdev/cadui-2d'
|
|
42
|
+
import Cutui2D from '@fsdev/cutui-2d'
|
|
43
|
+
const id: number = 1
|
|
44
|
+
|
|
45
|
+
// 拿到cadui的弹窗
|
|
46
|
+
onMounted(() => {
|
|
47
|
+
initWebCad()
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
const { initCadView, onInitCadViewSuccess } = Cutui2D.hooks.useInitCadView()
|
|
51
|
+
const initWebCad = async () => {
|
|
52
|
+
initCadView(id, 'cadview', {})
|
|
53
|
+
}
|
|
54
|
+
const theme = ref('light')
|
|
55
|
+
|
|
56
|
+
addFsEventListener('init-cadview-success', () => {
|
|
57
|
+
onInitCadViewSuccess()
|
|
58
|
+
Cutui2D.setTheme('light')
|
|
59
|
+
addFsEventListener('setTheme', (param: string) => {
|
|
60
|
+
theme.value = param
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<style lang="less" scoped>
|
|
66
|
+
.fs-protocut-home {
|
|
67
|
+
position: relative;
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
height: 100vh;
|
|
70
|
+
.template {
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
background-color: rgba(242, 242, 242);
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
.dock {
|
|
78
|
+
position: absolute;
|
|
79
|
+
z-index: 999;
|
|
80
|
+
left: 50%;
|
|
81
|
+
transform: translateX(-50%);
|
|
82
|
+
bottom: 1.5rem;
|
|
83
|
+
}
|
|
84
|
+
.global-header{
|
|
85
|
+
position: absolute;
|
|
86
|
+
top: 0;
|
|
87
|
+
z-index: 1002;
|
|
88
|
+
.template {
|
|
89
|
+
height: 5rem;
|
|
90
|
+
width: 100vw;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
.control-center {
|
|
94
|
+
transition: all .3s;
|
|
95
|
+
position: absolute;
|
|
96
|
+
height: calc(100% - 13.25rem);
|
|
97
|
+
right: 0;
|
|
98
|
+
bottom: 7rem;
|
|
99
|
+
z-index: 999;
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-direction: column;
|
|
102
|
+
justify-content: center;
|
|
103
|
+
.template {
|
|
104
|
+
width: 4.5rem;
|
|
105
|
+
height: 28rem;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
.cad-toolbar {
|
|
109
|
+
top: 5.5rem;
|
|
110
|
+
display: flex;
|
|
111
|
+
position: absolute;
|
|
112
|
+
z-index: 999;
|
|
113
|
+
left: 50%;
|
|
114
|
+
transform: translateX(-50%);
|
|
115
|
+
.template {
|
|
116
|
+
height: 4.75rem;
|
|
117
|
+
width: 10rem;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
.job-center {
|
|
121
|
+
position: absolute;
|
|
122
|
+
z-index: 1001;
|
|
123
|
+
left: 1rem;
|
|
124
|
+
top: 5.5rem;
|
|
125
|
+
.template {
|
|
126
|
+
width: 29rem;
|
|
127
|
+
min-height: 45rem;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
.main-toolbar {
|
|
131
|
+
position: absolute;
|
|
132
|
+
z-index: 999;
|
|
133
|
+
left: 50%;
|
|
134
|
+
transform: translateX(-50%);
|
|
135
|
+
bottom: 1.5rem;
|
|
136
|
+
div {
|
|
137
|
+
width: 40rem;
|
|
138
|
+
height: 5.5rem;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// / <reference types="vite/client" />
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils'
|
|
2
|
+
import { describe, it, expect } from 'vitest'
|
|
3
|
+
import Example from '../src/components/Example.vue'
|
|
4
|
+
import App from '../src/App.vue'
|
|
5
|
+
|
|
6
|
+
describe('App.vue', () => {
|
|
7
|
+
it('text app.vue', () => {
|
|
8
|
+
const wrapper = mount(App)
|
|
9
|
+
// 渲染app.vue组件
|
|
10
|
+
const example = wrapper.findComponent(Example)
|
|
11
|
+
// 检查 example 组件是否存在
|
|
12
|
+
expect(example.exists()).toBe(true)
|
|
13
|
+
// 检查props 对不对
|
|
14
|
+
expect(example.props('msg')).toBe('Vite + Vue + TS example project')
|
|
15
|
+
})
|
|
16
|
+
})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils'
|
|
2
|
+
import { describe, it, expect } from 'vitest'
|
|
3
|
+
import Example from '../src/components/Example.vue'
|
|
4
|
+
|
|
5
|
+
describe('Example.vue', () => {
|
|
6
|
+
it('render this correct text', () => {
|
|
7
|
+
const wrapper = mount(Example, {
|
|
8
|
+
props: {
|
|
9
|
+
msg: 'Vite + Vue + TS example project'
|
|
10
|
+
}
|
|
11
|
+
})
|
|
12
|
+
expect(wrapper.find('h1').text()).toBe('Vite + Vue + TS example project')
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
it('increments the count whine button is clicked', async() => {
|
|
16
|
+
const wrapper = mount(Example)
|
|
17
|
+
await wrapper.find('fs-button').trigger('click')
|
|
18
|
+
expect(wrapper.find('div').text()).toBe('Count: 1')
|
|
19
|
+
})
|
|
20
|
+
})
|
|
21
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"composite": true,
|
|
4
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
5
|
+
"target": "ES2020",
|
|
6
|
+
"useDefineForClassFields": true,
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
|
|
11
|
+
/* Bundler mode */
|
|
12
|
+
"moduleResolution": "bundler",
|
|
13
|
+
"allowImportingTsExtensions": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"moduleDetection": "force",
|
|
17
|
+
"noEmit": true,
|
|
18
|
+
"jsx": "preserve",
|
|
19
|
+
|
|
20
|
+
/* Linting */
|
|
21
|
+
"strict": true,
|
|
22
|
+
"noUnusedLocals": true,
|
|
23
|
+
"noUnusedParameters": true,
|
|
24
|
+
"noFallthroughCasesInSwitch": true
|
|
25
|
+
},
|
|
26
|
+
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
|
|
27
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": "./",
|
|
4
|
+
"paths": {
|
|
5
|
+
"@/*":["src/*"]
|
|
6
|
+
},
|
|
7
|
+
"target": "ES2020",
|
|
8
|
+
"useDefineForClassFields": true,
|
|
9
|
+
"module": "ESNext",
|
|
10
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
|
|
13
|
+
/* Bundler mode */
|
|
14
|
+
"moduleResolution": "bundler",
|
|
15
|
+
"allowImportingTsExtensions": true,
|
|
16
|
+
"resolveJsonModule": true,
|
|
17
|
+
"isolatedModules": true,
|
|
18
|
+
"noEmit": true,
|
|
19
|
+
"jsx": "preserve",
|
|
20
|
+
"checkJs": false,
|
|
21
|
+
|
|
22
|
+
/* Linting */
|
|
23
|
+
"strict": true,
|
|
24
|
+
"noUnusedLocals": true,
|
|
25
|
+
"noUnusedParameters": true,
|
|
26
|
+
"noFallthroughCasesInSwitch": true,
|
|
27
|
+
"experimentalDecorators": true,
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "src/main.ts"],
|
|
31
|
+
"references": [{ "path": "./tsconfig.node.json" }] ,
|
|
32
|
+
"exclude": ["node_modules"]
|
|
33
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// / <reference types="vite/client" />
|
|
2
|
+
declare module '@fsdev/webcad'
|
|
3
|
+
declare module '*.vue' {
|
|
4
|
+
import type { DefineComponent } from 'vue'
|
|
5
|
+
const component: DefineComponent<{}, {}, any>
|
|
6
|
+
export default component
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare module 'vuex' {
|
|
10
|
+
export * from 'vuex/types/index.d.ts'
|
|
11
|
+
export * from 'vuex/types/helpers.d.ts'
|
|
12
|
+
export * from 'vuex/types/logger.d.ts'
|
|
13
|
+
export * from 'vuex/types/vue.d.ts'
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineConfig, loadEnv } from 'vite'
|
|
2
|
+
import vue from '@vitejs/plugin-vue'
|
|
3
|
+
import { resolve } from 'path'
|
|
4
|
+
import { viteStaticCopy } from 'vite-plugin-static-copy'
|
|
5
|
+
import { pluginWatchNodeModules } from './src/utils/plugins/watchNodeModules'
|
|
6
|
+
const __dirname = resolve()
|
|
7
|
+
import process from 'process'
|
|
8
|
+
|
|
9
|
+
// https://vitejs.dev/config/
|
|
10
|
+
export default ({ mode }) => {
|
|
11
|
+
const env = loadEnv(mode, process.cwd())
|
|
12
|
+
return defineConfig({
|
|
13
|
+
plugins: [vue(),
|
|
14
|
+
viteStaticCopy({
|
|
15
|
+
targets: [
|
|
16
|
+
{
|
|
17
|
+
src: './node_modules/@fsdev/webcad-js/dist-lib/webcad.umd.min.worker.js',
|
|
18
|
+
dest: './'
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
src: './node_modules/@fsdev/webcad-js/dist-lib/assets/**',
|
|
22
|
+
dest: './assets/'
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}),
|
|
26
|
+
pluginWatchNodeModules(['@fsdev/cutui-2d'])
|
|
27
|
+
],
|
|
28
|
+
optimizeDeps: {
|
|
29
|
+
force: true // 强制进行依赖预构建
|
|
30
|
+
},
|
|
31
|
+
base: './',
|
|
32
|
+
build: {
|
|
33
|
+
minify: 'terser',
|
|
34
|
+
terserOptions: {
|
|
35
|
+
compress: {
|
|
36
|
+
'drop_console': env.VITE_ENV === 'production',
|
|
37
|
+
'drop_debugger': env.VITE_ENV === 'production'
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
rollupOptions: {
|
|
41
|
+
output: {
|
|
42
|
+
chunkFileNames: 'cdn/[name].js',
|
|
43
|
+
entryFileNames: 'cdn/[name].js',
|
|
44
|
+
sourcemap: env.VITE_ENV !== 'production' ? 'inline' : false
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
sourcemap: env.VITE_ENV !== 'production'
|
|
48
|
+
},
|
|
49
|
+
resolve: {
|
|
50
|
+
alias: {
|
|
51
|
+
'@': resolve(__dirname, './src')
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
}
|