Skip to content

Commit

Permalink
👷 (repo) [NO-ISSUE]: Use esbuild to produce builds (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
valpinkman authored Oct 14, 2024
2 parents b43bf86 + 2c6288b commit 446af98
Show file tree
Hide file tree
Showing 84 changed files with 752 additions and 588 deletions.
10 changes: 10 additions & 0 deletions .changeset/eleven-spies-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@ledgerhq/context-module": patch
"@ledgerhq/keyring-btc": patch
"@ledgerhq/keyring-eth": patch
"@ledgerhq/device-sdk-trusted-apps": patch
"@ledgerhq/device-sdk-core": patch
"@ledgerhq/device-sdk-ui": patch
---

Use esbuild to build libraries
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,16 @@ This project uses [turbo monorepo](https://turbo.build/repo/docs) to build and r

A brief description of this project packages:

| Name | Path | Description |
| --------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| @ledgerhq/device-sdk-sample | apps/sample | React Next web app used to test & demonstrate the Web Device Management Kit |
| @ledgerhq/eslint-config-dsdk | packages/config/eslint | internal package which contains eslint shared config. Used by `extends: ["@ledgerhq/dsdk"]` in `.eslintrc`. |
| @ledgerhq/jest-config-dsdk | packages/config/jest | internal package which contains jest shared config. Used by `preset: "@ledgerhq/jest-config-dsdk"` in `jest.config.ts` |
| @ledgerhq/tsconfig-dsdk | packages/config/typescript | internal package which contains typescript shared config. Used by `"extends": "@ledgerhq/tsconfig-dsdk/sdk"` in `tsconfig.json` |
| @ledgerhq/device-management-kit | packages/core | external package that contains the core of the Web SDK |
| @ledgerhq/device-sdk-signer | packages/signer | external package that contains device coin application dedicated handlers |
| @ledgerhq/device-sdk-trusted-apps | packages/trusted-apps | external package that contains device trusted application dedicated handlers |
| @ledgerhq/device-sdk-ui | packages/ui | external package |
| Name | Path | Description |
| --------------------------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| @ledgerhq/device-sdk-sample | apps/sample | React Next web app used to test & demonstrate the Web Device Management Kit |
| @ledgerhq/eslint-config-dsdk | packages/config/eslint | internal package which contains eslint shared config. Used by `extends: ["@ledgerhq/dsdk"]` in `.eslintrc`. |
| @ledgerhq/jest-config-dsdk | packages/config/jest | internal package which contains jest shared config. Used by `preset: "@ledgerhq/jest-config-dsdk"` in `jest.config.ts` |
| @ledgerhq/tsconfig-dsdk | packages/config/typescript | internal package which contains typescript shared config. Used by `"extends": "@ledgerhq/tsconfig-dsdk/tsconfig.sdk"` in `tsconfig.json` |
| @ledgerhq/device-management-kit | packages/core | external package that contains the core of the Web SDK |
| @ledgerhq/device-sdk-signer | packages/signer | external package that contains device coin application dedicated handlers |
| @ledgerhq/device-sdk-trusted-apps | packages/trusted-apps | external package that contains device trusted application dedicated handlers |
| @ledgerhq/device-sdk-ui | packages/ui | external package |

# Getting started

Expand Down
2 changes: 1 addition & 1 deletion apps/sample/src/components/CommandsView/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useMemo } from "react";
import {
BatteryStatusType,
CloseAppCommand,
GetAppAndVersionCommand,
GetAppAndVersionResponse,
Expand All @@ -16,7 +17,6 @@ import {
OpenAppCommand,
OpenAppErrorCodes,
} from "@ledgerhq/device-management-kit";
import { BatteryStatusType } from "@ledgerhq/device-management-kit/src/api/command/os/GetBatteryStatusCommand.js";
import { Grid } from "@ledgerhq/react-ui";

import { PageWithHeader } from "@/components/PageWithHeader";
Expand Down
4 changes: 2 additions & 2 deletions apps/sample/tsconfig.eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
"eslint.config.mjs",
"next.config.js",
"postcss.config.js"
"postcss.config.js",
"eslint.config.mjs"
]
}
9 changes: 7 additions & 2 deletions apps/sample/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@ledgerhq/tsconfig-dsdk/web",
"extends": "@ledgerhq/tsconfig-dsdk/tsconfig.web",
"compilerOptions": {
"plugins": [
{
Expand All @@ -11,6 +11,11 @@
},
"strictNullChecks": true
},
"include": ["**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"include": [
"**/*.ts",
"**/*.tsx",
"eslint.config.mjs",
".next/types/**/*.ts"
],
"exclude": ["node_modules"]
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
"@types/node": "^22.7.5",
"concurrently": "^9.0.1",
"danger": "^12.3.3",
"esbuild": "^0.24.0",
"esbuild-node-externals": "^1.14.0",
"eslint": "9.12.0",
"gitmoji-cli": "^9.4.0",
"hygen": "^6.2.11",
Expand Down
3 changes: 1 addition & 2 deletions packages/config/eslint/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-check

import globals from "globals";
import js from "@eslint/js";
import tseslint from "typescript-eslint";
Expand All @@ -13,6 +11,7 @@ export default [
{
ignores: [
".*.js",
".*.mjs",
"coverage/*",
"_templates/*",
"lib/*",
Expand Down
2 changes: 2 additions & 0 deletions packages/config/eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"devDependencies": {
"@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",
Expand Down
4 changes: 2 additions & 2 deletions packages/config/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "1.0.0",
"private": true,
"files": [
"sdk.json",
"web.json"
"tsconfig.sdk.json",
"tsconfig.web.json"
],
"devDependencies": {
"@tsconfig/recommended": "^1.0.7",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
{
"extends": "@tsconfig/recommended/tsconfig.json",
"compilerOptions": {
"target": "esnext",
"lib": ["esnext", "dom"],
"sourceMap": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"checkJs": false,
"declaration": true,
"declarationMap": true,
"skipLibCheck": false,
"strict": true,
"allowUnusedLabels": false,
"allowUnreachableCode": false,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"lib": ["esnext", "dom", "dom.iterable"],
"module": "esnext",
"moduleResolution": "bundler",
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"isolatedModules": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"experimentalDecorators": true,
"skipLibCheck": false,
"sourceMap": true,
"strict": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"moduleResolution": "bundler",
"module": "esnext"
"target": "esnext"
},
"exclude": ["node_modules"]
}
File renamed without changes.
3 changes: 2 additions & 1 deletion packages/core/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
},
Expand Down
26 changes: 9 additions & 17 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,23 @@
"license": "MIT",
"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": "rimraf lib && 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",
"postpack": "find . -name '*.tgz' -exec cp {} ../../dist/ \\; ",
Expand All @@ -56,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:*",
Expand Down
23 changes: 0 additions & 23 deletions packages/core/scripts/build.mjs

This file was deleted.

3 changes: 2 additions & 1 deletion packages/core/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export {
type GetAppAndVersionResponse,
} from "./command/os/GetAppAndVersionCommand";
export {
BatteryStatusType,
type GetBatteryStatusArgs,
GetBatteryStatusCommand,
type GetBatteryStatusResponse,
Expand Down Expand Up @@ -49,7 +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";
export * from "@api/apdu/utils/AppBuilderError";
export { InvalidStatusWordError } from "@api/command/Errors";
export {
type DeviceAction,
Expand Down
16 changes: 0 additions & 16 deletions packages/core/tsconfig.cjs.json

This file was deleted.

4 changes: 0 additions & 4 deletions packages/core/tsconfig.eslint.json

This file was deleted.

15 changes: 0 additions & 15 deletions packages/core/tsconfig.esm.json

This file was deleted.

12 changes: 8 additions & 4 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
{
"extends": "@ledgerhq/tsconfig-dsdk/sdk",
"extends": "@ledgerhq/tsconfig-dsdk/tsconfig.sdk",
"include": ["src", "index.ts", "jest.*.ts"],
"compilerOptions": {
"baseUrl": ".",
"outDir": "./lib/types",
"module": "esnext",
"target": "esnext",
"moduleResolution": "bundler",
"emitDeclarationOnly": true,
"paths": {
"@api/*": ["src/api/*"],
"@internal/*": ["src/internal/*"],
"@root/*": ["./*"]
},
"experimentalDecorators": true,
"resolveJsonModule": true
},
"include": ["src", "index.ts", "jest.*.ts"]
}
}
4 changes: 4 additions & 0 deletions packages/core/tsconfig.prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"include": ["src", "index.ts"]
}
3 changes: 2 additions & 1 deletion packages/signer/context-module/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
},
Expand Down
Loading

0 comments on commit 446af98

Please sign in to comment.