Skip to content

Commit 3044335

Browse files
committed
feat: 修改包名为@MyLib、修复turbo命令、新增批量替换包名脚本
1 parent 31c0b6a commit 3044335

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+302
-233
lines changed

.commitlintrc.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { default } from '@vue3-lib/commitlint-config';
1+
export { default } from '@mylib/commitlint-config';

TODO.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
- [ ] 添加 utils 包测试用例(jest或vitest)
22
- [ ] 完善docs文档
3-
- [ ] 编写脚本一键修改 @vue3-lib 的包名,方便统一修改
43
- [ ] github pages 部署

apps/docs/guide/index.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ Vue3 Library 是一个基于 Vue3 的组件库和工具集,包含以下几个
1818

1919
```ts
2020
import { createApp } from 'vue';
21-
import UI from '@vue3-lib/ui';
22-
import '@vue3-lib/ui/dist/styles/index.css';
21+
import UI from '@mylib/ui';
22+
import '@mylib/ui/dist/styles/index.css';
2323
const app = createApp(App);
2424
app.use(UI);
2525
```
2626

2727
### 工具函数
2828

2929
```ts
30-
import { isString } from '@vue3-lib/utils';
30+
import { isString } from '@mylib/utils';
3131
console.log(isString('hello')); // true
3232
```
3333

3434
### Hooks
3535

3636
```ts
37-
import { useCounter } from '@vue3-lib/hooks';
37+
import { useCounter } from '@mylib/hooks';
3838
const { count, increment, decrement } = useCounter();
3939
```

apps/docs/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: home
33
hero:
4-
name: vue3-component-lib
4+
name: mylib-template
55
text: Vue3 组件库和工具集
66
tagline: 简单、强大、高性能的 Vue3 工具库
77
actions:

