Skip to content

Commit

Permalink
Update deps (& berry) (polkadot-js#4765)
Browse files Browse the repository at this point in the history
* Update deps (& berry)

* linting

* Additional

* Bumps

* jest babel helpers esm
  • Loading branch information
jacogr authored Mar 3, 2021
1 parent adf36bd commit 7d2d184
Show file tree
Hide file tree
Showing 36 changed files with 474 additions and 450 deletions.

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 @@ -10,4 +10,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"

yarnPath: .yarn/releases/yarn-2.4.0.cjs
yarnPath: .yarn/releases/yarn-2.4.1.cjs
File renamed without changes.
6 changes: 2 additions & 4 deletions jest.config.js → jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

const config = require('@polkadot/dev/config/jest.cjs');

const findPackages = require('./scripts/findPackages');
const findPackages = require('./scripts/findPackages.cjs');

const internalModules = findPackages()
.filter(({ name }) => !['@polkadot/apps'].includes(name))
Expand All @@ -22,9 +22,7 @@ const defaultConfig = {
'\\.(md)$': '<rootDir>/jest/mocks/empty.js'
},
setupFilesAfterEnv: ['<rootDir>/jest/jest-setup.ts'],
transformIgnorePatterns: [
'<rootDir>/node_modules'
]
transformIgnorePatterns: ['/node_modules/(?!@polkadot|@babel/runtime/helpers/esm/|rxjs/_esm5)']
};

