web-kxjl-components 1.0.5 → 1.0.6

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.
Files changed (2) hide show
  1. package/README.md +73 -62
  2. package/package.json +64 -54
package/README.md CHANGED
@@ -1,62 +1,73 @@
1
- # web-kxjl-components
2
-
3
- 公司公共组件库,基于 Vue 3 + TypeScript + Vite + Element Plus,发布到公网 npm。
4
-
5
- ## 使用
6
-
7
- ```bash
8
- npm install web-kxjl-components
9
- ```
10
-
11
- 宿主项目需自带 `vue`、`element-plus`(peerDependencies),组件库不会重复打包这两个依赖。
12
-
13
- 样式已内联进 JS,导入组件时自动注入,无需再引入 css 文件。
14
-
15
- 全量注册(包含 KxEmpty 等套件组件,不含 KxAppSwitcher):
16
-
17
- ```ts
18
- import KxComponents from "web-kxjl-components";
19
-
20
- app.use(KxComponents);
21
- ```
22
-
23
- 只用套件中的个别组件时,也可以具名引入:
24
-
25
- ```ts
26
- import { KxEmpty } from "web-kxjl-components";
27
- ```
28
-
29
- KxAppSwitcher 按需引入(独立入口,宿主打包时只包含该组件):
30
-
31
- ```ts
32
- import KxAppSwitcher from "web-kxjl-components/kx-app-switcher";
33
- import type { ApiResult, Product, ProductSystem } from "web-kxjl-components/kx-app-switcher";
34
- ```
35
-
36
- ## 开发
37
-
38
- ```bash
39
- npm install
40
- npm run build # vue-tsc 生成类型声明 + vite 库模式构建,产物在 dist/
41
- ```
42
-
43
- 新增组件分两类:
44
-
45
- - 套件组件:在 `src/components/<kx-xxx>/index.vue` 编写,然后在 `src/index.ts` 中导入、加入 `components` 并具名导出。
46
- - 独立按需组件:除组件本身外,新建 `src/<kx-xxx>.ts` 作为入口,并在 `vite.config.ts` 的 `lib.entry`、`package.json` 的 `exports` 与 `sideEffects` 中补上对应条目,不放进 `src/index.ts` 的 `components`。
47
-
48
- ## 提交约定
49
-
50
- 直接在当前分支上提交,不额外新建分支;提交信息遵循 Conventional Commits(如 `feat(kx-xxx): ...`)。
51
-
52
- ## 发布
53
-
54
- 当前机器的 `~/.npmrc` 默认指向 npmmirror 镜像,镜像不能发布,`publishConfig` 已指定公网 registry。
55
-
56
- ```bash
57
- npm login --registry https://registry.npmjs.org/
58
- npm version patch # 或 minor / major
59
- npm publish
60
- ```
61
-
62
- 首次发布版本为 `1.0.0`。包发布到公网后任何人都能安装,不要放入内部地址、密钥等敏感内容。
1
+ # web-kxjl-components
2
+
3
+ 科讯嘉联公共组件库,基于 Vue 3 + TypeScript + Vite + Element Plus,发布到公网 npm。
4
+
5
+ ## 使用
6
+
7
+ ```bash
8
+ npm install web-kxjl-components
9
+ ```
10
+
11
+ 宿主项目需自带 `vue`、`element-plus`(peerDependencies),组件库不会重复打包这两个依赖。
12
+
13
+ 样式已内联进 JS,导入组件时自动注入,无需再引入 css 文件。
14
+
15
+ 全量注册(包含 KxEmpty 等套件组件,不含 KxAppSwitcher):
16
+
17
+ ```ts
18
+ import KxComponents from "web-kxjl-components";
19
+
20
+ app.use(KxComponents);
21
+ ```
22
+
23
+ 只用套件中的个别组件时,也可以具名引入:
24
+
25
+ ```ts
26
+ import { KxEmpty } from "web-kxjl-components";
27
+ ```
28
+
29
+ KxAppSwitcher 按需引入(独立入口,宿主打包时只包含该组件):
30
+
31
+ ```ts
32
+ import KxAppSwitcher from "web-kxjl-components/kx-app-switcher";
33
+ import type { ApiResult, Product, ProductSystem } from "web-kxjl-components/kx-app-switcher";
34
+ ```
35
+
36
+ ## 开发
37
+
38
+ ```bash
39
+ npm install
40
+ npm run build # vue-tsc 生成类型声明 + vite 库模式构建,产物在 dist/
41
+ ```
42
+
43
+ 新增组件分两类:
44
+
45
+ - 套件组件:在 `src/components/<kx-xxx>/index.vue` 编写,然后在 `src/index.ts` 中导入、加入 `components` 并具名导出。
46
+ - 独立按需组件:除组件本身外,新建 `src/<kx-xxx>.ts` 作为入口,并在 `vite.config.ts` 的 `lib.entry`、`package.json` 的 `exports` 与 `sideEffects` 中补上对应条目,不放进 `src/index.ts` 的 `components`。
47
+
48
+ ## 文档站
49
+
50
+ 基于 VitePress,源码在 `docs/`,演示直接引用 `src/` 中的组件。
51
+
52
+ ```bash
53
+ npm run docs:dev # 本地开发
54
+ npm run docs:build # 构建静态站,产物在 docs/.vitepress/dist
55
+ ```
56
+
57
+ 新增组件文档:在 `docs/components/` 下新建 md,并在 `docs/.vitepress/config.ts` 的 `sidebar` 登记;全局组件注册见 `docs/.vitepress/theme/index.ts`。
58
+
59
+ ## 提交约定
60
+
61
+ 直接在当前分支上提交,不额外新建分支;提交信息遵循 Conventional Commits(如 `feat(kx-xxx): ...`)。
62
+
63
+ ## 发布
64
+
65
+ 当前机器的 `~/.npmrc` 默认指向 npmmirror 镜像,镜像不能发布,`publishConfig` 已指定公网 registry。
66
+
67
+ ```bash
68
+ npm login --registry https://registry.npmjs.org/
69
+ npm version patch # 或 minor / major
70
+ npm publish
71
+ ```
72
+
73
+ 首次发布版本为 `1.0.0`。包发布到公网后任何人都能安装,不要放入内部地址、密钥等敏感内容。
package/package.json CHANGED
@@ -1,54 +1,64 @@
1
- {
2
- "name": "web-kxjl-components",
3
- "version": "1.0.5",
4
- "description": "公司公共组件库(Vue 3 + Element Plus)",
5
- "type": "module",
6
- "license": "UNLICENSED",
7
- "sideEffects": [
8
- "./dist/index.js",
9
- "./dist/kx-app-switcher.js"
10
- ],
11
- "files": [
12
- "dist"
13
- ],
14
- "main": "./dist/index.js",
15
- "module": "./dist/index.js",
16
- "types": "./dist/index.d.ts",
17
- "exports": {
18
- ".": {
19
- "types": "./dist/index.d.ts",
20
- "import": "./dist/index.js"
21
- },
22
- "./kx-app-switcher": {
23
- "types": "./dist/kx-app-switcher.d.ts",
24
- "import": "./dist/kx-app-switcher.js"
25
- }
26
- },
27
- "publishConfig": {
28
- "registry": "https://registry.npmjs.org/",
29
- "access": "public"
30
- },
31
- "scripts": {
32
- "dev": "vite build --watch",
33
- "play": "vite",
34
- "build": "vite build && vue-tsc -p tsconfig.build.json",
35
- "prepublishOnly": "npm run build"
36
- },
37
- "peerDependencies": {
38
- "element-plus": "^2.14.0",
39
- "vue": "^3.5.0"
40
- },
41
- "devDependencies": {
42
- "@types/node": "^24.12.3",
43
- "@vitejs/plugin-vue": "^6.0.6",
44
- "@vue/tsconfig": "^0.9.1",
45
- "element-plus": "^2.14.1",
46
- "sass-embedded": "^1.100.0",
47
- "typescript": "~6.0.2",
48
- "unplugin-vue-components": "^32.1.0",
49
- "vite": "^8.0.12",
50
- "vite-plugin-css-injected-by-js": "5.0.3",
51
- "vue": "^3.5.34",
52
- "vue-tsc": "^3.2.8"
53
- }
54
- }
1
+ {
2
+ "name": "web-kxjl-components",
3
+ "version": "1.0.6",
4
+ "description": "公司公共组件库(Vue 3 + Element Plus)",
5
+ "type": "module",
6
+ "license": "UNLICENSED",
7
+ "sideEffects": [
8
+ "./dist/index.js",
9
+ "./dist/kx-app-switcher.js"
10
+ ],
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "main": "./dist/index.js",
15
+ "module": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "typesVersions": {
18
+ "*": {
19
+ "kx-app-switcher": [
20
+ "./dist/kx-app-switcher.d.ts"
21
+ ]
22
+ }
23
+ },
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js"
28
+ },
29
+ "./kx-app-switcher": {
30
+ "types": "./dist/kx-app-switcher.d.ts",
31
+ "import": "./dist/kx-app-switcher.js"
32
+ }
33
+ },
34
+ "publishConfig": {
35
+ "registry": "https://registry.npmjs.org/",
36
+ "access": "public"
37
+ },
38
+ "scripts": {
39
+ "dev": "vite build --watch",
40
+ "build": "vite build && vue-tsc -p tsconfig.build.json",
41
+ "prepublishOnly": "npm run build",
42
+ "docs:dev": "vitepress dev docs",
43
+ "docs:build": "vitepress build docs",
44
+ "docs:preview": "vitepress preview docs --port 4173"
45
+ },
46
+ "peerDependencies": {
47
+ "element-plus": "^2.14.0",
48
+ "vue": "^3.5.0"
49
+ },
50
+ "devDependencies": {
51
+ "@types/node": "^24.12.3",
52
+ "@vitejs/plugin-vue": "^6.0.6",
53
+ "@vue/tsconfig": "^0.9.1",
54
+ "element-plus": "^2.14.1",
55
+ "sass-embedded": "^1.100.0",
56
+ "typescript": "~6.0.2",
57
+ "unplugin-vue-components": "^32.1.0",
58
+ "vite": "^8.0.12",
59
+ "vite-plugin-css-injected-by-js": "5.0.3",
60
+ "vitepress": "2.0.0-alpha.21",
61
+ "vue": "^3.5.34",
62
+ "vue-tsc": "^3.2.8"
63
+ }
64
+ }