Skip to content

Commit

Permalink
chore: replace webpack with vite.js
Browse files Browse the repository at this point in the history
  • Loading branch information
elbywan committed Jun 15, 2022
1 parent e356cd3 commit 7ecc0a2
Show file tree
Hide file tree
Showing 1,563 changed files with 63,594 additions and 63,660 deletions.
3 changes: 3 additions & 0 deletions .pnpmfile.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ function readPackage(pkg, context) {
addPeerDependencies("jest-worker", {
metro: "*",
}),
addPeerDependencies("react-lottie", {
"prop-types": "*",
}),
// "dmg-builder" is required to build .dmg electron apps on macs,
// but is not declared as such by app-builder-lib.
// I'm not adding it as a dependency because if I did,
Expand Down
2 changes: 2 additions & 0 deletions apps/ledger-live-desktop/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module.exports = {
"react-hooks/rules-of-hooks": "error", // Checks rules of Hooks
"react-hooks/exhaustive-deps": "warn", // Checks effect dependencies
"jest/no-done-callback": 0,
"react/jsx-filename-extension": "error",
},
overrides: [
{
Expand Down Expand Up @@ -70,6 +71,7 @@ module.exports = {
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error"],
"flowtype/no-types-missing-file-annotation": 0,
"react/jsx-filename-extension": 0,
},
},
],
Expand Down
4 changes: 2 additions & 2 deletions apps/ledger-live-desktop/.flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.system.node.resolve_dirname=node_modules
module.name_mapper='^~' ->'<PROJECT_ROOT>/src'
module.name_mapper='^@ledgerhq/react-ui/\(.*\)' ->'<PROJECT_ROOT>/../../libs/ui/packages/react/lib/\1'
module.name_mapper='^@ledgerhq/react-ui' ->'<PROJECT_ROOT>/../../libs/ui/packages/react/lib'
module.name_mapper='^@ledgerhq/live-common/\(.*\)' ->'<PROJECT_ROOT>/../../libs/ledger-live-common/\1'
module.name_mapper='^@ledgerhq/live-common/\(.*\)' ->'<PROJECT_ROOT>/../../libs/ledger-live-common/lib/\1'
munge_underscores=true
esproposal.optional_chaining=enable

Expand All @@ -31,4 +31,4 @@ esproposal.optional_chaining=enable
[untyped]
.*/node_modules/react-select
.*/libs/ledger-live-common/.*
<PROJECT_ROOT>/node_modules/@ledgerhq/live-common/lib/*
<PROJECT_ROOT>/node_modules/@ledgerhq/live-common/.*
18 changes: 7 additions & 11 deletions apps/ledger-live-desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"start": "cross-env NODE_ENV=development node ./tools/main.js",
"build": "cross-env NODE_ENV=production node ./tools/main.js build",
"build:testing": "cross-env NODE_ENV=production TESTING=1 node ./tools/main.js build",
"lint": "pnpm prettier:check && eslint src tools static --ext .js,.json,.ts,.tsx",
"lint:fix": "eslint src tools static --ext .js,.json,.ts,.tsx --fix",
"lint": "pnpm prettier:check && eslint src tools static --ext .js,.jsx,.json,.ts,.tsx",
"lint:fix": "eslint src tools static --ext .js,.jsx,.json,.ts,.tsx --fix",
"prettier": "prettier --write \"{src,tools}/**/*.{js,json}\"",
"prettier:check": "prettier -c \"{src,tools}/**/*.{js,json}\"",
"flow-typed": "pnpm install-flow-typed",
Expand Down Expand Up @@ -132,6 +132,7 @@
"uncontrollable": "^7.2.1",
"usb-detection": "4.13.0",
"uuid": "^8.3.2",
"vite": "^2.9.10",
"winston": "^3.2.1",
"winston-transport": "^4.3.0",
"write-file-atomic": "^3.0.3",
Expand All @@ -154,10 +155,10 @@
"@babel/preset-flow": "^7.13.13",
"@babel/preset-react": "^7.13.13",
"@babel/preset-typescript": "^7.15.0",
"@bunchtogether/vite-plugin-flow": "^1.0.2",
"@mapbox/node-pre-gyp": "^1.0.8",
"@octokit/rest": "^18.12.0",
"@playwright/test": "1.22.2",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
"@storybook/addon-actions": "^6.3.12",
"@storybook/addon-essentials": "^6.3.12",
"@storybook/addon-links": "^6.3.12",
Expand All @@ -167,14 +168,15 @@
"@types/redux-actions": "^2.6.2",
"@typescript-eslint/eslint-plugin": "^5.12.1",
"@typescript-eslint/parser": "^5.12.1",
"@vitejs/plugin-react": "^1.3.2",
"babel-cli": "^6.26.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^27.3.1",
"babel-plugin-module-resolver": "^4.1.0",
"chalk": "^4.1.2",
"codecov": "^3.8.3",
"cross-env": "^7.0.3",
"css-loader": "^3.5.3",
"dotenv-webpack": "^7.1.0",
"electron": "13.5.2",
"electron-builder": "22.13.1",
"electron-devtools-installer": "^3.2.0",
Expand All @@ -201,7 +203,6 @@
"flow-typed": "^2.6.2",
"git-rev-sync": "^2.0.0",
"hasha": "^5.2.2",
"html-webpack-plugin": "^5.5.0",
"istanbul-instrumenter-loader": "^3.0.1",
"jest": "^26.6.3",
"listr": "^0.14.3",
Expand All @@ -216,14 +217,9 @@
"serve": "^13.0.2",
"style-loader": "^1.2.1",
"typescript": "^4.4.4",
"unused-webpack-plugin": "^2.4.0",
"url-loader": "^4.1.1",
"v8-to-istanbul": "^8.1.0",
"webpack": "^5.73.0",
"webpack-cli": "^4.9.1",
"webpack-dev-middleware": "^5.3.3",
"webpack-hot-middleware": "^2.25.1",
"webpackbar": "^5.0.2",
"vite-plugin-electron": "^0.4.8",
"yargs": "^15.3.1"
}
}
2 changes: 1 addition & 1 deletion apps/ledger-live-desktop/src/config/languages.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { getEnv } from "@ledgerhq/live-common/lib/env";
import { getEnv } from "@ledgerhq/live-common/env";

