Skip to content

Commit

Permalink
refactor: remove vuepress-vite and vuepress-webpack packages
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `vuepress-vite` and `vuepress-webpack` packages have been deprecated, you should install bundler package and set bundler in config file manually
  • Loading branch information
meteorlxy committed Dec 20, 2023
1 parent d8f15f2 commit db2d8c8
Show file tree
Hide file tree
Showing 25 changed files with 87 additions and 217 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,11 @@ module.exports = {
'vue/one-component-per-file': 'off',
},
},
{
files: ['packages/vuepress/bin/vuepress-*.js'],
rules: {
'import/no-extraneous-dependencies': 'off',
},
},
],
}
4 changes: 1 addition & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ In the `packages` directory:

Here are some wrapper packages that use the above packages:

- `vuepress`: A wrapper of `vuepress-vite`.
- `vuepress-vite`: A wrapper of `@vuepress/cli` + `@vuepress/bundler-vite`. If users want to use vite, they can simply install this package.
- `vuepress-webpack`: A wrapper of `@vuepress/cli` + `@vuepress/bundler-webpack`. If users want to use webpack, they can simply install this package.
- `vuepress`: A wrapper the above packages, and provides `vuepress` command line tool. Users need to choose and install bundler and theme by themselves.

## Development Setup

Expand Down
4 changes: 1 addition & 3 deletions CONTRIBUTING_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

还有一些对上述 Package 进行封装后的 Package :

- `vuepress`: 是 `vuepress-vite` 的封装。
- `vuepress-vite`: 是 `@vuepress/cli` + `@vuepress/bundler-vite` 的封装。如果用户想使用 Vite ,仅安装这个 Package 就可以了。
- `vuepress-webpack`: 是 `@vuepress/cli` + `@vuepress/bundler-webpack` 的封装。如果用户想使用 Webpack ,仅安装这个 Package 就可以了。
- `vuepress`: 是上述包的封装,提供了 `vuepress` 命令行工具。用户需要在此包的基础上自行选择并安装打包工具和主题。

## 开发配置

Expand Down
3 changes: 2 additions & 1 deletion e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"@vuepress/utils": "workspace:*",
"sass": "^1.69.5",
"sass-loader": "^13.3.2",
"vue": "^3.3.13"
"vue": "^3.3.13",
"vuepress": "workspace:*"
},
"devDependencies": {
"anywhere": "^1.6.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/config/resolveAppConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { colors, isChildPath, logger } from '@vuepress/utils'
* Resolve app config according to:
*
* - default options
* - cli options
* - user config file
* - cli options
*/
export const resolveAppConfig = ({
defaultAppConfig,
Expand All @@ -20,10 +20,10 @@ export const resolveAppConfig = ({
}): AppConfig | null => {
const appConfig = {
// allow setting default app config via `cli()`
// for example, set different default bundler in `vuepress` and `vuepress-vite` package
...defaultAppConfig,
// use cli options to override config file
// user config from config file
...userConfig,
// allow cli options to override config file
...cliAppConfig,
} as AppConfig

Expand Down
12 changes: 0 additions & 12 deletions packages/vuepress-vite/README.md

This file was deleted.

71 changes: 0 additions & 71 deletions packages/vuepress-vite/package.json

This file was deleted.

3 changes: 0 additions & 3 deletions packages/vuepress-vite/src/index.ts

This file was deleted.

12 changes: 0 additions & 12 deletions packages/vuepress-webpack/README.md

This file was deleted.

68 changes: 0 additions & 68 deletions packages/vuepress-webpack/package.json

This file was deleted.

3 changes: 0 additions & 3 deletions packages/vuepress-webpack/src/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
import { viteBundler } from '@vuepress/bundler-vite'
import { cli } from '@vuepress/cli'

// set default bundler
cli({ bundler: viteBundler() })
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
import { webpackBundler } from '@vuepress/bundler-webpack'
import { cli } from '@vuepress/cli'

// set default bundler
cli({ bundler: webpackBundler() })
4 changes: 3 additions & 1 deletion packages/vuepress/bin/vuepress.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env node

import 'vuepress-vite/bin'
import { cli } from '@vuepress/cli'

cli()
50 changes: 46 additions & 4 deletions packages/vuepress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,20 @@
"exports": {
".": "./dist/index.js",
"./bin": "./bin/vuepress.js",
"./cli": "./dist/cli.js",
"./client": "./dist/client.js",
"./core": "./dist/core.js",
"./markdown": "./dist/markdown.js",
"./shared": "./dist/shared.js",
"./utils": "./dist/utils.js",
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"bin": {
"vuepress": "./bin/vuepress.js"
"vuepress": "./bin/vuepress.js",
"vuepress-vite": "./bin/vuepress-vite.js",
"vuepress-webpack": "./bin/vuepress-webpack.js"
},
"files": [
"bin",
Expand All @@ -38,16 +46,50 @@
"clean": "rimraf dist"
},
"dependencies": {
"vuepress-vite": "workspace:*"
"@vuepress/cli": "workspace:*",
"@vuepress/client": "workspace:*",
"@vuepress/core": "workspace:*",
"@vuepress/markdown": "workspace:*",
"@vuepress/shared": "workspace:*",
"@vuepress/utils": "workspace:*",
"vue": "^3.3.13"
},
"peerDependencies": {
"@vuepress/bundler-vite": "workspace:*",
"@vuepress/bundler-webpack": "workspace:*",
"@vuepress/client": "workspace:*",
"vue": "^3.3.13"
},
"peerDependenciesMeta": {
"@vuepress/bundler-vite": {
"optional": true
},
"@vuepress/bundler-webpack": {
"optional": true
}
},
"engines": {
"node": ">=18.16.0"
},
"tsup": {
"clean": true,
"dts": "./src/index.ts",
"dts": [
"./src/index.ts",
"./src/cli.ts",
"./src/client.ts",
"./src/core.ts",
"./src/markdown.ts",
"./src/shared.ts",
"./src/utils.ts"
],
"entry": [
"./src/index.ts"
"./src/index.ts",
"./src/cli.ts",
"./src/client.ts",
"./src/core.ts",
"./src/markdown.ts",
"./src/shared.ts",
"./src/utils.ts"
],
"format": [
"esm"
Expand Down
1 change: 1 addition & 0 deletions packages/vuepress/src/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@vuepress/cli'
1 change: 1 addition & 0 deletions packages/vuepress/src/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@vuepress/client'
1 change: 1 addition & 0 deletions packages/vuepress/src/core.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@vuepress/core'
3 changes: 2 additions & 1 deletion packages/vuepress/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from 'vuepress-vite'
export * from '@vuepress/cli'
export * from '@vuepress/core'
1 change: 1 addition & 0 deletions packages/vuepress/src/markdown.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@vuepress/markdown'
1 change: 1 addition & 0 deletions packages/vuepress/src/shared.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@vuepress/shared'
1 change: 1 addition & 0 deletions packages/vuepress/src/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@vuepress/utils'
Loading

0 comments on commit db2d8c8

Please sign in to comment.