Swap TS resolution to base config (#9194)

* Swap TS resolution to base config

* Run build fixup before lint

* Adjust with specific comment on fixup
This commit is contained in:
Jaco 2023-03-17 12:55:10 +02:00 committed by GitHub
parent 2088ffea96
commit 4bfda46580
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 221 additions and 189 deletions

View File

@ -27,13 +27,14 @@
"scripts": {
"analyze": "yarn clean && BUILD_ANALYZE=1 yarn run build:code && yarn source-map-explorer packages/apps/build/app.*.js",
"build": "yarn run build:i18n && yarn run build:code",
"build:before": "yarn build:images && yarn build:typesBundle",
"build:before": "yarn build:fixup && yarn build:images && yarn build:typesBundle",
"build:code": "NODE_ENV=production yarn polkadot-dev-build-ts",
"build:devElectronMain": "cd packages/apps-electron && yarn polkadot-exec-webpack --config webpack.main.cjs",
"build:devElectronRenderer": "cd packages/apps-electron && yarn polkadot-exec-webpack --config webpack.renderer.cjs",
"build:electron": "yarn clean:electronBuild && yarn build:electronMain && yarn build:electronRenderer",
"build:electronMain": "cd packages/apps-electron && NODE_ENV=production yarn polkadot-exec-webpack --config webpack.main.cjs",
"build:electronRenderer": "cd packages/apps-electron && NODE_ENV=production yarn polkadot-exec-webpack --config webpack.renderer.cjs",
"build:fixup": "node ./scripts/fixupModules.cjs",
"build:i18n": "i18next-scanner --config i18next-scanner.config.cjs && node ./scripts/i18nSort.cjs",
"build:images": "node scripts/imgConvert.mjs",
"build:release:electron": "yarn build && yarn build:electron && yarn postinstall:electron",
@ -41,7 +42,7 @@
"build:release:ipfs": "node scripts/ipfsUpload.mjs",
"build:release:www": "yarn polkadot-ci-ghact-build && yarn build:release:ghpages && yarn build:release:ipfs",
"build:robohash": "node scripts/robohash.cjs",
"build:typesBundle": "polkadot-dev-run-test --env node --require ./scripts/fixupModules.cjs --experimental-specifier-resolution=node packages/apps-config/src/api/typesBundle.spec.ts",
"build:typesBundle": "polkadot-dev-run-test --env node --experimental-specifier-resolution=node packages/apps-config/src/api/typesBundle.spec.ts",
"build:www": "rm -rf packages/apps/build && mkdir -p packages/apps/build && yarn run build:i18n && cd packages/apps && yarn polkadot-exec-webpack --config webpack.config.cjs",
"ci:chainEndpoints": "polkadot-dev-run-test --env node packages/apps-config/src/ci/chainEndpoints --log .github/chain-endpoints.md",
"ci:chainTypes": "echo ok",
@ -50,7 +51,7 @@
"clean:electronRelease": "cd packages/apps-electron && rm -rf release",
"clean:i18n": "rm -rf packages/apps/public/locales/en && mkdir -p packages/apps/public/locales/en",
"docs": "echo \"skipping docs\"",
"lint": "polkadot-dev-run-lint",
"lint": "yarn build:fixup && polkadot-dev-run-lint",
"packElectron": "yarn build:release:electron && yarn clean:electronRelease && electron-builder build -mwl",
"packElectron:linux": "yarn build:release:electron && electron-builder build --linux",
"packElectron:mac": "yarn build:release:electron && electron-builder build --mac",

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import type { OverrideBundleDefinition } from '@polkadot/types/types';

View File

@ -3,15 +3,17 @@
import type { OverrideBundleDefinition } from '@polkadot/types/types';
import { options } from '@frequency-chain/api-augment';
import { rpc, runtime, signedExtensions, types } from '@frequency-chain/api-augment';
export default {
...options,
rpc,
runtime,
signedExtensions,
types: [
{
// on all versions
minmax: [0, undefined],
types: options.types
types
}
]
} as OverrideBundleDefinition;

View File

@ -16,7 +16,9 @@ const bundle = {
types: [{
minmax: [0, undefined],
types: {
...typesFromDefs(typeDefs),
// the cast here is needed to make the build happy,
// however the output is actually correct as well...
...typesFromDefs(typeDefs as unknown as Record<string, { types: Record<string, any> }>),
TokensAccountData: {
free: 'Balance',
frozen: 'Balance',

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import fs from 'node:fs';

View File

@ -54013,76 +54013,6 @@ export const typesBundle = {
}
}
},
"types": [
{
"minmax": [
0,
null
],
"types": {
"RpcEvent": {
"phase": "Option<u32>",
"pallet": "u8",
"event": "u8",
"data": "Vec<u8>"
},
"BlockPaginationRequest": {
"from_block": "BlockNumber",
"from_index": "u32",
"to_block": "BlockNumber",
"page_size": "u32"
},
"MessageResponse": {
"payload": "Option<Vec<u8>>",
"cid": "Option<Vec<u8>>",
"provider_msa_id": "MessageSourceId",
"msa_id": "Option<MessageSourceId>",
"index": "u16",
"block_number": "BlockNumber",
"payload_length": "Option<u32>"
},
"BlockPaginationResponseMessage": {
"content": "Vec<MessageResponse>",
"has_next": "bool",
"next_block": "Option<BlockNumber>",
"next_index": "Option<u32>"
},
"MessageSourceId": "u64",
"DelegatorId": "MessageSourceId",
"ProviderId": "MessageSourceId",
"KeyInfoResponse": {
"key": "AccountId",
"msaId": "MessageSourceId"
},
"SchemaId": "u16",
"SchemaModel": "Vec<u8>",
"SchemaResponse": {
"schema_id": "SchemaId",
"model": "SchemaModel",
"model_type": "ModelType",
"payload_location": "PayloadLocation"
},
"ModelType": {
"_enum": [
"AvroBinary",
"Parquet"
]
},
"PayloadLocation": {
"_enum": [
"OnChain",
"IPFS"
]
}
}
}
],
"signedExtensions": {
"CheckFreeExtrinsicUse": {
"extrinsic": {},
"payload": {}
}
},
"runtime": {
"AdditionalRuntimeApi": [
{
@ -54191,7 +54121,77 @@ export const typesBundle = {
"version": 1
}
]
}
},
"signedExtensions": {
"CheckFreeExtrinsicUse": {
"extrinsic": {},
"payload": {}
}
},
"types": [
{
"minmax": [
0,
null
],
"types": {
"RpcEvent": {
"phase": "Option<u32>",
"pallet": "u8",
"event": "u8",
"data": "Vec<u8>"
},
"BlockPaginationRequest": {
"from_block": "BlockNumber",
"from_index": "u32",
"to_block": "BlockNumber",
"page_size": "u32"
},
"MessageResponse": {
"payload": "Option<Vec<u8>>",
"cid": "Option<Vec<u8>>",
"provider_msa_id": "MessageSourceId",
"msa_id": "Option<MessageSourceId>",
"index": "u16",
"block_number": "BlockNumber",
"payload_length": "Option<u32>"
},
"BlockPaginationResponseMessage": {
"content": "Vec<MessageResponse>",
"has_next": "bool",
"next_block": "Option<BlockNumber>",
"next_index": "Option<u32>"
},
"MessageSourceId": "u64",
"DelegatorId": "MessageSourceId",
"ProviderId": "MessageSourceId",
"KeyInfoResponse": {
"key": "AccountId",
"msaId": "MessageSourceId"
},
"SchemaId": "u16",
"SchemaModel": "Vec<u8>",
"SchemaResponse": {
"schema_id": "SchemaId",
"model": "SchemaModel",
"model_type": "ModelType",
"payload_location": "PayloadLocation"
},
"ModelType": {
"_enum": [
"AvroBinary",
"Parquet"
]
},
"PayloadLocation": {
"_enum": [
"OnChain",
"IPFS"
]
}
}
}
]
},
"frequency-rococo": {
"rpc": {
@ -54289,76 +54289,6 @@ export const typesBundle = {
}
}
},
"types": [
{
"minmax": [
0,
null
],
"types": {
"RpcEvent": {
"phase": "Option<u32>",
"pallet": "u8",
"event": "u8",
"data": "Vec<u8>"
},
"BlockPaginationRequest": {
"from_block": "BlockNumber",
"from_index": "u32",
"to_block": "BlockNumber",
"page_size": "u32"
},
"MessageResponse": {
"payload": "Option<Vec<u8>>",
"cid": "Option<Vec<u8>>",
"provider_msa_id": "MessageSourceId",
"msa_id": "Option<MessageSourceId>",
"index": "u16",
"block_number": "BlockNumber",
"payload_length": "Option<u32>"
},
"BlockPaginationResponseMessage": {
"content": "Vec<MessageResponse>",
"has_next": "bool",
"next_block": "Option<BlockNumber>",
"next_index": "Option<u32>"
},
"MessageSourceId": "u64",
"DelegatorId": "MessageSourceId",
"ProviderId": "MessageSourceId",
"KeyInfoResponse": {
"key": "AccountId",
"msaId": "MessageSourceId"
},
"SchemaId": "u16",
"SchemaModel": "Vec<u8>",
"SchemaResponse": {
"schema_id": "SchemaId",
"model": "SchemaModel",
"model_type": "ModelType",
"payload_location": "PayloadLocation"
},
"ModelType": {
"_enum": [
"AvroBinary",
"Parquet"
]
},
"PayloadLocation": {
"_enum": [
"OnChain",
"IPFS"
]
}
}
}
],
"signedExtensions": {
"CheckFreeExtrinsicUse": {
"extrinsic": {},
"payload": {}
}
},
"runtime": {
"AdditionalRuntimeApi": [
{
@ -54467,7 +54397,77 @@ export const typesBundle = {
"version": 1
}
]
}
},
"signedExtensions": {
"CheckFreeExtrinsicUse": {
"extrinsic": {},
"payload": {}
}
},
"types": [
{
"minmax": [
0,
null
],
"types": {
"RpcEvent": {
"phase": "Option<u32>",
"pallet": "u8",
"event": "u8",
"data": "Vec<u8>"
},
"BlockPaginationRequest": {
"from_block": "BlockNumber",
"from_index": "u32",
"to_block": "BlockNumber",
"page_size": "u32"
},
"MessageResponse": {
"payload": "Option<Vec<u8>>",
"cid": "Option<Vec<u8>>",
"provider_msa_id": "MessageSourceId",
"msa_id": "Option<MessageSourceId>",
"index": "u16",
"block_number": "BlockNumber",
"payload_length": "Option<u32>"
},
"BlockPaginationResponseMessage": {
"content": "Vec<MessageResponse>",
"has_next": "bool",
"next_block": "Option<BlockNumber>",
"next_index": "Option<u32>"
},
"MessageSourceId": "u64",
"DelegatorId": "MessageSourceId",
"ProviderId": "MessageSourceId",
"KeyInfoResponse": {
"key": "AccountId",
"msaId": "MessageSourceId"
},
"SchemaId": "u16",
"SchemaModel": "Vec<u8>",
"SchemaResponse": {
"schema_id": "SchemaId",
"model": "SchemaModel",
"model_type": "ModelType",
"payload_location": "PayloadLocation"
},
"ModelType": {
"_enum": [
"AvroBinary",
"Parquet"
]
},
"PayloadLocation": {
"_enum": [
"OnChain",
"IPFS"
]
}
}
}
]
},
"galital": {
"types": [

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { assert, isString } from '@polkadot/util';
import { WebSocket } from '@polkadot/x-ws';

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { strict as assert } from 'node:assert';

View File

@ -1,6 +1,8 @@
// Copyright 2017-2023 @polkadot/apps authors & contributors
// SPDX-License-Identifier: Apache-2.0
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode)
import type { KeyringJson } from '@polkadot/ui-keyring/types';
export interface AccountStoreApi {

View File

@ -2,13 +2,19 @@
// SPDX-License-Identifier: Apache-2.0
// setup these right at front
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode)
import '@polkadot/apps/initSettings';
import 'semantic-ui-css/semantic.min.css';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode)
import '@polkadot/react-components/i18n';
import React from 'react';
import { createRoot } from 'react-dom/client';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode)
import Root from '@polkadot/apps/Root';
import { electronMainApi } from './api/global-exported-api.js';

View File

@ -1,12 +1,16 @@
// Copyright 2017-2023 @polkadot/apps authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode)
import type { KeyringJson } from '@polkadot/ui-keyring/types';
import * as tmp from 'tmp';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode)
import { FileStore } from '@polkadot/ui-keyring/stores';
import { accountStoreIpcHandler } from './account-store.js';

View File

@ -1,11 +1,15 @@
// Copyright 2017-2023 @polkadot/apps authors & contributors
// SPDX-License-Identifier: Apache-2.0
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode)
import type { KeyringJson } from '@polkadot/ui-keyring/types';
import electron from 'electron';
import path from 'path';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode)
import { FileStore } from '@polkadot/ui-keyring/stores';
import { IpcMainHandler } from './ipc-main-handler.js';

