@dazhicheng/common 1.0.3 → 1.0.4

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/.gitattributes ADDED
@@ -0,0 +1,3 @@
1
+ * text=auto
2
+ *.html linguist-detectable=false
3
+ *.vue linguist-detectable=true
package/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ # base
2
+ node_modules
3
+ .DS_Store
4
+ dist
5
+ dist-ssr
6
+ *.local
7
+ .cursorrules
8
+ .vite
9
+ .claude
package/.prettierrc ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "printWidth": 100,
3
+ "tabWidth": 2,
4
+ "useTabs": false,
5
+ "semi": true,
6
+ "vueIndentScriptAndStyle": true,
7
+ "singleQuote": true,
8
+ "quoteProps": "as-needed",
9
+ "bracketSpacing": true,
10
+ "trailingComma": "all",
11
+ "bracketSameLine": false,
12
+ "jsxSingleQuote": false,
13
+ "arrowParens": "always",
14
+ "insertPragma": false,
15
+ "requirePragma": false,
16
+ "proseWrap": "never",
17
+ "htmlWhitespaceSensitivity": "strict",
18
+ "endOfLine": "auto",
19
+ "rangeStart": 0
20
+ }
@@ -0,0 +1,5 @@
1
+ dist
2
+ node_modules
3
+ public
4
+ .husky
5
+ .vscode
@@ -0,0 +1,76 @@
1
+ module.exports = {
2
+ extends: [
3
+ 'stylelint-config-standard',
4
+ 'stylelint-config-recommended-scss',
5
+ 'stylelint-config-recommended-vue/scss',
6
+ 'stylelint-config-html/vue',
7
+ 'stylelint-config-recess-order',
8
+ ],
9
+ overrides: [
10
+ {
11
+ files: ['**/*.{vue,html}'],
12
+ customSyntax: 'postcss-html',
13
+ },
14
+ {
15
+ files: ['**/*.{css,scss}'],
16
+ customSyntax: 'postcss-scss',
17
+ },
18
+ ],
19
+ rules: {
20
+ 'import-notation': 'string',
21
+ 'selector-class-pattern': null,
22
+ 'custom-property-pattern': null,
23
+ 'keyframes-name-pattern': null,
24
+ 'no-descending-specificity': null,
25
+ 'no-empty-source': null,
26
+ 'property-no-vendor-prefix': null,
27
+ 'selector-pseudo-class-no-unknown': [
28
+ true,
29
+ {
30
+ ignorePseudoClasses: ['global', 'export', 'deep'],
31
+ },
32
+ ],
33
+ 'property-no-unknown': [
34
+ true,
35
+ {
36
+ ignoreProperties: [],
37
+ },
38
+ ],
39
+ 'at-rule-no-unknown': [
40
+ true,
41
+ {
42
+ ignoreAtRules: [
43
+ 'apply',
44
+ 'use',
45
+ 'mixin',
46
+ 'include',
47
+ 'extend',
48
+ 'each',
49
+ 'if',
50
+ 'else',
51
+ 'for',
52
+ 'while',
53
+ 'reference',
54
+ ],
55
+ },
56
+ ],
57
+ 'scss/at-rule-no-unknown': [
58
+ true,
59
+ {
60
+ ignoreAtRules: [
61
+ 'apply',
62
+ 'use',
63
+ 'mixin',
64
+ 'include',
65
+ 'extend',
66
+ 'each',
67
+ 'if',
68
+ 'else',
69
+ 'for',
70
+ 'while',
71
+ 'reference',
72
+ ],
73
+ },
74
+ ],
75
+ },
76
+ };
package/Dockerfile ADDED
@@ -0,0 +1,33 @@
1
+ # 阶段 1:构建前端项目
2
+ FROM node:24-alpine AS builder
3
+
4
+ WORKDIR /app
5
+
6
+ # 安装 pnpm 并配置镜像源
7
+ RUN npm install -g pnpm && \
8
+ pnpm config set registry https://registry.npmmirror.com
9
+
10
+ ARG NODE_ENV=dev
11
+
12
+ # 先复制依赖文件并安装依赖
13
+ COPY package*.json pnpm-lock.yaml* pnpm-workspace.yaml ./
14
+ RUN pnpm install
15
+
16
+
17
+ # 再复制全部源代码,进行构建
18
+ COPY . .
19
+ RUN pnpm "build:${NODE_ENV}"
20
+
21
+ # 阶段 2:部署到 Nginx
22
+ FROM nginx:stable-alpine
23
+
24
+ ARG NODE_ENV=dev
25
+
26
+ # 复制 Nginx 配置
27
+ COPY "nginx_${NODE_ENV}.conf" /etc/nginx/conf.d/default.conf
28
+
29
+ # 复制构建产物
30
+ COPY --from=builder /app/dist /usr/share/nginx/html
31
+
32
+ # 启动 Nginx
33
+ CMD ["nginx", "-g", "daemon off;"]
@@ -0,0 +1,87 @@
1
+ import pluginJs from '@eslint/js';
2
+ import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
3
+ import pluginVue from 'eslint-plugin-vue';
4
+ import globals from 'globals';
5
+ import tseslint from 'typescript-eslint';
6
+
7
+ export default [
8
+ // 指定文件匹配规则
9
+ {
10
+ files: ['**/*.{js,mjs,cjs,ts,vue}'],
11
+ },
12
+ // 指定全局变量和环境
13
+ {
14
+ languageOptions: {
15
+ globals: {
16
+ ...globals.browser,
17
+ ...globals.node,
18
+ },
19
+ },
20
+ },
21
+ // 扩展配置
22
+ pluginJs.configs.recommended,
23
+ ...tseslint.configs.recommended,
24
+ ...pluginVue.configs['flat/essential'],
25
+ // 自定义规则
26
+ {
27
+ // 针对所有 JavaScript、TypeScript 和 Vue 文件应用以下配置
28
+ files: ['**/*.{js,mjs,cjs,ts,vue}'],
29
+
30
+ languageOptions: {
31
+ globals: {
32
+ // 合并从 autoImportConfig 中读取的全局变量配置
33
+ ...autoImportConfig.globals,
34
+ },
35
+ },
36
+ rules: {
37
+ 'no-undef': 'off', // TypeScript 自身已处理未定义变量检查
38
+ quotes: ['error', 'single'], // 使用单引号
39
+ semi: ['error', 'never'], // 语句末尾不加分号
40
+ 'no-var': 'error', // 要求使用 let 或 const 而不是 var
41
+ '@typescript-eslint/no-explicit-any': 'off', // 禁用 any 检查
42
+ 'vue/multi-word-component-names': 'off', // 禁用对 Vue 组件名称的多词要求检查
43
+ 'no-multiple-empty-lines': ['warn', { max: 1, maxEOF: 1 }], // 不允许多个空行
44
+ 'no-unexpected-multiline': 'error', // 禁止空余的多行
45
+ 'no-unused-vars': 'off', // 禁用未使用的变量检查
46
+ '@typescript-eslint/no-unused-vars': 'off', // 禁用 TypeScript 未使用的变量检查
47
+ },
48
+ },
49
+ {
50
+ files: ['**/*.vue'],
51
+ languageOptions: {
52
+ parserOptions: {
53
+ parser: tseslint.parser,
54
+ ecmaFeatures: {
55
+ jsx: true,
56
+ },
57
+ },
58
+ },
59
+ },
60
+ // vue 规则
61
+ {
62
+ files: ['**/*.vue'],
63
+ languageOptions: {
64
+ parserOptions: {
65
+ parser: tseslint.parser,
66
+ ecmaFeatures: {
67
+ jsx: true,
68
+ },
69
+ },
70
+ },
71
+ },
72
+ // 忽略文件
73
+ {
74
+ ignores: [
75
+ 'node_modules',
76
+ 'dist',
77
+ 'public',
78
+ '.vscode/**',
79
+ 'src/assets/**',
80
+ 'src/utils/console.ts',
81
+ 'src/api',
82
+ 'src/api/**',
83
+ ],
84
+ },
85
+ // prettier 配置
86
+ eslintPluginPrettierRecommended,
87
+ ];
package/package.json CHANGED
@@ -1,12 +1,31 @@
1
1
  {
2
2
  "name": "@dazhicheng/common",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "共享配置文件",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "commitlint.config.cjs",
8
- ".husky"
8
+ ".husky",
9
+ ".prettierrc",
10
+ ".stylelintrc.cjs",
11
+ ".stylelintignore",
12
+ ".gitignore",
13
+ ".gitattributes",
14
+ "eslint.config.mjs",
15
+ "tsconfig.json",
16
+ "tsconfig.web.json",
17
+ "Dockerfile"
9
18
  ],
