Skip to content
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

feat: refine contribute pages #25

Merged
merged 1 commit into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 29 additions & 23 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ export default defineConfig({
},
nav: [
{ text: "Getting Started", link: "/docs/guide/introduction" },
{ text: "Contribute", link: "/docs/contribute/intro" },
{ text: "Learn", link: "/docs/learn/ecosystem" },
{ text: "Contribute", link: "/docs/contribute/introduction" },
{ text: "Blog", link: "/blog/2022-02-10-js-tooling-research" },
{
text: "Playground",
Expand Down Expand Up @@ -146,28 +146,6 @@ export default defineConfig({
],
},
],
"/docs/contribute/": [
{ text: "Intro", link: "/docs/contribute/intro" },
{ text: "Rules", link: "/docs/contribute/rules" },
{
items: [
{ text: "Parser", link: "/docs/contribute/parser" },
{ text: "Linter", link: "/docs/contribute/linter" },
{ text: "Prettier", link: "/docs/contribute/prettier" },
{ text: "Resolver", link: "/docs/contribute/resolver" },
{
text: "Transformer",
link: "/docs/contribute/transformer",
},
{ text: "Formatter", link: "/docs/contribute/formatter" },
{ text: "Codegen", link: "/docs/contribute/codegen" },
{ text: "Minifier", link: "/docs/contribute/minifier" },
{ text: "VSCode", link: "/docs/contribute/vscode" },
],
},
{ text: "Performance", link: "/docs/contribute/performance" },
{ text: "Showcase", link: "/docs/contribute/showcase" },
],
"/docs/learn/": [
{
text: "Architecture",
Expand Down Expand Up @@ -213,6 +191,34 @@ export default defineConfig({
{ text: "Ecosystem", link: "/docs/learn/ecosystem" },
{ text: "References", link: "/docs/learn/references" },
],
"/docs/contribute/": [
{
text: "Contributing Guide",
items: [
{ text: "Introduction", link: "/docs/contribute/introduction" },
{ text: "Development", link: "/docs/contribute/development" },
],
},
{
text: "Domain",
items: [
{ text: "Parser", link: "/docs/contribute/parser" },
{ text: "Linter", link: "/docs/contribute/linter" },
{ text: "Prettier", link: "/docs/contribute/prettier" },
{ text: "Resolver", link: "/docs/contribute/resolver" },
{
text: "Transformer",
link: "/docs/contribute/transformer",
},
{ text: "Formatter", link: "/docs/contribute/formatter" },
{ text: "Codegen", link: "/docs/contribute/codegen" },
{ text: "Minifier", link: "/docs/contribute/minifier" },
{ text: "VSCode", link: "/docs/contribute/vscode" },
],
},
{ text: "Performance", link: "/docs/contribute/performance" },
{ text: "Showcase", link: "/docs/contribute/showcase" },
],
"/blog/": blogSidebar,
},
},
Expand Down
67 changes: 67 additions & 0 deletions src/docs/contribute/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
title: Development
outline: deep
---

# Development

This page explains how to set up enrionment for OXC development.

## Clone Repository

```bash
git clone --recurse-submodules --shallow-submodules [email protected]:oxc-project/oxc.git
```

The `--recurse-submodules` and `--shallow-submodules` flags are needed to initialize git submodules that are needed to run conformance tests.

## Set Up Project

### Install Rust

If you have not yet installed Rust, follow [the official instruction](https://www.rust-lang.org/tools/install) and install Rust.

After installing Rust, run the following command at the project root:

```bash
rustup show
```

`rustup show` reads the `./rust-toolchain.toml` file and installs the correct Rust toolchain and components for this project.

### Install Project Tools

#### `cargo-binstall`

Some Cargo tools are required to develop OXC, and it is recommended to use [cargo binstall](https://github.com/cargo-bins/cargo-binstall), which provides a low-complexity mechanism to install rust binaries and is fater way than building them from source by running `cargo install`.

```bash
cargo install cargo-binstall
```

You can also download [the pre-compiled binary](https://github.com/cargo-bins/cargo-binstall#installation) and save it in `~/.cargo/bin`.

#### `just`

OXC utilizes [`just`](https://github.com/casey/just), which is a handy way to save and run project-specific commands:

```bash
cargo binstall just -y
```

#### Dependencies

Run the following command in `justfile` at the project root to install dependencies:

```bash
just init
```

You can see the list of available commands by running `just`.

You can run `just ready` (or, `just r` in short) to make sure the whole project builds and runs correctly.

---

Now you are ready to develop OXC!
You can check out [good first issues](https://github.com/oxc-project/oxc/contribute) or ask us on [Discord](https://discord.gg/9uXCAwqQZW).
59 changes: 0 additions & 59 deletions src/docs/contribute/intro.md

This file was deleted.

41 changes: 41 additions & 0 deletions src/docs/contribute/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: Introduction
outline: deep
---

# Introduction

Thank you for getting interested in contributing to OXC project!
Before starting, please make sure to read the following rules and policy.

## General Rules

- We welcome and appreciate any form of contributions.
- Please create an issue or discussion if you want to make an architectural change.

## PR Rules

- We [prefer smaller PRs](https://graphite.dev/blog/how-large-prs-slow-down-development) for faster development.
- Try stacked PRs with [graphite](https://graphite.dev) if you are given access permission to the repository.

## Action Policy

Taken from [Astral's values](https://astral-sh.notion.site/Astral-s-Values-0ed6a642bcc84e91af6836b2373572f5):

> We bias towards action, even in the face of uncertainty. We favor _pragmatic doing_ over **prolonged debating**; we favor asking for _forgiveness_ over _permission_. We value **decisiveness — especially** when a decision isn’t clear cut, and **especially** when a decision is reversible.
>
> A bias towards action is _not_ the same as recklessness. Rather, it’s a bias towards making _responsible_ decisions and acting on them with _urgency_, even if we’re left with lingering ambiguity or known unknowns.

## Development Policy

- All performance issues (runtime and compilation speed) are considered as bugs in this project.
- Embrace data-oriented design.
- APIs should be simple and well-documented.
- Third-party dependencies should be minimal.
- Avoid the `regex` crate when possible. Regexes are slow, most of them can be rewritten in a performant way by using Rust iterator and string methods.
- Avoid macros, traits or any Rust techniques that would penalize compilation speed.

## Maintenance Policy

- Monitor code coverage for unused code. Aim for 99% code coverage.
- CI time should be actively monitored and reduced to speed up merging of PRs. The current CI time on GitHub actions is around 3 minutes.
38 changes: 0 additions & 38 deletions src/docs/contribute/rules.md

This file was deleted.