Skip to content

Commit

Permalink
fix(cli): optimized Baidu statistics, add varlet-cli-app generators t…
Browse files Browse the repository at this point in the history
…emplate, fix cli depend version

affects: @varlet/cli, @varlet/ui
  • Loading branch information
haoziqaq committed Sep 9, 2021
1 parent 9bf4945 commit 703517e
Show file tree
Hide file tree
Showing 33 changed files with 31,791 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit $1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install lint-staged
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
presets: [
[
'@varlet/cli/preset',
{
loose: process.env.NODE_ENV === 'compile',
},
],
],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="varlet-introduce">
<img class="varlet-introduce__image" src="./logo.svg" />
<div class="varlet-introduce__name">Basic</div>
<div class="varlet-introduce__des">一个组件库</div>
</div>

### 介绍

这里可以介绍一下组件库, 想写什么就写什么...
79 changes: 79 additions & 0 deletions packages/varlet-cli/generators/ts-sfc-varlet-cli-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"name": "basic-ui",
"version": "0.0.0",
"description": "A basic components library",
"module": "es/index.js",
"typings": "types/index.d.ts",
"vetur": {
"tags": "highlight/tags.json",
"attributes": "highlight/attributes.json"
},
"web-types": "highlight/web-types.json",
"keywords": [
"Vue",
"UI"
],
"files": [
"es",
"umd",
"highlight",
"types",
"README.md"
],
"license": "MIT",
"scripts": {
"husky": "husky install",
"dev": "varlet-cli dev",
"build": "varlet-cli build",
"compile": "varlet-cli compile",
"create": "varlet-cli create",
"test": "varlet-cli jest",
"test:watch": "varlet-cli jest -w"
},
"peerDependencies": {
"vue": "^3.0.0"
},
"devDependencies": {
"@varlet/cli": "^1.16.2",
"vue": "^3.1.4"
},
"dependencies": {
"@varlet/icons": "^1.0.0"
},
"lint-staged": {
"*.{ts,tsx,js,vue,less}": "prettier --write",
"*.{ts,tsx,js,vue}": "eslint --fix",
"*.{vue,css,less}": "stylelint --fix"
},
"eslintConfig": {
"root": true,
"ignorePatterns": [
"es/**",
"umd/**",
"site/**",
"src/*/__tests__/**",
".varlet/**"
],
"extends": [
"@varlet"
]
},
"stylelint": {
"extends": [
"@varlet/stylelint-config"
],
"ignoreFiles": [
"packages/varlet-cli/lib/**",
"packages/varlet-icons/dist/**",
"packages/varlet-ui/es/**",
"packages/varlet-ui/umd/**",
"packages/varlet-ui/site/**",
"packages/varlet-ui/coverage/**",
"packages/varlet-ui/highlight/**"
]
},
"browserslist": [
"Chrome >= 51",
"iOS >= 10"
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.md' {
const content: string
export default content
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare module '*.vue' {
import { defineComponent } from 'vue'

const component: ReturnType<typeof defineComponent>
export default component
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
'use strict'
;(self.webpackChunkbasic_ui = self.webpackChunkbasic_ui || []).push([
[146],
{
564: (n, e, l) => {
var a = l(645),
t = l.n(a)()(function (n) {
return n[1]
})
t.push([
n.id,
'.logo[data-v-49cd051b] {\n height: 100px;\n padding-top: 30px;\n margin-bottom: 20px;\n}\n.varlet-home__title[data-v-49cd051b] {\n margin: 0 0 16px;\n font-size: 32px;\n}\n.varlet-home__title[data-v-49cd051b],\n.varlet-home__desc[data-v-49cd051b] {\n padding-left: 16px;\n font-weight: normal;\n line-height: 1;\n -webkit-user-select: none;\n user-select: none;\n}\n.varlet-home__desc[data-v-49cd051b] {\n margin: 0 0 40px;\n color: rgba(69, 90, 100, 0.6);\n font-size: 14px;\n}\n.varlet-home__image[data-v-49cd051b] {\n width: 32px;\n height: 32px;\n}\n.varlet-home__image[data-v-49cd051b],\n.varlet-home__title span[data-v-49cd051b] {\n display: inline-block;\n vertical-align: middle;\n}\n.varlet-home__title span[data-v-49cd051b] {\n margin-left: 16px;\n}\n.var-cell[data-v-49cd051b] {\n cursor: pointer;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n transition: all 0.3s;\n color: #555;\n}\n.var-cell[data-v-49cd051b]:hover {\n color: var(--site-color-mobile-cell-hover);\n background: var(--site-color-mobile-cell-hover-background);\n}\n',
'',
]),
(e.Z = t)
},
146: (n, e, l) => {
l.r(e), l.d(e, { default: () => _ })
var a = l(252),
t = l(577)
;(0, a.dD)('data-v-49cd051b')
var o = { class: 'logo' },
i = { class: 'varlet-home__title' },
r = ['src'],
c = { class: 'varlet-home__desc' }
;(0, a.Cn)()
var d = l(473),
v = l(810),
s = l(262),
u = l(357),
p = {
name: 'AppHome',
setup() {
var n,
e,
l,
a,
t,
o,
i = (0, s.iH)(null !== (n = null == d ? void 0 : d.title) && void 0 !== n ? n : ''),
r = (0, s.iH)(null !== (e = null == d ? void 0 : d.logo) && void 0 !== e ? e : ''),
c = (0, s.iH)(
null !== (l = null == d || null === (a = d.mobile) || void 0 === a ? void 0 : a.title) && void 0 !== l
? l
: {}
),
p = (0, s.iH)(
null !== (t = null == d || null === (o = d.pc) || void 0 === o ? void 0 : o.menu) && void 0 !== t
? t
: []
).value.filter((n) => 2 === n.type),
h = (0, s.qj)(p),
g = (0, s.iH)('zh-CN'),
m = (0, s.iH)('mobile'),
_ = (0, v.tv)()
return (
(0, u.jS)((n) => {
g.value = n
}),
(0, u.Id)((n) => {
m.value = n
}),
{
components: h,
lang: g,
toComponent: (n) => {
_.push({ path: '/'.concat(n.doc), query: { language: g.value, platform: m.value, replace: n.doc } })
},
logo: r,
title: i,
description: c,
}
)
},
},
h = l(379),
g = l.n(h),
m = l(564)
g()(m.Z, { insert: 'head', singleton: !1 }),
m.Z.locals,
(p.render = function (n, e, l, d, v, s) {
var u = (0, a.up)('var-icon'),
p = (0, a.up)('var-cell'),
h = (0, a.Q2)('ripple')
return (
(0, a.wg)(),
(0, a.iD)(
a.HY,
null,
[
(0, a._)('div', o, [
(0, a._)('h1', i, [
(0, a._)('img', { class: 'varlet-home__image', src: d.logo }, null, 8, r),
(0, a._)('span', null, (0, t.zw)(d.title), 1),
]),
(0, a._)('h2', c, (0, t.zw)(d.description[d.lang]), 1),
]),
((0, a.wg)(!0),
(0, a.iD)(
a.HY,
null,
(0, a.Ko)(d.components, (n) =>
(0, a.wy)(
((0, a.wg)(),
(0, a.j4)(
p,
{ key: n.text, onClick: (e) => d.toComponent(n) },
{
extra: (0, a.w5)(() => [(0, a.Wm)(u, { name: 'chevron-right', size: '14' })]),
default: (0, a.w5)(() => [(0, a.Uk)((0, t.zw)(n.text[d.lang]), 1)]),
_: 2,
},
1032,
['onClick']
)),
[[h]]
)
),
128
)),
],
64
)
)
}),
(p.__scopeId = 'data-v-49cd051b')
var _ = p
},
},
])
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict'
;(self.webpackChunkbasic_ui = self.webpackChunkbasic_ui || []).push([
[169],
{
169: (s, i, e) => {
e.r(i), e.d(i, { default: () => d })
var a = e(252),
c = { class: 'varlet-site-doc' },
r = [
(0, a.uE)(
'<div class="varlet-introduce"><img class="varlet-introduce__image" src="https://cn.vuejs.org/images/logo.svg"><div class="varlet-introduce__name">Basic</div><div class="varlet-introduce__des">一个组件库</div></div><div class="card"><h3>介绍</h3><p>这里可以介绍一下组件库, 想写什么就写什么…</p></div>',
2
),
]
var d = {
render: function (s, i) {
return (0, a.wg)(), (0, a.iD)('div', c, r)
},
}
},
},
])
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
'use strict'
;(self.webpackChunkbasic_ui = self.webpackChunkbasic_ui || []).push([
[191],
{
956: (n, t, e) => {
var o = e(645),
r = e.n(o)()(function (n) {
return n[1]
})
r.push([n.id, '.app-type {\n width: 100%;\n padding: 15px 0;\n color: #888;\n font-size: 14px;\n}\n', '']),
(t.Z = r)
},
478: (n, t, e) => {
var o = e(645),
r = e.n(o)()(function (n) {
return n[1]
})
r.push([
n.id,
'.basic-button {\n display: flex;\n padding: 10px;\n background: #009688;\n color: #fff;\n outline: none;\n border: none;\n border-radius: 2px;\n cursor: pointer;\n}\n.basic-button:active {\n opacity: 0.3;\n}\n',
'',
]),
(t.Z = r)
},
191: (n, t, e) => {
e.r(t), e.d(t, { default: () => w })
var o = e(252),
r = (0, o.Uk)('基本使用'),
u = (0, o.Uk)('组件库从我开始'),
a = (0, o.Uk)('修改颜色'),
l = (0, o.Uk)('组件库从我开始'),
i = e(577),
p = (0, o.aZ)({
name: 'BButton',
props: { color: { type: String }, onClick: { type: Function } },
setup: (n) => ({
handleClick: (t) => {
var e
return null === (e = n.onClick) || void 0 === e ? void 0 : e.call(n, t)
},
}),
}),
s = e(379),
c = e.n(s),
d = e(478)
c()(d.Z, { insert: 'head', singleton: !1 }),
d.Z.locals,
(p.render = function (n, t, e, r, u, a) {
return (
(0, o.wg)(),
(0, o.iD)(
'button',
{ class: 'basic-button', style: (0, i.j5)({ background: n.color }) },
[(0, o.WI)(n.$slots, 'default')],
4
)
)
})
var f = p,
b = { class: 'app-type' },
k = (0, o.aZ)({ name: 'AppType' }),
v = e(956)
c()(v.Z, { insert: 'head', singleton: !1 }),
v.Z.locals,
(k.render = function (n, t, e, r, u, a) {
return (0, o.wg)(), (0, o.iD)('div', b, [(0, o.WI)(n.$slots, 'default')])
})
var g = k,
w = {
components: { [f.name]: f, AppType: g },
render: function (n, t, e, i, p, s) {
var c = (0, o.up)('app-type'),
d = (0, o.up)('b-button')
return (
(0, o.wg)(),
(0, o.iD)(
o.HY,
null,
[
(0, o.Wm)(c, null, { default: (0, o.w5)(() => [r]), _: 1 }),
(0, o.Wm)(d, null, { default: (0, o.w5)(() => [u]), _: 1 }),
(0, o.Wm)(c, null, { default: (0, o.w5)(() => [a]), _: 1 }),
(0, o.Wm)(d, { color: '#03A9F4' }, { default: (0, o.w5)(() => [l]), _: 1 }),
],
64
)
)
},
}
},
},
])
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict'
;(self.webpackChunkbasic_ui = self.webpackChunkbasic_ui || []).push([
[211],
{
211: (s, t, a) => {
a.r(t), a.d(t, { default: () => n })
var e = a(252),
d = { class: 'varlet-site-doc' },
l = [
(0, e.uE)(
'<h1>按钮</h1><div class="card"><h3>引入</h3><pre> <code>\n <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.3.2/styles/color-brewer.min.css">\n <span class="hljs-keyword">import</span> { createApp } <span class="hljs-keyword">from</span> <span class="hljs-string">&#39;vue&#39;</span>\n<span class="hljs-keyword">import</span> { Button } <span class="hljs-keyword">from</span> <span class="hljs-string">&#39;basic-ui&#39;</span>\n\ncreateApp().use(Button)\n\n </code>\n </pre></div><div class="card"><h3>基本使用</h3><pre> <code>\n <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.3.2/styles/color-brewer.min.css">\n <span class="hljs-tag">&lt;<span class="hljs-name">b-button</span>&gt;</span>组件库从我开始<span class="hljs-tag">&lt;/<span class="hljs-name">b-button</span>&gt;</span>\n\n </code>\n </pre></div><div class="card"><h3>主题色按钮</h3><pre> <code>\n <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.3.2/styles/color-brewer.min.css">\n <span class="hljs-tag">&lt;<span class="hljs-name">b-button</span> <span class="hljs-attr">color</span>=<span class="hljs-string">&quot;#009688&quot;</span>&gt;</span>组件库从我开始<span class="hljs-tag">&lt;/<span class="hljs-name">b-button</span>&gt;</span>\n\n </code>\n </pre></div><h2>API</h2><div class="card"><h3>属性</h3><table><thead><tr><th>参数</th><th>说明</th><th>类型</th><th>默认值</th></tr></thead><tbody><tr><td><code>color</code></td><td>按钮颜色</td><td><em>string</em></td><td><code>default</code></td></tr></tbody></table></div><div class="card"><h3>事件</h3><table><thead><tr><th>事件名</th><th>说明</th><th>参数</th></tr></thead><tbody><tr><td><code>click</code></td><td>点击按钮时触发</td><td><code>event: Event</code></td></tr></tbody></table></div><div class="card"><h3>插槽</h3><table><thead><tr><th>插槽名</th><th>说明</th><th>参数</th></tr></thead><tbody><tr><td><code>default</code></td><td>按钮内容</td><td><code>-</code></td></tr></tbody></table></div>',
8
),
]
var n = {
render: function (s, t) {
return (0, e.wg)(), (0, e.iD)('div', d, l)
},
}
},
},
])
Loading

0 comments on commit 703517e

Please sign in to comment.