mirror of
https://gitee.com/WeBank/fes.js.git
synced 2024-11-29 18:28:09 +08:00
docs: 优化 docs
This commit is contained in:
parent
453b500c28
commit
35be9b4aa6
@ -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 }
|
||||
};
|
||||
```
|
||||
|
||||
|
@ -99,7 +99,7 @@ FES_ENV=sit fes dev
|
||||
|
||||
### PORT
|
||||
|
||||
`fes dev` 时服务指定的端口号,默认是 `8080`
|
||||
`fes dev` 时服务指定的端口号,默认是 `8000`
|
||||
|
||||
### HOST
|
||||
|
||||
|
@ -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 ...
|
||||
</CodeGroupItem>
|
||||
</CodeGroup>
|
||||
|
||||
Fes.js 会在 [http://localhost:8080](http://localhost:8080) 启动一个热重载的开发服务器。当你修改你的 .vue 文件时,浏览器中的内容也会自动更新。
|
||||
Fes.js 会在 [http://localhost:8000](http://localhost:8000) 启动一个热重载的开发服务器。当你修改你的 .vue 文件时,浏览器中的内容也会自动更新。
|
||||
|
||||
<img :src="$withBase('home.png')" alt="home">
|
||||
|
||||
|
@ -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 <config> Set path to config file
|
||||
-p, --port <port> Use specified port (default: 8080)
|
||||
-t, --temp <temp> Set the directory of the temporary files
|
||||
--host <host> Use specified host (default: 0.0.0.0)
|
||||
--cache <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 <config> Set path to config file
|
||||
-p, --port <port> Use specified port (default: 8000)
|
||||
-t, --temp <temp> Set the directory of the temporary files
|
||||
--host <host> Use specified host (default: 0.0.0.0)
|
||||
--cache <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 <config> Set path to config file
|
||||
-d, --dest <dest> Set the directory build output (default: .vuepress/dist)
|
||||
-t, --temp <temp> Set the directory of the temporary files
|
||||
--cache <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 <config> Set path to config file
|
||||
-d, --dest <dest> Set the directory build output (default: .vuepress/dist)
|
||||
-t, --temp <temp> Set the directory of the temporary files
|
||||
--cache <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
|
||||
```
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 配置。
|
||||
|
||||
示例:
|
||||
|
||||
|
@ -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: './',
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
```
|
||||
|
@ -19,7 +19,7 @@ export default (api) => {
|
||||
options: [
|
||||
{
|
||||
name: '--port',
|
||||
description: 'http service port, like 8080',
|
||||
description: 'http service port, like 8000',
|
||||
},
|
||||
{
|
||||
name: '--https',
|
||||
|
@ -41,7 +41,7 @@ export default (api) => {
|
||||
options: [
|
||||
{
|
||||
name: '--port',
|
||||
description: 'http service port, like 8080',
|
||||
description: 'http service port, like 8000',
|
||||
},
|
||||
{
|
||||
name: '--https',
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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...');
|
||||
|
Loading…
Reference in New Issue
Block a user