[go: nahoru, domu]

Skip to content

Latest commit

 

History

History
136 lines (85 loc) · 8.22 KB

CONTRIBUTING.md

File metadata and controls

136 lines (85 loc) · 8.22 KB

How to contribute

English | 简体中文

Generally speaking, you have many ways to contribute to the development of the OpenSumi code, for example: write down a issue about the bug you found, submit a PR (Pull Requests), or simply to some Each feature submits a suggestion, etc.

After you clone and build our warehouse code, check Issues. For issues marked with PR Welcome, it is best to submit your first PR If you have any questions in the process, you can always consult any project member in the comment area @ any project member.

Development environment preparation

The system tool installation method here refers to the How-to-Contribute document of VS Code for translation, and you can directly view the document.

Before developing the code, you need to install some necessary development tools, clone our project code opensumi/core, and install dependencies through npm.

You may need the following development tools:

  • Git
  • Node.JS, x64, version number >= 12.x, <= 14.x
  • Python (pre-dependency of node-gyp library; view [node-gyp readme](https://github.com/nodejs/node-gyp# installation) Find a suitable version currently supported)
    • Note: Windows users will install Python automatically by installing the npm module of windows-build-tools, which can be quickly installed in this way. (See below)
  • A C/C++ compilation tool suitable for your system:
    • macOS
      • Installing Xcode and its command line tools will automatically install gcc, the installation process relies on the make tool chain
        • Run xcode-select --install to install command line tools
    • Windows 10/11
      • Install Windows Build Tools:
        • If you install it through the Node installer provided by Node.JS and make sure you install the native module tools, the environment will be able to be used normally.
        • If you manage scripts through Node version, such as nvm or nvs
      • Note: Make sure that your local PATH contains only ASCII characters, otherwise it may cause node-gyp usage problems (nodejs/node-gyp/ issues#297), and currently does not currently support the construction and debugging of the project under the lower version of the Windows environment.

Troubleshooting

In the actual development process, you may encounter issues such as node-gyp and other dependencies that become invalid due to NodeJS version switching. You can run yarn rebuild:node in the framework to rebuild the native dependencies.

Build and run

If you want to learn how to run OpenSumi or want to debug an issue, you need to get the code locally, build it, and then run it

Getting the sources

In the first step, you need to fork a copy of the OpenSumi repository, and then clone it locally:

$ git clone https://github.com/<<<your-github-account>>>/core.git

Usually you need to synchronize the latest branch code in advance before modifying or submitting the code.

$ cd core
$ git checkout main
$ git pull https://github.com/opensumi/core.git main

After handling the code conflicts, submit the code to your warehouse, and then you can go to opensumi/core to submit your PR at any time.

Note: The default opensumi/core also contains a lot of GitHub Actions. If you don't want to execute these Actions, you can go to https://github.com/<<Your Username>>/core/settings/actions Close the corresponding Actions.

Build

Build project as follows:

$ cd core
$ npm install
$ npm run init

Run

After the initialization is complete, you can run the Web version directly with the following command, and enable Hot Reload at the same time. All modifications except the plug-in process can be seen in the Web in real time.

$ npm start

By default, the framework will display the tools/workspace directory under the project as the workspace directory. You can also open OpenSumi by specifying the path with MY_WORKSPACE=, as shown below:

$ MY_WORKSPACE={workspace_path} npm start

perview

Debug

There are multiple processes when OpenSumi is running. You need to determine the specific process you want to debug before you can debug it in a targeted manner.

Browser process

For the Browser process, you can debug directly through Chrome Developer Tools (recommended), or install [Debugger for Chrome](https: //marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome) to debug the breakpoint of the Browser process. as the picture shows:

![](https://img.alicdn.com/imgextra/i2/O1CN01RytoAv1zgLMg9FCna_!!6000000006743-2-tps-2602-1732.png#id=YcHEw&originHeight=1732&originWidth=2602&originalType=binary&ratio=1&status=done&style=none&style=

Node process

For the Node process, after you run the framework through npm start, you can use VSCode or the IDE debug panel built based on OpenSumi to make a breakpoint of the Node process by using Attach to BackEnd debugging.

In addition, you can also use the Launch Backend and Launch Frontend of the debug panel to start the Node process and Browser process respectively for debugging.

Plug-in process

For the plug-in process, you can use VSCode or the Attach to Extension Host method in the debugging panel built on OpenSumi to debug the plug-in process. Occasionally, you can directly open the chrome://inspect panel for code debugging (it is easier to use). You can get the debugging after the framework is running by filling in localhost:9999 in the discovery port The process is debugged, as shown in the following figure:

PR rules

Each commit should be as small as possible, and you need to fill in your commit information in accordance with ng4's submission specifications.

For example, you fixed the variable acquisition problem of the debug module, and the submission information can be as follows:

fix: Fix the abnormal problem of variable acquisition under the debug panel

For PR content, just follow the PR and fill in the template. See: New Merge Request

Plug-in debugging

If you want to debug the plug-in under the OpenSumi framework, you can link your local plug-in to the {ide-framework}/tools/extensions directory in the form of a soft link, such as:

$ ln -s {local_path}/{extension_name} {ide-framework}/tools/extensions/{extension_name}

You can quickly preview the effect of the plug-in function by refreshing the page.

Feedback

We are happy to receive suggestions and functional requirements for the OpenSumi framework. Please submit and elaborate on Issues.