Skip to content

Commit 7faa309

Browse files
0237hYaroShkvorets
andauthored
Update all projects dependencies (#1775)
* Update all projects dependencies ## Project - Remove `@babel/core` - Remove `@babel/preset-env` - Remove `@babel/preset-typescript` - `eslint` - Fix [`@typescript-eslint/no-this-alias`](https://typescript-eslint.io/rules/no-this-alias/) lint rule - Fix [`unicorn/prefer-node-protocol`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md) lint rule (add `node:` prefix for built-in modules) - Move `.eslintignore` inside config with `ignorePatterns` - Update config annotations - Use `ESLINT_USE_FLAT_CONFIG=false` in `pnpm` scripts ## `cli` - Add `node:` prefix for built-in modules (e.g. `node:fs`) - Remove `dockerode` - Remove `tern` - Upgrade `moduleResolution` to `bundler`, `module` to `ESNext` and `target` to `ESNext` making it an ESM module - `binary-install-raw` - Replace with `binary-install` - `chokidar` - Import type `FSWatcher` as namespace no longer available - Remove `await` for `onTrigger` as it's no longer async - `http-ipfs-client` - Migrate from `http-ipfs-client` to `kubo-rpc-client` with dynamic import as it's ESM only[^1] - Make `createCompiler` async due to dynamic import - `immutable` - `Map([ [ 'k', 'v' ] ])` or `Map({ k: 'v' })` instead of `Map.of`[^2] - Replace `immutable.Collection<ProtocolName, string[]>` with `immutable.Collection<ProtocolName, immutable.List<string>>` - `js-yaml` - Replace `safe*` variants with `load`/`loadall`/`dump`[^3] - `oclif/core` - Use `gluegun.prompt` instead of `ux.prompt`[^4] - Fix `prompt` variable assignments from object destructuring (thanks @YaroShkvorets) - Migrate to ESM[^5] - `sync-request` - Replace with async `fetch` call[^6] - Make `generateTypes` async and update NEAR test snapshot - `vitest` - Remove `concurrent` for tests using the file system - `web3-eth-abi` - Import `decodeLogs` method directly as there is no more default export - `yaml` - Remove `strOptions`[^7] ## `ts` - Remove `common/eager_offset.ts` - `assemblyscript/asc` - Use `assemblyscript/asc` as import - `asc.main` no longer as callback for error, uses stderr and is async[^8] - Remove `asc.ready`[^9] - Remove `ascMain` in `package.json`[^10] - Replace `Promise.allSettled` with for loop in tests for resolving WASM generation promises in sequence (prevent WASM file corruption since they use same file `outputWasmPath`). - Silence warning 235 on compilation about exports[^11] ## `website` - Fix `eslint` config ## Examples - `ethereum-basic-event-handlers` - Fix `chai` max version to `4.x.x` as `chai 5.x.x` is ESM and `hardhat` doesn't support ESM Typescript projects yet[^12] - Rename `ethers.BaseContract.address` to `ethers.BaseContract.target` - Remove `@nomiclabs/hardhat-ethers` - Remove `@nomiclabs/hardhat-etherscan` - Remove `@typechain/ethers-v5` - Remove `@typechain/hardhat` - Remove `ethers` - Remove `hardhat-gas-reporter` - Remove `solidity-coverage` - Remove `typechain` [^1]: ipfs/helia#157 [^2]: https://github.com/immutable-js/immutable-js/blob/b3a1c9f13880048d744366ae561c39a34b26190a/CHANGELOG.md#breaking-changes [^3]: https://github.com/nodeca/js-yaml/blob/0d3ca7a27b03a6c974790a30a89e456007d62976/migrate_v3_to_v4.md#safeload-safeloadall-safedump--load-loadall-dump [^4]: oclif/core#999 [^5]: https://oclif.io/docs/esm/ [^6]: https://www.npmjs.com/package/sync-request [^7]: eemeli/yaml#235 [^8]: https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.20.0 [^9]: https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.20.0 [^10]: https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.20.0 [^11]: AssemblyScript/assemblyscript#2277 [^12]: https://hardhat.org/hardhat-runner/docs/advanced/using-esm#esm-and-typescript-projects --------- Co-authored-by: YaroShkvorets <[email protected]>
1 parent 7d18704 commit 7faa309

File tree

160 files changed

+9937
-19287
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+9937
-19287
lines changed

.changeset/green-islands-wink.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@graphprotocol/graph-cli': minor
3+
'@graphprotocol/graph-ts': minor
4+
---
5+
6+
Update all dependencies

.eslintignore

Lines changed: 0 additions & 11 deletions
This file was deleted.

.eslintrc.cjs

Lines changed: 0 additions & 52 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,4 @@ tmp
8282

8383
*.wasm
8484

85-
.idea
85+
.idea

.prettierignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ packages/cli/tests/cli/init
66
packages/cli/tests/cli/validation
77
packages/cli/tests/cli/add
88
pnpm-lock.yaml
9-
cf-pages/**
109
website/src/graphql-env.d.ts

.prettierrc.cjs

Lines changed: 0 additions & 1 deletion
This file was deleted.

.prettierrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"@theguild/prettier-config"

eslint.config.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import path from 'node:path';
2+
import { fileURLToPath } from 'node:url';
3+
import { FlatCompat } from '@eslint/eslintrc';
4+
import js from '@eslint/js';
5+
6+
// needed to extend the guild config
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = path.dirname(__filename);
9+
const compat = new FlatCompat({
10+
baseDirectory: __dirname,
11+
recommendedConfig: js.configs.recommended,
12+
allConfig: js.configs.all,
13+
});
14+
15+
export default [
16+
{
17+
ignores: [
18+
'**/dist',
19+
'packages/cli/tests/cli/validation',
20+
'packages/ts/test/',
21+
'**/examples',
22+
'**/vitest.config.ts',
23+
],
24+
},
25+
...compat.extends('@theguild'),
26+
{
27+
rules: {
28+
'import/extensions': 'off',
29+
'unicorn/no-array-push-push': 'off',
30+
'import/no-default-export': 'off',
31+
'@typescript-eslint/no-explicit-any': 'off',
32+
eqeqeq: 'off',
33+
'@typescript-eslint/no-unused-vars': 'off',
34+
},
35+
},
36+
{
37+
files: ['packages/ts/**'],
38+
39+
rules: {
40+
'@typescript-eslint/no-namespace': 'off',
41+
'sonarjs/no-inverted-boolean-check': 'off',
42+
},
43+
},
44+
{
45+
files: ['packages/cli/**'],
46+
47+
rules: {
48+
'no-restricted-imports': [
49+
'error',
50+
{
51+
patterns: [
52+
{
53+
group: ['@whatwg-node/fetch'],
54+
message: 'Please use `fetch` from `./packages/cli/src/fetch.ts`.',
55+
},
56+
],
57+
},
58+
],
59+
},
60+
},
61+
];