apps/docs/package.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
{
2-
"name": "@vue3-lib/docs",
2+
"name": "@mylib/docs",
33
"version": "1.0.0",
44
"description": "",
55
"main": "index.js",
66
"scripts": {
77
"dev": "vitepress dev",
88
"build": "vitepress build",
99
"preview": "vitepress preview",
10-
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
10+
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .vitepress/cache"
1111
},
1212
"keywords": [],
1313
"author": "",
1414
"license": "ISC",
15+
"dependencies": {
16+
"@mylib/ui": "workspace:*",
17+
"@mylib/utils": "workspace:*",
18+
"@mylib/hooks": "workspace:*"
19+
},
1520
"devDependencies": {
1621
"vitepress": "^1.5.0"
1722
}

apps/docs/packages/hooks/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
```ts
88
<script setup>
9-
import { useCounter } from '@vue3-lib/hooks'
9+
import { useCounter } from '@mylib/hooks'
1010

1111
const { count, increment, decrement } = useCounter()
1212
</script>

apps/docs/packages/ui/button.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
Button 按钮基础按钮组件。基础用法基础的按钮用法。
22

3-
<script setup>
4-
import { VButton } from '@vue3-lib/ui'
3+
<!-- <script setup>
4+
import { VButton } from '@mylib/ui'
55
</script>
66
7-
<VButton>默认按钮</VButton>
7+
<VButton>默认按钮</VButton> -->
88

9-
API 属性 | 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | | type | 按钮类型 | 'primary' \| 'default' \| 'text' | 'default' | | size | 按钮大小 | 'large' \| 'default' \| 'small' | 'default' | | disabled | 是否禁用 | boolean | false |
9+
| 属性 | 参数 | 说明 | 类型 | 默认值 |
10+
| -------- | -------- | -------------------------------- | --------- | ------ |
11+
| type | 按钮类型 | 'primary' \| 'default' \| 'text' | 'default' |
12+
| size | 按钮大小 | 'large' \| 'default' \| 'small' | 'default' |
13+
| disabled | 是否禁用 | boolean | false |

apps/docs/packages/utils/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
> 判断是否为字符串。
88
99
```ts
10-
import { isString } from '@vue3-lib/utils';
10+
import { isString } from '@mylib/utils';
1111

1212
isString('hello'); // true
1313
isString(123); // false
@@ -20,7 +20,7 @@ isString(123); // false
2020
> 判断是否为数组。
2121
2222
```ts
23-
import { isArray } from '@vue3-lib/utils';
23+
import { isArray } from '@mylib/utils';
2424

2525
isArray([1, 2, 3]); // true
2626
isArray('hello'); // false

eslint.config.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export default {
22
root: true,
3-
extends: ['@vue3-lib/eslint-config'],
3+
extends: ['@mylib/eslint-config'],
44
};

package.json

+12-11
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,29 @@
2323
],
2424
"scripts": {
2525
"dev": "turbo run dev",
26-
"dev:docs": "pnpm -F @vue3-lib/docs run dev",
27-
"dev:play": "pnpm -F @vue3-lib/playground run dev",
26+
"dev:docs": "pnpm -F @mylib/docs run dev",
27+
"dev:play": "pnpm -F @mylib/playground run dev",
2828
"build": "turbo run build",
2929
"lint": "turbo run lint",
3030
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,mjs,mts,md,vue}\"",
31-
"clean": "turbo run clean",
31+
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist && turbo run clean",
3232
"version-packages": "changeset version",
3333
"update:deps": "pnpm update -r --latest",
3434
"update:check": "pnpm outdated -r",
3535
"preinstall": "npx only-allow pnpm",
36-
"prepare": "husky install"
36+
"prepare": "husky install",
37+
"rename-pkg": "bash ./scripts/rename-package.sh"
3738
},
3839
"devDependencies": {
3940
"@changesets/cli": "^2.27.10",
4041
"@commitlint/cli": "^19.6.0",
41-
"@vue3-lib/commitlint-config": "workspace:*",
42-
"@vue3-lib/eslint-config": "workspace:*",
43-
"@vue3-lib/prettier-config": "workspace:*",
44-
"@vue3-lib/stylelint-config": "workspace:*",
45-
"@vue3-lib/typescript-config": "workspace:*",
46-
"@vue3-lib/ui": "workspace:*",
47-
"@vue3-lib/utils": "workspace:*",
42+
"@mylib/commitlint-config": "workspace:*",
43+
"@mylib/eslint-config": "workspace:*",
44+
"@mylib/prettier-config": "workspace:*",
45+
"@mylib/stylelint-config": "workspace:*",
46+
"@mylib/typescript-config": "workspace:*",
47+
"@mylib/ui": "workspace:*",
48+
"@mylib/utils": "workspace:*",
4849
"eslint": "^9.15.0",
4950
"husky": "^9.1.7",
5051
"lint-staged": "^15.2.10",

packages/hooks/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@vue3-lib/hooks",
2+
"name": "@mylib/hooks",
33
"version": "0.0.1",
44
"description": "Vue3 Composition API hooks library",
55
"main": "dist/index.js",
@@ -18,7 +18,7 @@
1818
"devDependencies": {
1919
"@rollup/plugin-node-resolve": "^15.3.0",
2020
"@rollup/plugin-typescript": "^12.1.1",
21-
"@vue3-lib/typescript-config": "workspace:*",
21+
"@mylib/typescript-config": "workspace:*",
2222
"rollup": "^4.27.3",
2323
"tslib": "^2.8.1",
2424
"typescript": "^5.6.3"

packages/hooks/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "@vue3-lib/typescript-config/base.json",
2+
"extends": "@mylib/typescript-config/base.json",
33
"include": ["src/**/*.ts", "src/**/*.d.ts"],
44
"compilerOptions": {
55
"baseUrl": ".",
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
export default {
2-
extends: ['@commitlint/config-conventional'], // 继承自 commitlint 的标准配置
3-
rules: {
4-
'type-enum': [
5-
2, // 规则级别:错误
6-
'always', // 规则应用条件:始终检查
7-
[
8-
'feat', // 新功能
9-
'fix', // 修复
10-
'docs', // 文档变更
11-
'style', // 代码格式(不影响代码运行的变动)
12-
'refactor', // 重构(即不是新增功能,也不是修改bug的代码变动)
13-
'perf', // 性能优化
14-
'test', // 增加测试
15-
'build', // 影响构建系统或外部依赖关系的更改
16-
'ci', // 更改持续集成文件和脚本
17-
'chore', // 其他不修改src或test文件的更改
18-
'revert', // 撤销之前的提交
19-
],
20-
],
21-
},
22-
};
1+
export default {
2+
extends: ['@commitlint/config-conventional'], // 继承自 commitlint 的标准配置
3+
rules: {
4+
'type-enum': [
5+
2, // 规则级别:错误
6+
'always', // 规则应用条件:始终检查
7+
[
8+
'feat', // 新功能
9+
'fix', // 修复
10+
'docs', // 文档变更
11+
'style', // 代码格式(不影响代码运行的变动)
12+
'refactor', // 重构(即不是新增功能,也不是修改bug的代码变动)
13+
'perf', // 性能优化
14+
'test', // 增加测试
15+
'build', // 影响构建系统或外部依赖关系的更改
16+
'ci', // 更改持续集成文件和脚本
17+
'chore', // 其他不修改src或test文件的更改
18+
'revert', // 撤销之前的提交
19+
],
20+
],
21+
},
22+
};

packages/lint-configs/commitlint-config/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@vue3-lib/commitlint-config",
2+
"name": "@mylib/commitlint-config",
33
"version": "0.0.1",
44
"private": true,
55
"main": "index.mjs",
+33-33
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
// 导入 eslint 配置定义工具
2-
import { defineConfig } from 'eslint-define-config';
3-
4-
export default defineConfig({
5-
// 指定环境
6-
env: {
7-
browser: true, // 浏览器环境
8-
es2021: true, // ES2021 特性
9-
node: true, // Node.js 环境
10-
},
11-
// 继承的配置
12-
extends: [
13-
'eslint:recommended', // ESLint 推荐规则
14-
'plugin:@typescript-eslint/recommended', // TypeScript 推荐规则
15-
'plugin:vue/vue3-recommended', // Vue3 推荐规则
16-
'prettier', // Prettier 规则,需要放在最后以覆盖之前的格式化规则
17-
],
18-
// 指定解析器
19-
parser: 'vue-eslint-parser', // 用于解析 .vue 文件
20-
// 解析器选项
21-
parserOptions: {
22-
parser: '@typescript-eslint/parser', // TypeScript 解析器
23-
ecmaVersion: 'latest', // 使用最新的 ECMAScript 版本
24-
sourceType: 'module', // 使用 ES 模块
25-
ecmaFeatures: {
26-
jsx: true, // 启用 JSX
27-
},
28-
},
29-
// 具体规则配置
30-
rules: {
31-
'vue/multi-word-component-names': 'off', // 关闭组件名必须多单词的限制
32-
},
33-
});
1+
// 导入 eslint 配置定义工具
2+
import { defineConfig } from 'eslint-define-config';
3+
4+
export default defineConfig({
5+
// 指定环境
6+
env: {
7+
browser: true, // 浏览器环境
8+
es2021: true, // ES2021 特性
9+
node: true, // Node.js 环境
10+
},
11+
// 继承的配置
12+
extends: [
13+
'eslint:recommended', // ESLint 推荐规则
14+
'plugin:@typescript-eslint/recommended', // TypeScript 推荐规则
15+
'plugin:vue/vue3-recommended', // Vue3 推荐规则
16+
'prettier', // Prettier 规则,需要放在最后以覆盖之前的格式化规则
17+
],
18+
// 指定解析器
19+
parser: 'vue-eslint-parser', // 用于解析 .vue 文件
20+
// 解析器选项
21+
parserOptions: {
22+
parser: '@typescript-eslint/parser', // TypeScript 解析器
23+
ecmaVersion: 'latest', // 使用最新的 ECMAScript 版本
24+
sourceType: 'module', // 使用 ES 模块
25+
ecmaFeatures: {
26+
jsx: true, // 启用 JSX
27+
},
28+
},
29+
// 具体规则配置
30+
rules: {
31+
'vue/multi-word-component-names': 'off', // 关闭组件名必须多单词的限制
32+
},
33+
});

packages/lint-configs/eslint-config/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@vue3-lib/eslint-config",
2+
"name": "@mylib/eslint-config",
33
"version": "0.0.1",
44
"private": true,
55
"main": "index.mjs",

packages/lint-configs/prettier-config/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@vue3-lib/prettier-config",
2+
"name": "@mylib/prettier-config",
33
"version": "0.0.1",
44
"private": true,
55
"main": "index.mjs",

packages/lint-configs/stylelint-config/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@vue3-lib/stylelint-config",
2+
"name": "@mylib/stylelint-config",
33
"version": "0.0.1",
44
"private": true,
55
"type": "module",
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"name": "@vue3-lib/typescript-config",
2+
"name": "@mylib/typescript-config",
33
"version": "0.0.1",
44
"private": true,
55
"license": "MIT",
66
"publishConfig": {
77
"access": "public"
88
}
9-
}
9+
}

packages/ui/README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# @vue3-lib/ui
1+
# @mylib/ui
22

33
Vue 3 组件库,基于 Vue 3 + TypeScript 构建的现代化组件库。
44

@@ -15,20 +15,20 @@ Vue 3 组件库,基于 Vue 3 + TypeScript 构建的现代化组件库。
1515

1616
```bash
1717
npm
18-
npm install @vue3-lib/ui
18+
npm install @mylib/ui
1919
yarn
20-
yarn add @vue3-lib/ui
20+
yarn add @mylib/ui
2121
pnpm
22-
pnpm add @vue3-lib/ui
22+
pnpm add @mylib/ui
2323
```
2424

2525
## 快速开始
2626

2727
```ts
2828
// main.ts
2929
import { createApp } from 'vue';
30-
import VUI from '@vue3-lib/ui';
31-
import '@vue3-lib/ui/dist/style.css';
30+
import VUI from '@mylib/ui';
31+
import '@mylib/ui/dist/style.css';
3232
import App from './App.vue';
3333
const app = createApp(App);
3434
app.use(VUI);
@@ -40,8 +40,8 @@ app.mount('#app');
4040
```ts
4141
// main.ts
4242
import { createApp } from 'vue';
43-
import { Button } from '@vue3-lib/ui';
44-
import '@vue3-lib/ui/dist/style.css';
43+
import { Button } from '@mylib/ui';
44+
import '@mylib/ui/dist/style.css';
4545
import App from './App.vue';
4646
const app = createApp(App);
4747
app.use(Button);

packages/ui/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@vue3-lib/ui",
2+
"name": "@mylib/ui",
33
"version": "0.0.1",
44
"private": true,
55
"type": "module",
@@ -25,7 +25,7 @@
2525
"@types/node": "^22.9.1",
2626
"@vitejs/plugin-vue": "^5.2.0",
2727
"@vue/runtime-core": "^3.5.13",
28-
"@vue3-lib/typescript-config": "workspace:*",
28+
"@mylib/typescript-config": "workspace:*",
2929
"sass": "^1.81.0",
3030
"terser": "^5.36.0",
3131
"typescript": "^5.6.3",

0 commit comments

Comments
 (0)