From 2c6288b8a3c1e5a1f5edd7207649cf6e814dfbbe Mon Sep 17 00:00:00 2001 From: "Valentin D. Pinkman" Date: Tue, 24 Sep 2024 15:51:38 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20(repo):=20Move=20build=20t?= =?UTF-8?q?ools=20to=20a=20package?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sample/tsconfig.eslint.json | 4 +- apps/sample/tsconfig.json | 7 +- packages/config/eslint/index.js | 3 +- packages/config/eslint/package.json | 1 + packages/config/typescript/tsconfig.sdk.json | 4 +- packages/core/eslint.config.mjs | 1 + packages/core/package.json | 6 +- packages/core/scripts/esbuild.mjs | 50 ------------- packages/core/src/api/index.ts | 7 -- packages/core/tsconfig.json | 2 +- .../signer/context-module/eslint.config.mjs | 1 + packages/signer/context-module/package.json | 6 +- .../signer/context-module/scripts/esbuild.mjs | 50 ------------- .../signer/context-module/scripts/watch.mjs | 43 ----------- packages/signer/context-module/src/index.ts | 1 + packages/signer/context-module/tsconfig.json | 2 +- packages/signer/keyring-btc/eslint.config.mjs | 1 + packages/signer/keyring-btc/package.json | 6 +- .../signer/keyring-btc/scripts/esbuild.mjs | 50 ------------- packages/signer/keyring-btc/scripts/watch.mjs | 43 ----------- packages/signer/keyring-btc/tsconfig.json | 2 +- packages/signer/keyring-eth/eslint.config.mjs | 1 + packages/signer/keyring-eth/package.json | 6 +- .../signer/keyring-eth/scripts/esbuild.mjs | 50 ------------- packages/signer/keyring-eth/scripts/watch.mjs | 43 ----------- .../src/api/KeyringEthBuilder.test.ts | 3 +- packages/signer/keyring-eth/tsconfig.json | 2 +- packages/tools/esbuild-tools/build.mjs | 74 +++++++++++++++++++ packages/tools/esbuild-tools/package.json | 20 +++++ .../scripts => tools/esbuild-tools}/watch.mjs | 31 ++++++-- packages/transport-mock/eslint.config.mjs | 3 +- packages/transport-mock/package.json | 29 +++----- packages/transport-mock/tsconfig.cjs.json | 10 --- packages/transport-mock/tsconfig.eslint.json | 4 - packages/transport-mock/tsconfig.esm.json | 9 --- packages/transport-mock/tsconfig.json | 17 ++++- packages/transport-mock/tsconfig.prod.json | 4 + packages/trusted-apps/eslint.config.mjs | 1 + packages/trusted-apps/package.json | 6 +- packages/trusted-apps/scripts/esbuild.mjs | 50 ------------- packages/trusted-apps/scripts/watch.mjs | 43 ----------- packages/trusted-apps/tsconfig.json | 2 +- packages/ui/eslint.config.mjs | 1 + packages/ui/package.json | 6 +- packages/ui/scripts/esbuild.mjs | 50 ------------- packages/ui/scripts/watch.mjs | 43 ----------- packages/ui/tsconfig.json | 2 +- pnpm-lock.yaml | 33 +++++++++ pnpm-workspace.yaml | 1 + turbo.json | 64 ++++------------ 50 files changed, 249 insertions(+), 649 deletions(-) delete mode 100644 packages/core/scripts/esbuild.mjs delete mode 100644 packages/signer/context-module/scripts/esbuild.mjs delete mode 100644 packages/signer/context-module/scripts/watch.mjs delete mode 100644 packages/signer/keyring-btc/scripts/esbuild.mjs delete mode 100644 packages/signer/keyring-btc/scripts/watch.mjs delete mode 100644 packages/signer/keyring-eth/scripts/esbuild.mjs delete mode 100644 packages/signer/keyring-eth/scripts/watch.mjs create mode 100755 packages/tools/esbuild-tools/build.mjs create mode 100644 packages/tools/esbuild-tools/package.json rename packages/{core/scripts => tools/esbuild-tools}/watch.mjs (51%) mode change 100644 => 100755 delete mode 100644 packages/transport-mock/tsconfig.cjs.json delete mode 100644 packages/transport-mock/tsconfig.eslint.json delete mode 100644 packages/transport-mock/tsconfig.esm.json create mode 100644 packages/transport-mock/tsconfig.prod.json delete mode 100644 packages/trusted-apps/scripts/esbuild.mjs delete mode 100644 packages/trusted-apps/scripts/watch.mjs delete mode 100644 packages/ui/scripts/esbuild.mjs delete mode 100644 packages/ui/scripts/watch.mjs diff --git a/apps/sample/tsconfig.eslint.json b/apps/sample/tsconfig.eslint.json index 022d7d734..ae4346431 100644 --- a/apps/sample/tsconfig.eslint.json +++ b/apps/sample/tsconfig.eslint.json @@ -4,8 +4,8 @@ "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", - "eslint.config.mjs", "next.config.js", - "postcss.config.js" + "postcss.config.js", + "eslint.config.mjs" ] } diff --git a/apps/sample/tsconfig.json b/apps/sample/tsconfig.json index 779da404a..11e670214 100644 --- a/apps/sample/tsconfig.json +++ b/apps/sample/tsconfig.json @@ -11,6 +11,11 @@ }, "strictNullChecks": true }, - "include": ["**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], + "include": [ + "**/*.ts", + "**/*.tsx", + "eslint.config.mjs", + ".next/types/**/*.ts" + ], "exclude": ["node_modules"] } diff --git a/packages/config/eslint/index.js b/packages/config/eslint/index.js index 3993b89e3..01a35f2be 100644 --- a/packages/config/eslint/index.js +++ b/packages/config/eslint/index.js @@ -1,5 +1,3 @@ -// @ts-check - import globals from "globals"; import js from "@eslint/js"; import tseslint from "typescript-eslint"; @@ -13,6 +11,7 @@ export default [ { ignores: [ ".*.js", + ".*.mjs", "coverage/*", "_templates/*", "lib/*", diff --git a/packages/config/eslint/package.json b/packages/config/eslint/package.json index 10a5dc8d9..1c038343c 100644 --- a/packages/config/eslint/package.json +++ b/packages/config/eslint/package.json @@ -13,6 +13,7 @@ "@eslint/compat": "^1.2.0", "@eslint/js": "9.12.0", "@types/eslint__js": "^8.42.3", + "@eslint/core": "^0.6.0", "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-react": "^7.37.1", "eslint-plugin-react-hooks": "^5.0.0", diff --git a/packages/config/typescript/tsconfig.sdk.json b/packages/config/typescript/tsconfig.sdk.json index 47ef6cf2a..bb6ad643c 100644 --- a/packages/config/typescript/tsconfig.sdk.json +++ b/packages/config/typescript/tsconfig.sdk.json @@ -3,14 +3,14 @@ "compilerOptions": { "allowUnreachableCode": false, "allowUnusedLabels": false, - "checkJs": true, + "checkJs": false, "declaration": true, "declarationMap": true, "emitDecoratorMetadata": true, "esModuleInterop": true, "experimentalDecorators": true, "forceConsistentCasingInFileNames": true, - "isolatedModules": false, + "isolatedModules": true, "lib": ["esnext", "dom", "dom.iterable"], "module": "esnext", "moduleResolution": "bundler", diff --git a/packages/core/eslint.config.mjs b/packages/core/eslint.config.mjs index 833c97da3..5d90c9c2e 100644 --- a/packages/core/eslint.config.mjs +++ b/packages/core/eslint.config.mjs @@ -3,6 +3,7 @@ import config from "@ledgerhq/eslint-config-dsdk"; export default [ ...config, { + ignores: ["eslint.config.mjs", "scripts/*.mjs"], languageOptions: { parserOptions: { project: "./tsconfig.json", diff --git a/packages/core/package.json b/packages/core/package.json index 88d4bfa8b..f40236141 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -16,9 +16,10 @@ "./lib" ], "scripts": { - "build": "rimraf lib && zx scripts/esbuild.mjs", + "prebuild": "rimraf lib", + "build": "pnpm lmdk-build --entryPoints index.ts --tsconfig tsconfig.prod.json", "dev": "concurrently \"pnpm watch:builds\" \"pnpm watch:types\"", - "watch:builds": "zx scripts/watch.mjs", + "watch:builds": "pnpm lmdk-watch --entryPoints index.ts --tsconfig tsconfig.prod.json", "watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\"", "lint": "eslint", "lint:fix": "pnpm lint --fix", @@ -46,6 +47,7 @@ "xstate": "^5.18.2" }, "devDependencies": { + "@ledgerhq/esbuild-tools": "workspace:*", "@ledgerhq/eslint-config-dsdk": "workspace:*", "@ledgerhq/jest-config-dsdk": "workspace:*", "@ledgerhq/prettier-config-dsdk": "workspace:*", diff --git a/packages/core/scripts/esbuild.mjs b/packages/core/scripts/esbuild.mjs deleted file mode 100644 index 74f8cfc5d..000000000 --- a/packages/core/scripts/esbuild.mjs +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env zx - -import "zx/globals"; -import esbuild from "esbuild"; -import { nodeExternalsPlugin } from "esbuild-node-externals"; -import path from "node:path"; -const root = path.join(__dirname, ".."); -const tsconfig = path.join(root, "tsconfig.prod.json"); - -const config = { - entryPoints: ["index.ts"], - // minify: true, - bundle: true, - treeShaking: true, - sourcemap: true, - color: true, - // To analyze the bundle - // https://esbuild.github.io/api/#build-metadata - // metafile: true, -}; - -const buildBrowser = async () => - esbuild.build({ - ...config, - outdir: "lib/esm", - format: "esm", - platform: "browser", - }); - -const buildNode = async () => - esbuild.build({ - ...config, - outdir: "lib/cjs", - format: "cjs", - platform: "node", - plugins: [nodeExternalsPlugin()], - }); - -const buildTypes = async () => { - await $`tsc --project ${tsconfig} --incremental`; - await $`tsc-alias --project ${tsconfig}`; -}; - -const build = async () => - Promise.all([buildBrowser(), buildNode(), buildTypes()]); - -build().catch((e) => { - console.error(e); - process.exitCode = e.exitCode; -}); diff --git a/packages/core/src/api/index.ts b/packages/core/src/api/index.ts index 9a62d46d6..d1d3d1369 100644 --- a/packages/core/src/api/index.ts +++ b/packages/core/src/api/index.ts @@ -50,14 +50,7 @@ export { WebLogsExporterLogger } from "./logger-subscriber/service/WebLogsExport export { ConnectedDevice } from "./transport/model/ConnectedDevice"; export { BuiltinTransports } from "./transport/model/TransportIdentifier"; export * from "./types"; -export * from "./types"; -<<<<<<< HEAD -||||||| parent of 7bbdd07 (👷 (repo): Use esbuild to produce builds) -export { ConnectedDevice } from "./usb/model/ConnectedDevice"; -======= -export { ConnectedDevice } from "./usb/model/ConnectedDevice"; export * from "@api/apdu/utils/AppBuilderError"; ->>>>>>> 7bbdd07 (👷 (repo): Use esbuild to produce builds) export { InvalidStatusWordError } from "@api/command/Errors"; export { type DeviceAction, diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index b65c01530..0d955afc3 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -1,6 +1,6 @@ { "extends": "@ledgerhq/tsconfig-dsdk/tsconfig.sdk", - "include": ["src", "index.ts", "jest.*.ts", "scripts", "eslint.config.mjs"], + "include": ["src", "index.ts", "jest.*.ts"], "compilerOptions": { "baseUrl": ".", "outDir": "./lib/types", diff --git a/packages/signer/context-module/eslint.config.mjs b/packages/signer/context-module/eslint.config.mjs index 833c97da3..5d90c9c2e 100644 --- a/packages/signer/context-module/eslint.config.mjs +++ b/packages/signer/context-module/eslint.config.mjs @@ -3,6 +3,7 @@ import config from "@ledgerhq/eslint-config-dsdk"; export default [ ...config, { + ignores: ["eslint.config.mjs", "scripts/*.mjs"], languageOptions: { parserOptions: { project: "./tsconfig.json", diff --git a/packages/signer/context-module/package.json b/packages/signer/context-module/package.json index c486ae3bd..4bc2b4b05 100644 --- a/packages/signer/context-module/package.json +++ b/packages/signer/context-module/package.json @@ -16,9 +16,10 @@ "./lib" ], "scripts": { - "build": "rimraf lib && zx scripts/esbuild.mjs", + "prebuild": "rimraf lib", + "build": "pnpm lmdk-build --entryPoints index.ts --tsconfig tsconfig.prod.json", "dev": "concurrently \"pnpm watch:builds\" \"pnpm watch:types\"", - "watch:builds": "zx scripts/watch.mjs", + "watch:builds": "pnpm lmdk-watch --entryPoints index.ts --tsconfig tsconfig.prod.json", "watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\"", "lint": "eslint", "lint:fix": "pnpm lint --fix", @@ -31,6 +32,7 @@ "typecheck": "tsc --noEmit" }, "devDependencies": { + "@ledgerhq/esbuild-tools": "workspace:*", "@ledgerhq/device-management-kit": "workspace:*", "@ledgerhq/eslint-config-dsdk": "workspace:*", "@ledgerhq/jest-config-dsdk": "workspace:*", diff --git a/packages/signer/context-module/scripts/esbuild.mjs b/packages/signer/context-module/scripts/esbuild.mjs deleted file mode 100644 index 74f8cfc5d..000000000 --- a/packages/signer/context-module/scripts/esbuild.mjs +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env zx - -import "zx/globals"; -import esbuild from "esbuild"; -import { nodeExternalsPlugin } from "esbuild-node-externals"; -import path from "node:path"; -const root = path.join(__dirname, ".."); -const tsconfig = path.join(root, "tsconfig.prod.json"); - -const config = { - entryPoints: ["index.ts"], - // minify: true, - bundle: true, - treeShaking: true, - sourcemap: true, - color: true, - // To analyze the bundle - // https://esbuild.github.io/api/#build-metadata - // metafile: true, -}; - -const buildBrowser = async () => - esbuild.build({ - ...config, - outdir: "lib/esm", - format: "esm", - platform: "browser", - }); - -const buildNode = async () => - esbuild.build({ - ...config, - outdir: "lib/cjs", - format: "cjs", - platform: "node", - plugins: [nodeExternalsPlugin()], - }); - -const buildTypes = async () => { - await $`tsc --project ${tsconfig} --incremental`; - await $`tsc-alias --project ${tsconfig}`; -}; - -const build = async () => - Promise.all([buildBrowser(), buildNode(), buildTypes()]); - -build().catch((e) => { - console.error(e); - process.exitCode = e.exitCode; -}); diff --git a/packages/signer/context-module/scripts/watch.mjs b/packages/signer/context-module/scripts/watch.mjs deleted file mode 100644 index da13eca65..000000000 --- a/packages/signer/context-module/scripts/watch.mjs +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env zx - -import esbuild from "esbuild"; - -const config = { - entryPoints: ["index.ts"], - // minify: true, - bundle: true, - treeShaking: true, - sourcemap: true, - color: true, - // To analyze the bundle - // https://esbuild.github.io/api/#build-metadata - // metafile: true, -}; - -const getBrowserContext = async () => - esbuild.context({ - ...config, - outdir: "lib/esm", - format: "esm", - platform: "browser", - }); - -const getNodeContext = async () => - esbuild.context({ - ...config, - outdir: "lib/cjs", - format: "cjs", - platform: "node", - }); - -const watch = async () => { - const browserContext = await getBrowserContext(); - const nodeContext = await getNodeContext(); - await browserContext.watch(); - await nodeContext.watch(); -}; - -watch().catch((e) => { - console.error(e); - process.exitCode = e.exitCode; -}); diff --git a/packages/signer/context-module/src/index.ts b/packages/signer/context-module/src/index.ts index bdce0f20b..afe6bf019 100644 --- a/packages/signer/context-module/src/index.ts +++ b/packages/signer/context-module/src/index.ts @@ -5,6 +5,7 @@ export * from "./DefaultContextModule"; export * from "./external-plugin/domain/ExternalPluginContextLoader"; export * from "./forward-domain/domain/ForwardDomainContextLoader"; export * from "./nft/domain/NftContextLoader"; +export * from "./shared/domain/ContextLoader"; export * from "./shared/model/ClearSignContext"; export * from "./shared/model/TransactionContext"; export * from "./shared/model/TransactionSubset"; diff --git a/packages/signer/context-module/tsconfig.json b/packages/signer/context-module/tsconfig.json index a593e8850..1b5ac89a2 100644 --- a/packages/signer/context-module/tsconfig.json +++ b/packages/signer/context-module/tsconfig.json @@ -13,5 +13,5 @@ }, "resolveJsonModule": true }, - "include": ["index.ts", "src", "scripts", "jest.*.ts", "eslint.config.mjs"] + "include": ["index.ts", "src", "jest.*.ts"] } diff --git a/packages/signer/keyring-btc/eslint.config.mjs b/packages/signer/keyring-btc/eslint.config.mjs index 833c97da3..efdcd9509 100644 --- a/packages/signer/keyring-btc/eslint.config.mjs +++ b/packages/signer/keyring-btc/eslint.config.mjs @@ -3,6 +3,7 @@ import config from "@ledgerhq/eslint-config-dsdk"; export default [ ...config, { + ignores: ["eslint.config.mjs"], languageOptions: { parserOptions: { project: "./tsconfig.json", diff --git a/packages/signer/keyring-btc/package.json b/packages/signer/keyring-btc/package.json index 7b86a4b04..96096e061 100644 --- a/packages/signer/keyring-btc/package.json +++ b/packages/signer/keyring-btc/package.json @@ -19,9 +19,10 @@ "./lib" ], "scripts": { - "build": "rimraf lib && zx scripts/esbuild.mjs", + "prebuild": "rimraf lib", + "build": "pnpm lmdk-build --entryPoints src/index.ts --tsconfig tsconfig.prod.json", "dev": "concurrently \"pnpm watch:builds\" \"pnpm watch:types\"", - "watch:builds": "zx scripts/watch.mjs", + "watch:builds": "pnpm lmdk-watch --entryPoints src/index.ts --tsconfig tsconfig.prod.json", "watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\"", "lint": "eslint", "lint:fix": "pnpm lint --fix", @@ -43,6 +44,7 @@ "xstate": "^5.18.2" }, "devDependencies": { + "@ledgerhq/esbuild-tools": "workspace:*", "@ledgerhq/device-management-kit": "workspace:*", "@ledgerhq/eslint-config-dsdk": "workspace:*", "@ledgerhq/jest-config-dsdk": "workspace:*", diff --git a/packages/signer/keyring-btc/scripts/esbuild.mjs b/packages/signer/keyring-btc/scripts/esbuild.mjs deleted file mode 100644 index 42361c2a3..000000000 --- a/packages/signer/keyring-btc/scripts/esbuild.mjs +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env zx - -import "zx/globals"; -import esbuild from "esbuild"; -import { nodeExternalsPlugin } from "esbuild-node-externals"; -import path from "node:path"; -const root = path.join(__dirname, ".."); -const tsconfig = path.join(root, "tsconfig.prod.json"); - -const config = { - entryPoints: ["src/index.ts"], - // minify: true, - bundle: true, - treeShaking: true, - sourcemap: true, - color: true, - // To analyze the bundle - // https://esbuild.github.io/api/#build-metadata - // metafile: true, -}; - -const buildBrowser = async () => - esbuild.build({ - ...config, - outdir: "lib/esm", - format: "esm", - platform: "browser", - }); - -const buildNode = async () => - esbuild.build({ - ...config, - outdir: "lib/cjs", - format: "cjs", - platform: "node", - plugins: [nodeExternalsPlugin()], - }); - -const buildTypes = async () => { - await $`tsc --project ${tsconfig} --incremental`; - await $`tsc-alias --project ${tsconfig}`; -}; - -const build = async () => - Promise.all([buildBrowser(), buildNode(), buildTypes()]); - -build().catch((e) => { - console.error(e); - process.exitCode = e.exitCode; -}); diff --git a/packages/signer/keyring-btc/scripts/watch.mjs b/packages/signer/keyring-btc/scripts/watch.mjs deleted file mode 100644 index 8aa069d08..000000000 --- a/packages/signer/keyring-btc/scripts/watch.mjs +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env zx - -import esbuild from "esbuild"; - -const config = { - entryPoints: ["src/index.ts"], - // minify: true, - bundle: true, - treeShaking: true, - sourcemap: true, - color: true, - // To analyze the bundle - // https://esbuild.github.io/api/#build-metadata - // metafile: true, -}; - -const getBrowserContext = async () => - esbuild.context({ - ...config, - outdir: "lib/esm", - format: "esm", - platform: "browser", - }); - -const getNodeContext = async () => - esbuild.context({ - ...config, - outdir: "lib/cjs", - format: "cjs", - platform: "node", - }); - -const watch = async () => { - const browserContext = await getBrowserContext(); - const nodeContext = await getNodeContext(); - await browserContext.watch(); - await nodeContext.watch(); -}; - -watch().catch((e) => { - console.error(e); - process.exitCode = e.exitCode; -}); diff --git a/packages/signer/keyring-btc/tsconfig.json b/packages/signer/keyring-btc/tsconfig.json index dfead4259..4bf329fc6 100644 --- a/packages/signer/keyring-btc/tsconfig.json +++ b/packages/signer/keyring-btc/tsconfig.json @@ -14,5 +14,5 @@ }, "resolveJsonModule": true }, - "include": ["src", "scripts", "jest.*.ts", "eslint.config.mjs"] + "include": ["src", "jest.*.ts"] } diff --git a/packages/signer/keyring-eth/eslint.config.mjs b/packages/signer/keyring-eth/eslint.config.mjs index 833c97da3..efdcd9509 100644 --- a/packages/signer/keyring-eth/eslint.config.mjs +++ b/packages/signer/keyring-eth/eslint.config.mjs @@ -3,6 +3,7 @@ import config from "@ledgerhq/eslint-config-dsdk"; export default [ ...config, { + ignores: ["eslint.config.mjs"], languageOptions: { parserOptions: { project: "./tsconfig.json", diff --git a/packages/signer/keyring-eth/package.json b/packages/signer/keyring-eth/package.json index 279a92176..e2f282d9a 100644 --- a/packages/signer/keyring-eth/package.json +++ b/packages/signer/keyring-eth/package.json @@ -17,9 +17,10 @@ "./lib" ], "scripts": { - "build": "rimraf lib && zx scripts/esbuild.mjs", + "prebuild": "rimraf lib", + "build": "pnpm lmdk-build --entryPoints src/index.ts --tsconfig tsconfig.prod.json", "dev": "concurrently \"pnpm watch:builds\" \"pnpm watch:types\"", - "watch:builds": "zx scripts/watch.mjs", + "watch:builds": "pnpm lmdk-watch --entryPoints src/index.ts --tsconfig tsconfig.prod.json", "watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\"", "lint": "eslint", "lint:fix": "pnpm lint --fix", @@ -40,6 +41,7 @@ "xstate": "^5.18.2" }, "devDependencies": { + "@ledgerhq/esbuild-tools": "workspace:*", "@ledgerhq/context-module": "workspace:*", "@ledgerhq/device-management-kit": "workspace:*", "@ledgerhq/eslint-config-dsdk": "workspace:*", diff --git a/packages/signer/keyring-eth/scripts/esbuild.mjs b/packages/signer/keyring-eth/scripts/esbuild.mjs deleted file mode 100644 index 42361c2a3..000000000 --- a/packages/signer/keyring-eth/scripts/esbuild.mjs +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env zx - -import "zx/globals"; -import esbuild from "esbuild"; -import { nodeExternalsPlugin } from "esbuild-node-externals"; -import path from "node:path"; -const root = path.join(__dirname, ".."); -const tsconfig = path.join(root, "tsconfig.prod.json"); - -const config = { - entryPoints: ["src/index.ts"], - // minify: true, - bundle: true, - treeShaking: true, - sourcemap: true, - color: true, - // To analyze the bundle - // https://esbuild.github.io/api/#build-metadata - // metafile: true, -}; - -const buildBrowser = async () => - esbuild.build({ - ...config, - outdir: "lib/esm", - format: "esm", - platform: "browser", - }); - -const buildNode = async () => - esbuild.build({ - ...config, - outdir: "lib/cjs", - format: "cjs", - platform: "node", - plugins: [nodeExternalsPlugin()], - }); - -const buildTypes = async () => { - await $`tsc --project ${tsconfig} --incremental`; - await $`tsc-alias --project ${tsconfig}`; -}; - -const build = async () => - Promise.all([buildBrowser(), buildNode(), buildTypes()]); - -build().catch((e) => { - console.error(e); - process.exitCode = e.exitCode; -}); diff --git a/packages/signer/keyring-eth/scripts/watch.mjs b/packages/signer/keyring-eth/scripts/watch.mjs deleted file mode 100644 index 8aa069d08..000000000 --- a/packages/signer/keyring-eth/scripts/watch.mjs +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env zx - -import esbuild from "esbuild"; - -const config = { - entryPoints: ["src/index.ts"], - // minify: true, - bundle: true, - treeShaking: true, - sourcemap: true, - color: true, - // To analyze the bundle - // https://esbuild.github.io/api/#build-metadata - // metafile: true, -}; - -const getBrowserContext = async () => - esbuild.context({ - ...config, - outdir: "lib/esm", - format: "esm", - platform: "browser", - }); - -const getNodeContext = async () => - esbuild.context({ - ...config, - outdir: "lib/cjs", - format: "cjs", - platform: "node", - }); - -const watch = async () => { - const browserContext = await getBrowserContext(); - const nodeContext = await getNodeContext(); - await browserContext.watch(); - await nodeContext.watch(); -}; - -watch().catch((e) => { - console.error(e); - process.exitCode = e.exitCode; -}); diff --git a/packages/signer/keyring-eth/src/api/KeyringEthBuilder.test.ts b/packages/signer/keyring-eth/src/api/KeyringEthBuilder.test.ts index be383aedf..0ee0e044c 100644 --- a/packages/signer/keyring-eth/src/api/KeyringEthBuilder.test.ts +++ b/packages/signer/keyring-eth/src/api/KeyringEthBuilder.test.ts @@ -1,5 +1,4 @@ -import { ContextModule } from "@ledgerhq/context-module"; -import { ContextLoader } from "@ledgerhq/context-module/src/shared/domain/ContextLoader.js"; +import { ContextLoader, ContextModule } from "@ledgerhq/context-module"; import { DeviceSdk } from "@ledgerhq/device-management-kit"; import { KeyringEthBuilder } from "@api/KeyringEthBuilder"; diff --git a/packages/signer/keyring-eth/tsconfig.json b/packages/signer/keyring-eth/tsconfig.json index 2e86ba226..dd2f89524 100644 --- a/packages/signer/keyring-eth/tsconfig.json +++ b/packages/signer/keyring-eth/tsconfig.json @@ -14,5 +14,5 @@ }, "resolveJsonModule": true }, - "include": ["src", "scripts", "jest.*.ts", "eslint.config.mjs"] + "include": ["src", "jest.*.ts"] } diff --git a/packages/tools/esbuild-tools/build.mjs b/packages/tools/esbuild-tools/build.mjs new file mode 100755 index 000000000..0e6248892 --- /dev/null +++ b/packages/tools/esbuild-tools/build.mjs @@ -0,0 +1,74 @@ +#!/usr/bin/env zx + +import "zx/globals"; +import esbuild from "esbuild"; +import { nodeExternalsPlugin } from "esbuild-node-externals"; + +const config = { + minify: false, + bundle: true, + treeShaking: true, + sourcemap: true, + color: true, + // To analyze the bundle + // https://esbuild.github.io/api/#build-metadata + // metafile: true, +}; + +const { entryPoints, tsconfig } = argv; + +if (!entryPoints) { + console.error(chalk.red("Entry points are required")); + process.exit(1); +} + +if (!tsconfig) { + console.error(chalk.red("TSConfig file is required")); + process.exit(1); +} +const entryPointsArray = entryPoints.includes(",") + ? entryPoints.split(",") + : [entryPoints]; + +const buildBrowser = async () => { + console.log(chalk.blue("Building browser bundle...")); + return esbuild.build({ + ...config, + entryPoints: entryPointsArray, + outdir: "lib/esm", + format: "esm", + platform: "browser", + }); +}; + +const buildNode = async () => { + console.log(chalk.blue("Building node bundle...")); + return esbuild.build({ + ...config, + entryPoints: entryPointsArray, + outdir: "lib/cjs", + format: "cjs", + platform: "node", + plugins: [nodeExternalsPlugin()], + }); +}; + +const buildTypes = async () => { + console.log(chalk.blue("Building types...")); + await $`tsc --project ${tsconfig} --incremental`; + await $`tsc-alias --project ${tsconfig}`; +}; + +const build = async () => + spinner(() => Promise.all([buildBrowser(), buildNode(), buildTypes()])); + +build() + .then(() => { + console.log(chalk.green("Build succeeded")); + process.exitCode = 0; + }) + .catch((e) => { + console.error(chalk.red("Build failed")); + console.error(e); + process.exitCode = e.exitCode; + }); diff --git a/packages/tools/esbuild-tools/package.json b/packages/tools/esbuild-tools/package.json new file mode 100644 index 000000000..5a1e93d9a --- /dev/null +++ b/packages/tools/esbuild-tools/package.json @@ -0,0 +1,20 @@ +{ + "name": "@ledgerhq/esbuild-tools", + "license": "MIT", + "version": "0.0.1", + "private": true, + "description": "Build and watch tools for Ledger Device Management Kit", + "bin": { + "lmdk-build": "./build.mjs", + "lmdk-watch": "./watch.mjs" + }, + "files": [ + "build.mjs", + "watch.mjs" + ], + "type": "module", + "devDependencies": { + "esbuild": "^0.24.0", + "esbuild-node-externals": "^1.14.0" + } +} diff --git a/packages/core/scripts/watch.mjs b/packages/tools/esbuild-tools/watch.mjs old mode 100644 new mode 100755 similarity index 51% rename from packages/core/scripts/watch.mjs rename to packages/tools/esbuild-tools/watch.mjs index da13eca65..3cf79de96 --- a/packages/core/scripts/watch.mjs +++ b/packages/tools/esbuild-tools/watch.mjs @@ -4,7 +4,7 @@ import esbuild from "esbuild"; const config = { entryPoints: ["index.ts"], - // minify: true, + minify: true, bundle: true, treeShaking: true, sourcemap: true, @@ -14,21 +14,42 @@ const config = { // metafile: true, }; -const getBrowserContext = async () => - esbuild.context({ +const { entryPoints, tsconfig } = argv; + +if (!entryPoints) { + console.error(chalk.red("Entry points are required")); + process.exit(1); +} + +if (!tsconfig) { + console.error(chalk.red("TSConfig file is required")); + process.exit(1); +} +const entryPointsArray = entryPoints.includes(",") + ? entryPoints.split(",") + : [entryPoints]; + +const getBrowserContext = async () => { + console.log(chalk.blue("Watching browser bundle...")); + return esbuild.context({ ...config, + entryPoints: entryPointsArray, outdir: "lib/esm", format: "esm", platform: "browser", }); +}; -const getNodeContext = async () => - esbuild.context({ +const getNodeContext = async () => { + console.log(chalk.blue("Watching node bundle...")); + return esbuild.context({ ...config, + entryPoints: entryPointsArray, outdir: "lib/cjs", format: "cjs", platform: "node", }); +}; const watch = async () => { const browserContext = await getBrowserContext(); diff --git a/packages/transport-mock/eslint.config.mjs b/packages/transport-mock/eslint.config.mjs index 1a471b422..4cccdf597 100644 --- a/packages/transport-mock/eslint.config.mjs +++ b/packages/transport-mock/eslint.config.mjs @@ -3,9 +3,10 @@ import config from "@ledgerhq/eslint-config-dsdk"; export default [ ...config, { + ignores: ["eslint.config.mjs", "scripts/*.mjs"], languageOptions: { parserOptions: { - project: "./tsconfig.eslint.json", + project: "./tsconfig.json", }, }, }, diff --git a/packages/transport-mock/package.json b/packages/transport-mock/package.json index bdf5cc949..6fadfe4ae 100644 --- a/packages/transport-mock/package.json +++ b/packages/transport-mock/package.json @@ -6,29 +6,23 @@ "types": "lib/index.d.ts", "exports": { ".": { + "types": "./lib/types/index.d.ts", "import": "./lib/esm/index.js", - "require": "./lib/cjs/index.js", - "default": "./index.ts", - "types": "./lib/esm/index.d.ts" - }, - "./*.js": { - "import": "./lib/esm/*.js", - "require": "./lib/cjs/*.js", - "default": "./*.js", - "types": "./lib/esm/*.d.ts" + "require": "./lib/cjs/index.js" }, "./*": { - "import": "./lib/esm/*", - "require": "./lib/cjs/*", - "default": "./*", - "types": "./lib/esm/*" + "types": "./lib/types/*" } }, + "files": [ + "./lib" + ], "scripts": { - "build": "zx scripts/build.mjs", - "dev": "concurrently \"pnpm dev:esm\" \"pnpm dev:cjs\"", - "dev:esm": "concurrently \"tsc --watch -p tsconfig.esm.json\" \"tsc-alias --watch -p tsconfig.esm.json\"", - "dev:cjs": "concurrently \"tsc --watch -p tsconfig.cjs.json\" \"tsc-alias --watch -p tsconfig.cjs.json\"", + "prebuild": "rimraf lib", + "build": "pnpm lmdk-build --entryPoints index.ts --tsconfig tsconfig.prod.json", + "dev": "concurrently \"pnpm watch:builds\" \"pnpm watch:types\"", + "watch:builds": "pnpm lmdk-watch --entryPoints index.ts --tsconfig tsconfig.prod.json", + "watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\"", "lint": "eslint", "lint:fix": "pnpm lint --fix", "prettier": "prettier . --check", @@ -39,6 +33,7 @@ }, "dependencies": {}, "devDependencies": { + "@ledgerhq/esbuild-tools": "workspace:*", "@ledgerhq/tsconfig-dsdk": "workspace:*", "@ledgerhq/eslint-config-dsdk": "workspace:*", "@ledgerhq/jest-config-dsdk": "workspace:*", diff --git a/packages/transport-mock/tsconfig.cjs.json b/packages/transport-mock/tsconfig.cjs.json deleted file mode 100644 index 3797ab02f..000000000 --- a/packages/transport-mock/tsconfig.cjs.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.json", - "exclude": ["src/**/*.test.ts", "jest.*.ts"], - "compilerOptions": { - "module": "nodenext", - "moduleResolution": "nodenext", - "outDir": "./lib/cjs", - "declarationDir": "./lib/cjs" - } -} diff --git a/packages/transport-mock/tsconfig.eslint.json b/packages/transport-mock/tsconfig.eslint.json deleted file mode 100644 index db99aa7a0..000000000 --- a/packages/transport-mock/tsconfig.eslint.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": ["src", "index.ts", "jest.*.ts", "scripts", "eslint.config.mjs"] -} diff --git a/packages/transport-mock/tsconfig.esm.json b/packages/transport-mock/tsconfig.esm.json deleted file mode 100644 index dd32a6fe4..000000000 --- a/packages/transport-mock/tsconfig.esm.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.json", - "exclude": ["src/**/*.test.ts", "jest.*.ts"], - "compilerOptions": { - "module": "esnext", - "outDir": "./lib/esm", - "declarationDir": "./lib/esm" - } -} diff --git a/packages/transport-mock/tsconfig.json b/packages/transport-mock/tsconfig.json index c3419f2c2..0d955afc3 100644 --- a/packages/transport-mock/tsconfig.json +++ b/packages/transport-mock/tsconfig.json @@ -1,9 +1,18 @@ { - "extends": "@ledgerhq/tsconfig-dsdk/sdk", + "extends": "@ledgerhq/tsconfig-dsdk/tsconfig.sdk", + "include": ["src", "index.ts", "jest.*.ts"], "compilerOptions": { "baseUrl": ".", - "experimentalDecorators": true, + "outDir": "./lib/types", + "module": "esnext", + "target": "esnext", + "moduleResolution": "bundler", + "emitDeclarationOnly": true, + "paths": { + "@api/*": ["src/api/*"], + "@internal/*": ["src/internal/*"], + "@root/*": ["./*"] + }, "resolveJsonModule": true - }, - "include": ["src", "index.ts", "jest.*.ts"] + } } diff --git a/packages/transport-mock/tsconfig.prod.json b/packages/transport-mock/tsconfig.prod.json new file mode 100644 index 000000000..0ca26e07b --- /dev/null +++ b/packages/transport-mock/tsconfig.prod.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.json", + "include": ["src", "index.ts"] +} diff --git a/packages/trusted-apps/eslint.config.mjs b/packages/trusted-apps/eslint.config.mjs index 833c97da3..efdcd9509 100644 --- a/packages/trusted-apps/eslint.config.mjs +++ b/packages/trusted-apps/eslint.config.mjs @@ -3,6 +3,7 @@ import config from "@ledgerhq/eslint-config-dsdk"; export default [ ...config, { + ignores: ["eslint.config.mjs"], languageOptions: { parserOptions: { project: "./tsconfig.json", diff --git a/packages/trusted-apps/package.json b/packages/trusted-apps/package.json index 08470715b..16e835c3b 100644 --- a/packages/trusted-apps/package.json +++ b/packages/trusted-apps/package.json @@ -17,9 +17,10 @@ "./lib" ], "scripts": { - "build": "rimraf lib && zx scripts/esbuild.mjs", + "prebuild": "rimraf lib", + "build": "pnpm lmdk-build --entryPoints src/index.ts --tsconfig tsconfig.prod.json", "dev": "concurrently \"pnpm watch:builds\" \"pnpm watch:types\"", - "watch:builds": "zx scripts/watch.mjs", + "watch:builds": "pnpm lmdk-watch --entryPoints src/index.ts --tsconfig tsconfig.prod.json", "watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\"", "lint": "eslint", "lint:fix": "pnpm lint --fix", @@ -35,6 +36,7 @@ "reflect-metadata": "^0.2.2" }, "devDependencies": { + "@ledgerhq/esbuild-tools": "workspace:*", "@ledgerhq/eslint-config-dsdk": "workspace:*", "@ledgerhq/jest-config-dsdk": "workspace:*", "@ledgerhq/prettier-config-dsdk": "workspace:*", diff --git a/packages/trusted-apps/scripts/esbuild.mjs b/packages/trusted-apps/scripts/esbuild.mjs deleted file mode 100644 index 42361c2a3..000000000 --- a/packages/trusted-apps/scripts/esbuild.mjs +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env zx - -import "zx/globals"; -import esbuild from "esbuild"; -import { nodeExternalsPlugin } from "esbuild-node-externals"; -import path from "node:path"; -const root = path.join(__dirname, ".."); -const tsconfig = path.join(root, "tsconfig.prod.json"); - -const config = { - entryPoints: ["src/index.ts"], - // minify: true, - bundle: true, - treeShaking: true, - sourcemap: true, - color: true, - // To analyze the bundle - // https://esbuild.github.io/api/#build-metadata - // metafile: true, -}; - -const buildBrowser = async () => - esbuild.build({ - ...config, - outdir: "lib/esm", - format: "esm", - platform: "browser", - }); - -const buildNode = async () => - esbuild.build({ - ...config, - outdir: "lib/cjs", - format: "cjs", - platform: "node", - plugins: [nodeExternalsPlugin()], - }); - -const buildTypes = async () => { - await $`tsc --project ${tsconfig} --incremental`; - await $`tsc-alias --project ${tsconfig}`; -}; - -const build = async () => - Promise.all([buildBrowser(), buildNode(), buildTypes()]); - -build().catch((e) => { - console.error(e); - process.exitCode = e.exitCode; -}); diff --git a/packages/trusted-apps/scripts/watch.mjs b/packages/trusted-apps/scripts/watch.mjs deleted file mode 100644 index 8aa069d08..000000000 --- a/packages/trusted-apps/scripts/watch.mjs +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env zx - -import esbuild from "esbuild"; - -const config = { - entryPoints: ["src/index.ts"], - // minify: true, - bundle: true, - treeShaking: true, - sourcemap: true, - color: true, - // To analyze the bundle - // https://esbuild.github.io/api/#build-metadata - // metafile: true, -}; - -const getBrowserContext = async () => - esbuild.context({ - ...config, - outdir: "lib/esm", - format: "esm", - platform: "browser", - }); - -const getNodeContext = async () => - esbuild.context({ - ...config, - outdir: "lib/cjs", - format: "cjs", - platform: "node", - }); - -const watch = async () => { - const browserContext = await getBrowserContext(); - const nodeContext = await getNodeContext(); - await browserContext.watch(); - await nodeContext.watch(); -}; - -watch().catch((e) => { - console.error(e); - process.exitCode = e.exitCode; -}); diff --git a/packages/trusted-apps/tsconfig.json b/packages/trusted-apps/tsconfig.json index bc0aee7ff..8b6f7906b 100644 --- a/packages/trusted-apps/tsconfig.json +++ b/packages/trusted-apps/tsconfig.json @@ -9,5 +9,5 @@ "emitDeclarationOnly": true, "resolveJsonModule": true }, - "include": ["src", "scripts", "jest.*.ts", "eslint.config.mjs"] + "include": ["src", "jest.*.ts"] } diff --git a/packages/ui/eslint.config.mjs b/packages/ui/eslint.config.mjs index 833c97da3..efdcd9509 100644 --- a/packages/ui/eslint.config.mjs +++ b/packages/ui/eslint.config.mjs @@ -3,6 +3,7 @@ import config from "@ledgerhq/eslint-config-dsdk"; export default [ ...config, { + ignores: ["eslint.config.mjs"], languageOptions: { parserOptions: { project: "./tsconfig.json", diff --git a/packages/ui/package.json b/packages/ui/package.json index dc13f8028..2375cb531 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -17,9 +17,10 @@ "./lib" ], "scripts": { - "build": "rimraf lib && zx scripts/esbuild.mjs", + "prebuild": "rimraf lib", + "build": "pnpm lmdk-build --entryPoints src/index.ts --tsconfig tsconfig.prod.json", "dev": "concurrently \"pnpm watch:builds\" \"pnpm watch:types\"", - "watch:builds": "zx scripts/watch.mjs", + "watch:builds": "pnpm lmdk-watch --entryPoints src/index.ts --tsconfig tsconfig.prod.json", "watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\"", "lint": "eslint", "lint:fix": "pnpm lint --fix", @@ -35,6 +36,7 @@ "reflect-metadata": "^0.2.2" }, "devDependencies": { + "@ledgerhq/esbuild-tools": "workspace:*", "@ledgerhq/eslint-config-dsdk": "workspace:*", "@ledgerhq/jest-config-dsdk": "workspace:*", "@ledgerhq/prettier-config-dsdk": "workspace:*", diff --git a/packages/ui/scripts/esbuild.mjs b/packages/ui/scripts/esbuild.mjs deleted file mode 100644 index 42361c2a3..000000000 --- a/packages/ui/scripts/esbuild.mjs +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env zx - -import "zx/globals"; -import esbuild from "esbuild"; -import { nodeExternalsPlugin } from "esbuild-node-externals"; -import path from "node:path"; -const root = path.join(__dirname, ".."); -const tsconfig = path.join(root, "tsconfig.prod.json"); - -const config = { - entryPoints: ["src/index.ts"], - // minify: true, - bundle: true, - treeShaking: true, - sourcemap: true, - color: true, - // To analyze the bundle - // https://esbuild.github.io/api/#build-metadata - // metafile: true, -}; - -const buildBrowser = async () => - esbuild.build({ - ...config, - outdir: "lib/esm", - format: "esm", - platform: "browser", - }); - -const buildNode = async () => - esbuild.build({ - ...config, - outdir: "lib/cjs", - format: "cjs", - platform: "node", - plugins: [nodeExternalsPlugin()], - }); - -const buildTypes = async () => { - await $`tsc --project ${tsconfig} --incremental`; - await $`tsc-alias --project ${tsconfig}`; -}; - -const build = async () => - Promise.all([buildBrowser(), buildNode(), buildTypes()]); - -build().catch((e) => { - console.error(e); - process.exitCode = e.exitCode; -}); diff --git a/packages/ui/scripts/watch.mjs b/packages/ui/scripts/watch.mjs deleted file mode 100644 index 8aa069d08..000000000 --- a/packages/ui/scripts/watch.mjs +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env zx - -import esbuild from "esbuild"; - -const config = { - entryPoints: ["src/index.ts"], - // minify: true, - bundle: true, - treeShaking: true, - sourcemap: true, - color: true, - // To analyze the bundle - // https://esbuild.github.io/api/#build-metadata - // metafile: true, -}; - -const getBrowserContext = async () => - esbuild.context({ - ...config, - outdir: "lib/esm", - format: "esm", - platform: "browser", - }); - -const getNodeContext = async () => - esbuild.context({ - ...config, - outdir: "lib/cjs", - format: "cjs", - platform: "node", - }); - -const watch = async () => { - const browserContext = await getBrowserContext(); - const nodeContext = await getNodeContext(); - await browserContext.watch(); - await nodeContext.watch(); -}; - -watch().catch((e) => { - console.error(e); - process.exitCode = e.exitCode; -}); diff --git a/packages/ui/tsconfig.json b/packages/ui/tsconfig.json index bc0aee7ff..8b6f7906b 100644 --- a/packages/ui/tsconfig.json +++ b/packages/ui/tsconfig.json @@ -9,5 +9,5 @@ "emitDeclarationOnly": true, "resolveJsonModule": true }, - "include": ["src", "scripts", "jest.*.ts", "eslint.config.mjs"] + "include": ["src", "jest.*.ts"] } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 08ce56281..8c0987e06 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -144,6 +144,9 @@ importers: '@eslint/compat': specifier: ^1.2.0 version: 1.2.0(eslint@9.12.0) + '@eslint/core': + specifier: ^0.6.0 + version: 0.6.0 '@eslint/js': specifier: 9.12.0 version: 9.12.0 @@ -232,6 +235,9 @@ importers: specifier: ^5.18.2 version: 5.18.2 devDependencies: + '@ledgerhq/esbuild-tools': + specifier: workspace:* + version: link:../tools/esbuild-tools '@ledgerhq/eslint-config-dsdk': specifier: workspace:* version: link:../config/eslint @@ -281,6 +287,9 @@ importers: '@ledgerhq/device-management-kit': specifier: workspace:* version: link:../../core + '@ledgerhq/esbuild-tools': + specifier: workspace:* + version: link:../../tools/esbuild-tools '@ledgerhq/eslint-config-dsdk': specifier: workspace:* version: link:../../config/eslint @@ -330,6 +339,9 @@ importers: '@ledgerhq/device-management-kit': specifier: workspace:* version: link:../../core + '@ledgerhq/esbuild-tools': + specifier: workspace:* + version: link:../../tools/esbuild-tools '@ledgerhq/eslint-config-dsdk': specifier: workspace:* version: link:../../config/eslint @@ -376,6 +388,9 @@ importers: '@ledgerhq/device-management-kit': specifier: workspace:* version: link:../../core + '@ledgerhq/esbuild-tools': + specifier: workspace:* + version: link:../../tools/esbuild-tools '@ledgerhq/eslint-config-dsdk': specifier: workspace:* version: link:../../config/eslint @@ -395,8 +410,20 @@ importers: specifier: ^10.9.2 version: 10.9.2(@types/node@22.7.5)(typescript@5.6.3) + packages/tools/esbuild-tools: + devDependencies: + esbuild: + specifier: ^0.24.0 + version: 0.24.0 + esbuild-node-externals: + specifier: ^1.14.0 + version: 1.15.0(esbuild@0.24.0) + packages/transport-mock: devDependencies: + '@ledgerhq/esbuild-tools': + specifier: workspace:* + version: link:../tools/esbuild-tools '@ledgerhq/eslint-config-dsdk': specifier: workspace:* version: link:../config/eslint @@ -419,6 +446,9 @@ importers: specifier: ^0.2.2 version: 0.2.2 devDependencies: + '@ledgerhq/esbuild-tools': + specifier: workspace:* + version: link:../tools/esbuild-tools '@ledgerhq/eslint-config-dsdk': specifier: workspace:* version: link:../config/eslint @@ -441,6 +471,9 @@ importers: specifier: ^0.2.2 version: 0.2.2 devDependencies: + '@ledgerhq/esbuild-tools': + specifier: workspace:* + version: link:../tools/esbuild-tools '@ledgerhq/eslint-config-dsdk': specifier: workspace:* version: link:../config/eslint diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 12d98294f..0d95524f0 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -3,3 +3,4 @@ packages: - "packages/*" - "packages/config/*" - "packages/signer/*" + - "packages/tools/*" diff --git a/turbo.json b/turbo.json index 645ae2ad0..21d7731e7 100644 --- a/turbo.json +++ b/turbo.json @@ -3,77 +3,41 @@ "ui": "tui", "tasks": { "build": { - "dependsOn": [ - "^build" - ], - "outputs": [ - "lib/**", - ".next/**" - ], - "inputs": [ - "src/**/*.ts", - "index.ts" - ] + "dependsOn": ["^build"], + "outputs": ["lib/**", ".next/**"], + "inputs": ["src/**/*.ts", "index.ts"] }, "lint": { - "dependsOn": [ - "^build" - ] + "dependsOn": ["^build"] }, "lint:fix": { - "dependsOn": [ - "^build" - ] + "dependsOn": ["^build"] }, "prettier": { - "dependsOn": [ - "^prettier" - ] + "dependsOn": ["^prettier"] }, "prettier:fix": { - "dependsOn": [ - "^prettier:fix" - ] + "dependsOn": ["^prettier:fix"] }, "dev": { "cache": false, "persistent": true }, "test": { - "dependsOn": [ - "^build" - ], - "outputs": [ - "coverage/**" - ], - "inputs": [ - "src/**/*.ts", - "tests/**/*.ts" - ] + "dependsOn": ["^build"], + "outputs": ["coverage/**"], + "inputs": ["src/**/*.ts", "tests/**/*.ts"] }, "test:coverage": { - "dependsOn": [ - "^build" - ], + "dependsOn": ["^build"], "outputs": [], - "inputs": [ - "src/**/*.ts", - "tests/**/*.ts" - ] + "inputs": ["src/**/*.ts", "tests/**/*.ts"] }, "typecheck": { - "dependsOn": [ - "^build", - "^typecheck" - ] + "dependsOn": ["^build", "^typecheck"] }, "health-check": { - "dependsOn": [ - "build", - "prettier", - "lint", - "typecheck" - ] + "dependsOn": ["build", "prettier", "lint", "typecheck"] } } }