|
2 | 2 |
|
3 | 3 | Welcome, and thank you for taking time in contributing to esm.sh project!
|
4 | 4 |
|
5 |
| -## Development setup |
| 5 | +## Development Setup |
6 | 6 |
|
7 |
| -You will need [Golang](https://golang.org/) 1.18+ and [Deno](https://deno.land) to run the server and tests. |
| 7 | +You will need [Golang](https://golang.org/)(1.21+) and [Deno](https://deno.land)(1.40+) installed on a Linux or macOS machine. |
8 | 8 |
|
9 | 9 | 1. Fork this repository to your own GitHub account.
|
10 | 10 | 2. Clone the repository to your local device.
|
11 |
| -3. Create a new branch `git checkout -b BRANCH_NAME`. |
12 |
| -4. Change code then run the testings. |
| 11 | +3. Create a new branch (`git checkout -b BRANCH_NAME`). |
| 12 | +4. Change code then run tests |
13 | 13 | 5. Push your branch to Github after **all tests passed**.
|
14 | 14 | 6. Make a [pull request](https://github.com/esm-dev/esm.sh/pulls).
|
15 | 15 | 7. Merge to master branch by our maintainers.
|
16 | 16 |
|
17 | 17 | ## Configration
|
18 | 18 |
|
19 |
| -To configure the server, create a `config.json` file in the project root directory. Here is an example: |
| 19 | +Create a `config.json` file in the project root directory following the example below: |
20 | 20 |
|
21 | 21 | ```jsonc
|
22 | 22 | // config.json
|
23 | 23 | {
|
24 | 24 | "port": 8080,
|
25 | 25 | "workDir": ".esmd",
|
26 |
| - "npmRegistry": "https://registry.npmjs.org", |
27 |
| - "npmToken": "xxxxxx" |
| 26 | + "npmRegistry": "https://registry.npmjs.org/", // change to your own registry if needed |
| 27 | + "npmToken": "xxxxxx" // remove this line if you don't need a token |
28 | 28 | }
|
29 | 29 | ```
|
30 | 30 |
|
31 |
| -You can find all the server options in [config.exmaple.jsonc](./config.example.jsonc). |
| 31 | +More server options please check [config.exmaple.jsonc](./config.example.jsonc). |
32 | 32 |
|
33 |
| -## Run the sever in development mode |
| 33 | +## Running the Server from Source Code |
34 | 34 |
|
35 | 35 | ```bash
|
36 | 36 | go run main.go --dev
|
37 | 37 | ```
|
38 | 38 |
|
39 | 39 | Then you can import `React` from "http://localhost:8080/react"
|
40 | 40 |
|
41 |
| -## Run testings |
| 41 | +## Running Integration Tests |
| 42 | + |
| 43 | +We use [Deno](https://deno.land) to run all the integration tests. Make sure you have Deno installed on your machine. |
42 | 44 |
|
43 | 45 | ```bash
|
44 | 46 | # Run all tests
|
45 |
| -./test/bootstrap.sh |
| 47 | +./test/bootstrap.ts |
46 | 48 |
|
47 |
| -# Run tests for a specific case (directory name) |
48 |
| -./test/bootstrap.sh preact |
| 49 | +# Run a test for a specific case (directory name) |
| 50 | +./test/bootstrap.ts preact |
49 | 51 |
|
50 | 52 | # Run tests with `clean` option (purge previous builds)
|
51 |
| -./test/bootstrap.sh --clean |
| 53 | +./test/bootstrap.ts --clean |
52 | 54 | ```
|
53 | 55 |
|
54 |
| -All the tests are running in [Deno](https://deno.land), you can find them in [test/](./test) directory. |
| 56 | +To add a new integration test case, copy the [test/_template](./test/_template) directory and rename it to your case name. |
| 57 | + |
| 58 | +```bash |
| 59 | +cp -r test/_template test/case_name |
| 60 | +nvim test/case_name/test.ts |
| 61 | +./test/bootstrap.ts case_name |
| 62 | +``` |
0 commit comments