Skip to content

Commit

Permalink
Bump deps (#787)
Browse files Browse the repository at this point in the history
* bump some deps

* fix

* update deps and fix build command

* create build scripts

* ..depcheckrc

---------

Co-authored-by: Ermal Kaleci <ermalkaleci@gmail.com>
  • Loading branch information
xlc and ermalkaleci authored Jul 6, 2024
1 parent 7ddcf2c commit 68fca97
Show file tree
Hide file tree
Showing 23 changed files with 1,386 additions and 1,362 deletions.
1 change: 1 addition & 0 deletions .depcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ignores: ["@swc/*", "typescript", "pino-pretty"]
893 changes: 0 additions & 893 deletions .yarn/releases/yarn-4.1.1.cjs

This file was deleted.

894 changes: 894 additions & 0 deletions .yarn/releases/yarn-4.3.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ npmPublishRegistry: "https://registry.npmjs.org/"

npmRegistryServer: "https://registry.npmjs.org/"

yarnPath: .yarn/releases/yarn-4.1.1.cjs
yarnPath: .yarn/releases/yarn-4.3.1.cjs
8 changes: 3 additions & 5 deletions executor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,15 @@
"scripts": {
"clean": "rm -rf pkg dist",
"wasm": "yarn clean && wasm-pack build --target web --out-dir pkg && scripts/pack-wasm.cjs",
"build": "yarn wasm && yarn build:cjs && yarn build:esm",
"build:cjs": "swc ./pkg -C module.type=commonjs -d dist/cjs --copy-files && cp pkg/chopsticks_executor.d.ts dist/cjs/index.d.ts && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json",
"build:esm": "swc ./pkg -C module.type=es6 -d dist/esm --copy-files && cp pkg/chopsticks_executor.d.ts dist/esm/index.d.ts && echo '{\"type\": \"module\"}' > dist/esm/package.json"
"build": "yarn wasm && ./package.sh"
},
"dependencies": {
"@polkadot/util": "^12.6.2",
"@polkadot/wasm-util": "^7.3.2"
},
"devDependencies": {
"@swc/cli": "0.1.65",
"@swc/core": "^1.4.8",
"@swc/cli": "0.4.0",
"@swc/core": "^1.6.7",
"fflate": "^0.8.2"
},
"files": [
Expand Down
17 changes: 17 additions & 0 deletions executor/package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -e

## Build CJS
yarn swc ./pkg -C module.type=commonjs -d dist/cjs --copy-files --strip-leading-paths
## Build ESM
yarn swc ./pkg -C module.type=es6 -d dist/esm --copy-files --strip-leading-paths

## Copy types
cp pkg/chopsticks_executor.d.ts dist/cjs/index.d.ts
cp pkg/chopsticks_executor.d.ts dist/esm/index.d.ts

## Make package CJS
echo '{ "type": "commonjs" }' > dist/cjs/package.json
## Make package ESM
echo '{ "type": "module" }' > dist/esm/package.json
15 changes: 15 additions & 0 deletions package-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e

## Build CJS
yarn swc ./src --config-file $(dirname "$0")/.cjsswcrc -d dist/cjs --copy-files --strip-leading-paths
## Build ESM
yarn swc ./src --config-file $(dirname "$0")/.esmswcrc -d dist/esm --copy-files --strip-leading-paths

## Build types
yarn tsc -p tsconfig.json --declarationDir dist/cjs
yarn tsc -p tsconfig.json --declarationDir dist/esm

## Make package CJS
echo '{ "type": "commonjs" }' > dist/cjs/package.json
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "chopsticks-monorepo",
"author": "Acala Developers <hello@acala.network>",
"license": "Apache-2.0",
"packageManager": "yarn@4.1.1",
"packageManager": "yarn@4.3.1",
"private": true,
"type": "module",
"workspaces": [
Expand Down Expand Up @@ -44,11 +44,11 @@
"*.{js,ts,css,md}": "prettier --write"
},
"devDependencies": {
"@swc/core": "^1.4.8",
"@types/node": "^20.11.5",
"@swc/core": "^1.6.7",
"@types/node": "^20.14.9",
"@types/prettier": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"@typescript-eslint/eslint-plugin": "^7.15.0",
"@typescript-eslint/parser": "^7.15.0",
"@vitest/coverage-v8": "^1.4.0",
"@vitest/ui": "^1.4.0",
"eslint": "^8.57.0",
Expand All @@ -57,15 +57,15 @@
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
"husky": "^8.0.3",
"prettier": "^3.2.5",
"prettier": "^3.3.2",
"ts-node": "^10.9.2",
"typedoc": "^0.25.12",
"typedoc-plugin-markdown": "^3.17.1",
"typescript": "^5.3.3",
"typescript": "^5.5.3",
"unplugin-swc": "^1.4.4",
"vite-tsconfig-paths": "^4.3.2",
"vitepress": "^1.0.1",
"vitest": "^1.4.0",
"wasm-pack": "^0.12.1"
"wasm-pack": "^0.13.0"
}
}
24 changes: 11 additions & 13 deletions packages/chopsticks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,18 @@
"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 --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",
"build": "yarn clean && ../../package-build.sh",
"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": "^11.2.1",
"@polkadot/api-augment": "^11.2.1",
"@polkadot/rpc-provider": "^11.2.1",
"@polkadot/types": "^11.2.1",
"@polkadot/api": "^12.1.1",
"@polkadot/api-augment": "^12.1.1",
"@polkadot/rpc-provider": "^12.1.1",
"@polkadot/types": "^12.1.1",
"@polkadot/util": "^12.6.2",
"@polkadot/util-crypto": "^12.6.2",
"axios": "^1.6.8",
Expand All @@ -35,15 +33,15 @@
"zod": "^3.22.4"
},
"devDependencies": {
"@swc/cli": "0.1.65",
"@swc/core": "^1.4.8",
"@swc/cli": "0.4.0",
"@swc/core": "^1.6.7",
"@types/global-agent": "^2.1.3",
"@types/js-yaml": "^4.0.9",
"@types/lodash": "^4.17.0",
"@types/node": "^20.11.5",
"@types/lodash": "^4.17.6",
"@types/node": "^20.14.9",
"@types/ws": "^8.5.10",
"@types/yargs": "^17.0.32",
"typescript": "^5.3.3"
"typescript": "^5.5.3"
},
"files": [
"dist/esm/**",
Expand Down Expand Up @@ -74,4 +72,4 @@
"default": "./dist/esm/utils/*.js"
}
}
}
}
2 changes: 1 addition & 1 deletion packages/chopsticks/src/plugins/run-block/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const cli = (y: Argv) => {
openHtml(filePath)
}
} else if (argv.outputPath) {
writeFileSync(argv.outputPath, JSON.stringify(result, null, 2))
writeFileSync(argv.outputPath as string, JSON.stringify(result, null, 2))
} else {
console.dir(result, { depth: null, colors: false })
}
Expand Down
4 changes: 2 additions & 2 deletions packages/chopsticks/src/plugins/trace-transaction/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ export const cli = (y: Argv) => {
config['disable-stack'],
config['enable-memory'],
)
writeFileSync(argv.output, JSON.stringify(steps, null, 2))
writeFileSync(argv.output as string, JSON.stringify(steps, null, 2))
} else {
pinoLogger.info('Running EVM call trace ...')
const calls = await traceCalls(tracingBlock, extrinsic)
writeFileSync(argv.output, JSON.stringify(calls, null, 2))
writeFileSync(argv.output as string, JSON.stringify(calls, null, 2))
}

