Skip to content

Commit

Permalink
Merge pull request #25 from firstbatchxyz/erhant/yaml-fix
Browse files Browse the repository at this point in the history
use `pnpm` instead of `yarn` for peer deps
  • Loading branch information
anilaltuner authored Dec 27, 2023
2 parents 14970a4 + 8a389bb commit 2094cfb
Show file tree
Hide file tree
Showing 8 changed files with 3,923 additions and 3,738 deletions.
44 changes: 0 additions & 44 deletions .github/workflows/build.yml

This file was deleted.

37 changes: 30 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,42 @@ on:

jobs:
publish:
needs: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-node@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
node-version: 19

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false # use caching via later commands

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm build

- run: yarn
- run: yarn build
- uses: JS-DevTools/npm-publish@v3
id: publish
with:
Expand Down
53 changes: 29 additions & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,53 @@ name: test
# run when `dev` has a push or PR
# or when `master` has a push
on:
pull_request:
types:
- opened
branches:
- dev
push:
branches:
- master
- dev

jobs:
test:
runs-on: ubuntu-latest

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

- name: Install Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 19.x
node-version: 19

- name: Start Redis
uses: supercharge/[email protected]
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
redis-version: 7
redis-port: 6379
version: 8
run_install: false # use caching via later commands

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Restore yarn cache
uses: actions/cache@v3
id: yarn-cache
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-yarn-
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: yarn
run: pnpm install

- name: Start Redis
uses: supercharge/[email protected]
with:
redis-version: 7
redis-port: 6379

- name: Build
run: pnpm build

- name: Run tests
run: yarn test
run: pnpm test
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
auto-install-peers=true
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![NPM](https://img.shields.io/npm/v/warp-contracts-redis?logo=npm&color=CB3837)](https://www.npmjs.com/package/warp-contracts-redis)
![Test Workflow](https://github.com/firstbatchxyz/warp-contracts-redis/actions/workflows/test.yml/badge.svg?branch=master)
![Build Workflow](https://github.com/firstbatchxyz/warp-contracts-redis/actions/workflows/build.yml/badge.svg?branch=master)

# Warp Contracts Redis Cache

Expand Down Expand Up @@ -68,8 +67,8 @@ For the managed version, simply create your `ioredis` client outside and pass it
Tests require a Redis server running at the specified URL within `tests/constants`. We use the default Redis URL for that, if you would like to run tests on a custom URL you must change the URL within the constants file.

```sh
yarn test # test everything
yarn test <path> # test a specific suite
pnpm test # test everything
pnpm test <path> # test a specific suite
```

## Resources
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
"scripts": {
"build:cjs": "tsc -b tsconfig.json",
"build:types": "tsc -b tsconfig.types.json",
"build": "yarn run clean && yarn build:cjs && yarn build:types",
"build": "pnpm run clean && pnpm build:cjs && pnpm build:types",
"format": "prettier --write 'src/**/*.ts'",
"clean": "rimraf ./lib",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"prettier:format": "prettier --config .prettierrc 'src/**/*.ts' --write",
"prepublishOnly": "yarn lint:fix",
"preversion": "yarn lint && yarn build",
"version": "yarn format && git add -A src",
"prepublishOnly": "pnpm lint:fix",
"preversion": "pnpm lint && pnpm build",
"version": "pnpm format && git add -A src",
"postversion": "git push && git push --tags",
"yalc:publish": "yarn build && yalc publish --push",
"yalc:publish": "pnpm build && yalc publish --push",
"test": "jest --detectOpenHandles"
},
"files": [
Expand Down
Loading

0 comments on commit 2094cfb

Please sign in to comment.