@varlet/cli 2.20.0-alpha.1701880061001 → 2.20.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/lib/node/bin.js +6 -2
- package/lib/node/commands/checklist.js +1 -1
- package/lib/node/config/varlet.default.config.js +1 -0
- package/lib/node/index.d.ts +0 -1
- package/lib/node/index.js +0 -1
- package/package.json +10 -10
- package/site/pc/components/AppHeader.vue +5 -0
- package/site/pc/components/AppSidebar.vue +2 -1
- package/template/generators/base/package.json +1 -1
- package/lib/node/commands/commitLint.d.ts +0 -4
- package/lib/node/commands/commitLint.js +0 -48
package/lib/node/bin.js
CHANGED
|
@@ -126,10 +126,14 @@ program
|
|
|
126
126
|
return release(options);
|
|
127
127
|
});
|
|
128
128
|
program
|
|
129
|
-
.command('commit-lint
|
|
129
|
+
.command('commit-lint')
|
|
130
|
+
.option('-p --commitMessagePath <path>', 'Git commit message path')
|
|
131
|
+
.option('-r --commitMessageRe <reg>', 'Validate the regular of whether the commit message passes')
|
|
132
|
+
.option('-e --errorMessage <message>', 'Validation failed to display error messages')
|
|
133
|
+
.option('-w --warningMessage <message>', 'Validation failed to display warning messages')
|
|
130
134
|
.description('Lint commit message')
|
|
131
135
|
.action(async (options) => {
|
|
132
|
-
const { commitLint } = await import('
|
|
136
|
+
const { commitLint } = await import('@varlet/release');
|
|
133
137
|
return commitLint(options);
|
|
134
138
|
});
|
|
135
139
|
program
|
|
@@ -2,7 +2,7 @@ import fse from 'fs-extra';
|
|
|
2
2
|
import markdownIt from 'markdown-it';
|
|
3
3
|
import logger from '../shared/logger.js';
|
|
4
4
|
import { CHECKLIST_FILE } from '../shared/constant.js';
|
|
5
|
-
import { COMMIT_MESSAGE_RE, isVersionCommitMessage, getCommitMessage } from '
|
|
5
|
+
import { COMMIT_MESSAGE_RE, isVersionCommitMessage, getCommitMessage } from '@varlet/release';
|
|
6
6
|
const { readFileSync, existsSync } = fse;
|
|
7
7
|
const blockRE = /<h3>(.|\n|\r)+?<\/ul>/g;
|
|
8
8
|
const typeRE = /<h3>(.+)<\/h3>/;
|
|
@@ -420,6 +420,7 @@ export default defineConfig({
|
|
|
420
420
|
},
|
|
421
421
|
versions: null,
|
|
422
422
|
github: 'https://github.com/varletjs/varlet',
|
|
423
|
+
changelog: 'https://github.com/varletjs/varlet/blob/main/CHANGELOG.md',
|
|
423
424
|
playground: 'https://varlet.gitee.io/varlet-ui-playground',
|
|
424
425
|
darkMode: true,
|
|
425
426
|
},
|
package/lib/node/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export * from '@varlet/release';
|
|
|
3
3
|
export * from './commands/dev.js';
|
|
4
4
|
export * from './commands/build.js';
|
|
5
5
|
export * from './commands/compile.js';
|
|
6
|
-
export * from './commands/commitLint.js';
|
|
7
6
|
export * from './commands/gen.js';
|
|
8
7
|
export * from './commands/test.js';
|
|
9
8
|
export * from './commands/create.js';
|
package/lib/node/index.js
CHANGED
|
@@ -3,7 +3,6 @@ export * from '@varlet/release';
|
|
|
3
3
|
export * from './commands/dev.js';
|
|
4
4
|
export * from './commands/build.js';
|
|
5
5
|
export * from './commands/compile.js';
|
|
6
|
-
export * from './commands/commitLint.js';
|
|
7
6
|
export * from './commands/gen.js';
|
|
8
7
|
export * from './commands/test.js';
|
|
9
8
|
export * from './commands/create.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/cli",
|
|
3
|
-
"version": "2.20.
|
|
3
|
+
"version": "2.20.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "cli of varlet",
|
|
6
6
|
"bin": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"url": "https://github.com/varletjs/varlet/issues"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@varlet/release": "0.
|
|
37
|
+
"@varlet/release": "^0.1.2",
|
|
38
38
|
"@babel/core": "^7.22.5",
|
|
39
39
|
"@babel/preset-typescript": "^7.22.5",
|
|
40
40
|
"@vitejs/plugin-vue": "4.2.3",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"vite": "4.3.5",
|
|
65
65
|
"vue": "3.3.4",
|
|
66
66
|
"webfont": "^9.0.0",
|
|
67
|
-
"@varlet/
|
|
68
|
-
"@varlet/
|
|
67
|
+
"@varlet/vite-plugins": "2.20.1",
|
|
68
|
+
"@varlet/shared": "2.20.1"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@types/babel__core": "^7.20.1",
|
|
@@ -80,9 +80,9 @@
|
|
|
80
80
|
"@types/semver": "^7.3.9",
|
|
81
81
|
"@types/sharp": "0.31.1",
|
|
82
82
|
"rimraf": "^5.0.1",
|
|
83
|
-
"@varlet/
|
|
84
|
-
"@varlet/
|
|
85
|
-
"@varlet/touch-emulator": "2.20.
|
|
83
|
+
"@varlet/ui": "2.20.1",
|
|
84
|
+
"@varlet/icons": "2.20.1",
|
|
85
|
+
"@varlet/touch-emulator": "2.20.1"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"@vue/runtime-core": "3.3.4",
|
|
@@ -95,9 +95,9 @@
|
|
|
95
95
|
"lodash-es": "^4.17.21",
|
|
96
96
|
"vue": "3.3.4",
|
|
97
97
|
"vue-router": "4.2.0",
|
|
98
|
-
"@varlet/
|
|
99
|
-
"@varlet/
|
|
100
|
-
"@varlet/touch-emulator": "2.20.
|
|
98
|
+
"@varlet/ui": "2.20.1",
|
|
99
|
+
"@varlet/icons": "2.20.1",
|
|
100
|
+
"@varlet/touch-emulator": "2.20.1"
|
|
101
101
|
},
|
|
102
102
|
"scripts": {
|
|
103
103
|
"dev": "tsc --watch",
|
|
@@ -32,6 +32,9 @@
|
|
|
32
32
|
</transition>
|
|
33
33
|
</div>
|
|
34
34
|
|
|
35
|
+
<a class="varlet-site-header__link" style="margin-right: 8px;" target="_blank" :href="changelog" v-ripple v-if="changelog">
|
|
36
|
+
<var-icon name="history" :size="28"/>
|
|
37
|
+
</a>
|
|
35
38
|
<a class="varlet-site-header__link" target="_blank" :href="playground" v-ripple v-if="playground">
|
|
36
39
|
<var-icon name="code-json" :size="24"/>
|
|
37
40
|
</a>
|
|
@@ -103,6 +106,7 @@ export default defineComponent({
|
|
|
103
106
|
const versionItems: Ref<Record<string, string>> = ref(get(config, 'pc.header.version.items'))
|
|
104
107
|
const playground: Ref<string> = ref(get(config, 'pc.header.playground'))
|
|
105
108
|
const github: Ref<string> = ref(get(config, 'pc.header.github'))
|
|
109
|
+
const changelog: Ref<string> = ref(get(config, 'pc.header.changelog'))
|
|
106
110
|
const redirect = get(config, 'pc.redirect')
|
|
107
111
|
const darkMode: Ref<boolean> = ref(get(config, 'pc.header.darkMode'))
|
|
108
112
|
const currentTheme = ref(getBrowserTheme())
|
|
@@ -175,6 +179,7 @@ export default defineComponent({
|
|
|
175
179
|
nonEmptyLanguages,
|
|
176
180
|
nonEmptyVersions,
|
|
177
181
|
playground,
|
|
182
|
+
changelog,
|
|
178
183
|
github,
|
|
179
184
|
isOpenLanguageMenu,
|
|
180
185
|
isOpenVersionsMenu,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
class="varlet-site-sidebar__link"
|
|
5
5
|
v-for="(item, index) in menu"
|
|
6
6
|
:key="index"
|
|
7
|
-
:href="`#/${language}/${item.doc}`"
|
|
7
|
+
:href="item.type !== MenuTypes.TITLE ? `#/${language}/${item.doc}` : undefined"
|
|
8
8
|
@click.prevent
|
|
9
9
|
>
|
|
10
10
|
<var-cell
|
|
@@ -130,6 +130,7 @@ const changeRoute = (item: Menu) => {
|
|
|
130
130
|
|
|
131
131
|
&__title {
|
|
132
132
|
margin-top: 10px !important;
|
|
133
|
+
cursor: default;
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
</style>
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"simple-git-hooks": {
|
|
67
67
|
"pre-commit": "pnpm exec lint-staged --allow-empty --concurrent false",
|
|
68
|
-
"commit-msg": "pnpm exec varlet-cli commit-lint $1"
|
|
68
|
+
"commit-msg": "pnpm exec varlet-cli commit-lint -p $1"
|
|
69
69
|
},
|
|
70
70
|
"packageManager": "pnpm@8.0.0",
|
|
71
71
|
"engines": {
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import logger from '../shared/logger.js';
|
|
2
|
-
import semver from 'semver';
|
|
3
|
-
import fse from 'fs-extra';
|
|
4
|
-
const { readFileSync } = fse;
|
|
5
|
-
export const COMMIT_MESSAGE_RE = /^(revert|fix|feat|docs|perf|test|types|style|build|chore|release|refactor)(\(.+\))?!?: (.|\n)+/;
|
|
6
|
-
export function isVersionCommitMessage(message) {
|
|
7
|
-
return message.startsWith('v') && semver.valid(message.slice(1));
|
|
8
|
-
}
|
|
9
|
-
export function getCommitMessage(gitParams) {
|
|
10
|
-
return readFileSync(gitParams, 'utf-8').trim();
|
|
11
|
-
}
|
|
12
|
-
export function commitLint(gitParams) {
|
|
13
|
-
const commitMessage = getCommitMessage(gitParams);
|
|
14
|
-
if (!isVersionCommitMessage(commitMessage) && !COMMIT_MESSAGE_RE.test(commitMessage)) {
|
|
15
|
-
logger.error(`Commit message invalid`);
|
|
16
|
-
logger.warning(`\
|
|
17
|
-
The rules for commit messages are as follows
|
|
18
|
-
|
|
19
|
-
Example:
|
|
20
|
-
|
|
21
|
-
feat: add a new feature
|
|
22
|
-
feat(ui/button): add a new feature in the ui/button scope
|
|
23
|
-
|
|
24
|
-
fix: fix a bug
|
|
25
|
-
fix(ui/button): fix a bug in the ui/button scope
|
|
26
|
-
|
|
27
|
-
docs: fix an error in the documentation
|
|
28
|
-
docs(ui/button): fix a documentation error in the ui/button scope
|
|
29
|
-
|
|
30
|
-
Allowed types:
|
|
31
|
-
- fix
|
|
32
|
-
- feat
|
|
33
|
-
- docs
|
|
34
|
-
- perf
|
|
35
|
-
- test
|
|
36
|
-
- types
|
|
37
|
-
- style
|
|
38
|
-
- build
|
|
39
|
-
- chore
|
|
40
|
-
- release
|
|
41
|
-
- refactor
|
|
42
|
-
- revert
|
|
43
|
-
|
|
44
|
-
Commit message reference: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y
|
|
45
|
-
参考阮一峰Commit message编写指南: https://www.ruanyifeng.com/blog/2016/01/commit_message_change_log.html`);
|
|
46
|
-
process.exit(1);
|
|
47
|
-
}
|
|
48
|
-
}
|