@varlet/cli 2.13.1-alpha.1689619056304 → 2.13.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.
- package/package.json +7 -7
- package/template/create/index.ts.ejs +2 -5
- package/template/generators/config/default/sfc/src/button/index.ts +2 -4
- package/template/generators/config/default/sfc/src/utils/components.ts +17 -0
- package/template/generators/config/default/tsx/src/button/index.ts +3 -5
- package/template/generators/config/default/tsx/src/utils/components.ts +17 -0
- package/template/generators/config/i18n/sfc/src/button/index.ts +2 -4
- package/template/generators/config/i18n/sfc/src/utils/components.ts +17 -0
- package/template/generators/config/i18n/tsx/src/button/index.ts +2 -4
- package/template/generators/config/i18n/tsx/src/utils/components.ts +17 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/cli",
|
|
3
|
-
"version": "2.13.1
|
|
3
|
+
"version": "2.13.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "cli of varlet",
|
|
6
6
|
"bin": {
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"vite": "4.3.5",
|
|
71
71
|
"vue": "3.3.4",
|
|
72
72
|
"webfont": "^9.0.0",
|
|
73
|
-
"@varlet/shared": "2.13.1
|
|
74
|
-
"@varlet/vite-plugins": "2.13.1
|
|
73
|
+
"@varlet/shared": "2.13.1",
|
|
74
|
+
"@varlet/vite-plugins": "2.13.1"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@types/babel__core": "^7.20.1",
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
"@types/semver": "^7.3.9",
|
|
87
87
|
"@types/sharp": "0.31.1",
|
|
88
88
|
"rimraf": "^5.0.1",
|
|
89
|
-
"@varlet/icons": "2.13.1
|
|
90
|
-
"@varlet/touch-emulator": "2.13.1
|
|
89
|
+
"@varlet/icons": "2.13.1",
|
|
90
|
+
"@varlet/touch-emulator": "2.13.1"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
93
|
"@vue/runtime-core": "3.3.4",
|
|
@@ -97,8 +97,8 @@
|
|
|
97
97
|
"lodash-es": "^4.17.21",
|
|
98
98
|
"vue": "3.3.4",
|
|
99
99
|
"vue-router": "4.2.0",
|
|
100
|
-
"@varlet/icons": "2.13.1
|
|
101
|
-
"@varlet/touch-emulator": "2.13.1
|
|
100
|
+
"@varlet/icons": "2.13.1",
|
|
101
|
+
"@varlet/touch-emulator": "2.13.1"
|
|
102
102
|
},
|
|
103
103
|
"scripts": {
|
|
104
104
|
"dev": "tsc --watch",
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
// Component entry, the folder where the file exists will be exposed to the user
|
|
2
1
|
import <%- bigCamelizeName %> from './<%- bigCamelizeName %><%- style === 'vue' ? '.vue' : '' %>'
|
|
3
|
-
import
|
|
2
|
+
import { withInstall } from '../utils/components'
|
|
4
3
|
|
|
5
|
-
<%- bigCamelizeName
|
|
6
|
-
app.component(<%- bigCamelizeName %>.name, <%- bigCamelizeName %>)
|
|
7
|
-
}
|
|
4
|
+
withInstall(<%- bigCamelizeName %>)
|
|
8
5
|
|
|
9
6
|
export const _<%- bigCamelizeName %>Component = <%- bigCamelizeName %>
|
|
10
7
|
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import type { App } from 'vue'
|
|
2
1
|
import Button from './Button.vue'
|
|
2
|
+
import { withInstall } from '../utils/components'
|
|
3
3
|
|
|
4
|
-
Button
|
|
5
|
-
app.component(Button.name, Button)
|
|
6
|
-
}
|
|
4
|
+
withInstall(Button)
|
|
7
5
|
|
|
8
6
|
export const _ButtonComponent = Button
|
|
9
7
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Component, Plugin, App } from 'vue'
|
|
2
|
+
|
|
3
|
+
export type ComponentWithInstall<T> = T & Plugin
|
|
4
|
+
|
|
5
|
+
export function withInstall<T = Component>(component: Component, target?: T): ComponentWithInstall<T> {
|
|
6
|
+
const componentWithInstall = target ?? component
|
|
7
|
+
|
|
8
|
+
;(componentWithInstall as ComponentWithInstall<T>).install = function (app: App) {
|
|
9
|
+
const { name } = component
|
|
10
|
+
|
|
11
|
+
if (name) {
|
|
12
|
+
app.component(name, component)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return componentWithInstall as ComponentWithInstall<T>
|
|
17
|
+
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type { App } from 'vue'
|
|
2
1
|
import Button from './Button'
|
|
2
|
+
import { withInstall } from '../utils/components'
|
|
3
3
|
|
|
4
|
-
Button
|
|
5
|
-
app.component(Button.name, Button)
|
|
6
|
-
}
|
|
4
|
+
withInstall(Button)
|
|
7
5
|
|
|
8
6
|
export const _ButtonComponent = Button
|
|
9
7
|
|
|
10
|
-
export default Button
|
|
8
|
+
export default Button
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Component, Plugin, App } from 'vue'
|
|
2
|
+
|
|
3
|
+
export type ComponentWithInstall<T> = T & Plugin
|
|
4
|
+
|
|
5
|
+
export function withInstall<T = Component>(component: Component, target?: T): ComponentWithInstall<T> {
|
|
6
|
+
const componentWithInstall = target ?? component
|
|
7
|
+
|
|
8
|
+
;(componentWithInstall as ComponentWithInstall<T>).install = function (app: App) {
|
|
9
|
+
const { name } = component
|
|
10
|
+
|
|
11
|
+
if (name) {
|
|
12
|
+
app.component(name, component)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return componentWithInstall as ComponentWithInstall<T>
|
|
17
|
+
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import type { App } from 'vue'
|
|
2
1
|
import Button from './Button.vue'
|
|
2
|
+
import { withInstall } from '../utils/components'
|
|
3
3
|
|
|
4
|
-
Button
|
|
5
|
-
app.component(Button.name, Button)
|
|
6
|
-
}
|
|
4
|
+
withInstall(Button)
|
|
7
5
|
|
|
8
6
|
export const _ButtonComponent = Button
|
|
9
7
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Component, Plugin, App } from 'vue'
|
|
2
|
+
|
|
3
|
+
export type ComponentWithInstall<T> = T & Plugin
|
|
4
|
+
|
|
5
|
+
export function withInstall<T = Component>(component: Component, target?: T): ComponentWithInstall<T> {
|
|
6
|
+
const componentWithInstall = target ?? component
|
|
7
|
+
|
|
8
|
+
;(componentWithInstall as ComponentWithInstall<T>).install = function (app: App) {
|
|
9
|
+
const { name } = component
|
|
10
|
+
|
|
11
|
+
if (name) {
|
|
12
|
+
app.component(name, component)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return componentWithInstall as ComponentWithInstall<T>
|
|
17
|
+
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import type { App } from 'vue'
|
|
2
1
|
import Button from './Button'
|
|
2
|
+
import { withInstall } from '../utils/components'
|
|
3
3
|
|
|
4
|
-
Button
|
|
5
|
-
app.component(Button.name, Button)
|
|
6
|
-
}
|
|
4
|
+
withInstall(Button)
|
|
7
5
|
|
|
8
6
|
export const _ButtonComponent = Button
|
|
9
7
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Component, Plugin, App } from 'vue'
|
|
2
|
+
|
|
3
|
+
export type ComponentWithInstall<T> = T & Plugin
|
|
4
|
+
|
|
5
|
+
export function withInstall<T = Component>(component: Component, target?: T): ComponentWithInstall<T> {
|
|
6
|
+
const componentWithInstall = target ?? component
|
|
7
|
+
|
|
8
|
+
;(componentWithInstall as ComponentWithInstall<T>).install = function (app: App) {
|
|
9
|
+
const { name } = component
|
|
10
|
+
|
|
11
|
+
if (name) {
|
|
12
|
+
app.component(name, component)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return componentWithInstall as ComponentWithInstall<T>
|
|
17
|
+
}
|