Skip to content

Commit

Permalink
Update contributing docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ije committed May 20, 2024
1 parent bc21ae2 commit 7125ee2
Showing 1 changed file with 23 additions and 15 deletions.
38 changes: 23 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,61 @@

Welcome, and thank you for taking time in contributing to esm.sh project!

## Development setup
## Development Setup

You will need [Golang](https://golang.org/) 1.18+ and [Deno](https://deno.land) to run the server and tests.
You will need [Golang](https://golang.org/)(1.21+) and [Deno](https://deno.land)(1.40+) installed on a Linux or macOS machine.

1. Fork this repository to your own GitHub account.
2. Clone the repository to your local device.
3. Create a new branch `git checkout -b BRANCH_NAME`.
4. Change code then run the testings.
3. Create a new branch (`git checkout -b BRANCH_NAME`).
4. Change code then run tests
5. Push your branch to Github after **all tests passed**.
6. Make a [pull request](https://github.com/esm-dev/esm.sh/pulls).
7. Merge to master branch by our maintainers.

## Configration

To configure the server, create a `config.json` file in the project root directory. Here is an example:
Create a `config.json` file in the project root directory following the example below:

```jsonc
// config.json
{
"port": 8080,
"workDir": ".esmd",
"npmRegistry": "https://registry.npmjs.org",
"npmToken": "xxxxxx"
"npmRegistry": "https://registry.npmjs.org/", // change to your own registry if needed
"npmToken": "xxxxxx" // remove this line if you don't need a token
}
```

You can find all the server options in [config.exmaple.jsonc](./config.example.jsonc).
More server options please check [config.exmaple.jsonc](./config.example.jsonc).

## Run the sever in development mode
## Running the Server from Source Code

```bash
go run main.go --dev
```

Then you can import `React` from "http://localhost:8080/react"

## Run testings
## Running Integration Tests

We use [Deno](https://deno.land) to run all the integration tests. Make sure you have Deno installed on your machine.

```bash
# Run all tests
./test/bootstrap.sh
./test/bootstrap.ts

# Run tests for a specific case (directory name)
./test/bootstrap.sh preact
# Run a test for a specific case (directory name)
./test/bootstrap.ts preact

# Run tests with `clean` option (purge previous builds)
./test/bootstrap.sh --clean
./test/bootstrap.ts --clean
```

All the tests are running in [Deno](https://deno.land), you can find them in [test/](./test) directory.
To add a new integration test case, copy the [test/_template](./test/_template) directory and rename it to your case name.

```bash
cp -r test/_template test/case_name
nvim test/case_name/test.ts
./test/bootstrap.ts case_name
```

0 comments on commit 7125ee2

Please sign in to comment.