pinoLogger.info(`Trace logs: ${argv.output}`)
Expand Down
2 changes: 1 addition & 1 deletion packages/chopsticks/src/plugins/try-runtime/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const cli = (y: Argv) => {
const response = await block.call('TryRuntime_on_runtime_upgrade', [select_none.toHex()])

if (argv.outputPath) {
writeFileSync(argv.outputPath, JSON.stringify(response, null, 2))
writeFileSync(argv.outputPath as string, JSON.stringify(response, null, 2))
} else {
const [actual, max] = registry.createType('(Weight, Weight)', response.result)
const consumedWeight = actual.refTime.toBn()
Expand Down
17 changes: 11 additions & 6 deletions packages/chopsticks/src/schema/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { BuildBlockMode, defaultLogger, genesisSchema, isUrl } from '@acala-network/chopsticks-core'
import { HexString } from '@polkadot/util/types'
import { Options } from 'yargs'
import { ZodNativeEnum, ZodRawShape, ZodTypeAny, z } from 'zod'
import { basename, extname } from 'node:path'
import { readFileSync } from 'node:fs'
Expand Down Expand Up @@ -117,12 +118,16 @@ const getZodFirstOption = (option: ZodTypeAny) => {
}

export const getYargsOptions = (zodShape: ZodRawShape) => {
return _.mapValues(zodShape, (option) => ({
demandOption: !option.isOptional(),
description: option._def.description,
type: getZodType(option) || getZodFirstOption(option),
choices: getZodChoices(option),
}))
return _.mapValues(
zodShape,
(option) =>
({
demandOption: !option.isOptional(),
description: option._def.description,
type: getZodType(option) || getZodFirstOption(option),
choices: getZodChoices(option),
}) as Options,
)
}

const CONFIGS_BASE_URL = 'https://raw.githubusercontent.com/AcalaNetwork/chopsticks/master/configs/'
Expand Down
24 changes: 11 additions & 13 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@
"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": "yarn clean && ../../package-build.sh",
"docs:prep": "typedoc",
"depcheck": "npx depcheck --ignores=pino-pretty"
"depcheck": "npx depcheck"
},
"dependencies": {
"@acala-network/chopsticks-executor": "workspace:*",
"@polkadot/rpc-provider": "^11.2.1",
"@polkadot/types": "^11.2.1",
"@polkadot/types-codec": "^11.2.1",
"@polkadot/types-known": "^11.2.1",
"@polkadot/rpc-provider": "^12.1.1",
"@polkadot/types": "^12.1.1",
"@polkadot/types-codec": "^12.1.1",
"@polkadot/types-known": "^12.1.1",
"@polkadot/util": "^12.6.2",
"@polkadot/util-crypto": "^12.6.2",
"comlink": "^4.4.1",
Expand All @@ -30,10 +28,10 @@
"zod": "^3.22.4"
},
"devDependencies": {
"@swc/cli": "0.1.65",
"@swc/core": "^1.4.8",
"@types/lodash": "^4.17.0",
"typescript": "^5.3.3",
"@swc/cli": "0.4.0",
"@swc/core": "^1.6.7",
"@types/lodash": "^4.17.6",
"typescript": "^5.5.3",
"vitest": "^1.4.0"
},
"files": [
Expand All @@ -58,4 +56,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"
}
}
}
2 changes: 1 addition & 1 deletion packages/core/src/blockchain/block-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ export const dryRunExtrinsic = async (
return newBlock.call('BlockBuilder_apply_extrinsic', [generic.toHex()])
}

