@varlet/cli 3.8.2 → 3.8.3
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/README.md +0 -7
- package/README.zh-CN.md +0 -7
- package/lib/client/index.d.ts +1 -1
- package/lib/client/index.js +3 -3
- package/lib/node/bin.js +0 -7
- package/lib/node/commands/build.js +3 -3
- package/lib/node/commands/checklist.d.ts +1 -1
- package/lib/node/commands/checklist.js +3 -3
- package/lib/node/commands/compile.js +2 -2
- package/lib/node/commands/create.js +6 -6
- package/lib/node/commands/dev.js +6 -6
- package/lib/node/commands/gen.js +3 -3
- package/lib/node/commands/icons.js +5 -5
- package/lib/node/commands/preview.js +1 -1
- package/lib/node/compiler/compileModule.js +6 -6
- package/lib/node/compiler/compileSFC.js +5 -5
- package/lib/node/compiler/compileScript.js +6 -7
- package/lib/node/compiler/compileSiteEntry.js +7 -5
- package/lib/node/compiler/compileStyle.js +3 -3
- package/lib/node/compiler/compileStyleVars.js +2 -2
- package/lib/node/compiler/compileTemplateHighlight.js +3 -3
- package/lib/node/compiler/compileTypes.js +3 -3
- package/lib/node/config/varlet.config.js +3 -3
- package/lib/node/config/vite.config.js +4 -4
- package/lib/node/config/vitest.config.js +1 -1
- package/lib/node/index.d.ts +0 -1
- package/lib/node/index.js +0 -1
- package/lib/node/shared/constant.d.ts +0 -1
- package/lib/node/shared/constant.js +0 -1
- package/lib/node/shared/fsUtils.js +3 -3
- package/package.json +29 -29
- package/site/index.html +3 -2
- package/site/mobile/App.vue +8 -6
- package/site/mobile/AppHome.vue +2 -2
- package/site/mobile/main.ts +3 -4
- package/site/mobile.html +3 -2
- package/site/pc/App.vue +8 -4
- package/site/pc/Layout.vue +16 -10
- package/site/pc/components/AppAd.vue +1 -1
- package/site/pc/components/AppHeader.vue +5 -5
- package/site/pc/components/AppSidebar.vue +1 -1
- package/site/pc/components/code-example/CodeExample.vue +6 -6
- package/site/pc/main.ts +4 -5
- package/site/pc/pages/index/index.vue +13 -7
- package/template/create/example/locale/_index.ts +1 -1
- package/template/create/example/locale/index.ts +3 -3
- package/template/generators/base/{.eslintrc → eslint.config.js} +6 -7
- package/template/generators/base/package.json +5 -3
- package/template/generators/base/prettier.config.js +3 -0
- package/template/generators/base/shims/shims-md.d.ts +3 -3
- package/template/generators/base/shims/shims-vue.d.ts +4 -4
- package/template/generators/config/default/sfc/src/button/__tests__/index.spec.js +1 -1
- package/template/generators/config/default/sfc/src/button/example/index.vue +1 -1
- package/template/generators/config/default/sfc/src/button/index.ts +1 -1
- package/template/generators/config/default/sfc/src/utils/components.ts +1 -1
- package/template/generators/config/default/tsx/src/button/Button.tsx +0 -1
- package/template/generators/config/default/tsx/src/button/__tests__/index.spec.js +1 -1
- package/template/generators/config/default/tsx/src/button/example/index.vue +1 -1
- package/template/generators/config/default/tsx/src/button/index.ts +1 -1
- package/template/generators/config/default/tsx/src/utils/components.ts +1 -1
- package/template/generators/config/i18n/sfc/src/button/Button.vue +1 -2
- package/template/generators/config/i18n/sfc/src/button/__tests__/index.spec.js +1 -1
- package/template/generators/config/i18n/sfc/src/button/example/BasicUse.vue +1 -1
- package/template/generators/config/i18n/sfc/src/button/example/ModifyColor.vue +1 -1
- package/template/generators/config/i18n/sfc/src/button/example/index.vue +1 -1
- package/template/generators/config/i18n/sfc/src/button/example/locale/index.ts +3 -3
- package/template/generators/config/i18n/sfc/src/button/index.ts +1 -1
- package/template/generators/config/i18n/sfc/src/locale/__tests__/index.spec.js +1 -1
- package/template/generators/config/i18n/sfc/src/utils/components.ts +1 -1
- package/template/generators/config/i18n/tsx/src/button/Button.tsx +0 -2
- package/template/generators/config/i18n/tsx/src/button/__tests__/index.spec.js +1 -1
- package/template/generators/config/i18n/tsx/src/button/example/BasicUse.vue +1 -1
- package/template/generators/config/i18n/tsx/src/button/example/ModifyColor.vue +1 -1
- package/template/generators/config/i18n/tsx/src/button/example/index.vue +1 -1
- package/template/generators/config/i18n/tsx/src/button/example/locale/index.ts +3 -3
- package/template/generators/config/i18n/tsx/src/button/index.ts +1 -1
- package/template/generators/config/i18n/tsx/src/locale/__tests__/index.spec.js +1 -1
- package/template/generators/config/i18n/tsx/src/utils/components.ts +1 -1
- package/lib/node/commands/lint.d.ts +0 -1
- package/lib/node/commands/lint.js +0 -42
- package/template/generators/base/.prettierrc +0 -5
package/site/pc/App.vue
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import config from '@config'
|
|
3
2
|
import { defineComponent, onMounted, ref } from 'vue'
|
|
4
|
-
import
|
|
3
|
+
import config from '@config'
|
|
4
|
+
import { getMobileIndex, getPCLocationInfo } from '@varlet/cli/client'
|
|
5
5
|
import { isPhone } from '../utils'
|
|
6
6
|
|
|
7
7
|
export default defineComponent({
|
|
@@ -31,10 +31,14 @@ export default defineComponent({
|
|
|
31
31
|
|
|
32
32
|
<style lang="less">
|
|
33
33
|
body {
|
|
34
|
-
transition:
|
|
34
|
+
transition:
|
|
35
|
+
background-color 0.25s,
|
|
36
|
+
box-shadow 0.25s;
|
|
35
37
|
|
|
36
38
|
* {
|
|
37
|
-
transition:
|
|
39
|
+
transition:
|
|
40
|
+
background-color 0.25s,
|
|
41
|
+
box-shadow 0.25s;
|
|
38
42
|
}
|
|
39
43
|
}
|
|
40
44
|
</style>
|
package/site/pc/Layout.vue
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
+
import { nextTick, onMounted, ref, watch, type Ref } from 'vue'
|
|
2
3
|
import config from '@config'
|
|
3
|
-
import
|
|
4
|
-
import AppMobile from './components/AppMobile.vue'
|
|
5
|
-
import AppHeader from './components/AppHeader.vue'
|
|
6
|
-
import AppSidebar from './components/AppSidebar.vue'
|
|
4
|
+
import { getPCLocationInfo } from '@varlet/cli/client'
|
|
7
5
|
import { Context } from '@varlet/ui'
|
|
8
|
-
import { nextTick, onMounted, ref, watch, type Ref } from 'vue'
|
|
9
6
|
import { useRoute } from 'vue-router'
|
|
10
|
-
import { getPCLocationInfo } from '@varlet/cli/client'
|
|
11
|
-
import { MenuTypes, type Menu } from '../utils'
|
|
12
7
|
import { type SiteContext } from '../types'
|
|
8
|
+
import { MenuTypes, type Menu } from '../utils'
|
|
9
|
+
import AppAd from './components/AppAd.vue'
|
|
10
|
+
import AppHeader from './components/AppHeader.vue'
|
|
11
|
+
import AppMobile from './components/AppMobile.vue'
|
|
12
|
+
import AppSidebar from './components/AppSidebar.vue'
|
|
13
13
|
|
|
14
14
|
const context = Context as SiteContext
|
|
15
15
|
const menu: Ref<Menu[]> = ref(config?.pc?.menu ?? [])
|
|
@@ -91,7 +91,7 @@ watch(
|
|
|
91
91
|
useMobile.value = menu.value.find((item) => item.doc === _menuName)?.useMobile ?? config?.useMobile
|
|
92
92
|
document.title = config?.pc?.title[lang] as string
|
|
93
93
|
},
|
|
94
|
-
{ immediate: true }
|
|
94
|
+
{ immediate: true },
|
|
95
95
|
)
|
|
96
96
|
</script>
|
|
97
97
|
|
|
@@ -227,7 +227,10 @@ iframe {
|
|
|
227
227
|
border-top: 6px solid var(--site-config-color-introduce-border);
|
|
228
228
|
border-radius: 2px;
|
|
229
229
|
background: var(--site-config-color-bar);
|
|
230
|
-
box-shadow:
|
|
230
|
+
box-shadow:
|
|
231
|
+
0 3px 1px -2px rgba(0, 0, 0, 0.2),
|
|
232
|
+
0 2px 2px 0 rgba(0, 0, 0, 0.14),
|
|
233
|
+
0 1px 5px 0 rgba(0, 0, 0, 0.12);
|
|
231
234
|
|
|
232
235
|
&__row {
|
|
233
236
|
display: flex;
|
|
@@ -448,7 +451,10 @@ iframe {
|
|
|
448
451
|
background: var(--site-config-color-bar);
|
|
449
452
|
padding: 20px;
|
|
450
453
|
margin-bottom: 30px;
|
|
451
|
-
box-shadow:
|
|
454
|
+
box-shadow:
|
|
455
|
+
0 2px 1px -1px rgba(0, 0, 0, 0.2),
|
|
456
|
+
0 1px 1px 0 rgba(0, 0, 0, 0.14),
|
|
457
|
+
0 1px 3px 0 rgba(0, 0, 0, 0.12);
|
|
452
458
|
|
|
453
459
|
&:first-child {
|
|
454
460
|
margin-top: 30px;
|
|
@@ -114,12 +114,12 @@
|
|
|
114
114
|
</template>
|
|
115
115
|
|
|
116
116
|
<script lang="ts">
|
|
117
|
+
import { computed, defineComponent, ref } from 'vue'
|
|
118
|
+
import type { ComputedRef, Ref } from 'vue'
|
|
117
119
|
import config from '@config'
|
|
118
|
-
import {
|
|
119
|
-
import { getBrowserTheme, getPCLocationInfo, Theme, watchTheme, setTheme } from '@varlet/cli/client'
|
|
120
|
-
import { removeEmpty } from '../../utils'
|
|
120
|
+
import { getBrowserTheme, getPCLocationInfo, setTheme, Theme, watchTheme } from '@varlet/cli/client'
|
|
121
121
|
import { useRouter } from 'vue-router'
|
|
122
|
-
import
|
|
122
|
+
import { removeEmpty } from '../../utils'
|
|
123
123
|
|
|
124
124
|
export default defineComponent({
|
|
125
125
|
name: 'AppHeader',
|
|
@@ -136,7 +136,7 @@ export default defineComponent({
|
|
|
136
136
|
const versions = config?.pc?.header?.versions
|
|
137
137
|
const isShowVersion: Ref<boolean> = ref(!!versions)
|
|
138
138
|
const versionItems: Ref<Array<Record<string, any>>> = ref(
|
|
139
|
-
(versions ?? []).find((i: any) => window.location.host.includes(i.name))?.items ?? versions?.[0]?.items ?? []
|
|
139
|
+
(versions ?? []).find((i: any) => window.location.host.includes(i.name))?.items ?? versions?.[0]?.items ?? [],
|
|
140
140
|
)
|
|
141
141
|
const playground: Ref<string> = ref(config?.pc?.header?.playground)
|
|
142
142
|
const github: Ref<string> = ref(config?.pc?.header?.github)
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
</template>
|
|
32
32
|
|
|
33
33
|
<script setup lang="ts">
|
|
34
|
-
import { MenuTypes, type Menu } from '../../utils'
|
|
35
34
|
import { reactive } from 'vue'
|
|
35
|
+
import { MenuTypes, type Menu } from '../../utils'
|
|
36
36
|
|
|
37
37
|
const props = defineProps<{ menu: Menu[]; menuName: string; language: string }>()
|
|
38
38
|
const emit = defineEmits(['change'])
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
</template>
|
|
41
41
|
|
|
42
42
|
<script lang="ts">
|
|
43
|
+
import { defineComponent, nextTick, onMounted, ref, type Ref } from 'vue'
|
|
43
44
|
import config from '@config'
|
|
44
|
-
import Clipboard from 'clipboard'
|
|
45
|
-
import { Context, Snackbar } from '@varlet/ui'
|
|
46
|
-
import { defineComponent, nextTick, ref, onMounted, type Ref } from 'vue'
|
|
47
|
-
import { doubleRaf } from '@varlet/shared'
|
|
48
45
|
import { getBrowserTheme, getPCLocationInfo } from '@varlet/cli/client'
|
|
49
|
-
import {
|
|
46
|
+
import { doubleRaf } from '@varlet/shared'
|
|
47
|
+
import { Context, Snackbar } from '@varlet/ui'
|
|
48
|
+
import Clipboard from 'clipboard'
|
|
50
49
|
import { type SiteContext } from '../../../types'
|
|
50
|
+
import { utoa } from '../../../utils'
|
|
51
51
|
|
|
52
52
|
const context = Context as SiteContext
|
|
53
53
|
|
|
@@ -70,7 +70,7 @@ export default defineComponent({
|
|
|
70
70
|
const clipboard: Ref = ref(config?.pc?.clipboard || {})
|
|
71
71
|
const height: Ref<number> = ref(-1)
|
|
72
72
|
const playground: Ref<string | undefined> = ref(
|
|
73
|
-
!props.playgroundIgnore ? config?.pc?.header?.playground : undefined
|
|
73
|
+
!props.playgroundIgnore ? config?.pc?.header?.playground : undefined,
|
|
74
74
|
)
|
|
75
75
|
let timer: any = null
|
|
76
76
|
|
package/site/pc/main.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import routes from '@pc-routes'
|
|
1
|
+
import { createApp } from 'vue'
|
|
3
2
|
import config from '@config'
|
|
3
|
+
import routes from '@pc-routes'
|
|
4
4
|
import Varlet, { Snackbar } from '@varlet/ui'
|
|
5
|
-
import CodeExample from './components/code-example'
|
|
6
|
-
import { createApp } from 'vue'
|
|
7
5
|
import { createRouter, createWebHashHistory } from 'vue-router'
|
|
8
|
-
|
|
6
|
+
import App from './App.vue'
|
|
7
|
+
import CodeExample from './components/code-example'
|
|
9
8
|
import '@varlet/ui/es/style'
|
|
10
9
|
import '@varlet/touch-emulator'
|
|
11
10
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import config from '@config'
|
|
3
|
-
import AppHeader from '../../components/AppHeader.vue'
|
|
4
|
-
import AppAd from '../../components/AppAd.vue'
|
|
5
2
|
import { ref, watch, type Ref } from 'vue'
|
|
3
|
+
import config from '@config'
|
|
4
|
+
import { getBrowserTheme, getPCLocationInfo, onThemeChange, setTheme, watchTheme, type Theme } from '@varlet/cli/client'
|
|
6
5
|
import { useRoute, useRouter } from 'vue-router'
|
|
7
|
-
import
|
|
6
|
+
import AppAd from '../../components/AppAd.vue'
|
|
7
|
+
import AppHeader from '../../components/AppHeader.vue'
|
|
8
8
|
|
|
9
9
|
const route = useRoute()
|
|
10
10
|
const router = useRouter()
|
|
@@ -58,7 +58,7 @@ watch(
|
|
|
58
58
|
language.value = getPCLocationInfo().language
|
|
59
59
|
setLocale()
|
|
60
60
|
},
|
|
61
|
-
{ immediate: true }
|
|
61
|
+
{ immediate: true },
|
|
62
62
|
)
|
|
63
63
|
</script>
|
|
64
64
|
|
|
@@ -275,7 +275,10 @@ watch(
|
|
|
275
275
|
padding: 20px;
|
|
276
276
|
border-radius: 12px;
|
|
277
277
|
background: var(--site-config-color-index-page-feature-background);
|
|
278
|
-
box-shadow:
|
|
278
|
+
box-shadow:
|
|
279
|
+
0 3px 1px -2px rgba(0, 0, 0, 0.2),
|
|
280
|
+
0 2px 2px 0 rgba(0, 0, 0, 0.14),
|
|
281
|
+
0 1px 5px 0 rgba(0, 0, 0, 0.12);
|
|
279
282
|
}
|
|
280
283
|
|
|
281
284
|
&__feature-description {
|
|
@@ -321,7 +324,10 @@ watch(
|
|
|
321
324
|
padding: 30px 20px;
|
|
322
325
|
border-radius: 12px;
|
|
323
326
|
background: var(--site-config-color-index-page-feature-background);
|
|
324
|
-
box-shadow:
|
|
327
|
+
box-shadow:
|
|
328
|
+
0 3px 1px -2px rgba(0, 0, 0, 0.2),
|
|
329
|
+
0 2px 2px 0 rgba(0, 0, 0, 0.14),
|
|
330
|
+
0 1px 5px 0 rgba(0, 0, 0, 0.12);
|
|
325
331
|
|
|
326
332
|
&-avatar {
|
|
327
333
|
width: 80px;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
// lib
|
|
3
|
-
import
|
|
3
|
+
import { add as _add, use as _use, useLocale } from '../../../locale'
|
|
4
4
|
import _enCN from '../../../locale/en-US'
|
|
5
|
+
import _zhCN from '../../../locale/zh-CN'
|
|
6
|
+
import enUS from './en-US'
|
|
5
7
|
// mobile example doc
|
|
6
8
|
import zhCN from './zh-CN'
|
|
7
|
-
import enUS from './en-US'
|
|
8
|
-
import { useLocale, add as _add, use as _use } from '../../../locale'
|
|
9
9
|
|
|
10
10
|
const { add, use: exampleUse, t, merge } = useLocale()
|
|
11
11
|
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const { defineConfig } = require("@configurajs/eslint");
|
|
2
|
+
|
|
3
|
+
module.export = defineConfig({
|
|
4
|
+
ignores: [
|
|
4
5
|
"lib/**",
|
|
5
6
|
"es/**",
|
|
6
7
|
"umd/**",
|
|
7
8
|
"site/**",
|
|
8
9
|
"public/**",
|
|
9
|
-
"src/*/__tests__/**",
|
|
10
10
|
"coverage/**",
|
|
11
11
|
"highlight/**",
|
|
12
12
|
"types/index.d.ts",
|
|
13
|
-
".varlet/**"
|
|
13
|
+
".varlet/**",
|
|
14
14
|
],
|
|
15
|
-
|
|
16
|
-
}
|
|
15
|
+
});
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"build": "varlet-cli build",
|
|
26
26
|
"preview": "varlet-cli preview",
|
|
27
27
|
"compile": "varlet-cli compile",
|
|
28
|
-
"lint": "
|
|
28
|
+
"lint": "eslint . --fix",
|
|
29
|
+
"format": "prettier --write .",
|
|
29
30
|
"changelog": "varlet-cli changelog",
|
|
30
31
|
"release": "pnpm compile && varlet-cli release",
|
|
31
32
|
"test": "varlet-cli test",
|
|
@@ -38,7 +39,6 @@
|
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@varlet/cli": "workspace:*",
|
|
41
|
-
"@varlet/eslint-config": "workspace:*",
|
|
42
42
|
"@varlet/icons": "workspace:*",
|
|
43
43
|
"@varlet/touch-emulator": "workspace:*",
|
|
44
44
|
"@varlet/shared": "workspace:*",
|
|
@@ -46,10 +46,12 @@
|
|
|
46
46
|
"@vue/test-utils": "2.4.1",
|
|
47
47
|
"@vue/runtime-core": "3.4.21",
|
|
48
48
|
"@vitest/coverage-istanbul": "2.0.5",
|
|
49
|
+
"@configurajs/eslint": "*",
|
|
50
|
+
"@configurajs/prettier": "*",
|
|
49
51
|
"jsdom": "24.1.1",
|
|
50
52
|
"vitest": "2.0.5",
|
|
51
53
|
"clipboard": "^2.0.6",
|
|
52
|
-
"eslint": "^
|
|
54
|
+
"eslint": "^9.17.0",
|
|
53
55
|
"lint-staged": "^10.5.0",
|
|
54
56
|
"live-server": "^1.2.1",
|
|
55
57
|
"prettier": "^2.8.8",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
const content: string
|
|
3
|
-
export default content
|
|
1
|
+
declare module "*.md" {
|
|
2
|
+
const content: string;
|
|
3
|
+
export default content;
|
|
4
4
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
import { defineComponent } from
|
|
1
|
+
declare module "*.vue" {
|
|
2
|
+
import { defineComponent } from "vue";
|
|
3
3
|
|
|
4
|
-
const component: ReturnType<typeof defineComponent
|
|
5
|
-
export default component
|
|
4
|
+
const component: ReturnType<typeof defineComponent>;
|
|
5
|
+
export default component;
|
|
6
6
|
}
|
|
@@ -7,10 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
<script lang="ts">
|
|
9
9
|
import { defineComponent, PropType } from 'vue'
|
|
10
|
-
import { createNamespace } from '../utils/components'
|
|
11
|
-
|
|
12
10
|
// i18n for component's internal
|
|
13
11
|
import { t } from '../locale'
|
|
12
|
+
import { createNamespace } from '../utils/components'
|
|
14
13
|
|
|
15
14
|
const { name, n, classes } = createNamespace('button')
|
|
16
15
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// lib
|
|
2
|
-
import
|
|
2
|
+
import { add as _add, use as _use, useLocale } from '../../../locale'
|
|
3
3
|
import _enCN from '../../../locale/en-US'
|
|
4
|
+
import _zhCN from '../../../locale/zh-CN'
|
|
5
|
+
import enUS from './en-US'
|
|
4
6
|
// mobile example doc
|
|
5
7
|
import zhCN from './zh-CN'
|
|
6
|
-
import enUS from './en-US'
|
|
7
|
-
import { useLocale, add as _add, use as _use } from '../../../locale'
|
|
8
8
|
|
|
9
9
|
const { add, use: exampleUse, t, merge } = useLocale()
|
|
10
10
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// lib
|
|
2
|
-
import
|
|
2
|
+
import { add as _add, use as _use, useLocale } from '../../../locale'
|
|
3
3
|
import _enCN from '../../../locale/en-US'
|
|
4
|
+
import _zhCN from '../../../locale/zh-CN'
|
|
5
|
+
import enUS from './en-US'
|
|
4
6
|
// mobile example doc
|
|
5
7
|
import zhCN from './zh-CN'
|
|
6
|
-
import enUS from './en-US'
|
|
7
|
-
import { useLocale, add as _add, use as _use } from '../../../locale'
|
|
8
8
|
|
|
9
9
|
const { add, use: exampleUse, t, merge } = useLocale()
|
|
10
10
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function lint(): Promise<void>;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { x } from 'tinyexec';
|
|
2
|
-
import { createSpinner } from 'nanospinner';
|
|
3
|
-
import { CWD, ESLINT_EXTENSIONS } from '../shared/constant.js';
|
|
4
|
-
import { isDir } from '../shared/fsUtils.js';
|
|
5
|
-
import { resolve } from 'path';
|
|
6
|
-
export async function lint() {
|
|
7
|
-
const spinner = createSpinner();
|
|
8
|
-
try {
|
|
9
|
-
spinner.start({ text: 'prettier starting...' });
|
|
10
|
-
await x('prettier', ['--write', '--cache', '.'], { nodeOptions: { stdio: 'inherit' }, throwOnError: true });
|
|
11
|
-
spinner.success({ text: 'prettier success' });
|
|
12
|
-
spinner.start({ text: 'eslint starting...' });
|
|
13
|
-
const eslintPatterns = [
|
|
14
|
-
'./src',
|
|
15
|
-
'./packages/varlet-cli/src',
|
|
16
|
-
'./packages/varlet-ui/src',
|
|
17
|
-
'./packages/varlet-shared/src',
|
|
18
|
-
'./packages/varlet-vite-plugins/src',
|
|
19
|
-
'./packages/varlet-use/src',
|
|
20
|
-
'./packages/varlet-touch-emulator',
|
|
21
|
-
'./packages/varlet-vscode-extension/src',
|
|
22
|
-
'./packages/varlet-ui-playground/src',
|
|
23
|
-
'./packages/varlet-import-resolver/src',
|
|
24
|
-
'./packages/varlet-vite-plugins/src',
|
|
25
|
-
'./packages/varlet-preset-unocss/src',
|
|
26
|
-
'./packages/varlet-preset-tailwindcss/src',
|
|
27
|
-
];
|
|
28
|
-
const { stdout } = await x('eslint', [
|
|
29
|
-
...eslintPatterns.filter((pattern) => isDir(resolve(CWD, pattern))),
|
|
30
|
-
'--fix',
|
|
31
|
-
'--cache',
|
|
32
|
-
'--ext',
|
|
33
|
-
ESLINT_EXTENSIONS.join(),
|
|
34
|
-
], { nodeOptions: { stdio: 'inherit' }, throwOnError: true });
|
|
35
|
-
const type = stdout ? 'warn' : 'success';
|
|
36
|
-
spinner[type]({ text: stdout || 'eslint success' });
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
spinner.error({ text: e.toString() });
|
|
40
|
-
process.exit(1);
|
|
41
|
-
}
|
|
42
|
-
}
|