Skip to content

Commit

Permalink
ci with depcheck (#774)
Browse files Browse the repository at this point in the history
* ci with depcheck

* use npx
  • Loading branch information
qiweiii authored Jun 4, 2024
1 parent e06f745 commit ea65882
Show file tree
Hide file tree
Showing 12 changed files with 311 additions and 33 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
- run: yarn lint
- run: yarn build
- run: yarn publint
- run: yarn depcheck
- run: yarn test
timeout-minutes: 30

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ The second way is use `fetch-storages` subcommand to only fetch and cache storag

```sh
npx @acala-network/chopsticks@latest fetch-storages 0x123456 Balances Tokens.Accounts
--endlpint=wss://acala-rpc-0.aca-api.network
--endpoint=wss://acala-rpc-0.aca-api.network
--block=<blockhash> # default to latest block
--db=acala.sqlite
```
Expand Down
2 changes: 1 addition & 1 deletion executor/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@acala-network/chopsticks-executor",
"description": "Chopsticks executor",
"version": "0.12.1",
"version": "0.12.1-1",
"license": "Apache-2.0",
"type": "module",
"repository": {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"docs:dev": "yarn docs:prep && vitepress dev",
"docs:build": "yarn docs:prep && vitepress build",
"docs:preview": "yarn docs:build && vitepress preview",
"publint": "sh ./publint.sh"
"publint": "sh ./publint.sh",
"depcheck": "yarn workspaces foreach --all -pvit run depcheck"
},
"engines": {
"node": ">=v18"
Expand Down
12 changes: 7 additions & 5 deletions packages/chopsticks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/chopsticks",
"version": "0.12.1",
"version": "0.12.1-1",
"author": "Acala Developers <[email protected]>",
"license": "Apache-2.0",
"bin": "./chopsticks.cjs",
Expand All @@ -10,18 +10,21 @@
"build": "yarn clean && yarn build:cjs && yarn build:esm",
"build:cjs": "swc ./src --config-file ../../.cjsswcrc -d dist/cjs --copy-files && tsc -p tsconfig.json --declarationDir dist/cjs && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json",
"build:esm": "swc ./src --config-file ../../.esmswcrc -d dist/esm --copy-files && tsc -p tsconfig.json --declarationDir dist/esm",
"docs:prep": "typedoc"
"docs:prep": "typedoc",
"depcheck": "npx depcheck --ignore-patterns='*.test.ts'"
},
"dependencies": {
"@acala-network/chopsticks-core": "workspace:*",
"@acala-network/chopsticks-db": "workspace:*",
"@pnpm/npm-conf": "^2.2.2",
"@polkadot/api": "^10.11.2",
"@polkadot/api-augment": "^10.11.2",
"@polkadot/rpc-provider": "^10.11.2",
"@polkadot/types": "^10.11.2",
"@polkadot/util": "^12.6.2",
"@polkadot/util-crypto": "^12.6.2",
"axios": "^1.6.8",
"comlink": "^4.4.1",
"dotenv": "^16.4.5",
"global-agent": "^3.0.0",
"js-yaml": "^4.1.0",
Expand All @@ -40,8 +43,7 @@
"@types/node": "^20.11.5",
"@types/ws": "^8.5.10",
"@types/yargs": "^17.0.32",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
"typescript": "^5.3.3"
},
"files": [
"dist/esm/**",
Expand Down Expand Up @@ -72,4 +74,4 @@
"default": "./dist/esm/utils/*.js"
}
}
}
}
3 changes: 2 additions & 1 deletion packages/chopsticks/src/plugins/fetch-storage/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import _ from 'lodash'
import type { Argv } from 'yargs'

import { configSchema, getYargsOptions } from '../../schema/index.js'
import { fetchStorages } from '../../utils/fetch-storages.js'
import { fetchStorages, logger } from '../../utils/fetch-storages.js'

const schema = z.object(_.pick(configSchema.shape, ['endpoint', 'block', 'db']))

