Skip to content

Commit

Permalink
Replace yarn with npm (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsudmi authored Jul 20, 2022
1 parent 3678444 commit bafe999
Show file tree
Hide file tree
Showing 11 changed files with 5,366 additions and 4,017 deletions.
31 changes: 19 additions & 12 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,36 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ matrix.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ matrix.os }}-yarn-
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit == 'false' }}
name: List the state of node modules
continue-on-error: true
run: npm list

- name: Install dependencies
run: yarn install
run: npm install

- name: Build subgraph
env:
NETWORK: ${{ matrix.network }}
run: yarn build:$NETWORK
run: npm run build:$NETWORK
33 changes: 20 additions & 13 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,41 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 14.x

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ matrix.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ matrix.os }}-yarn-
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit == 'false' }}
name: List the state of node modules
continue-on-error: true
run: npm list

- name: Install dependencies
run: yarn install
run: npm install

- name: Install Graph CLI
run: |
yarn global add @graphprotocol/graph-cli
npm install -g @graphprotocol/graph-cli
graph auth https://api.thegraph.com/deploy/ ${{ secrets.THEGRAPH_TOKEN }}
- name: Deploy Subgraphs
env:
NETWORK: ${{ matrix.network }}
run: yarn deploy:$NETWORK
run: npm run deploy:$NETWORK
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ FROM node:16-alpine
RUN apk add --no-cache git
WORKDIR /app
COPY . ./
RUN yarn install
RUN npm install
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@ Current subgraphs:
1. Install dependencies:

```shell script
yarn install
npm install
```

2. Prepare subgraphs for the network you want to deploy on (supports goerli and mainnet):

```shell script
yarn prepare:mainnet
npm run prepare:mainnet
```

3. Generate types for the Typescript source code:

```shell script
yarn run codegen
npm run codegen
```

4. Optionally, build the subgraph to check compile errors before deploying:

```shell script
yarn run build
npm run build
```

5. Authenticate to the Graph API for deployment:
Expand All @@ -45,7 +45,7 @@ Current subgraphs:

6. Deploy all the subgraphs or a specific one by navigating to `subgraphs/<subgraph_name>` and running:
```shell script
yarn deploy:mainnet
npm run deploy:mainnet
```

## Documentation
Expand Down
Loading

0 comments on commit bafe999

Please sign in to comment.