View File

@ -1,6 +1,8 @@
// Copyright 2017-2023 @polkadot/apps authors & contributors
// SPDX-License-Identifier: Apache-2.0
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode)
import type { KeyringJson } from '@polkadot/ui-keyring/types';
import { contextBridge, ipcRenderer } from 'electron';

View File

@ -1,8 +1,10 @@
// Copyright 2017-2023 @polkadot/apps authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode)
import type { KeyringJson } from '@polkadot/ui-keyring/types';
import { RemoteElectronStore } from './remote-electron-store.js';

View File

@ -1,6 +1,8 @@
// Copyright 2017-2023 @polkadot/apps authors & contributors
// SPDX-License-Identifier: Apache-2.0
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode)
import type { KeyringJson, KeyringStore } from '@polkadot/ui-keyring/types';
import { AccountStoreApi } from '../api/account-store-api.js';

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/page-accounts authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { fireEvent, screen, within } from '@testing-library/react';

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/app-accounts authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import '@polkadot/react-components/i18n';

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/page-accounts authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { fireEvent, screen, waitFor, within } from '@testing-library/react';

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/page-accounts authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { fireEvent, screen, waitForElementToBeRemoved } from '@testing-library/react';

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/page-addresses authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { screen } from '@testing-library/react';

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/app-alliance authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { Metadata, TypeRegistry } from '@polkadot/types';
import substrate from '@polkadot/types-support/metadata/static-substrate';

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/app-bounties authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import '@polkadot/react-components/i18n';

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/app-bounties authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import type { SubmittableExtrinsic } from '@polkadot/api/types';
import type { DeriveCollectiveProposal } from '@polkadot/api-derive/types';

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/app-bounties authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { TypeRegistry } from '@polkadot/types/create';
import { BN } from '@polkadot/util';

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/app-bounties authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { createAugmentedApi } from '@polkadot/test-support/api';
import { BountyFactory } from '@polkadot/test-support/creation/bounties';

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/app-bounties authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { TypeRegistry } from '@polkadot/types/create';

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/app-bounties authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { TypeRegistry } from '@polkadot/types/create';
import { BN } from '@polkadot/util';

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/app-bounties authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { truncateTitle } from './stringHelpers.js';

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { hexToU8a } from '@polkadot/util';

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/app-democracy authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { calcPassing } from '@polkadot/api-derive/democracy/util';
import { TypeRegistry } from '@polkadot/types/create';

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/app-referenda authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import type { PalletReferendaCurve } from '@polkadot/types/lookup';
import type { BN } from '@polkadot/util';

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/react-api authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import fs from 'fs';
import path from 'path';

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/app-bounties authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import React, { Suspense } from 'react';

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import React, { Suspense } from 'react';