Expand All @@ -26,6 +26,7 @@ export const cli = (y: Argv) => {
})
process.exit(0)
} catch (e) {
logger.error(e)
process.exit(1)
}
},
Expand Down
1 change: 0 additions & 1 deletion packages/chopsticks/src/utils/fetch-storages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ type FetchStoragesParams = {
*/
export const fetchStorages = async ({ block, endpoint, dbPath, config }: FetchStoragesParams) => {
if (!endpoint) throw new Error('endpoint is required')
if (!block) throw new Error('block is required')

const provider = new WsProvider(endpoint, 3_000)
const apiPromise = new ApiPromise({ provider })
Expand Down
7 changes: 4 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/chopsticks-core",
"version": "0.12.1",
"version": "0.12.1-1",
"author": "Acala Developers <[email protected]>",
"license": "Apache-2.0",
"type": "module",
Expand All @@ -9,7 +9,8 @@
"build": "yarn clean && yarn build:cjs && yarn build:esm",
"build:cjs": "swc ./src --config-file ../../.cjsswcrc -d dist/cjs && tsc -p tsconfig.json --declarationDir dist/cjs && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json",
"build:esm": "swc ./src --config-file ../../.esmswcrc -d dist/esm && tsc -p tsconfig.json --declarationDir dist/esm",
"docs:prep": "typedoc"
"docs:prep": "typedoc",
"depcheck": "npx depcheck --ignores=pino-pretty"
},
"dependencies": {
"@acala-network/chopsticks-executor": "workspace:*",
Expand Down Expand Up @@ -57,4 +58,4 @@
"./dist/cjs/wasm-executor/node-worker.js": "./dist/cjs/wasm-executor/browser-worker.js",
"./dist/esm/wasm-executor/node-worker.js": "./dist/esm/wasm-executor/browser-worker.js"
}
}
}
7 changes: 4 additions & 3 deletions packages/db/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"name": "@acala-network/chopsticks-db",
"version": "0.12.1",
"version": "0.12.1-1",
"author": "Acala Developers <[email protected]>",
"license": "Apache-2.0",
"type": "module",
"scripts": {
"clean": "rm -rf dist tsconfig.tsbuildinfo",
"build": "yarn clean && yarn build:cjs && yarn build:esm",
"build:cjs": "swc ./src --config-file ../../.cjsswcrc -d dist/cjs && tsc -p tsconfig.json --declarationDir dist/cjs && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json",
"build:esm": "swc ./src --config-file ../../.esmswcrc -d dist/esm && tsc -p tsconfig.json --declarationDir dist/esm"
"build:esm": "swc ./src --config-file ../../.esmswcrc -d dist/esm && tsc -p tsconfig.json --declarationDir dist/esm",
"depcheck": "npx depcheck"
},
"dependencies": {
"@acala-network/chopsticks-core": "workspace:*",
Expand Down Expand Up @@ -40,4 +41,4 @@
"default": "./dist/esm/*.js"
}
}
}
}
8 changes: 4 additions & 4 deletions packages/testing/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"name": "@acala-network/chopsticks-testing",
"version": "0.12.1",
"version": "0.12.1-1",
"author": "Acala Developers <[email protected]>",
"license": "Apache-2.0",
"type": "module",
"scripts": {
"clean": "rm -rf dist tsconfig.tsbuildinfo",
"build": "yarn clean && yarn build:cjs && yarn build:esm",
"build:cjs": "swc ./src --config-file ../../.cjsswcrc -d dist/cjs && tsc -p tsconfig.json --declarationDir dist/cjs && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json",
"build:esm": "swc ./src --config-file ../../.esmswcrc -d dist/esm && tsc -p tsconfig.json --declarationDir dist/esm"
"build:esm": "swc ./src --config-file ../../.esmswcrc -d dist/esm && tsc -p tsconfig.json --declarationDir dist/esm",
"depcheck": "npx depcheck"
},
"dependencies": {
"@acala-network/chopsticks-utils": "workspace:*",
Expand All @@ -18,7 +19,6 @@
"devDependencies": {
"@swc/cli": "0.1.65",
"@swc/core": "^1.4.8",
"@types/chai": "^4.3.11",
"typescript": "^5.3.3"
},
"files": [
Expand All @@ -39,4 +39,4 @@
"default": "./dist/esm/*.js"
}
}
}
}
12 changes: 8 additions & 4 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
{
"name": "@acala-network/chopsticks-utils",
"version": "0.12.1",
"version": "0.12.1-1",
"author": "Acala Developers <[email protected]>",
"license": "Apache-2.0",
"type": "module",
"scripts": {
"clean": "rm -rf dist tsconfig.tsbuildinfo",
"build": "yarn clean && yarn build:cjs && yarn build:esm",
"build:cjs": "swc ./src --config-file ../../.cjsswcrc -d dist/cjs && tsc -p tsconfig.json --declarationDir dist/cjs && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json",
"build:esm": "swc ./src --config-file ../../.esmswcrc -d dist/esm && tsc -p tsconfig.json --declarationDir dist/esm"
"build:esm": "swc ./src --config-file ../../.esmswcrc -d dist/esm && tsc -p tsconfig.json --declarationDir dist/esm",
"depcheck": "npx depcheck"
},
"dependencies": {
"@acala-network/chopsticks": "workspace:*",
"@polkadot/api": "^10.11.2",
"@polkadot/types": "^10.11.2"
"@polkadot/api-base": "^10.11.2",
"@polkadot/keyring": "^12.6.2",
"@polkadot/types": "^10.11.2",
"@polkadot/util": "^12.6.2"
},
"devDependencies": {
"@swc/cli": "0.1.65",
Expand All @@ -38,4 +42,4 @@
"default": "./dist/esm/*.js"
}
}
}
}
Loading

0 comments on commit ea65882

Please sign in to comment.