-
Notifications
You must be signed in to change notification settings - Fork 27
docs: add quick start #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # 架构简述 | ||
|
|
||
| CodeBlitz 将原来 OpenSumi 的功能封装成了一个 React 组件。 | ||
|
|
||
| 它的主入口在 `@codeblitzjs/ide-core` 这个包,用起来很简单: | ||
|
|
||
| ```tsx | ||
| import { AppRenderer, EditorRenderer } from '@codeblitzjs/ide-core'; | ||
|
|
||
| function App() { | ||
| return <AppRenderer appConfig={{}} /> | ||
| } | ||
|
|
||
| function Editor() { | ||
| return <EditorRenderer appConfig={{}} /> | ||
| } | ||
| ``` | ||
|
|
||
| 此外还提供了 `DiffViewerRenderer`,这是我们的新版 Diff 组件,所有的 diff 在行内展示,并且可以让用户选择是否采纳, | ||
| 对于 AI 生成代码的场景特别有用。 | ||
|
|
||
| ## 产物 | ||
|
|
||
| CodeBlitz 有一个很特别的地方是它打包的产物分 `bundle` 与 `lib` 两种版本: | ||
|
|
||
| 1. lib 下为源码经过 tsc 编译后的文件,因此如直接从 lib 下引用,那么可根据需要使用 OpenSumi (@opensumi/ide-*) 和 monaco (@opensumi/monaco-editor-core/esm) 相关模块,满足高定制的应用的需求,可以参考 [OpenSumi 开发文档](https://opensumi.com/zh/docs/integrate/universal-integrate-case/custom-view)。另外由于 lib 下的样式文件为 less,因此 webpack 需要额外处理 less 的编译。 | ||
|
|
||
| 2. 提供 bundle 方式可以减少集成方打包的时间,缺点就是整个 bundle 包体积很大。 | ||
| bundle 下为打包好的文件,只需引入 js 和 css 即可。 | ||
|
|
||
| 同时 CodeBlitz 还会打包成 umd 格式,方便在浏览器中直接引用,它的导出名为 `Alex`。 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Quick Start | ||
|
|
||
| ## Clone | ||
|
|
||
| ```bash | ||
|
|
||
| git clone git@github.com:opensumi/codeblitz.git | ||
| cd codeblitz | ||
| ``` | ||
|
|
||
| ## Install | ||
|
|
||
| ```bash | ||
| yarn | ||
| yarn run init | ||
| ``` | ||
|
|
||
| ## Start | ||
|
|
||
| ```bash | ||
| yarn start | ||
| ``` | ||
|
|
||
| CodeBlitz 有很多集成场景,在开发的时候需要模拟这些场景,你也可以直接通过命令行启动这些场景: | ||
|
|
||
| - diff-viewer 行内的 diff 查看器 | ||
| `yarn diff-viewer` | ||
| - code | ||
| `yarn code` | ||
| - provider 直接渲染编辑器组件、Diff 组件的例子 | ||
| 使用 `CodeEditor`/`DiffEditor`。 | ||
| `yarn provider` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.