export const allLanguages = [
"de",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
listCryptoCurrencies,
isCurrencySupported,
listTokens,
} from "@ledgerhq/live-common/lib/currencies";
} from "@ledgerhq/live-common/currencies/index";

const outputFile = "cryptoassets.md";
test("generate cryptoassets.md", () => {
Expand Down
8 changes: 4 additions & 4 deletions apps/ledger-live-desktop/src/helpers/accountModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
* @module models/account
* @flow
*/
import { createDataModel } from "@ledgerhq/live-common/lib/DataModel";
import { fromAccountRaw, toAccountRaw } from "@ledgerhq/live-common/lib/account";
import type { DataModel } from "@ledgerhq/live-common/lib/DataModel";
import type { Account, AccountRaw, Operation } from "@ledgerhq/live-common/lib/types";
import { createDataModel } from "@ledgerhq/live-common/DataModel";
import { fromAccountRaw, toAccountRaw } from "@ledgerhq/live-common/account/index";
import type { DataModel } from "@ledgerhq/live-common/DataModel";
import type { Account, AccountRaw, Operation } from "@ledgerhq/live-common/types/index";

/**
* @memberof models/account
Expand Down
2 changes: 1 addition & 1 deletion apps/ledger-live-desktop/src/helpers/env.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow
import { ipcRenderer } from "electron";
import { setEnvUnsafe } from "@ledgerhq/live-common/lib/env";
import { setEnvUnsafe } from "@ledgerhq/live-common/env";

// List of environment variables for which killing internal process is necessary
// (I must admit having considered calling this `bloodThirstyEnvs`)
Expand Down
2 changes: 1 addition & 1 deletion apps/ledger-live-desktop/src/helpers/nft.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import type { NFTMetadata, NFTMediaSizes } from "@ledgerhq/live-common/lib/types";
import type { NFTMetadata, NFTMediaSizes } from "@ledgerhq/live-common/types/index";

const mimeTypesMap = {
video: ["video/mp4", "video/webm", "video/ogg"],
Expand Down
8 changes: 4 additions & 4 deletions apps/ledger-live-desktop/src/internal/commands/appOpExec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @flow
import type { Observable } from "rxjs";
import { withDevice } from "@ledgerhq/live-common/lib/hw/deviceAccess";
import type { App } from "@ledgerhq/live-common/lib/types/manager";
import { execWithTransport } from "@ledgerhq/live-common/lib/apps/hw";
import type { AppOp } from "@ledgerhq/live-common/lib/apps";
import { withDevice } from "@ledgerhq/live-common/hw/deviceAccess";
import type { App } from "@ledgerhq/live-common/types/manager";
import { execWithTransport } from "@ledgerhq/live-common/apps/hw";
import type { AppOp } from "@ledgerhq/live-common/apps/index";

type Input = {
deviceId: string,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @flow
import { from } from "rxjs";
import type { Observable } from "rxjs";
import { checkRPCNodeConfig } from "@ledgerhq/live-common/lib/families/bitcoin/satstack";
import type { RPCNodeConfig } from "@ledgerhq/live-common/lib/families/bitcoin/satstack";
import { checkRPCNodeConfig } from "@ledgerhq/live-common/families/bitcoin/satstack";
import type { RPCNodeConfig } from "@ledgerhq/live-common/families/bitcoin/satstack";

const cmd = (config: RPCNodeConfig): Observable<void> => from(checkRPCNodeConfig(config));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,18 @@

import type { Observable } from "rxjs";
import { from } from "rxjs";
import type { SellRequestEvent } from "@ledgerhq/live-common/lib/exchange/sell/types";
import type { SellRequestEvent } from "@ledgerhq/live-common/exchange/sell/types";
import type {
AccountRaw,
AccountRawLike,
TransactionStatusRaw,
TransactionRaw,
} from "@ledgerhq/live-common/lib/types";
import { fromTransactionRaw } from "@ledgerhq/live-common/lib/transaction";
import checkSignatureAndPrepare from "@ledgerhq/live-common/lib/exchange/sell/checkSignatureAndPrepare";
import { withDevice } from "@ledgerhq/live-common/lib/hw/deviceAccess";
import {
fromAccountRaw,
fromAccountLikeRaw,
} from "@ledgerhq/live-common/lib/account/serialization";
import { fromTransactionStatusRaw } from "@ledgerhq/live-common/lib/transaction/status";
} from "@ledgerhq/live-common/types";
import { fromTransactionRaw } from "@ledgerhq/live-common/transaction/index";
import checkSignatureAndPrepare from "@ledgerhq/live-common/exchange/sell/checkSignatureAndPrepare";
import { withDevice } from "@ledgerhq/live-common/hw/deviceAccess";
import { fromAccountRaw, fromAccountLikeRaw } from "@ledgerhq/live-common/account/serialization";
import { fromTransactionStatusRaw } from "@ledgerhq/live-common/transaction/status";
type Input = {
parentAccount: ?AccountRaw,
account: AccountRawLike,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import type { Observable } from "rxjs";
import { from } from "rxjs";
import type { ExchangeRaw } from "@ledgerhq/live-common/lib/exchange/platform/types";
import completeExchange from "@ledgerhq/live-common/lib/exchange/platform/completeExchange";
import { fromExchangeRaw } from "@ledgerhq/live-common/lib/exchange/platform/serialization";
import type { TransactionRaw } from "@ledgerhq/live-common/lib/types";
import { fromTransactionRaw } from "@ledgerhq/live-common/lib/transaction";
import type { ExchangeRaw } from "@ledgerhq/live-common/exchange/platform/types";
import completeExchange from "@ledgerhq/live-common/exchange/platform/completeExchange";
import { fromExchangeRaw } from "@ledgerhq/live-common/exchange/platform/serialization";
import type { TransactionRaw } from "@ledgerhq/live-common/types/index";
import { fromTransactionRaw } from "@ledgerhq/live-common/transaction/index";

type Input = {
deviceId: string,
Expand Down
4 changes: 2 additions & 2 deletions apps/ledger-live-desktop/src/internal/commands/connectApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import type { Observable } from "rxjs";
import { from } from "rxjs";
import connectApp from "@ledgerhq/live-common/lib/hw/connectApp";
import type { Input, ConnectAppEvent } from "@ledgerhq/live-common/lib/hw/connectApp";
import connectApp from "@ledgerhq/live-common/hw/connectApp";
import type { Input, ConnectAppEvent } from "@ledgerhq/live-common/hw/connectApp";
const cmd = (input: Input): Observable<ConnectAppEvent> => from(connectApp(input));

export default cmd;
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import type { Observable } from "rxjs";
import { from } from "rxjs";
import connectManager from "@ledgerhq/live-common/lib/hw/connectManager";
import type { Input, ConnectManagerEvent } from "@ledgerhq/live-common/lib/hw/connectManager";
import connectManager from "@ledgerhq/live-common/hw/connectManager";
import type { Input, ConnectManagerEvent } from "@ledgerhq/live-common/hw/connectManager";

const cmd = (input: Input): Observable<ConnectManagerEvent> => from(connectManager(input));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @flow

import type { Observable } from "rxjs";
import main from "@ledgerhq/live-common/lib/hw/firmwareUpdate-main";
import type { FirmwareUpdateContext } from "@ledgerhq/live-common/lib/types/manager";
import main from "@ledgerhq/live-common/hw/firmwareUpdate-main";
import type { FirmwareUpdateContext } from "@ledgerhq/live-common/types/manager";

type Input = FirmwareUpdateContext;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @flow

import type { Observable } from "rxjs";
import prepare from "@ledgerhq/live-common/lib/hw/firmwareUpdate-prepare";
import type { FirmwareUpdateContext } from "@ledgerhq/live-common/lib/types/manager";
import prepare from "@ledgerhq/live-common/hw/firmwareUpdate-prepare";
import type { FirmwareUpdateContext } from "@ledgerhq/live-common/types/manager";

type Input = {
deviceId: string,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow

import type { Observable } from "rxjs";
import repair from "@ledgerhq/live-common/lib/hw/firmwareUpdate-repair";
import repair from "@ledgerhq/live-common/hw/firmwareUpdate-repair";

type Input = {
version: ?string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import type { Observable } from "rxjs";
import { from } from "rxjs";
import { withDevicePolling } from "@ledgerhq/live-common/lib/hw/deviceAccess";
import getDeviceInfo from "@ledgerhq/live-common/lib/hw/getDeviceInfo";
import type { DeviceInfo } from "@ledgerhq/live-common/lib/types/manager";
import { withDevicePolling } from "@ledgerhq/live-common/hw/deviceAccess";
import getDeviceInfo from "@ledgerhq/live-common/hw/getDeviceInfo";
import type { DeviceInfo } from "@ledgerhq/live-common/types/manager";

type Input = {
deviceId: string,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import type { Observable } from "rxjs";
import { from } from "rxjs";
import flush from "@ledgerhq/live-common/lib/hw/flush";
import flush from "@ledgerhq/live-common/hw/flush";

type Input = string;
type Result = void;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import type { Observable } from "rxjs";
import { withDevice } from "@ledgerhq/live-common/lib/hw/deviceAccess";
import getAppAndVersion from "@ledgerhq/live-common/lib/hw/getAppAndVersion";
import { withDevice } from "@ledgerhq/live-common/hw/deviceAccess";
import getAppAndVersion from "@ledgerhq/live-common/hw/getAppAndVersion";
import { from } from "rxjs";

type Input = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import type { Observable } from "rxjs";
import { from } from "rxjs";
import type { DeviceInfo, FirmwareUpdateContext } from "@ledgerhq/live-common/lib/types/manager";
import manager from "@ledgerhq/live-common/lib/manager";
import type { DeviceInfo, FirmwareUpdateContext } from "@ledgerhq/live-common/types/manager";
import manager from "@ledgerhq/live-common/manager/index";

type Result = ?FirmwareUpdateContext;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow
import type { SatStackStatus } from "@ledgerhq/live-common/lib/families/bitcoin/satstack";
import { statusObservable } from "@ledgerhq/live-common/lib/families/bitcoin/satstack";
import type { SatStackStatus } from "@ledgerhq/live-common/families/bitcoin/satstack";
import { statusObservable } from "@ledgerhq/live-common/families/bitcoin/satstack";
import type { Observable } from "rxjs";

const cmd = (): Observable<SatStackStatus> => statusObservable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import type { Observable } from "rxjs";
import { from } from "rxjs";
import getTransactionId from "@ledgerhq/live-common/lib/exchange/sell/getTransactionId";
import type { SellRequestEvent } from "@ledgerhq/live-common/lib/exchange/sell/types";
import { withDevice } from "@ledgerhq/live-common/lib/hw/deviceAccess";
import getTransactionId from "@ledgerhq/live-common/exchange/sell/getTransactionId";
import type { SellRequestEvent } from "@ledgerhq/live-common/exchange/sell/types";
import { withDevice } from "@ledgerhq/live-common/hw/deviceAccess";

type Input = {
deviceId: string,
Expand Down
10 changes: 5 additions & 5 deletions apps/ledger-live-desktop/src/internal/commands/initSwap.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import type {
ExchangeRateRaw,
ExchangeRaw,
SwapRequestEvent,
} from "@ledgerhq/live-common/lib/exchange/swap/types";
import type { TransactionRaw } from "@ledgerhq/live-common/lib/types";
import { fromTransactionRaw } from "@ledgerhq/live-common/lib/transaction";
} from "@ledgerhq/live-common/exchange/swap/types";
import type { TransactionRaw } from "@ledgerhq/live-common/types/index";
import { fromTransactionRaw } from "@ledgerhq/live-common/transaction/index";
import {
fromExchangeRaw,
fromExchangeRateRaw,
} from "@ledgerhq/live-common/lib/exchange/swap/serialization";
import initSwap from "@ledgerhq/live-common/lib/exchange/swap/initSwap";
} from "@ledgerhq/live-common/exchange/swap/serialization";
import initSwap from "@ledgerhq/live-common/exchange/swap/initSwap";

type Input = {
exchange: ExchangeRaw,
Expand Down
8 changes: 4 additions & 4 deletions apps/ledger-live-desktop/src/internal/commands/listApps.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @flow
import type { Observable } from "rxjs";
import { withDevice } from "@ledgerhq/live-common/lib/hw/deviceAccess";
import type { DeviceInfo } from "@ledgerhq/live-common/lib/types/manager";
import { listApps } from "@ledgerhq/live-common/lib/apps/hw";
import type { ListAppsEvent } from "@ledgerhq/live-common/lib/apps";
import { withDevice } from "@ledgerhq/live-common/hw/deviceAccess";
import type { DeviceInfo } from "@ledgerhq/live-common/types/manager";
import { listApps } from "@ledgerhq/live-common/apps/hw";
import type { ListAppsEvent } from "@ledgerhq/live-common/apps/index";

type Input = {
deviceInfo: DeviceInfo,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @flow
import type { Observable } from "rxjs";
import { from } from "rxjs";
import { scanDescriptors } from "@ledgerhq/live-common/lib/families/bitcoin/descriptor";
import { getCryptoCurrencyById } from "@ledgerhq/live-common/lib/currencies";
import type { AccountDescriptor } from "@ledgerhq/live-common/lib/families/bitcoin/descriptor";
import { scanDescriptors } from "@ledgerhq/live-common/families/bitcoin/descriptor";
import { getCryptoCurrencyById } from "@ledgerhq/live-common/currencies/index";
import type { AccountDescriptor } from "@ledgerhq/live-common/families/bitcoin/descriptor";

type Input = {
deviceId: string,
Expand Down
Loading

0 comments on commit 7ecc0a2

Please sign in to comment.