Skip to content

Commit

Permalink
docs: optimize doc format (#690)
Browse files Browse the repository at this point in the history
* docs: delete old doc

* docs: fix doc format
  • Loading branch information
zhoushaw authored Nov 4, 2024
1 parent acabc59 commit f2c2a5c
Show file tree
Hide file tree
Showing 120 changed files with 11 additions and 22,799 deletions.
2 changes: 1 addition & 1 deletion website-new/docs/api/registerApp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Garfish 处理 app 参数的原则是:
> activeWhen 为基于路由模式加载子应用时的激活路径(或条件),目的是为了寻找当前应该激活的子应用。当用户使用 [loadApp](/api#loadApp) 手动挂载应用时,此时可省略 `activeWhen` 参数。

:::caution
:::danger

1. 子应用如果本身具备路由,在微前端的场景下,必须把 basename 作为子应用的基础路径,没有基础路由,子应用的路由可能与主应用和其他应用发生冲突;
2. 我们强留建议不要使用根路径作为子应用的激活条件,[为什么?](/issues/#根路由作为子应用的激活条件)
Expand Down
6 changes: 4 additions & 2 deletions website-new/docs/guide/demo/angular.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ npm install @angular-builders/custom-webpack:dev-server -D
// angular.json
"builder": "@angular-builders/custom-webpack:dev-server",
```
:::caution
:::danger
1. 请注意,在 [packageName] > architect > build > options 的配置中,index 属性我们设置为空,这是因为在 angular 13 中编译产物默认会带上 esm 标识,即 type=module, 即使打包产物是 umd 格式,这会导致 garfish 加载子应用失败;
2. index 置空后,编译产物会去除 es module 标识,子应用加载正常;

Expand All @@ -44,7 +44,8 @@ npm install @angular-builders/custom-webpack:dev-server -D

### 3. 添加 webpack 配置文件

:::caution 【重要】注意:
:::tip danger
【重要】注意:
1. libraryTarget 需要配置成 umd 规范;
2. globalObject 需要设置为 'window',以避免由于不规范的代码格式导致的逃逸沙箱;
3. 如果你的 webpack 为 v4 版本,需要设置 jsonpFunction 并保证该值唯一(否则可能出现 webpack chunk 互相影响的可能)。若为 webpack5 将会直接使用 package.json name 作为唯一值,请确保应用间的 name 各不相同;
Expand Down Expand Up @@ -129,6 +130,7 @@ module.exports = {
3. 目前主应用仅支持 history 模式的子应用路由,[why](../../issues/childApp.md#为什么主应用仅支持-history-模式)

:::

```ts
// app.module.ts
import { NgModule } from '@angular/core';
Expand Down
1 change: 1 addition & 0 deletions website-new/docs/guide/demo/react.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export const provider = () => {
1. 为什么要设置 basename?请参考 [issue](../../issues/childApp.md#子应用拿到-basename-的作用)
2. 我们强烈建议使用从主应用传递过来的 basename 作为子应用的 basename,而非主、子应用约定式,避免 basename 后期变更未同步带来的问题。
3. 目前主应用仅支持 history 模式的子应用路由,[why](../../issues/childApp.md#为什么主应用仅支持-history-模式)

:::

```tsx
Expand Down
2 changes: 1 addition & 1 deletion website-new/docs/guide/demo/vite.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Garfish.run({
})
```

:::caution
:::danger
注意,不要设置 Garfish.run() 顶层的 sandbox 属性,这会导致所有子应用的沙箱关闭。

:::
Expand Down
2 changes: 1 addition & 1 deletion website-new/src/components/config/_sandbox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Garfish.run({
});
```

:::caution
:::danger
请注意:
如果你在沙箱内自定义的行为将会产生副作用,请确保在 recover 函数中清除你的副作用,garfish 将在应用卸载过程中执行 recover 函数销毁沙箱副作用,否则可能会造成内存泄漏。
:::
Expand Down
5 changes: 3 additions & 2 deletions website-new/src/components/config/_webpackConfig.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ module.exports = {
};
```

:::tip 【重要】注意:

<p>
【重要】注意:
1. libraryTarget 需要配置成 umd 规范;
2. globalObject 需要设置为 'window',以避免由于不规范的代码格式导致的逃逸沙箱;
3. 如果你的 webpack 为 v4 版本,需要设置 jsonpFunction 并保证该值唯一(否则可能出现 webpack chunk 互相影响的可能)。若为 webpack5 将会直接使用 package.json name 作为唯一值,请确保应用间的 name 各不相同;
4. publicPath 设置为子应用资源的绝对地址,避免由于子应用的相对资源导致资源变为了主应用上的相对资源。这是因为主、子应用处于同一个文档流中,相对路径是相对于主应用而言的
5. 'Access-Control-Allow-Origin': '\*' 允许开发环境跨域,保证子应用的资源支持跨域。另外也需要保证在上线后子应用的资源在主应用的环境中加载不会存在跨域问题(**也需要限制范围注意安全问题**);

:::
</p>
23 changes: 0 additions & 23 deletions website/.editorconfig

This file was deleted.

22 changes: 0 additions & 22 deletions website/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion website/.npmrc

This file was deleted.

16 changes: 0 additions & 16 deletions website/CHANGELOG.md

This file was deleted.

1 change: 0 additions & 1 deletion website/CNAME

This file was deleted.

43 changes: 0 additions & 43 deletions website/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions website/babel.config.js

This file was deleted.

5 changes: 0 additions & 5 deletions website/docs/api/__meta__.md

This file was deleted.

28 changes: 0 additions & 28 deletions website/docs/api/api.md

This file was deleted.

44 changes: 0 additions & 44 deletions website/docs/api/channel.md

This file was deleted.

20 changes: 0 additions & 20 deletions website/docs/api/clearEscapeEffect.md

This file was deleted.

31 changes: 0 additions & 31 deletions website/docs/api/getGlobal.md

This file was deleted.

Loading

0 comments on commit f2c2a5c

Please sign in to comment.