examples/aggregations/check-data.sh

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -20,54 +20,50 @@ sgd=$1
2020
# Note that these substitutions are done for all possible combinations of
2121
# INTV/DUR and TBL
2222
expand() {
23-
query=${1//SGD/$sgd}
24-
if [[ "$query" =~ "INTV" ]]
25-
then
26-
for pair in hour:3600 day:86400
27-
do
28-
intv=${pair%:*}
29-
duration=${pair#*:}
30-
q=${query//INTV/$intv}
31-
q=${q//DUR/$duration}
32-
if [[ "$q" =~ "TBL" ]]
33-
then
34-
for tbl in stats group_1 group_2 group_3 groups
35-
do
36-
echo "${q//TBL/$tbl};"
37-
done
38-
else
39-
echo "$q;"
40-
fi
23+
query=${1//SGD/$sgd}
24+
if [[ "$query" =~ "INTV" ]]; then
25+
for pair in hour:3600 day:86400; do
26+
intv=${pair%:*}
27+
duration=${pair#*:}
28+
q=${query//INTV/$intv}
29+
q=${q//DUR/$duration}
30+
if [[ "$q" =~ "TBL" ]]; then
31+
for tbl in stats group_1 group_2 group_3 groups; do
32+
echo "${q//TBL/$tbl};"
4133
done
42-
else
43-
echo "$query;"
44-
fi
34+
else
35+
echo "$q;"
36+
fi
37+
done
38+
else
39+
echo "$query;"
40+
fi
4541
}
4642

4743
# Max and last must be the same
48-
read -d '' -r max_last <<'EOF'
44+
read -d '' -r max_last << 'EOF'
4945
select count(*) = 0 as TBL_INTV_max_eq_last
5046
from SGD.TBL_INTV
5147
where max != last
5248
EOF
5349

5450
# Min and first must be the same
55-
read -d '' -r min_first <<'EOF'
51+
read -d '' -r min_first << 'EOF'
5652
select count(*) = 0 as TBL_INTV_min_eq_first
5753
from SGD.TBL_INTV
5854
where min != first
5955
EOF
6056

6157
# The sum over block numbers must be correct
62-
read -d '' -r sum_check <<'EOF'
58+
read -d '' -r sum_check << 'EOF'
6359
select count(*) = 0 as stats_INTV_sum_correct
6460
from SGD.stats_INTV
6561
where sum != (last - first + 1)::numeric*(last + first)::numeric/2
6662
and first > 1
6763
EOF
6864

6965
# The timestamps of all buckets are rounded to the beginning of the period
70-
read -d '' -r bucket_timestamp <<'EOF'
66+
read -d '' -r bucket_timestamp << 'EOF'
7167
select count(*) = 0 as TBL_INTV_bucket_timestamp
7268
from SGD.TBL_INTV
7369
where to_timestamp(timestamp)
@@ -76,7 +72,7 @@ EOF
7672

7773
# The timestamp of the min and max block for all buckets must be between
7874
# the bucket's timestamp plus the bucket's duration
79-
read -d '' -r block_timestamp <<'EOF'
75+
read -d '' -r block_timestamp << 'EOF'
8076
select count(*) = 0 as TBL_INTV_timestamp
8177
from SGD.TBL_INTV s,
8278
SGD.block_time b
@@ -87,7 +83,7 @@ EOF
8783
# For group_3_hour, since we split the aggregations into 1000 buckets,
8884
# there can only be one or two blocks in each bucket; if there are two,
8985
# they must differ by 1000 blocks
90-
read -d '' -r group3_count_min_max <<'EOF'
86+
read -d '' -r group3_count_min_max << 'EOF'
9187
select count(*) = 0 as count_min_max
9288
from SGD.group_3_hour
9389
where (count = 1 and min != max)
@@ -96,15 +92,15 @@ select count(*) = 0 as count_min_max
9692
EOF
9793

9894
# Same as previous for 'groups' instead of 'group_3'
99-
read -d '' -r groups_count_min_max <<'EOF'
95+
read -d '' -r groups_count_min_max << 'EOF'
10096
select count(*) = 0 as count_min_max
10197
from SGD.groups_hour
10298
where (count = 1 and min != max)
10399
or (count = 2 and min + 1000 != max)
104100
or count > 2
105101
EOF
106102

107-
read -d '' -r groups_total_min_max <<'EOF'
103+
read -d '' -r groups_total_min_max << 'EOF'
108104
select count(*) = 0 as total_min_max
109105
from SGD.groups_hour
110106
where total_min != group_3
@@ -118,14 +114,14 @@ EOF
118114
# is g + (g+1000) + (g+2000) + .. + (g + (tc-1)*1000)
119115
# We don't know what the total count should be since each group can contain
120116
# 1 or 2 blocks, but we can at least relate total_count and total_sum
121-
read -d '' -r groups_total_count_sum <<'EOF'
117+
read -d '' -r groups_total_count_sum << 'EOF'
122118
select count(*) = 0 as total_count_sum
123119
from SGD.groups_hour
124120
where total_sum != total_count * (group_3 + 1000 * (total_count::numeric - 1) / 2)
125121
EOF
126122

127123
# Recalculate total count and sum with a window query
128-
read -d '' -r groups_window_totals <<'EOF'
124+
read -d '' -r groups_window_totals << 'EOF'
129125
select count(*) = 0 as window_totals from
130126
(select group_3, total_count, total_sum,
131127
sum(count) over (partition by group_3 order by timestamp) as new_total_count,
@@ -144,4 +140,4 @@ expand "$block_timestamp"
144140
expand "$group3_count_min_max"
145141
expand "$groups_total_min_max"
146142
expand "$groups_total_count_sum"
147-
expand "$groups_window_totals"
143+
expand "$groups_window_totals"

examples/aggregations/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
"test": "graph test"
1818
},
1919
"dependencies": {
20-
"@graphprotocol/graph-cli": "0.71.2",
21-
"@graphprotocol/graph-ts": "^0.32.0"
20+
"@graphprotocol/graph-cli": "0.90.1",
21+
"@graphprotocol/graph-ts": "^0.35.1"
2222
},
2323
"devDependencies": {
24-
"matchstick-as": "0.5.0"
24+
"matchstick-as": "0.6.0"
2525
}
2626
}

0 commit comments

Comments
 (0)