Skip to content

Commit e4e5f17

Browse files
PNPM (#35)
* refactor ESLint configuration and update dependencies, move to PNPM * add pnpm lock file, build fixes * up node to 24 * fix playwright start * test action run * test action run * test action run * test action run * test action run * test action run * test action run * test action run * test action run * add pnpm workspace configuration * up sdk * remove unused script
1 parent 3f83f2a commit e4e5f17

18 files changed

Lines changed: 13808 additions & 22618 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@ on:
55
branches: [ main ]
66

77
jobs:
8-
audit:
8+
e2e:
99
name: E2E testing
1010
permissions:
1111
contents: read
1212
packages: read
1313
runs-on: ubuntu-latest
14-
container: mcr.microsoft.com/playwright:v1.52.0-jammy
14+
15+
container: mcr.microsoft.com/playwright:v1.57.0-jammy
16+
1517
steps:
1618
- name: Get preview link
17-
uses: zentered/vercel-preview-url@v1.1.9
19+
uses: zentered/vercel-preview-url@v1.4.0
1820
id: preview
1921
env:
2022
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
@@ -23,47 +25,45 @@ jobs:
2325
vercel_project_id: ${{ secrets.VERCEL_PROJ_ID }}
2426

2527
- name: Checkout 🛎️
26-
uses: actions/checkout@v2
2728
if: ${{ steps.preview.outputs.deployment_state != 'CANCELED' }}
29+
uses: actions/checkout@v4
2830

29-
- name: Restore Node Modules
30-
id: cache-restore
31-
uses: actions/cache@v3
32-
with:
33-
path: |
34-
node_modules
35-
key: node_modules_${{ hashFiles('package-lock.json') }}
31+
- name: Setup pnpm
3632
if: ${{ steps.preview.outputs.deployment_state != 'CANCELED' }}
37-
38-
- name: Setup node and npm
39-
uses: actions/setup-node@v3
33+
uses: pnpm/action-setup@v4
4034
with:
41-
cache: npm
42-
node-version: '22.14.0'
43-
cache-dependency-path: 'package-lock.json'
35+
version: 10.25.0
36+
37+
- name: Setup Node.js
4438
if: ${{ steps.preview.outputs.deployment_state != 'CANCELED' }}
39+
uses: actions/setup-node@v6
40+
with:
41+
node-version: '24.12.0'
42+
cache: pnpm
43+
cache-dependency-path: pnpm-lock.yaml
4544

46-
- name: Install npm dependencies
47-
run: 'npm ci --ignore-scripts || npm i --ignore-scripts --force'
48-
shell: bash
45+
- name: Install dependencies
46+
if: ${{ steps.preview.outputs.deployment_state != 'CANCELED' }}
47+
run: |
48+
pnpm install --frozen-lockfile --ignore-scripts
4949
env:
5050
NODE_AUTH_TOKEN: ${{ github.token }}
51-
if: ${{ steps.preview.outputs.deployment_state != 'CANCELED' }}
5251

5352
- name: Awaiting WEB deployment to be ready
53+
if: ${{ steps.preview.outputs.deployment_state != 'CANCELED' }}
5454
uses: UnlyEd/github-action-await-vercel@v1.1.1
5555
env:
5656
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
5757
with:
5858
deployment-url: ${{ steps.preview.outputs.preview_url }}
5959
timeout: 600
60-
if: ${{ steps.preview.outputs.deployment_state != 'CANCELED' }}
6160

6261
- name: Install Foundry
63-
uses: foundry-rs/foundry-toolchain@v1
6462
if: ${{ steps.preview.outputs.deployment_state != 'CANCELED' }}
63+
uses: foundry-rs/foundry-toolchain@v1
6564

6665
- name: Run tests
66+
if: ${{ steps.preview.outputs.deployment_state != 'CANCELED' }}
6767
env:
6868
CI: true
6969
WITH_ANVIL: true
@@ -72,11 +72,11 @@ jobs:
7272
GUARDIAN_UI_INFURA_API_KEY: ${{ secrets.GUARDIAN_UI_INFURA_API_KEY }}
7373
GUARDIAN_UI_ALCHEMY_API_KEY: ${{ secrets.GUARDIAN_UI_ALCHEMY_API_KEY }}
7474
VERCEL_AUTOMATION_BYPASS_SECRET: ${{ secrets.VERCEL_AUTOMATION_BYPASS_SECRET }}
75-
run: npm run e2e
76-
if: ${{ steps.preview.outputs.deployment_state != 'CANCELED' }}
75+
run: pnpm run e2e
7776

78-
- uses: actions/upload-artifact@v4
77+
- name: Upload Playwright report
7978
if: ${{ failure() }}
79+
uses: actions/upload-artifact@v4
8080
with:
8181
name: vault-interface-desktop
8282
path: ./playwright-report/

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22.14.0
1+
24.12.0

e2e/fixtures/anvil/setBalance.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { Contract, BaseContract } from 'ethers'
2-
import { JsonRpcProvider } from 'ethers'
1+
import { Contract, BaseContract, JsonRpcProvider } from 'ethers'
32

43

54
type Wrapper = E2E.FixtureMethod<SetBalance, 'page'>

e2e/fixtures/swap/helpers/getBaseInfoItem.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const createGetBaseInfoItem: Wrapper = ({ page }) => (
88
async (type: BaseInfoTypes) => {
99
const value = await page.getByTestId(type).textContent()
1010

11-
const result = parseFloat(value?.replace(/\,/gm, '') || '')
11+
const result = parseFloat(value?.replace(/,/gm, '') || '')
1212

1313
return result
1414
}

eslint.config.mjs

Lines changed: 92 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,103 @@
1-
import { configs } from 'typescript-eslint'
1+
import js from '@eslint/js'
2+
import tsEslint from 'typescript-eslint'
3+
import react from 'eslint-plugin-react'
4+
import reactHooks from 'eslint-plugin-react-hooks'
5+
import importPlugin from 'eslint-plugin-import'
6+
import nextPlugin from '@next/eslint-plugin-next'
27
import { globalIgnores } from 'eslint/config'
3-
import pluginReact from 'eslint-plugin-react'
4-
import { FlatCompat } from '@eslint/eslintrc'
58

69

7-
const plugins = new FlatCompat()
8-
.config({
9-
extends: [
10-
'next',
11-
'next/core-web-vitals',
12-
'plugin:import/errors',
13-
'plugin:import/warnings',
14-
'plugin:import/recommended',
15-
],
16-
plugins: [
17-
'import',
18-
],
19-
})
20-
21-
/** @type {import('eslint').Linter.Config[]} */
22-
const config = [
23-
...plugins,
24-
...configs.recommended,
25-
pluginReact.configs.flat.recommended,
10+
export default [
11+
js.configs.recommended,
12+
...tsEslint.configs.recommended,
13+
react.configs.flat.recommended,
14+
nextPlugin.configs.recommended,
2615
{
27-
files: [
28-
'**/*.{js,ts,jsx,tsx}',
29-
],
16+
files: ['**/*.{js,ts,jsx,tsx}'],
17+
settings: {
18+
react: {
19+
version: 'detect'
20+
}
21+
},
22+
plugins: {
23+
import: importPlugin,
24+
'react-hooks': reactHooks,
25+
},
26+
rules: {
27+
...importPlugin.configs.recommended.rules,
28+
...importPlugin.configs.errors?.rules,
29+
...importPlugin.configs.warnings?.rules,
30+
},
31+
},
32+
{
33+
files: ['**/*.{js,ts,jsx,tsx}'],
34+
3035
rules: {
3136
// Common
37+
'no-empty': 0,
38+
'no-empty-pattern': 0,
39+
'no-loss-of-precision': 0,
3240
'no-trailing-spaces': 1,
33-
'semi': [ 'error', 'never' ],
34-
"max-len": [ 'warn', { 'code': 140 } ],
35-
'object-curly-spacing': [ 'error', 'always' ],
36-
'array-bracket-spacing': [ 'error', 'always' ],
37-
'no-multiple-empty-lines': [ 'error', { 'max': 2 } ],
41+
semi: ['error', 'never'],
42+
'no-irregular-whitespace': 0,
43+
'no-extra-boolean-cast': 'off',
44+
'max-len': ['warn', { code: 140 }],
45+
'object-curly-spacing': ['error', 'always'],
46+
'array-bracket-spacing': ['error', 'always'],
47+
'no-multiple-empty-lines': ['error', { max: 2 }],
3848
'jsx-a11y/alt-text': 0,
3949
'comma-dangle': [
40-
'warn', {
41-
'arrays': 'always-multiline',
42-
'objects': 'always-multiline',
43-
'imports': 'always-multiline',
44-
'exports': 'always-multiline',
45-
'functions': 'never',
50+
'warn',
51+
{
52+
arrays: 'always-multiline',
53+
objects: 'always-multiline',
54+
imports: 'always-multiline',
55+
exports: 'always-multiline',
56+
functions: 'never',
4657
},
4758
],
48-
// Special
59+
60+
// TypeScript
4961
'@typescript-eslint/no-namespace': 0,
5062
'@typescript-eslint/ban-ts-comment': 0,
5163
'@typescript-eslint/no-explicit-any': 0,
5264
'@typescript-eslint/no-require-imports': 0,
5365
'@typescript-eslint/no-empty-object-type': 0,
5466
'@typescript-eslint/no-unnecessary-type-constraint': 0,
55-
5667
'@typescript-eslint/no-unused-vars': [
5768
'error',
5869
{
59-
'argsIgnorePattern': '^_',
60-
'varsIgnorePattern': '^_',
61-
'caughtErrorsIgnorePattern': '^_'
62-
}
70+
argsIgnorePattern: '^_',
71+
varsIgnorePattern: '^_',
72+
caughtErrorsIgnorePattern: '^_',
73+
},
6374
],
6475

76+
// Restricted
6577
'no-restricted-globals': [
6678
'error',
6779
{
68-
'name': 'localStorage',
69-
'message': 'Use localStorage module from @stakewise/frontwise-modules!',
80+
name: 'localStorage',
81+
message:
82+
'Use localStorage module from @stakewise/frontwise-modules!',
7083
},
7184
],
72-
7385
'no-restricted-imports': [
7486
'error',
7587
{
76-
'name': 'FixedNumber',
77-
'message': 'Do not use FixedNumber, it is not safe.',
88+
name: 'FixedNumber',
89+
message: 'Do not use FixedNumber, it is not safe.',
7890
},
7991
],
8092

8193
// Next
8294
'@next/next/no-html-link-for-pages': 0,
8395

84-
// React hooks plugin
96+
// React hooks
8597
'react-hooks/rules-of-hooks': 'error',
8698
'react-hooks/exhaustive-deps': 'warn',
8799

88-
// Import plugin
100+
// Import
89101
'import/named': 0,
90102
'import/first': 0,
91103
'import/extensions': 0,
@@ -96,18 +108,44 @@ const config = [
96108
'import/no-named-as-default-member': 1,
97109
'import/no-extraneous-dependencies': 0,
98110
'import/no-anonymous-default-export': 0,
99-
'import/newline-after-import': [ 'error', { 'count': 2 } ],
111+
'import/newline-after-import': ['error', { count: 2 }],
100112
},
101113
},
114+
102115
globalIgnores([
103-
'**/*.graphql.ts',
116+
'next-env.d.ts',
117+
'**/node_modules/**',
118+
'**/playwright-report/**',
119+
'**/test-results/**',
120+
'**/.next/**',
121+
'**/dist/**',
122+
'**/build/**',
123+
'**/coverage/**',
124+
'**/.turbo/**',
125+
'**/out/**',
104126
]),
127+
105128
{
129+
files: ['e2e/**/*.{js,ts,jsx,tsx}'],
106130
rules: {
107131
'react-hooks/rules-of-hooks': 'off',
108132
},
109133
},
110-
]
111-
112134

113-
export default config
135+
{
136+
files: [
137+
'**/*.config.*',
138+
'scripts/**/*.{js,ts,jsx,tsx}',
139+
],
140+
languageOptions: {
141+
globals: {
142+
require: 'readonly',
143+
module: 'readonly',
144+
__dirname: 'readonly',
145+
process: 'readonly',
146+
console: 'readonly',
147+
URL: 'readonly',
148+
},
149+
},
150+
},
151+
]

next.config.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,7 @@ const nextConfig = {
9898
}),
9999
new webpack.NormalModuleReplacementPlugin(/(.*\.graphql)$/m, (resource) => {
100100
resource.request = resource.request.replace(/(.*\.graphql)$/m, '$1.ts')
101-
}),
102-
// Cow SDK used 5 version of the "ethers" lib. Special for this we have ethers-5 pkg.
103-
new webpack.NormalModuleReplacementPlugin(
104-
/ethers/m, (resource) => {
105-
const isCowProtocol = /@cowprotocol/.test(resource.context)
106-
107-
if (isCowProtocol) {
108-
resource.request = resource.request.replace(/^ethers(\/lib)?/, 'ethers-5/lib.esm')
109-
}
110-
}
111-
)
101+
})
112102
)
113103

114104
const prefix = config.assetPrefix || ''

0 commit comments

Comments
 (0)