module.exports = Object.assign({}, config, {
Expand Down
44 changes: 22 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,37 @@
"packages/*"
],
"resolutions": {
"@polkadot/api": "^3.11.2-3",
"@polkadot/api-contract": "^3.11.2-3",
"@polkadot/hw-ledger": "^5.9.3-0",
"@polkadot/keyring": "^5.9.3-0",
"@polkadot/networks": "^5.9.3-0",
"@polkadot/api": "^4.0.1-4",
"@polkadot/api-contract": "^4.0.1-4",
"@polkadot/hw-ledger": "^6.0.1-5",
"@polkadot/keyring": "^6.0.1-5",
"@polkadot/networks": "^6.0.1-5",
"@polkadot/phishing": "^0.6.2",
"@polkadot/types": "^3.11.2-3",
"@polkadot/util": "^5.9.3-0",
"@polkadot/util-crypto": "^5.9.3-0",
"@polkadot/wasm-crypto": "^3.2.4",
"@polkadot/x-rxjs": "^5.9.3-0",
"@polkadot/types": "^4.0.1-4",
"@polkadot/util": "^6.0.1-5",
"@polkadot/util-crypto": "^6.0.1-5",
"@polkadot/wasm-crypto": "^4.0.1-5",
"@polkadot/x-rxjs": "^6.0.1-5",
"babel-core": "^7.0.0-bridge.0",
"styled-components": "^5.2.0",
"typescript": "^4.1.5"
"typescript": "^4.2.2"
},
"scripts": {
"analyze": "yarn clean && BUILD_ANALYZE=1 yarn run build:code && yarn source-map-explorer packages/apps/build/main.*.js",
"build": "yarn run build:i18n && yarn run build:code",
"build:code": "NODE_ENV=production yarn polkadot-dev-build-ts",
"build:i18n": "i18next-scanner --config i18next-scanner.config.js && node ./scripts/i18nSort.js",
"build:i18n": "i18next-scanner --config i18next-scanner.config.js && node ./scripts/i18nSort.cjs",
"build:release:electron": "yarn build && yarn build:electron && yarn postinstall:electron",
"build:release:ipfs": "node scripts/ipfsUpload.js",
"build:release:ipfs": "node scripts/ipfsUpload.cjs",
"build:release:ghpages": "yarn polkadot-ci-ghact-docs",
"build:release:www": "yarn polkadot-ci-ghact-build && yarn build:release:ipfs && yarn build:release:ghpages",
"build:robohash": "node scripts/robohash.js",
"build:www": "rm -rf packages/apps/build && mkdir -p packages/apps/build && yarn run build:i18n && cd packages/apps && yarn webpack --config webpack.config.js",
"build:robohash": "node scripts/robohash.cjs",
"build:www": "rm -rf packages/apps/build && mkdir -p packages/apps/build && yarn run build:i18n && cd packages/apps && yarn webpack --config webpack.config.cjs",
"build:electron": "yarn clean:electronBuild && yarn build:electronMain && yarn build:electronRenderer",
"build:devElectronRenderer": "cd packages/apps-electron && yarn webpack --config webpack.renderer.js",
"build:electronRenderer": "cd packages/apps-electron && NODE_ENV=production yarn webpack --config webpack.renderer.js",
"build:devElectronMain": "cd packages/apps-electron && yarn webpack --config webpack.main.js",
"build:electronMain": "cd packages/apps-electron && NODE_ENV=production yarn webpack --config webpack.main.js",
"build:devElectronRenderer": "cd packages/apps-electron && yarn webpack --config webpack.renderer.cjs",
"build:electronRenderer": "cd packages/apps-electron && NODE_ENV=production yarn webpack --config webpack.renderer.cjs",
"build:devElectronMain": "cd packages/apps-electron && yarn webpack --config webpack.main.cjs",
"build:electronMain": "cd packages/apps-electron && NODE_ENV=production yarn webpack --config webpack.main.cjs",
"packElectron:test": "yarn build:release:electron && electron-builder --dir",
"packElectron:mac": "yarn build:release:electron && electron-builder build --mac",
"packElectron:win": "yarn build:release:electron && electron-builder build --win",
Expand All @@ -60,16 +60,16 @@
"test": "polkadot-dev-run-test --selectProjects=fast-tests --silent --testPathIgnorePatterns slow --testNamePattern='^((?!--SLOW--).)*$'",
"test:all": "polkadot-dev-run-test --selectProjects=all-tests --silent",
"test:one": "polkadot-dev-run-test",
"start": "yarn clean && cd packages/apps && yarn webpack-cli serve --config webpack.serve.js --port 3000",
"start": "yarn clean && cd packages/apps && yarn webpack-cli serve --config webpack.serve.cjs --port 3000",
"start:electron": "yarn clean:electronBuild && concurrently 'yarn build:devElectronMain && cd packages/apps-electron && electron ./build/electron.js' 'yarn build:devElectronRenderer'"
},
"devDependencies": {
"@babel/core": "^7.13.8",
"@babel/register": "^7.13.8",
"@babel/runtime": "^7.13.9",
"@pinata/sdk": "^1.1.13",
"@polkadot/dev": "^0.61.31",
"@polkadot/ts": "^0.3.60",
"@polkadot/dev": "^0.62.5",
"@polkadot/ts": "^0.3.61",
"@types/bn.js": "^4.11.6",
"@types/chart.js": "^2.9.31",
"@types/file-saver": "^2.0.1",
Expand Down
5 changes: 3 additions & 2 deletions packages/apps-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@polkadot/apps-config",
"version": "0.82.2-6",
"type": "module",
"main": "index.js",
"sideEffects": true,
"repository": "github:polkadot-js/apps",
Expand All @@ -15,9 +16,9 @@
"@edgeware/node-types": "^3.3.2",
"@interlay/polkabtc-types": "^0.5.2",
"@laminar/type-definitions": "^0.3.1",
"@polkadot/networks": "^5.9.3-0",
"@polkadot/networks": "^6.0.1-5",
"@snowfork/snowbridge-types": "^0.2.3",
"@sora-substrate/type-definitions": "^0.4.9",
"@sora-substrate/type-definitions": "^0.4.10",
"@subsocial/types": "^0.4.33-w3f-grant2",
"moonbeam-types-bundle": "1.1.6"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/apps-electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dependencies": {
"@babel/core": "^7.13.8",
"@babel/polyfill": "^7.12.1",
"@polkadot/dev": "^0.61.31",
"@polkadot/dev": "^0.62.5",
"@polkadot/react-components": "^0.82.2-6",
"electron-log": "^4.3.1",
"electron-updater": "^4.3.7"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const { merge } = require('webpack-merge');

const baseConfig = require('../apps/webpack.base.js');
const baseConfig = require('../apps/webpack.base.cjs');

const context = __dirname;

Expand Down
2 changes: 1 addition & 1 deletion packages/apps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@babel/runtime": "^7.13.9",
"@polkadot/apps-config": "^0.82.2-6",
"@polkadot/apps-routing": "^0.82.2-6",
"@polkadot/dev": "^0.61.31",
"@polkadot/dev": "^0.62.5",
"@polkadot/react-api": "^0.82.2-6",
"@polkadot/react-components": "^0.82.2-6",
"@polkadot/react-hooks": "^0.82.2-6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const webpack = require('webpack');

const findPackages = require('../../scripts/findPackages');
const findPackages = require('../../scripts/findPackages.cjs');

function mapChunks (name, regs, inc) {
return regs.reduce((result, test, index) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const { merge } = require('webpack-merge');

const baseConfig = require('./webpack.base.js');
const baseConfig = require('./webpack.base.cjs');

const context = __dirname;
const hasPublic = fs.existsSync(path.join(context, 'public'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const { merge } = require('webpack-merge');

const baseConfig = require('./webpack.base.js');
const baseConfig = require('./webpack.base.cjs');

module.exports = merge(
baseConfig(__dirname, 'development'),
Expand Down
2 changes: 1 addition & 1 deletion packages/page-accounts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@babel/runtime": "^7.13.9",
"@polkadot/phishing": "^0.6.2",
"@polkadot/react-components": "^0.82.2-6",
"@polkadot/vanitygen": "^0.30.1",
"@polkadot/vanitygen": "^0.30.2-1",
"detect-browser": "^5.2.0",
"file-saver": "^2.0.5"
},
Expand Down
22 changes: 11 additions & 11 deletions packages/page-accounts/src/Accounts/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { ApiPromise } from '@polkadot/api';
import { AddressInfo, AddressMini, AddressSmall, Badge, Button, ChainLock, CryptoType, Forget, Icon, IdentityIcon, LinkExternal, Menu, Popup, StatusContext, Tags } from '@polkadot/react-components';
import { useAccountInfo, useApi, useCall, useLedger, useToggle } from '@polkadot/react-hooks';
import { keyring } from '@polkadot/ui-keyring';
import { BN_ZERO, formatBalance, formatNumber } from '@polkadot/util';
import { BN_ZERO, formatBalance, formatNumber, isFunction } from '@polkadot/util';

import Backup from '../modals/Backup';
import ChangePass from '../modals/ChangePass';
Expand Down Expand Up @@ -209,31 +209,31 @@ function Account ({ account: { address, meta }, className = '', delegation, filt

const menuItems = useMemo(() => [
createMenuGroup([
api.api.tx.identity?.setIdentity && !isHardware && (
isFunction(api.api.tx.identity?.setIdentity) && !isHardware && (
<Menu.Item
key='identityMain'
onClick={toggleIdentityMain}
>
{t('Set on-chain identity')}
</Menu.Item>
),
api.api.tx.identity?.setSubs && identity?.display && !isHardware && (
isFunction(api.api.tx.identity?.setSubs) && identity?.display && !isHardware && (
<Menu.Item
key='identitySub'
onClick={toggleIdentitySub}
>
{t('Set on-chain sub-identities')}
</Menu.Item>
),
api.api.tx.democracy?.unlock && democracyUnlockTx && (
isFunction(api.api.tx.democracy?.unlock) && democracyUnlockTx && (
<Menu.Item
key='clearDemocracy'
onClick={_clearDemocracyLocks}
>
{t('Clear expired democracy locks')}
</Menu.Item>
),
api.api.tx.vesting?.vest && vestingVestTx && (
isFunction(api.api.tx.vesting?.vest) && vestingVestTx && (
<Menu.Item
key='vestingVest'
onClick={_vestingVest}
Expand Down Expand Up @@ -286,7 +286,7 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
</Menu.Item>
)
]),
api.api.tx.recovery?.createRecovery && createMenuGroup([
isFunction(api.api.tx.recovery?.createRecovery) && createMenuGroup([
!recoveryInfo && (
<Menu.Item
key='makeRecoverable'
Expand All @@ -302,7 +302,7 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
{t('Initiate recovery for another')}
</Menu.Item>
]),
api.api.tx.multisig?.asMulti && isMultisig && createMenuGroup([
isFunction(api.api.tx.multisig?.asMulti) && isMultisig && createMenuGroup([
<Menu.Item
disabled={!multiInfos || !multiInfos.length}
key='multisigApprovals'
Expand All @@ -311,7 +311,7 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
{t('Multisig approvals')}
</Menu.Item>
]),
api.api.query.democracy?.votingOf && delegation?.accountDelegated && createMenuGroup([
isFunction(api.api.query.democracy?.votingOf) && delegation?.accountDelegated && createMenuGroup([
<Menu.Item
key='changeDelegate'
onClick={toggleDelegate}
Expand All @@ -325,15 +325,15 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
{t('Undelegate')}
</Menu.Item>
]),
api.api.query.democracy?.votingOf && !delegation?.accountDelegated && createMenuGroup([
isFunction(api.api.query.democracy?.votingOf) && !delegation?.accountDelegated && createMenuGroup([
<Menu.Item
key='delegate'
onClick={toggleDelegate}
>
{t('Delegate democracy votes')}
</Menu.Item>
]),
api.api.query.proxy?.proxies && createMenuGroup([
isFunction(api.api.query.proxy?.proxies) && createMenuGroup([
<Menu.Item
key='proxy-overview'
onClick={toggleProxyOverview}
Expand Down Expand Up @@ -590,7 +590,7 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
/>
</td>
<td className='button'>
{api.api.tx.balances?.transfer && (
{isFunction(api.api.tx.balances?.transfer) && (
<Button
icon='paper-plane'
label={t<string>('send')}
Expand Down
2 changes: 1 addition & 1 deletion packages/page-accounts/src/modals/Transfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ function Transfer ({ className = '', onClose, recipientId: propRecipientId, send
</>
)
}
{api.tx.balances.transferKeepAlive && (
{isFunction(api.tx.balances.transferKeepAlive) && (
<Toggle
className='typeToggle'
label={
Expand Down
6 changes: 3 additions & 3 deletions packages/page-addresses/src/Contacts/Address.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Transfer from '@polkadot/app-accounts/modals/Transfer';
import { AddressInfo, AddressSmall, Button, ChainLock, Forget, Icon, LinkExternal, Menu, Popup, Tags } from '@polkadot/react-components';
import { useApi, useCall } from '@polkadot/react-hooks';
import { keyring } from '@polkadot/ui-keyring';
import { BN_ZERO, formatNumber } from '@polkadot/util';
import { BN_ZERO, formatNumber, isFunction } from '@polkadot/util';

import { useTranslation } from '../translate';

Expand Down Expand Up @@ -60,7 +60,7 @@ function Address ({ address, className = '', filter, isFavorite, toggleFavorite
useEffect((): void => {
const { identity, nickname } = info || {};

if (api.api.query.identity && api.api.query.identity.identityOf) {
if (isFunction(api.api.query.identity?.identityOf)) {
if (identity?.display) {
setAccName(identity.display);
}
Expand Down Expand Up @@ -197,7 +197,7 @@ function Address ({ address, className = '', filter, isFavorite, toggleFavorite
/>
</td>
<td className='button'>
{api.api.tx.balances?.transfer && (
{isFunction(api.api.tx.balances?.transfer) && (
<Button
icon='paper-plane'
key='send'
Expand Down
9 changes: 7 additions & 2 deletions packages/page-calendar/src/DayItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ interface Props {
item: EntryInfoTyped;
}

const options = { day: 'numeric', month: 'long', weekday: 'long', year: 'numeric' };
const FORMAT_OPTIONS: Intl.DateTimeFormatOptions = {
day: 'numeric',
month: 'long',
weekday: 'long',
year: 'numeric'
};

// eslint-disable-next-line @typescript-eslint/no-unused-vars
function assertUnreachable (x: never): never {
Expand Down Expand Up @@ -160,7 +165,7 @@ function DayItem ({ className, item: { date, info, type }, showAllEvents }: Prop
return (
<div className={className}>
{showAllEvents &&
<div className='itemDate'>{date.toLocaleString(undefined, options)}</div>
<div className='itemDate'>{date.toLocaleString(undefined, FORMAT_OPTIONS)}</div>
}
<div className='itemTime'>{date.toLocaleTimeString().split(':').slice(0, 2).join(':')}</div>
{desc}
Expand Down
2 changes: 1 addition & 1 deletion packages/page-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.13.9",
"@polkadot/api-contract": "^3.11.2-3"
"@polkadot/api-contract": "^4.0.1-4"
}
}
3 changes: 2 additions & 1 deletion packages/page-staking/src/Actions/Account/ListNominees.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import React, { useMemo } from 'react';

import { AddressMini, Expander, MarkWarning } from '@polkadot/react-components';
import { useApi, useCall } from '@polkadot/react-hooks';
import { isFunction } from '@polkadot/util';

import { useTranslation } from '../../translate';
import useInactives from '../useInactives';
Expand Down Expand Up @@ -68,7 +69,7 @@ function ListNominees ({ nominating, stashId }: Props): React.ReactElement<Props
const { api } = useApi();
const { nomsActive, nomsChilled, nomsInactive, nomsOver, nomsWaiting } = useInactives(stashId, nominating);
const sessionInfo = useCall<DeriveSessionIndexes>(api.query.staking && api.derive.session?.indexes);
const eraExposure = useCall<DeriveEraExposure>(api.query.staking.erasStakers && api.derive.staking.eraExposure, [sessionInfo?.activeEra]);
const eraExposure = useCall<DeriveEraExposure>(isFunction(api.query.staking.erasStakers) && api.derive.staking.eraExposure, [sessionInfo?.activeEra]);
const [renActive, renChilled, renInactive, renOver, renWaiting] = useMemo(
() => [renderNominators(stashId, nomsActive, eraExposure), renderNominators(stashId, nomsChilled), renderNominators(stashId, nomsInactive), renderNominators(stashId, nomsOver), renderNominators(stashId, nomsWaiting)],
[eraExposure, nomsActive, nomsChilled, nomsInactive, nomsOver, nomsWaiting, stashId]
Expand Down
4 changes: 2 additions & 2 deletions packages/page-staking/src/Actions/Account/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import styled from 'styled-components';
import { ApiPromise } from '@polkadot/api';
import { AddressInfo, AddressMini, AddressSmall, Badge, Button, Menu, Popup, StakingBonded, StakingRedeemable, StakingUnbonding, StatusContext, TxButton } from '@polkadot/react-components';
import { useApi, useCall, useToggle } from '@polkadot/react-hooks';
import { formatNumber } from '@polkadot/util';
import { formatNumber, isFunction } from '@polkadot/util';

import { useTranslation } from '../../translate';
import BondExtra from './BondExtra';
Expand Down Expand Up @@ -324,7 +324,7 @@ function Account ({ allSlashes, className = '', info: { controllerId, destinatio
>
{t<string>('Change validator preferences')}
</Menu.Item>
{api.tx.staking.kick && (
{isFunction(api.tx.staking.kick) && (
<Menu.Item
disabled={!isOwnController}
onClick={toggleKick}
Expand Down
Loading

0 comments on commit 7d2d184

Please sign in to comment.