Skip to content

Commit

Permalink
🔧 (build): Update our tsconfig to use nodenext or bundler
Browse files Browse the repository at this point in the history
  • Loading branch information
valpinkman committed Dec 30, 2024
1 parent 278bf59 commit c0c9da9
Show file tree
Hide file tree
Showing 186 changed files with 820 additions and 1,487 deletions.
5 changes: 2 additions & 3 deletions apps/cli/src/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"module": "commonjs",
"module": "nodenext",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
Expand All @@ -10,8 +10,7 @@
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"skipLibCheck": true,

"moduleResolution": "node",
"moduleResolution": "nodenext",
"downlevelIteration": true,
"resolveJsonModule": true,
"rootDir": ".",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { Button as BaseButton, InvertTheme } from "@ledgerhq/react-ui";
import { ButtonProps as BaseButtonProps } from "@ledgerhq/react-ui/components/cta/Button";
import { ButtonProps as BaseButtonProps } from "@ledgerhq/react-ui/components/cta/Button/index";
import { useTrack } from "~/renderer/analytics/segment";
import styled from "styled-components";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ import {
Text,
Theme,
} from "@ledgerhq/react-ui";
import { LockAltMedium } from "@ledgerhq/react-ui/assets/icons";
import { withV3StyleProvider } from "~/renderer/styles/StyleProviderV3";
import DeviceIllustration from "~/renderer/components/DeviceIllustration";
import { Account } from "@ledgerhq/types-live";
Expand Down Expand Up @@ -642,7 +641,7 @@ export const renderLockedDeviceError = ({
return (
<Wrapper id="error-locked-device">
<ErrorBody
Icon={LockAltMedium}
Icon={IconsLegacy.LockAltMedium}
title={t("errors.LockedDeviceError.title")}
description={
productName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import Ellipsis from "~/renderer/components/Ellipsis";
import { BoxProps } from "./Box/Box";
import { Icons } from "@ledgerhq/react-ui";

console.log(Icons);

const T = styled(Box).attrs((p: { color?: string; inline?: boolean; ff?: string } & BoxProps) => ({
ff: p.ff || "Inter|Medium",
horizontal: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styled, { DefaultTheme, StyledComponent } from "styled-components";
import { Box } from "@ledgerhq/react-ui";
import { BoxProps } from "@ledgerhq/react-ui/components/layout/Box";
import { BoxProps } from "@ledgerhq/react-ui/components/layout/Box/index";

type Props = {
lightSource: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { useTranslation } from "react-i18next";
import styled, { DefaultTheme, StyledComponent } from "styled-components";
import { Box, Text, Flex, Icon, Switch } from "@ledgerhq/react-ui";
import { BoxProps } from "@ledgerhq/react-ui/components/layout/Box/index";
import { SwitchProps } from "@ledgerhq/react-ui/components/form/Switch/Switch";
import { TextProps } from "@ledgerhq/react-ui/components/asorted/Text";
import { SwitchProps } from "@ledgerhq/react-ui/components/form/Switch/index";
import { TextProps } from "@ledgerhq/react-ui/components/asorted/Text/index";

export const WaveContainer: StyledComponent<"div", DefaultTheme, BoxProps> = styled(Box).attrs({
position: "absolute",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { isStuckOperation } from "@ledgerhq/live-common/operation";
import { InfiniteLoader } from "@ledgerhq/react-ui";
import { WarningSolidMedium } from "@ledgerhq/react-ui/assets/icons";
import { InfiniteLoader, IconsLegacy } from "@ledgerhq/react-ui";
import { Operation } from "@ledgerhq/types-live";
import { TFunction } from "i18next";
import React from "react";
Expand Down Expand Up @@ -31,7 +30,7 @@ const PendingLoadingIcon = ({ displayWarning }: { displayWarning: boolean }): JS
if (displayWarning) {
return (
<Box style={{ verticalAlign: "sub", display: "inline" }}>
<WarningSolidMedium size={12} color={"#FFBD42"} />
<IconsLegacy.WarningSolidMedium size={12} color={"#FFBD42"} />
</Box>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from "react";
import { Account, AccountLike, TransactionCommon } from "@ledgerhq/types-live";
import { useDebounce } from "@ledgerhq/live-common//hooks/useDebounce";
import { useDebounce } from "@ledgerhq/live-common/hooks/useDebounce";
import { getAccountBridge } from "@ledgerhq/live-common/bridge/index";
import FormattedVal from "~/renderer/components/FormattedVal";
import BigNumber from "bignumber.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { Flex, Text, InfiniteLoader, IconsLegacy } from "@ledgerhq/react-ui";
import styled, { StyledComponent, DefaultTheme } from "styled-components";
import { FlexBoxProps } from "@ledgerhq/react-ui/components/layout/Flex";
import { FlexBoxProps } from "@ledgerhq/react-ui/components/layout/Flex/index";
import { Status } from "../types";

const BorderFlex: StyledComponent<"div", DefaultTheme, FlexBoxProps> = styled(Flex).attrs({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { NotificationIndicator } from "~/renderer/components/TopBar/Notification
import { setTrackingSource } from "~/renderer/analytics/TrackPage";
import { LiveAppDrawer } from "~/renderer/components/LiveAppDrawer";
import { IconsLegacy } from "@ledgerhq/react-ui";

const Container = styled(Box).attrs(() => ({}))`
height: ${p => p.theme.sizes.topBarHeight}px;
box-sizing: content-box;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Box from "~/renderer/components/Box";
import { Flex } from "@ledgerhq/react-ui";
import Text from "~/renderer/components/Text";
import ExternalLinkIcon from "~/renderer/icons/ExternalLink";
import { FlexBoxProps } from "@ledgerhq/react-ui/components/layout/Flex";
import { FlexBoxProps } from "@ledgerhq/react-ui/components/layout/Flex/index";

export const Wrapper = styled(Box).attrs({
alignItems: "center",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import { useTheme } from "styled-components";
import SelectInput, {
Props as SelectInputProps,
} from "@ledgerhq/react-ui/components/form/SelectInput/index";
import { Text, Flex as FlexBox } from "@ledgerhq/react-ui";
import { Text, Flex as FlexBox, IconsLegacy } from "@ledgerhq/react-ui";
import {
ValueContainer,
MixedProps as ValueContainerProps,
} from "@ledgerhq/react-ui/components/form/SelectInput/ValueContainer";
import { ChevronBottomMedium, ChevronTopMedium } from "@ledgerhq/react-ui/assets/icons";

export type Props<O> = SelectInputProps<O> & {
searchable?: boolean;
Expand All @@ -31,7 +30,9 @@ function DropdownControl<O extends OptionTypeBase>(props: ControlProps<O, false>
function DropdownValueContainer<O extends OptionTypeBase>(
props: ValueContainerProps<O, false> & { label?: React.ReactNode },
) {
const ChevronIcon = props.selectProps.menuIsOpen ? ChevronTopMedium : ChevronBottomMedium;
const ChevronIcon = props.selectProps.menuIsOpen
? IconsLegacy.ChevronTopMedium
: IconsLegacy.ChevronBottomMedium;
// @ts-expect-error This label prop is inherited from the original component props but it is not handled well in the react-select bindings
const { label } = props.selectProps;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { FeatureId } from "@ledgerhq/types-live";
import Box from "~/renderer/components/Box";
import FeatureFlagEdit from "./FeatureFlagEdit";
import styled, { DefaultTheme, StyledComponent } from "styled-components";
import { FlexBoxProps } from "@ledgerhq/react-ui/components/layout/Flex";
import { FlexBoxProps } from "@ledgerhq/react-ui/components/layout/Flex/index";
import { useTranslation } from "react-i18next";

type Props = {
Expand Down
3 changes: 2 additions & 1 deletion apps/ledger-live-desktop/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"compilerOptions": {
"allowJs": false,
"composite": true,
"module": "es2020",
"jsx": "react",
"lib": ["ES2021", "dom"],
"target": "esnext",
"module": "nodenext",
"moduleResolution": "nodenext",
"baseUrl": ".",
"rootDir": ".",
"paths": {
Expand Down
2 changes: 1 addition & 1 deletion apps/ledger-live-mobile/e2e/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { device } from "detox";
import * as serverBridge from "./bridge/server";
import fs from "fs";
import { getState } from "expect";
import { MatcherState } from "expect/build/types";
import { MatcherState } from "expect";
import { format } from "date-fns";
import { launchApp, deleteSpeculos } from "./helpers";
import { closeProxy } from "./bridge/proxy";
Expand Down
2 changes: 1 addition & 1 deletion apps/ledger-live-mobile/src/components/InfoModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Trans } from "react-i18next";

import { useTheme } from "styled-components/native";
import { IconsLegacy, IconBox, Flex } from "@ledgerhq/native-ui";
import type { Props as IconBoxProps } from "@ledgerhq/native-ui/components/Icon/IconBox";
import type { Props as IconBoxProps } from "@ledgerhq/native-ui/components/Icon/IconBox/index";
import QueuedDrawer from "./QueuedDrawer";
import LText from "./LText";
import IconArrowRight from "~/icons/ArrowRight";
Expand Down
2 changes: 1 addition & 1 deletion apps/ledger-live-mobile/src/components/Switch.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { Switch as RNSwitch } from "@ledgerhq/native-ui";
import type { SwitchProps as RNSwitchProps } from "@ledgerhq/native-ui/components/Form/Switch";
import type { SwitchProps as RNSwitchProps } from "@ledgerhq/native-ui/components/Form/Switch/index";

type SwitchProps = {
value: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { memo, useCallback, useMemo } from "react";
import Animated, { useSharedValue, useAnimatedStyle, withTiming } from "react-native-reanimated";
import styled from "styled-components/native";
import { Button, Icons } from "@ledgerhq/native-ui";
import { ButtonProps } from "@ledgerhq/native-ui/components/cta/Button";
import { ButtonProps } from "@ledgerhq/native-ui/components/cta/Button/index";

export default memo(CopyButton);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Transaction } from "@ledgerhq/live-common/generated/types";
import type { AnimatedInputProps } from "@ledgerhq/native-ui/components/Form/Input/AnimatedInput";
import type { AnimatedInputProps } from "@ledgerhq/native-ui/components/Form/Input/AnimatedInput/index";

export type TxPatch<T extends Transaction> = (tx: T) => T;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import { Flex, Text, Button, Link, Box } from "@ledgerhq/native-ui";
import { AnalyticsPage } from "../../hooks/useLedgerSyncAnalytics";
import TrackScreen from "~/analytics/TrackScreen";
import { ButtonProps } from "@ledgerhq/native-ui/components/cta/Button";
import { ButtonProps } from "@ledgerhq/native-ui/components/cta/Button/index";
import styled from "styled-components/native";

interface Props {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useTranslation } from "react-i18next";
import { useTheme } from "styled-components/native";
import { AnalyticsButton, AnalyticsPage, useLedgerSyncAnalytics } from "./useLedgerSyncAnalytics";

import { ButtonProps } from "@ledgerhq/native-ui/components/cta/Button";
import { ButtonProps } from "@ledgerhq/native-ui/components/cta/Button/index";

export enum ErrorReason {
UNSECURED = "unsecured",
Expand Down
4 changes: 2 additions & 2 deletions libs/coin-framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@
},
"scripts": {
"clean": "rm -rf lib lib-es",
"build": "tsc && tsc -m ES6 --outDir lib-es",
"build": "tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es",
"prewatch": "pnpm build",
"watch": "tsc --watch",
"watch:es": "tsc --watch -m ES6 --outDir lib-es",
"watch:es": "tsc --watch -m esnext --moduleResolution bundler --outDir lib-es",
"doc": "documentation readme src/** --section=API --pe ts --re ts --re d.ts",
"lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx --cache",
"lint:fix": "pnpm lint --fix",
Expand Down
1 change: 0 additions & 1 deletion libs/coin-framework/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"module": "commonjs",
"downlevelIteration": true,
"lib": ["es2020", "dom"],
"outDir": "lib",
Expand Down
4 changes: 2 additions & 2 deletions libs/coin-modules/coin-algorand/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@
},
"scripts": {
"clean": "rimraf lib lib-es",
"build": "tsc && tsc -m ES6 --outDir lib-es",
"build": "tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es",
"coverage": "jest --coverage --testPathIgnorePatterns='/bridge.integration.test.ts|node_modules|lib-es|lib/' --passWithNoTests && mv coverage/coverage-final.json coverage/coverage-algorand.json",
"prewatch": "pnpm build",
"watch": "tsc --watch",
"watch:es": "tsc --watch -m ES6 --outDir lib-es",
"watch:es": "tsc --watch -m esnext --moduleResolution bundler --outDir lib-es",
"doc": "documentation readme src/** --section=API --pe ts --re ts --re d.ts",
"lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx --cache",
"lint:fix": "pnpm lint --fix",
Expand Down
1 change: 0 additions & 1 deletion libs/coin-modules/coin-algorand/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"module": "commonjs",
"downlevelIteration": true,
"lib": ["es2020", "dom"],
"outDir": "lib",
Expand Down
6 changes: 3 additions & 3 deletions libs/coin-modules/coin-bitcoin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"devDependencies": {
"@types/bchaddrjs": "^0.4.3",
"@types/bs58": "^4.0.1",
"@types/bs58check": "^2.1.0",
"@types/bs58check": "^2.1.2",
"@types/cashaddrjs": "^0.3.3",
"@types/create-hmac": "^1.1.3",
"@types/invariant": "^2.2.2",
Expand All @@ -96,11 +96,11 @@
},
"scripts": {
"clean": "rimraf lib lib-es",
"build": "tsc && tsc -m ES6 --outDir lib-es",
"build": "tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es",
"coverage": "jest --coverage --testPathIgnorePatterns='/bridge.integration.test.ts|node_modules|lib-es|lib/' --passWithNoTests && mv coverage/coverage-final.json coverage/coverage-bitcoin.json",
"prewatch": "pnpm build",
"watch": "tsc --watch",
"watch:es": "tsc --watch -m ES6 --outDir lib-es",
"watch:es": "tsc --watch -m esnext --moduleResolution bundler --outDir lib-es",
"doc": "documentation readme src/** --section=API --pe ts --re ts --re d.ts",
"lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx --cache",
"lint:fix": "pnpm lint --fix",
Expand Down
3 changes: 1 addition & 2 deletions libs/coin-modules/coin-bitcoin/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"module": "commonjs",
"downlevelIteration": true,
"lib": ["es2020", "dom"],
"outDir": "lib",
"exactOptionalPropertyTypes": true,
"typeRoots": ["./types", "./node_modules/@types"]
},
"include": ["src/**/*"],
"include": ["src/**/*", "types.d.ts"],
}
3 changes: 3 additions & 0 deletions libs/coin-modules/coin-bitcoin/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module "coininfo";
declare module "blake-hash";
declare module "bs58check/base";
4 changes: 2 additions & 2 deletions libs/coin-modules/coin-cardano/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@
},
"scripts": {
"clean": "rimraf lib lib-es",
"build": "tsc && tsc -m ES6 --outDir lib-es",
"build": "tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es",
"coverage": "jest --coverage --testPathIgnorePatterns='/bridge.integration.test.ts|node_modules|lib-es|lib/' --passWithNoTests && mv coverage/coverage-final.json coverage/coverage-cardano.json",
"prewatch": "pnpm build",
"watch": "tsc --watch",
"watch:es": "tsc --watch -m ES6 --outDir lib-es",
"watch:es": "tsc --watch -m esnext --moduleResolution bundler --outDir lib-es",
"doc": "documentation readme src/** --section=API --pe ts --re ts --re d.ts",
"lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx --cache",
"lint:fix": "pnpm lint --fix",
Expand Down
1 change: 0 additions & 1 deletion libs/coin-modules/coin-cardano/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"module": "commonjs",
"downlevelIteration": true,
"lib": ["es2020", "dom"],
"outDir": "lib"
Expand Down
4 changes: 2 additions & 2 deletions libs/coin-modules/coin-cosmos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@
},
"scripts": {
"clean": "rimraf lib lib-es",
"build": "tsc && tsc -m ES6 --outDir lib-es",
"build": "tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es",
"coverage": "jest --coverage --testPathIgnorePatterns='/bridge.integration.test.ts|node_modules|lib-es|lib/' --passWithNoTests && mv coverage/coverage-final.json coverage/coverage-algorand.json",
"prewatch": "pnpm build",
"watch": "tsc --watch",
"watch:es": "tsc --watch -m ES6 --outDir lib-es",
"watch:es": "tsc --watch -m esnext --moduleResolution bundler --outDir lib-es",
"doc": "documentation readme src/** --section=API --pe ts --re ts --re d.ts",
"lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx --cache",
"lint:fix": "pnpm lint --fix",
Expand Down
1 change: 0 additions & 1 deletion libs/coin-modules/coin-cosmos/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"module": "commonjs",
"downlevelIteration": true,
"lib": ["es2020", "dom"],
"outDir": "lib",
Expand Down
4 changes: 2 additions & 2 deletions libs/coin-modules/coin-elrond/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@
},
"scripts": {
"clean": "rimraf lib lib-es",
"build": "tsc && tsc -m ES6 --outDir lib-es",
"build": "tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es",
"coverage": "jest --coverage --testPathIgnorePatterns='/bridge.integration.test.ts|node_modules|lib-es|lib/' --passWithNoTests && mv coverage/coverage-final.json coverage/coverage-multiversx.json",
"prewatch": "pnpm build",
"watch": "tsc --watch",
"watch:es": "tsc --watch -m ES6 --outDir lib-es",
"watch:es": "tsc --watch -m esnext --moduleResolution bundler --outDir lib-es",
"doc": "documentation readme src/** --section=API --pe ts --re ts --re d.ts",
"lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx --cache",
"lint:fix": "pnpm lint --fix",
Expand Down
1 change: 0 additions & 1 deletion libs/coin-modules/coin-elrond/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"module": "commonjs",
"downlevelIteration": true,
"lib": ["es2020", "dom"],
"rootDir": "./src",
Expand Down
6 changes: 3 additions & 3 deletions libs/coin-modules/coin-evm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
"license": "Apache-2.0",
"scripts": {
"clean": "rimraf lib lib-es",
"build": "tsc && tsc -m ES6 --outDir lib-es",
"build": "tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es",
"coverage": "jest --coverage --testPathIgnorePatterns='/bridge.integration.test.ts|node_modules|lib-es|lib/' --passWithNoTests && mv coverage/coverage-final.json coverage/coverage-evm.json",
"prewatch": "pnpm build",
"watch": "tsc --watch",
"watch:es": "tsc --watch -m ES6 --outDir lib-es",
"watch:es": "tsc --watch -m esnext --moduleResolution bundler --outDir lib-es",
"doc": "documentation readme src/** --section=API --pe ts --re ts --re d.ts",
"lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx --cache",
"lint:fix": "pnpm lint --fix",
Expand Down Expand Up @@ -103,4 +103,4 @@
"prando": "^6.0.1",
"ts-jest": "^29.1.1"
}
}
}
Loading

0 comments on commit c0c9da9

Please sign in to comment.