19
+ "exports": {
20
+ "./commitlint.config.cjs": "./commitlint.config.cjs",
21
+ "./.prettierrc": "./.prettierrc",
22
+ "./.stylelintrc.cjs": "./.stylelintrc.cjs",
23
+ "./.stylelintignore": "./.stylelintignore",
24
+ "./.gitignore": "./.gitignore",
25
+ "./.gitattributes": "./.gitattributes",
26
+ "./eslint.config.mjs": "./eslint.config.mjs",
27
+ "./tsconfig.json": "./tsconfig.json"
28
+ },
10
29
  "publishConfig": {
11
30
  "access": "public"
12
31
  },
package/tsconfig.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "esnext",
4
+ "module": "esnext",
5
+ "moduleResolution": "node",
6
+ "strict": true,
7
+ "jsx": "preserve",
8
+ "jsxImportSource": "vue",
9
+ "sourceMap": true,
10
+ "resolveJsonModule": true,
11
+ "esModuleInterop": true,
12
+ "lib": ["esnext", "dom"],
13
+ "types": ["vite/client", "node", "element-plus/global"],
14
+ "skipLibCheck": true,
15
+ "baseUrl": ".",
16
+ "paths": {
17
+ "@/*": ["src/*"],
18
+ "@views/*": ["src/views/*"],
19
+ "@imgs/*": ["src/assets/images/*"],
20
+ "@icons/*": ["src/assets/icons/*"],
21
+ "@utils/*": ["src/utils/*"],
22
+ "@stores/*": ["src/store/*"],
23
+ "@plugins/*": ["src/plugins/*"],
24
+ "@styles/*": ["src/assets/styles/*"]
25
+ }
26
+ },
27
+ "include": ["src/**/*", "src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
28
+ "exclude": ["node_modules", "dist", "**/*.js"]
29
+ }