View File

@ -55,7 +55,10 @@ function Tooltip ({ children, className = '', isClickable = false, place, text,
);
}
const StyledReactTooltip = styled(ReactTooltip)`
// FIXME This cast should really not be needed since the export is React.Component<TooltipProps>,
// however while it works as specified, it fails here on the definition. Until we have the component
// upgraded to latest, we probably don't want to start digging...
const StyledReactTooltip = styled(ReactTooltip as unknown as React.ComponentType<any>)`
.tooltipSpacer {
padding: 0.375rem;
}

View File

@ -1,6 +1,8 @@
// Copyright 2017-2023 @polkadot/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { LanguageDetectorModule, Newable } from 'i18next';
import i18next from 'i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import { initReactI18next } from 'react-i18next';
@ -9,7 +11,12 @@ import { LANGUAGE_DEFAULT, settings } from '@polkadot/ui-settings';
import Backend from './Backend.js';
const languageDetector = new LanguageDetector();
// This is a workaround for the above package -
//
// 1. It does have an ESM export which would be used
// 2. The package type is set to commonjs
// 3. Unless we run fixup on it, it seems problematic... (here we opt for no fixup)
const languageDetector = new (LanguageDetector as unknown as Newable<LanguageDetectorModule & { addDetector: (...args: unknown[]) => unknown }>)();
languageDetector.addDetector({
lookup: () => {

View File

@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals" />
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { stringify } from '@polkadot/util';

17
scripts/fixupModules.cjs Normal file → Executable file
View File

@ -1,18 +1,15 @@
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
const fs = require('fs');
const path = require('path');
const process = require('process');
const fs = require('node:fs');
const path = require('node:path');
const process = require('node:process');
// incorrect packages without type specifier
const PKG_FIX = [
'@frequency-chain/api-augment',
// the default export here is ESM
'i18next-browser-languagedetector'
];
PKG_FIX.forEach((f) => {
[
// See https://github.com/LibertyDSNP/frequency/issues/1116
'@frequency-chain/api-augment'
].forEach((f) => {
const full = path.join(process.cwd(), `node_modules/${f}/package.json`);
const json = JSON.parse(fs.readFileSync(full, 'utf8'));

View File

@ -2,8 +2,6 @@
"extends": "@polkadot/dev/config/tsconfig.json",
"compilerOptions": {
"composite": false,
/* FIXME we still have some issues with some deps that make the default nodenext impossible */
"moduleResolution": "node",
"paths": {
"@polkadot/apps": ["apps/src/index.tsx"],
"@polkadot/apps/Root": ["apps/src/Root.tsx"],