@gct-paas/cli 0.0.1-dev.0 → 0.0.1-dev.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 +30 -2
- package/src/core/commitlint/commitlint-config/commitlint-config.ts +37 -0
- package/src/core/commitlint/index.ts +1 -0
- package/src/core/eslint/eslint-config/eslint-config.ts +122 -0
- package/src/core/eslint/index.ts +1 -0
- package/src/core/index.ts +4 -0
- package/src/core/prettier/index.ts +1 -0
- package/src/core/prettier/prettier-config/prettier-config.ts +48 -0
- package/src/core/rollup/index.ts +1 -1
- package/src/core/rollup/rollup-config/dev-config.ts +1 -1
- package/src/core/stylelint/index.ts +1 -0
- package/src/core/stylelint/stylelint-config/stylelint-config.ts +28 -0
- package/src/core/vite/index.ts +1 -1
- package/src/core/vite/vite-config/vite-config.ts +1 -1
- package/src/types/index.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gct-paas/cli",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "paas 平台核心包",
|
|
6
6
|
"bin": {
|
|
7
7
|
"gct-build": "dist/bin.mjs"
|
|
8
8
|
},
|
|
9
9
|
"main": "dist/index.mjs",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
10
11
|
"files": [
|
|
11
12
|
"src",
|
|
12
13
|
"CHANGELOG.md",
|
|
@@ -32,25 +33,52 @@
|
|
|
32
33
|
"publish:npm": "npm run build && npm publish --access public --registry=https://registry.npmjs.org/"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
36
|
+
"@babel/core": "^7.26.0",
|
|
37
|
+
"@babel/preset-env": "^7.26.0",
|
|
38
|
+
"@commitlint/cli": "^19.6.1",
|
|
39
|
+
"@commitlint/config-conventional": "^19.6.0",
|
|
40
|
+
"@eslint/js": "^9.17.0",
|
|
41
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
35
42
|
"@rollup/plugin-commonjs": "^28.0.2",
|
|
43
|
+
"@rollup/plugin-eslint": "^9.0.5",
|
|
36
44
|
"@rollup/plugin-json": "^6.1.0",
|
|
37
45
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
38
46
|
"@vitejs/plugin-vue": "^5.2.1",
|
|
39
47
|
"@vitejs/plugin-vue-jsx": "^4.1.1",
|
|
48
|
+
"@vue/compiler-sfc": "^3.5.13",
|
|
40
49
|
"chokidar": "^4.0.3",
|
|
41
50
|
"commander": "^13.0.0",
|
|
51
|
+
"consola": "^3.3.3",
|
|
42
52
|
"copy-file": "^11.0.0",
|
|
43
53
|
"cpy": "^11.1.0",
|
|
54
|
+
"eslint": "^9.17.0",
|
|
55
|
+
"eslint-plugin-import": "^2.31.0",
|
|
56
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
57
|
+
"eslint-plugin-unused-imports": "^4.1.4",
|
|
58
|
+
"eslint-plugin-vue": "^9.32.0",
|
|
44
59
|
"fast-glob": "^3.3.3",
|
|
45
60
|
"fs-extra": "^11.2.0",
|
|
61
|
+
"globals": "^15.14.0",
|
|
46
62
|
"lodash-es": "^4.17.21",
|
|
47
63
|
"picocolors": "^1.1.1",
|
|
64
|
+
"prettier": "^3.4.2",
|
|
48
65
|
"rimraf": "^6.0.1",
|
|
49
66
|
"rollup": "^4.30.0",
|
|
50
67
|
"rollup-plugin-esbuild": "^6.1.1",
|
|
51
|
-
"
|
|
68
|
+
"stylelint": "^16.12.0",
|
|
69
|
+
"stylelint-config-standard": "^36.0.1",
|
|
70
|
+
"stylelint-config-standard-scss": "^14.0.0",
|
|
71
|
+
"typescript-eslint": "^8.19.0",
|
|
72
|
+
"vite-plugin-dts": "^4.4.0",
|
|
73
|
+
"vue-tsc": "^2.2.0"
|
|
52
74
|
},
|
|
53
75
|
"devDependencies": {
|
|
76
|
+
"@commitlint/types": "^19.5.0",
|
|
77
|
+
"@types/babel__core": "^7.20.5",
|
|
78
|
+
"@types/babel__preset-env": "^7.9.7",
|
|
79
|
+
"@types/fs-extra": "^11.0.4",
|
|
80
|
+
"@types/lodash-es": "^4.17.12",
|
|
81
|
+
"@types/node": "^22.10.5",
|
|
54
82
|
"typescript": "^5.7.2",
|
|
55
83
|
"unbuild": "^3.2.0"
|
|
56
84
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { merge } from 'lodash-es';
|
|
2
|
+
import type { UserConfig } from '@commitlint/types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 基于基础配置,定义 commitlint 配置
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @param {UserConfig} [config={}]
|
|
9
|
+
* @returns {*} {UserConfig}
|
|
10
|
+
*/
|
|
11
|
+
export function defineCommitlintConfig(config: UserConfig = {}): UserConfig {
|
|
12
|
+
return merge(
|
|
13
|
+
{
|
|
14
|
+
extends: ['@commitlint/config-conventional'],
|
|
15
|
+
rules: {
|
|
16
|
+
'type-enum': [
|
|
17
|
+
2,
|
|
18
|
+
'always',
|
|
19
|
+
[
|
|
20
|
+
'feat',
|
|
21
|
+
'fix',
|
|
22
|
+
'docs',
|
|
23
|
+
'style',
|
|
24
|
+
'refactor',
|
|
25
|
+
'test',
|
|
26
|
+
'perf',
|
|
27
|
+
'revert',
|
|
28
|
+
'build',
|
|
29
|
+
'chore',
|
|
30
|
+
'release',
|
|
31
|
+
],
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
config,
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { defineCommitlintConfig } from './commitlint-config/commitlint-config';
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import eslint from '@eslint/js';
|
|
2
|
+
import tsEslint, {
|
|
3
|
+
ConfigArray,
|
|
4
|
+
InfiniteDepthConfigWithExtends,
|
|
5
|
+
} from 'typescript-eslint';
|
|
6
|
+
import eslintPluginVue from 'eslint-plugin-vue';
|
|
7
|
+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
8
|
+
import unusedImports from 'eslint-plugin-unused-imports';
|
|
9
|
+
import eslintPluginImport from 'eslint-plugin-import';
|
|
10
|
+
import globals from 'globals';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 基于基础规则,定义 eslint 配置
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @param {...InfiniteDepthConfigWithExtends[]} configs
|
|
17
|
+
* @returns {*} {ConfigArray}
|
|
18
|
+
*/
|
|
19
|
+
export function defineEslintConfig(
|
|
20
|
+
...configs: InfiniteDepthConfigWithExtends[]
|
|
21
|
+
): ConfigArray {
|
|
22
|
+
return tsEslint.config(
|
|
23
|
+
/** js推荐配置 */
|
|
24
|
+
eslint.configs.recommended,
|
|
25
|
+
/** ts推荐配置 */
|
|
26
|
+
tsEslint.configs.strict,
|
|
27
|
+
tsEslint.configs.stylistic,
|
|
28
|
+
/** vue推荐配置 */
|
|
29
|
+
eslintPluginVue.configs['flat/recommended'],
|
|
30
|
+
eslintPluginPrettierRecommended,
|
|
31
|
+
eslintPluginImport.flatConfigs.recommended,
|
|
32
|
+
eslintPluginImport.flatConfigs.warnings,
|
|
33
|
+
eslintPluginImport.flatConfigs.errors,
|
|
34
|
+
eslintPluginImport.flatConfigs.typescript,
|
|
35
|
+
{
|
|
36
|
+
ignores: [
|
|
37
|
+
'**/node_modules',
|
|
38
|
+
'lerna.json',
|
|
39
|
+
'package.json',
|
|
40
|
+
'tsconfig.json',
|
|
41
|
+
'pnpm-lock.yaml',
|
|
42
|
+
'pnpm-workspace.yaml',
|
|
43
|
+
'eslint.config.mjs',
|
|
44
|
+
'**/dist',
|
|
45
|
+
'**/out',
|
|
46
|
+
'**/es',
|
|
47
|
+
'**/lib',
|
|
48
|
+
],
|
|
49
|
+
files: ['**/*.ts', '**.*.tsx', '**/*.vue'],
|
|
50
|
+
plugins: {
|
|
51
|
+
'unused-imports': unusedImports,
|
|
52
|
+
},
|
|
53
|
+
languageOptions: {
|
|
54
|
+
globals: {
|
|
55
|
+
...globals.browser,
|
|
56
|
+
},
|
|
57
|
+
parserOptions: {
|
|
58
|
+
ecmaFeatures: {
|
|
59
|
+
// 全局严格模式
|
|
60
|
+
impliedStrict: true,
|
|
61
|
+
// 启用 jsx
|
|
62
|
+
jsx: true,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
rules: {
|
|
67
|
+
// 基础配置覆盖
|
|
68
|
+
'no-console': 'off',
|
|
69
|
+
'no-debugger': 'off',
|
|
70
|
+
'no-undef': 'off',
|
|
71
|
+
'no-plusplus': [
|
|
72
|
+
'error',
|
|
73
|
+
{
|
|
74
|
+
allowForLoopAfterthoughts: true,
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
'no-underscore-dangle': 'off',
|
|
78
|
+
'no-restricted-syntax': 'off',
|
|
79
|
+
'no-continue': 'off',
|
|
80
|
+
'no-unused-vars': 'off',
|
|
81
|
+
'no-extraneous-class': 'off',
|
|
82
|
+
'no-param-reassign': 'off',
|
|
83
|
+
'no-useless-constructor': 'off',
|
|
84
|
+
'no-empty-function': 'off',
|
|
85
|
+
// unused-imports 配置覆盖
|
|
86
|
+
'unused-imports/no-unused-imports': 'error',
|
|
87
|
+
'consistent-return': 'off',
|
|
88
|
+
'func-names': 'off',
|
|
89
|
+
// import 配置覆盖
|
|
90
|
+
'import/no-unresolved': 'off',
|
|
91
|
+
'import/extensions': 'off',
|
|
92
|
+
'import/prefer-default-export': 'off',
|
|
93
|
+
// vue 配置覆盖
|
|
94
|
+
'vue/no-setup-props-destructure': 'off',
|
|
95
|
+
'vue/require-default-prop': 'off',
|
|
96
|
+
// typescript 配置覆盖
|
|
97
|
+
'@typescript-eslint/no-unused-vars': [
|
|
98
|
+
'error',
|
|
99
|
+
{
|
|
100
|
+
argsIgnorePattern: '^_',
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
'@typescript-eslint/no-inferrable-types': 'off',
|
|
104
|
+
'@typescript-eslint/no-explicit-any': ['error'],
|
|
105
|
+
'@typescript-eslint/explicit-module-boundary-types': 'error',
|
|
106
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
107
|
+
'@typescript-eslint/no-extraneous-class': 'off',
|
|
108
|
+
// 其他配置覆盖
|
|
109
|
+
'class-methods-use-this': 'off',
|
|
110
|
+
'prefer-destructuring': 'off',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: 'ts-vue-override',
|
|
115
|
+
files: ['**/*.vue'],
|
|
116
|
+
rules: {
|
|
117
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
...configs,
|
|
121
|
+
);
|
|
122
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { defineEslintConfig } from './eslint-config/eslint-config';
|
package/src/core/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { definePrettierConfig } from './prettier-config/prettier-config';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { merge } from 'lodash-es';
|
|
2
|
+
import { Options } from 'prettier';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 基于基础配置,定义 prettier 配置
|
|
6
|
+
*
|
|
7
|
+
* @description 提交信息规范,提交格式: type: description
|
|
8
|
+
* feat: 新功能(feature)
|
|
9
|
+
* fix: 修补bug
|
|
10
|
+
* docs: 文档(documentation)
|
|
11
|
+
* style: 格式(不影响代码运行的变动)
|
|
12
|
+
* refactor: 重构(即不是新增功能,也不是修改bug的代码变动)
|
|
13
|
+
* test: 增加测试,或测试变更
|
|
14
|
+
* perf : 性能优化
|
|
15
|
+
* revert: 撤销上一次的提交
|
|
16
|
+
* build: 构建工具或构建过程等的变动,如:关联包升级等
|
|
17
|
+
* chore: 其他修改(不在上述类型中的修改)
|
|
18
|
+
* release: 发布新版本
|
|
19
|
+
*
|
|
20
|
+
* @export
|
|
21
|
+
* @param {Options} config
|
|
22
|
+
* @returns {*} {Options}
|
|
23
|
+
*/
|
|
24
|
+
export function definePrettierConfig(config: Options = {}): Options {
|
|
25
|
+
return merge(
|
|
26
|
+
{
|
|
27
|
+
// 起始格式化间隔
|
|
28
|
+
tabWidth: 2,
|
|
29
|
+
// 使用单引号
|
|
30
|
+
singleQuote: true,
|
|
31
|
+
// jsx 中使用单引号
|
|
32
|
+
jsxSingleQuote: true,
|
|
33
|
+
// 对象中的 key 是否需要引号。as-needed: 只有在必须时才要
|
|
34
|
+
quoteProps: 'as-needed',
|
|
35
|
+
// 每行结尾是否需要分号
|
|
36
|
+
trailingComma: 'all',
|
|
37
|
+
// 括号中参数前后补充空格
|
|
38
|
+
bracketSpacing: true,
|
|
39
|
+
// 箭头函数,参数是否添加括号
|
|
40
|
+
arrowParens: 'avoid',
|
|
41
|
+
// jsx 元素最后末尾的 > ,换行放置
|
|
42
|
+
bracketSameLine: false,
|
|
43
|
+
// 设置换行符
|
|
44
|
+
endOfLine: 'lf',
|
|
45
|
+
},
|
|
46
|
+
config,
|
|
47
|
+
);
|
|
48
|
+
}
|
package/src/core/rollup/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { defineRollupConfig } from './rollup-config/dev-config';
|
|
2
2
|
export * from './rollup-plugins';
|
|
@@ -22,7 +22,7 @@ import { PROD_MODE } from '../../constants';
|
|
|
22
22
|
* @param {RollupOptions} [opts={}]
|
|
23
23
|
* @returns {*} {RollupOptions}
|
|
24
24
|
*/
|
|
25
|
-
export function
|
|
25
|
+
export function defineRollupConfig(opts: RollupOptions = {}): RollupOptions {
|
|
26
26
|
// 监控 ctrl + c 停止进程,触发 exit 事件
|
|
27
27
|
process.on('SIGINT', () => {
|
|
28
28
|
process.exit();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { defineStylelintConfig } from './stylelint-config/stylelint-config';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { merge } from 'lodash-es';
|
|
2
|
+
import { Config } from 'stylelint';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 基于基础规则,定义 stylelint 配置
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @param {Config} config
|
|
9
|
+
* @returns {*} {Config}
|
|
10
|
+
*/
|
|
11
|
+
export function defineStylelintConfig(config: Config = {}): Config {
|
|
12
|
+
return merge(
|
|
13
|
+
{
|
|
14
|
+
extends: ['stylelint-config-standard', 'stylelint-config-standard-scss'],
|
|
15
|
+
rules: {
|
|
16
|
+
'annotation-no-unknown': null,
|
|
17
|
+
'color-no-invalid-hex': true,
|
|
18
|
+
'function-name-case': null, // 强制样式方法名称小写或大写
|
|
19
|
+
'no-duplicate-selectors': null,
|
|
20
|
+
'selector-class-pattern': null,
|
|
21
|
+
'scss/dollar-variable-pattern': null,
|
|
22
|
+
'scss/at-function-pattern': null,
|
|
23
|
+
'scss/dollar-variable-empty-line-before': null, // 变量声明之间不可以有空白行
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
config,
|
|
27
|
+
);
|
|
28
|
+
}
|
package/src/core/vite/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { defineViteConfig } from './vite-config/vite-config';
|
|
@@ -12,7 +12,7 @@ import * as rf from 'rimraf';
|
|
|
12
12
|
* @param {UserConfig} [opts={}]
|
|
13
13
|
* @returns {*} {UserConfig}
|
|
14
14
|
*/
|
|
15
|
-
export function
|
|
15
|
+
export function defineViteConfig(opts: UserConfig = {}): UserConfig {
|
|
16
16
|
// 当前脚本执行的工作目录
|
|
17
17
|
const cwd = process.cwd();
|
|
18
18
|
// 编译文件输出目录
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module 'eslint-plugin-import';
|