Skip to content

Commit

Permalink
Updates some READMEs & Scripts (#17)
Browse files Browse the repository at this point in the history
* add clean commands to each package and app

* adds root level clean command

* update nx to automatically run build command for deps when running dev

* updated README with setup instructions
  • Loading branch information
nitaliano authored Jan 4, 2024
1 parent 56947d5 commit 2c3fa17
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 4 deletions.
60 changes: 59 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ In this repository, you'll find numerous ecosystem components of the OP Stack, t

- If you want to build on top of OP Mainnet, refer to the [Optimism Documentation](https://docs.optimism.io)
- If you want to build your own OP Stack based blockchain, refer to the [OP Stack Guide](https://docs.optimism.io/stack/getting-started)
- If you want to contribute to the OP Stack, check out the [Protocol Specs](./specs)
- If you want to contribute to the OP Stack, check out the [Protocol Specs](https://github.com/ethereum-optimism/optimism/tree/develop/specs)

## Community

Expand All @@ -32,3 +32,61 @@ Governance discussion can also be found on the [Optimism Governance Forum](https
├── <a href="./packages">packages</a>
│ ├── <a href="./packages/op-app">op-app</a>: Optimism Stack App Utils
</pre>

## Development Quick Start

### Dependencies

You'll need the following:

* [Git](https://git-scm.com/downloads)
* [NodeJS](https://nodejs.org/en/download/)
* [Node Version Manager](https://github.com/nvm-sh/nvm)
* [pnpm](https://pnpm.io/installation)

### Setup

Clone the repository and open it:

```bash
git clone [email protected]:ethereum-optimism/ecosystem.git
cd ecosystem
```

### Install the Correct Version of NodeJS

Install the correct node version with [nvm](https://github.com/nvm-sh/nvm)

```bash
nvm use
```

### Install Node Modules With pnpm

```bash
pnpm i
```

### Running Targets

Each application and package have npm scripts in there indivdual package.json.
In order to run those easily we can leverage nx here. The `nx.json` file is setup
to improve QoL while working in the repo.

The npm package name can be found in their `package.json` and the targets are what you'll see in the `scripts` object in the `package.json`

```bash
pnpm nx run <npm package name>:dev
```

For example if we wanted to run the `bridge-app` for development we could run this
```bash
pnpm nx run @eth-optimism/bridge-app:dev
```

If we wanted to build the `op-app` package we could run this
```bash
pnpm nx run @eth-optimism/op-app:build
```

Feel free to open up an issue on the repo if you're running into any issues!
1 change: 1 addition & 0 deletions apps/bridge-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"clean": "rm -rf dist",
"typecheck": "tsc --noEmit --emitDeclarationOnly false",
"lint": "eslint \"**/*.{ts,tsx}\" && pnpm prettier --check \"**/*.{ts,tsx}\"",
"lint:fix": "eslint \"**/*.{ts,tsx}\" --fix --quiet && pnpm prettier \"**/*.{ts,tsx}\" --write --loglevel=warn",
Expand Down
17 changes: 14 additions & 3 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"neverConnectToCloud": true,
"projects": {
"apps": {
"bridge-app": ["type:app"]
},
"packages": {
"op-app": ["type:package"]
}
},
"targetDefaults": {
"dev": {
"cache": true,
"dependsOn": ["^build"]
},
"build": {
"cache": true,
"dependsOn": [
"^build"
]
"dependsOn": ["^build"]
},
"lint": {
"cache": true
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"author": "Optimism PBC",
"license": "MIT",
"scripts": {
"clean": "pnpm recursive run clean",
"create:app": "cd apps && pnpm create vite --template=react-ts ",
"create:react:library": "cd packages && pnpm create vite --template=react-ts "
},
Expand Down
1 change: 1 addition & 0 deletions packages/op-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"scripts": {
"dev": "vite -m development",
"build": "tsup && pnpm tsc",
"clean": "rm -rf dist",
"typecheck": "tsc --noEmit --emitDeclarationOnly false",
"lint": "eslint \"**/*.{ts,tsx}\" && pnpm prettier --check \"**/*.{ts,tsx}\"",
"lint:fix": "eslint \"**/*.{ts,tsx}\" --fix --quiet && pnpm prettier \"**/*.{ts,tsx}\" --write --loglevel=warn",
Expand Down

0 comments on commit 2c3fa17

Please sign in to comment.