From 35be9b4aa6f90101ba689b178f2105444939af4e Mon Sep 17 00:00:00 2001 From: winixt Date: Sat, 1 Apr 2023 15:45:51 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E4=BC=98=E5=8C=96=20docs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/guide/config.md | 8 ++-- docs/guide/env.md | 2 +- docs/guide/getting-started.md | 6 +-- docs/reference/cli.md | 40 +++++++++---------- docs/reference/cli/README.md | 4 +- docs/reference/config/README.md | 16 +++++++- docs/reference/plugin/plugins/windicss.md | 11 +++-- .../src/commands/dev/index.js | 2 +- .../src/plugins/commands/dev/index.js | 2 +- .../plugins/commands/webpackConfig/index.js | 7 +--- scripts/release.mjs | 24 +++++------ 11 files changed, 69 insertions(+), 53 deletions(-) diff --git a/docs/guide/config.md b/docs/guide/config.md index 225bb9f5..0732043e 100644 --- a/docs/guide/config.md +++ b/docs/guide/config.md @@ -51,7 +51,7 @@ export default { mock: false }; // .fes.local.js export default { mock: true, - devServer: { port: 8080 } + devServer: { port: 8000 } }; ``` @@ -60,7 +60,7 @@ export default { ```js { mock: true, - devServer: { port: 8080 } + devServer: { port: 8000 } }; ``` @@ -81,7 +81,7 @@ export default { mock: false }; // .fes.uat.js export default { mock: true, - devServer: { port: 8080 } + devServer: { port: 8000 } }; ``` @@ -96,7 +96,7 @@ FES_ENV=uat fes dev ```js { mock: true, - devServer: { port: 8080 } + devServer: { port: 8000 } }; ``` diff --git a/docs/guide/env.md b/docs/guide/env.md index 15fbc9b2..98bab5e3 100644 --- a/docs/guide/env.md +++ b/docs/guide/env.md @@ -99,7 +99,7 @@ FES_ENV=sit fes dev ### PORT -`fes dev` 时服务指定的端口号,默认是 `8080` +`fes dev` 时服务指定的端口号,默认是 `8000` ### HOST diff --git a/docs/guide/getting-started.md b/docs/guide/getting-started.md index dff20fe4..aff9bfd3 100644 --- a/docs/guide/getting-started.md +++ b/docs/guide/getting-started.md @@ -112,7 +112,7 @@ pnpm dev pnpm run v1.22.4 $ fes dev -Starting the development server http://localhost:8080 ... +Starting the development server http://localhost:8000 ... ✔ Webpack Compiled successfully in 15.91s @@ -129,7 +129,7 @@ Starting the development server http://localhost:8080 ... npm run dev > fes dev -Starting the development server http://localhost:8080 ... +Starting the development server http://localhost:8000 ... ✔ Webpack Compiled successfully in 3.66s @@ -140,7 +140,7 @@ Starting the development server http://localhost:8080 ... -Fes.js 会在 [http://localhost:8080](http://localhost:8080) 启动一个热重载的开发服务器。当你修改你的 .vue 文件时,浏览器中的内容也会自动更新。 +Fes.js 会在 [http://localhost:8000](http://localhost:8000) 启动一个热重载的开发服务器。当你修改你的 .vue 文件时,浏览器中的内容也会自动更新。 home diff --git a/docs/reference/cli.md b/docs/reference/cli.md index 1c7eda5e..364570fe 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -19,8 +19,8 @@ For more info, run any command with the `--help` flag: $ vuepress info --help Options: - -v, --version Display version number - -h, --help Display this message + -v, --version Display version number + -h, --help Display this message ``` ## dev @@ -32,17 +32,17 @@ Usage: $ vuepress dev [sourceDir] Options: - -c, --config Set path to config file - -p, --port Use specified port (default: 8080) - -t, --temp Set the directory of the temporary files - --host Use specified host (default: 0.0.0.0) - --cache Set the directory of the cache files - --clean-temp Clean the temporary files before dev - --clean-cache Clean the cache files before dev - --open Open browser when ready - --debug Enable debug mode + -c, --config Set path to config file + -p, --port Use specified port (default: 8000) + -t, --temp Set the directory of the temporary files + --host Use specified host (default: 0.0.0.0) + --cache Set the directory of the cache files + --clean-temp Clean the temporary files before dev + --clean-cache Clean the cache files before dev + --open Open browser when ready + --debug Enable debug mode --no-watch Disable watching page and config files (default: true) - -v, --version Display version number + -v, --version Display version number -h, --help Display this message ``` @@ -59,14 +59,14 @@ Usage: $ vuepress build [sourceDir] Options: - -c, --config Set path to config file - -d, --dest Set the directory build output (default: .vuepress/dist) - -t, --temp Set the directory of the temporary files - --cache Set the directory of the cache files - --clean-temp Clean the temporary files before build - --clean-cache Clean the cache files before build - --debug Enable debug mode - -v, --version Display version number + -c, --config Set path to config file + -d, --dest Set the directory build output (default: .vuepress/dist) + -t, --temp Set the directory of the temporary files + --cache Set the directory of the cache files + --clean-temp Clean the temporary files before build + --clean-cache Clean the cache files before build + --debug Enable debug mode + -v, --version Display version number -h, --help Display this message ``` diff --git a/docs/reference/cli/README.md b/docs/reference/cli/README.md index a1418e1e..f6d799f3 100644 --- a/docs/reference/cli/README.md +++ b/docs/reference/cli/README.md @@ -112,7 +112,7 @@ Usage: fes dev [options] start a local http service for development Options: - --port http service port, like 8080 + --port http service port, like 8000 --https whether to turn on the https service -h, --help display help for command ``` @@ -120,7 +120,7 @@ Options: 比如: ```bash -fes dev --port=8080 +fes dev --port=8000 ``` ### fes build diff --git a/docs/reference/config/README.md b/docs/reference/config/README.md index ff71b4e7..291db9c2 100644 --- a/docs/reference/config/README.md +++ b/docs/reference/config/README.md @@ -78,6 +78,20 @@ export default { 2.1.x 版本请使用 router.base 代替 ::: +### builder + +- 类型: `string` +- 默认值: 如果装了多个构建,需要通过 builder 指定具体使用哪个 +- 详情: + 比如 dev 用 vite,构建用 webpack +- 示例: + +```js +export default { + builder: 'webpack', +}; +``` + ### define - 类型: `object` @@ -319,7 +333,7 @@ const defaultTerserOptions = { - 默认值:`null` - 详情: - 通过 [webpack-chain](https://github.com/neutrinojs/webpack-chain) 的 API 修改 webpack 配置。 + 通过 [webpack-chain](https://github.com/sorrycc/webpack-chain#readme) 的 API 修改 webpack 配置。 示例: diff --git a/docs/reference/plugin/plugins/windicss.md b/docs/reference/plugin/plugins/windicss.md index be28d80b..9dd4dced 100644 --- a/docs/reference/plugin/plugins/windicss.md +++ b/docs/reference/plugin/plugins/windicss.md @@ -1,17 +1,22 @@ # @fesjs/plugin-windicss +::: warning 即将废弃 +由于 windicss 不怎么维护了,本插件即将废弃,推荐使用 [tailwindcss](https://tailwindcss.com/)。 +::: ## 介绍 `windicss` 支持 ## 启用方式 + 在 `package.json` 中引入依赖: + ```json { "devDependencies": { "@fesjs/plugin-windicss": "^2.0.0" - }, + } } ``` @@ -23,6 +28,6 @@ export default { windicss: { root: './', - } -} + }, +}; ``` diff --git a/packages/fes-builder-vite/src/commands/dev/index.js b/packages/fes-builder-vite/src/commands/dev/index.js index 660a27d4..de0b6880 100644 --- a/packages/fes-builder-vite/src/commands/dev/index.js +++ b/packages/fes-builder-vite/src/commands/dev/index.js @@ -19,7 +19,7 @@ export default (api) => { options: [ { name: '--port', - description: 'http service port, like 8080', + description: 'http service port, like 8000', }, { name: '--https', diff --git a/packages/fes-builder-webpack/src/plugins/commands/dev/index.js b/packages/fes-builder-webpack/src/plugins/commands/dev/index.js index 66a01005..a1ceca9c 100644 --- a/packages/fes-builder-webpack/src/plugins/commands/dev/index.js +++ b/packages/fes-builder-webpack/src/plugins/commands/dev/index.js @@ -41,7 +41,7 @@ export default (api) => { options: [ { name: '--port', - description: 'http service port, like 8080', + description: 'http service port, like 8000', }, { name: '--https', diff --git a/packages/fes-builder-webpack/src/plugins/commands/webpackConfig/index.js b/packages/fes-builder-webpack/src/plugins/commands/webpackConfig/index.js index 782bcef6..6b4342b6 100644 --- a/packages/fes-builder-webpack/src/plugins/commands/webpackConfig/index.js +++ b/packages/fes-builder-webpack/src/plugins/commands/webpackConfig/index.js @@ -78,7 +78,8 @@ export default async function getConfig({ api, cwd, config, env, entry = {}, mod .path(absoluteOutput) .publicPath(publicPath || '/') .filename('static/[name].[contenthash:8].js') - .chunkFilename('static/[name].[contenthash:8].chunk.js'); + .chunkFilename('static/[name].[contenthash:8].chunk.js') + .assetModuleFilename('static/[name][hash:8][ext]'); // --------------- resolve ----------- webpackConfig.resolve.extensions.merge(['.mjs', '.js', '.jsx', '.vue', '.ts', '.tsx', '.json', '.wasm']); @@ -293,10 +294,6 @@ export default async function getConfig({ api, cwd, config, env, entry = {}, mod aggregateTimeout: 200, ...memo.watchOptions, }; - memo.output = { - ...memo.output, - assetModuleFilename: 'static/[name][hash:8][ext]', - }; return memo; } diff --git a/scripts/release.mjs b/scripts/release.mjs index 45d5a462..32d4c202 100644 --- a/scripts/release.mjs +++ b/scripts/release.mjs @@ -78,12 +78,6 @@ function writePackageJson(pkg, content) { fs.writeFileSync(path.join(pkgPath, 'package.json'), `${JSON.stringify(content, null, 2)}\n`); } -function genRootPackageVersion() { - const pkgPath = path.resolve(path.resolve(__dirname, '..'), 'package.json'); - const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8')); - return semver.inc(pkg.version, 'prerelease', semver.prerelease(pkg.version) && semver.prerelease(pkg.version)[0]); -} - function readPackageVersionAndName(pkg) { const { version, name } = readPackageJson(pkg); return { @@ -140,9 +134,7 @@ const filterChangedPackages = async () => { return packages.filter((_v, index) => results[index]); }; -async function createPackageNewVersion(pkg) { - const { name, version } = readPackageVersionAndName(pkg); - +async function createPackageNewVersion(name, version) { // no explicit version, offer suggestions const { release } = await prompt({ type: 'select', @@ -167,12 +159,19 @@ async function createPackageNewVersion(pkg) { if (!semver.valid(newVersion)) { console.log(`invalid target version: ${newVersion}, please again.`); - return createPackageNewVersion(pkg); + return createPackageNewVersion(name, version); } return newVersion; } +async function genRootPackageVersion() { + const pkgPath = path.resolve(path.resolve(__dirname, '..'), 'package.json'); + const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8')); + const newVersion = await createPackageNewVersion(pkg.name, pkg.version); + return newVersion; +} + function genOtherPkgsVersion(packagesVersion) { const noChangedPkgs = packages.filter((name) => !packagesVersion.find((item) => item.dirName === name)); const pkgs = arrToObj(packagesVersion, 'name'); @@ -216,7 +215,8 @@ async function main() { const updatedPkgs = []; for (const pkg of changedPackages) { - const newVersion = await createPackageNewVersion(pkg); + const { name, version } = readPackageVersionAndName(pkg); + const newVersion = await createPackageNewVersion(name, version); updatedPkgs.push({ dirName: pkg, newVersion, @@ -239,7 +239,7 @@ async function main() { return; } - const newRootVersion = genRootPackageVersion(); + const newRootVersion = await genRootPackageVersion(); // update all package versions and inter-dependencies step('\nUpdating cross dependencies...');