mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-02-28 20:45:01 +01:00
chore: TS project references for build:libs + buildless utxo-lib (#11526)
* chore(repo): buildless utxo-lib * chore: use project references for build:libs too * chore: reformat tsconfig.lib.json
This commit is contained in:
@@ -74,7 +74,7 @@
|
||||
"refs": "yarn update-project-references",
|
||||
"types": "yarn type-check",
|
||||
"messages": "yarn message-system-sign-config",
|
||||
"validate": "yarn verify-project-references && yarn nx:lint:js && yarn nx:lint:styles && yarn nx:build:libs && yarn nx:type-check && yarn nx:test-unit && yarn check-workspace-resolutions",
|
||||
"validate": "yarn verify-project-references && yarn lint:js && yarn nx:lint:styles && yarn nx:build:libs && yarn nx:type-check && yarn nx:test-unit && yarn check-workspace-resolutions",
|
||||
"a": "yarn native:android",
|
||||
"ios": "yarn native:ios",
|
||||
"p": "yarn native:prebuild",
|
||||
@@ -143,6 +143,7 @@
|
||||
"tar": "^6.2.0",
|
||||
"ts-node": "^10.9.2",
|
||||
"tsconfig-paths": "^4.2.0",
|
||||
"tslib": "^2.6.2",
|
||||
"tsx": "^4.7.0",
|
||||
"typescript": "5.3.3",
|
||||
"version-bump-prompt": "^6.1.0"
|
||||
|
||||
@@ -2,8 +2,15 @@
|
||||
"extends": "../../tsconfig.lib.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./lib",
|
||||
"importHelpers": true,
|
||||
"esModuleInterop": false
|
||||
},
|
||||
"include": ["./src"]
|
||||
"include": ["./src"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../env-utils"
|
||||
},
|
||||
{
|
||||
"path": "../utils"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
|
||||
"type-check": "yarn g:tsc --build",
|
||||
"dev": "yarn g:tsx watch ./src/index.ts",
|
||||
"build": "rimraf ./lib && yarn g:tsc --build tsconfig.lib.json && ../../scripts/replace-imports.sh ./lib",
|
||||
"build": "yarn g:rimraf ./lib && yarn g:tsc --build tsconfig.lib.json && ../../scripts/replace-imports.sh ./lib",
|
||||
"start": "node ./lib/index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -18,5 +18,8 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/cors": "^2.8.17"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"tslib": "^2.6.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
"compilerOptions": {
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": ["./src"]
|
||||
"include": ["./src"],
|
||||
"references": []
|
||||
}
|
||||
|
||||
@@ -27,5 +27,8 @@
|
||||
"devDependencies": {
|
||||
"ripple-lib": "^1.10.1",
|
||||
"tsx": "^4.7.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"tslib": "^2.6.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,5 +3,13 @@
|
||||
"compilerOptions": {
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": ["./src"]
|
||||
"include": ["./src"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../type-utils"
|
||||
},
|
||||
{
|
||||
"path": "../utxo-lib"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,8 +1,18 @@
|
||||
{
|
||||
"extends": "../../tsconfig.lib.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"importHelpers": true
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": ["./src"]
|
||||
"include": ["./src"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../utils"
|
||||
},
|
||||
{
|
||||
"path": "../blockchain-link-types"
|
||||
},
|
||||
{
|
||||
"path": "../type-utils"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -3,8 +3,27 @@
|
||||
"compilerOptions": {
|
||||
"outDir": "./lib",
|
||||
"lib": ["webworker"],
|
||||
"types": ["jest", "node", "web"],
|
||||
"importHelpers": true
|
||||
"types": ["jest", "node", "web"]
|
||||
},
|
||||
"include": ["./src"]
|
||||
"include": ["./src"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../blockchain-link-types"
|
||||
},
|
||||
{
|
||||
"path": "../blockchain-link-utils"
|
||||
},
|
||||
{
|
||||
"path": "../utils"
|
||||
},
|
||||
{
|
||||
"path": "../utxo-lib"
|
||||
},
|
||||
{
|
||||
"path": "../e2e-utils"
|
||||
},
|
||||
{
|
||||
"path": "../type-utils"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -2,8 +2,12 @@
|
||||
"extends": "../../tsconfig.lib.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./lib",
|
||||
"importHelpers": true,
|
||||
"esModuleInterop": false
|
||||
},
|
||||
"include": ["./src"]
|
||||
"include": ["./src"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../analytics"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -2,8 +2,15 @@
|
||||
"extends": "../../tsconfig.lib.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./lib",
|
||||
"importHelpers": true,
|
||||
"esModuleInterop": false
|
||||
},
|
||||
"include": ["./src"]
|
||||
"include": ["./src"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../env-utils"
|
||||
},
|
||||
{
|
||||
"path": "../utils"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
"extends": "../../tsconfig.lib.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"importHelpers": true,
|
||||
"lib": ["ES2019"]
|
||||
},
|
||||
"include": ["./src"]
|
||||
"include": ["./src"],
|
||||
"references": []
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.lib.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"importHelpers": true
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": ["./src"]
|
||||
"include": ["./src"],
|
||||
"references": []
|
||||
}
|
||||
|
||||
@@ -3,8 +3,18 @@
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"target": "es2017",
|
||||
"types": ["chrome", "w3c-web-usb"],
|
||||
"importHelpers": true
|
||||
"types": ["chrome", "w3c-web-usb"]
|
||||
},
|
||||
"include": ["./src"]
|
||||
"include": ["./src"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../connect"
|
||||
},
|
||||
{
|
||||
"path": "../connect-common"
|
||||
},
|
||||
{
|
||||
"path": "../utils"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -3,8 +3,27 @@
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"target": "es2017",
|
||||
"types": ["chrome", "w3c-web-usb"],
|
||||
"importHelpers": true
|
||||
"types": ["chrome", "w3c-web-usb"]
|
||||
},
|
||||
"include": ["./src"]
|
||||
"include": ["./src"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../connect"
|
||||
},
|
||||
{
|
||||
"path": "../connect-common"
|
||||
},
|
||||
{
|
||||
"path": "../connect-web"
|
||||
},
|
||||
{
|
||||
"path": "../utils"
|
||||
},
|
||||
{
|
||||
"path": "../node-utils"
|
||||
},
|
||||
{
|
||||
"path": "../trezor-user-env-link"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -3,10 +3,42 @@
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"target": "es2019",
|
||||
"lib": ["es2019", "webworker"],
|
||||
// note: do not remove tslib from package.json. It might seem that it is not used
|
||||
// but it is required due to importHelpers: true
|
||||
"importHelpers": true
|
||||
"lib": ["es2019", "webworker"]
|
||||
},
|
||||
"include": ["./src"]
|
||||
"include": ["./src"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../blockchain-link"
|
||||
},
|
||||
{
|
||||
"path": "../blockchain-link-types"
|
||||
},
|
||||
{
|
||||
"path": "../connect-analytics"
|
||||
},
|
||||
{
|
||||
"path": "../connect-common"
|
||||
},
|
||||
{
|
||||
"path": "../protobuf"
|
||||
},
|
||||
{
|
||||
"path": "../protocol"
|
||||
},
|
||||
{
|
||||
"path": "../schema-utils"
|
||||
},
|
||||
{
|
||||
"path": "../transport"
|
||||
},
|
||||
{
|
||||
"path": "../utils"
|
||||
},
|
||||
{
|
||||
"path": "../utxo-lib"
|
||||
},
|
||||
{
|
||||
"path": "../trezor-user-env-link"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.lib.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"importHelpers": true
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": ["./src"]
|
||||
"include": ["./src"],
|
||||
"references": []
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
{
|
||||
"extends": "../../tsconfig.lib.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"importHelpers": true
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": ["./src"]
|
||||
"include": ["./src"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../schema-utils"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.lib.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"importHelpers": true
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": ["./src"]
|
||||
"include": ["./src"],
|
||||
"references": []
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"test:unit": "yarn g:jest",
|
||||
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
|
||||
"type-check": "yarn g:tsc --build",
|
||||
"build:lib": "rimraf ./lib && yarn g:tsc --build tsconfig.lib.json && ../../scripts/replace-imports.sh ./lib",
|
||||
"build:lib": "yarn g:rimraf ./lib && yarn g:tsc --build tsconfig.lib.json && ../../scripts/replace-imports.sh ./lib",
|
||||
"codegen": "ts-node --skip-project ./src/codegen.ts",
|
||||
"prepublishOnly": "yarn tsx ../../scripts/prepublishNPM.js",
|
||||
"prepublish": "yarn tsx ../../scripts/prepublish.js"
|
||||
@@ -28,5 +28,8 @@
|
||||
"dependencies": {
|
||||
"@sinclair/typebox": "^0.31.28",
|
||||
"ts-mixer": "^6.0.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"tslib": "^2.6.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.lib.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"importHelpers": true
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": ["./src"]
|
||||
"include": ["./src"],
|
||||
"references": []
|
||||
}
|
||||
|
||||
@@ -2,8 +2,21 @@
|
||||
"extends": "../../tsconfig.lib.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./lib",
|
||||
"types": ["w3c-web-usb"],
|
||||
"importHelpers": true
|
||||
"types": ["w3c-web-usb"]
|
||||
},
|
||||
"include": ["./src"]
|
||||
"include": ["./src"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../protobuf"
|
||||
},
|
||||
{
|
||||
"path": "../protocol"
|
||||
},
|
||||
{
|
||||
"path": "../utils"
|
||||
},
|
||||
{
|
||||
"path": "../trezor-user-env-link"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.lib.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"importHelpers": true
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": ["./src"]
|
||||
"include": ["./src"],
|
||||
"references": []
|
||||
}
|
||||
|
||||
@@ -20,13 +20,16 @@
|
||||
"utxo",
|
||||
"javascript"
|
||||
],
|
||||
"main": "./lib/index.js",
|
||||
"main": "./src/index.ts",
|
||||
"files": [
|
||||
"lib/",
|
||||
"!**/*.map"
|
||||
],
|
||||
"types": "lib/index.d.ts",
|
||||
"typings": "lib/index.d.ts",
|
||||
"publishConfig": {
|
||||
"main": "./lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"typings": "lib/index.d.ts"
|
||||
},
|
||||
"scripts": {
|
||||
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
|
||||
"test:unit": "yarn g:jest --verbose -c jest.config.js",
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
{
|
||||
"extends": "../../tsconfig.lib.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./lib",
|
||||
"importHelpers": true
|
||||
"outDir": "./lib"
|
||||
},
|
||||
"include": ["./src"]
|
||||
"include": ["./src"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../utils"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -28,9 +28,12 @@ const rootTsConfigLocation = path.join(__dirname, '..', 'tsconfig.json');
|
||||
|
||||
const prettierConfig = await getPrettierConfig();
|
||||
|
||||
const serializeConfig = (config: any) => {
|
||||
const serializeConfig = (config: any, stringifySpaces?: number) => {
|
||||
try {
|
||||
return prettier.format(JSON.stringify(config).replace(/\\\\/g, '/'), prettierConfig);
|
||||
return prettier.format(
|
||||
JSON.stringify(config, null, stringifySpaces).replace(/\\\\/g, '/'),
|
||||
prettierConfig,
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
@@ -119,6 +122,33 @@ const rootTsConfigLocation = path.join(__dirname, '..', 'tsconfig.json');
|
||||
if (!readOnlyGlobs.some((path: string) => minimatch(workspace.location, path))) {
|
||||
fs.writeFileSync(workspaceConfigPath, await serializeConfig(workspaceConfig));
|
||||
}
|
||||
|
||||
// Copy references also to tsconfig.lib.json if exists
|
||||
const workspaceLibConfigPath = path.resolve(workspacePath, 'tsconfig.lib.json');
|
||||
if (fs.existsSync(workspaceLibConfigPath)) {
|
||||
try {
|
||||
const workspaceLibConfig = JSON.parse(
|
||||
fs.readFileSync(workspaceLibConfigPath).toString(),
|
||||
);
|
||||
|
||||
workspaceLibConfig.references = nextWorkspaceReferences;
|
||||
|
||||
if (
|
||||
!readOnlyGlobs.some((path: string) => minimatch(workspace.location, path))
|
||||
) {
|
||||
fs.writeFileSync(
|
||||
workspaceLibConfigPath,
|
||||
await serializeConfig(workspaceLibConfig, 2),
|
||||
);
|
||||
}
|
||||
} catch {
|
||||
console.error(
|
||||
chalk.bold.red('Error while parsing file: '),
|
||||
workspaceLibConfigPath,
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (isTesting) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"target": "es6",
|
||||
"importHelpers": true,
|
||||
|
||||
"composite": false,
|
||||
"incremental": false,
|
||||
|
||||
@@ -9568,6 +9568,8 @@ __metadata:
|
||||
"@types/cors": "npm:^2.8.17"
|
||||
cors: "npm:^2.8.5"
|
||||
express: "npm:^4.18.2"
|
||||
peerDependencies:
|
||||
tslib: ^2.6.2
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
@@ -9581,6 +9583,8 @@ __metadata:
|
||||
ripple-lib: "npm:^1.10.1"
|
||||
socks-proxy-agent: "npm:6.1.1"
|
||||
tsx: "npm:^4.7.0"
|
||||
peerDependencies:
|
||||
tslib: ^2.6.2
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
@@ -10114,6 +10118,8 @@ __metadata:
|
||||
ts-mixer: "npm:^6.0.3"
|
||||
ts-node: "npm:^10.9.2"
|
||||
tsx: "npm:^4.7.0"
|
||||
peerDependencies:
|
||||
tslib: ^2.6.2
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
@@ -33249,6 +33255,7 @@ __metadata:
|
||||
tar: "npm:^6.2.0"
|
||||
ts-node: "npm:^10.9.2"
|
||||
tsconfig-paths: "npm:^4.2.0"
|
||||
tslib: "npm:^2.6.2"
|
||||
tsx: "npm:^4.7.0"
|
||||
typescript: "npm:5.3.3"
|
||||
version-bump-prompt: "npm:^6.1.0"
|
||||
|
||||
Reference in New Issue
Block a user