logger.debug({ call: registry.createType('GenericExtrinsic', hexToU8a(extrinsic)).toHuman() }, 'dry_run_extrinsic')
logger.debug({ call: registry.createType('GenericExtrinsic', hexToU8a(extrinsic)).toJSON() }, 'dry_run_extrinsic')
return newBlock.call('BlockBuilder_apply_extrinsic', [extrinsic])
}

Expand Down
12 changes: 5 additions & 7 deletions packages/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
"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": "yarn clean && ../../package-build.sh",
"depcheck": "npx depcheck"
},
"dependencies": {
Expand All @@ -19,9 +17,9 @@
"typeorm": "^0.3.20"
},
"devDependencies": {
"@swc/cli": "0.1.65",
"@swc/core": "^1.4.8",
"typescript": "^5.3.3"
"@swc/cli": "0.4.0",
"@swc/core": "^1.6.7",
"typescript": "^5.5.3"
},
"files": [
"dist/esm/**",
Expand All @@ -41,4 +39,4 @@
"default": "./dist/esm/*.js"
}
}
}
}
4 changes: 2 additions & 2 deletions packages/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"devDependencies": {
"@acala-network/chopsticks": "workspace:*",
"@acala-network/chopsticks-testing": "workspace:*",
"@polkadot/api": "^11.2.1",
"typescript": "^5.3.3",
"@polkadot/api": "^12.1.1",
"typescript": "^5.5.3",
"vitest": "^1.4.0"
}
}
4 changes: 2 additions & 2 deletions packages/e2e/src/__snapshots__/dry-run-extrinsic.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

exports[`dry-run-extrinsic > dry run extrinsic 1`] = `
{
"Ok": {
"Ok": [],
"ok": {
"ok": [],
},
}
`;
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e/src/dry-run-extrinsic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('dry-run-extrinsic', () => {
})
const extrinsic = await api.tx.balances.transfer(bob.address, 1e12).signAsync(alice)
const { outcome, storageDiff } = await chain.dryRunExtrinsic(extrinsic.toHex())
expect(outcome.toHuman()).toMatchSnapshot()
expect(outcome.toJSON()).toMatchSnapshot()
expect(storageDiff).toMatchSnapshot()
})

Expand Down
16 changes: 7 additions & 9 deletions packages/testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,18 @@
"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": "yarn clean && ../../package-build.sh",
"depcheck": "npx depcheck"
},
"dependencies": {
"@acala-network/chopsticks-utils": "workspace:*",
"@polkadot/api": "^11.2.1",
"@polkadot/types": "^11.2.1"
"@polkadot/api": "^12.1.1",
"@polkadot/types": "^12.1.1"
},
"devDependencies": {
"@swc/cli": "0.1.65",
"@swc/core": "^1.4.8",
"typescript": "^5.3.3"
"@swc/cli": "0.4.0",
"@swc/core": "^1.6.7",
"typescript": "^5.5.3"
},
"files": [
"dist/esm/**",
Expand All @@ -39,4 +37,4 @@
"default": "./dist/esm/*.js"
}
}
}
}
Loading

0 comments on commit 68fca97

Please sign in to comment.