diff options
author | Kristóf Marussy <kristof@marussy.com> | 2021-12-31 02:26:51 +0100 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2021-12-31 02:26:51 +0100 |
commit | 91b0ebbed2c20b8659dbae6f3ff4924940983a09 (patch) | |
tree | a6136d87619c7fb84f3850c97433d1602c625981 | |
parent | test: Add tests for main package (diff) | |
download | sophie-91b0ebbed2c20b8659dbae6f3ff4924940983a09.tar.gz sophie-91b0ebbed2c20b8659dbae6f3ff4924940983a09.tar.zst sophie-91b0ebbed2c20b8659dbae6f3ff4924940983a09.zip |
build: Upgrade to chalk 5.0.0 anyways
Requires some workarounds for ts-jest to find the vendored dependencies.
-rw-r--r-- | config/jest.config.base.js | 7 | ||||
-rw-r--r-- | packages/main/package.json | 2 | ||||
-rw-r--r-- | packages/main/src/utils/logging.ts | 6 | ||||
-rw-r--r-- | yarn.lock | 11 |
4 files changed, 18 insertions, 8 deletions
diff --git a/config/jest.config.base.js b/config/jest.config.base.js index f265c1c..87d5b31 100644 --- a/config/jest.config.base.js +++ b/config/jest.config.base.js | |||
@@ -2,7 +2,7 @@ import { join } from 'path'; | |||
2 | 2 | ||
3 | import { fileURLToDirname } from './utils.js'; | 3 | import { fileURLToDirname } from './utils.js'; |
4 | 4 | ||
5 | const dirname = fileURLToDirname(import.meta.url); | 5 | const thisDir = fileURLToDirname(import.meta.url); |
6 | 6 | ||
7 | /** @type {import('ts-jest').InitialOptionsTsJest} */ | 7 | /** @type {import('ts-jest').InitialOptionsTsJest} */ |
8 | export default { | 8 | export default { |
@@ -13,8 +13,11 @@ export default { | |||
13 | }, | 13 | }, |
14 | }, | 14 | }, |
15 | moduleNameMapper: { | 15 | moduleNameMapper: { |
16 | '@sophie/(.+)': join(dirname, '../packages/$1/src/index.ts'), | 16 | '@sophie/(.+)': join(thisDir, '../packages/$1/src/index.ts'), |
17 | '^(\\.{1,2}/.*)\\.js$': '$1', | 17 | '^(\\.{1,2}/.*)\\.js$': '$1', |
18 | // Workaround for typescript to recognize the vendored dependencies of chalk. | ||
19 | '#ansi-styles': join(thisDir, '../node_modules/chalk/source/vendor/ansi-styles/index.js'), | ||
20 | '#supports-color': join(thisDir, '../node_modules/chalk/source/vendor/supports-color/index.js'), | ||
18 | }, | 21 | }, |
19 | resetMocks: true, | 22 | resetMocks: true, |
20 | restoreMocks: true, | 23 | restoreMocks: true, |
diff --git a/packages/main/package.json b/packages/main/package.json index eb2ecf6..f4cf18b 100644 --- a/packages/main/package.json +++ b/packages/main/package.json | |||
@@ -10,7 +10,7 @@ | |||
10 | "dependencies": { | 10 | "dependencies": { |
11 | "@sophie/service-shared": "workspace:*", | 11 | "@sophie/service-shared": "workspace:*", |
12 | "@sophie/shared": "workspace:*", | 12 | "@sophie/shared": "workspace:*", |
13 | "chalk": "^4.1.2", | 13 | "chalk": "^5.0.0", |
14 | "electron": "16.0.5", | 14 | "electron": "16.0.5", |
15 | "json5": "^2.2.0", | 15 | "json5": "^2.2.0", |
16 | "lodash-es": "^4.17.21", | 16 | "lodash-es": "^4.17.21", |
diff --git a/packages/main/src/utils/logging.ts b/packages/main/src/utils/logging.ts index ed40365..f703749 100644 --- a/packages/main/src/utils/logging.ts +++ b/packages/main/src/utils/logging.ts | |||
@@ -18,7 +18,7 @@ | |||
18 | * SPDX-License-Identifier: AGPL-3.0-only | 18 | * SPDX-License-Identifier: AGPL-3.0-only |
19 | */ | 19 | */ |
20 | 20 | ||
21 | import chalk, { Chalk } from 'chalk'; | 21 | import chalk, { ChalkInstance } from 'chalk'; |
22 | import loglevel, { Logger } from 'loglevel'; | 22 | import loglevel, { Logger } from 'loglevel'; |
23 | import prefix from 'loglevel-plugin-prefix'; | 23 | import prefix from 'loglevel-plugin-prefix'; |
24 | 24 | ||
@@ -28,7 +28,7 @@ if (import.meta.env?.DEV) { | |||
28 | loglevel.setLevel('info'); | 28 | loglevel.setLevel('info'); |
29 | } | 29 | } |
30 | 30 | ||
31 | const COLORS: Partial<Record<string, Chalk>> = { | 31 | const COLORS: Partial<Record<string, ChalkInstance>> = { |
32 | TRACE: chalk.magenta, | 32 | TRACE: chalk.magenta, |
33 | DEBUG: chalk.cyan, | 33 | DEBUG: chalk.cyan, |
34 | INFO: chalk.blue, | 34 | INFO: chalk.blue, |
@@ -37,7 +37,7 @@ const COLORS: Partial<Record<string, Chalk>> = { | |||
37 | CRITICAL: chalk.red, | 37 | CRITICAL: chalk.red, |
38 | }; | 38 | }; |
39 | 39 | ||
40 | function getColor(level: string): Chalk { | 40 | function getColor(level: string): ChalkInstance { |
41 | return COLORS[level] ?? chalk.gray; | 41 | return COLORS[level] ?? chalk.gray; |
42 | } | 42 | } |
43 | 43 | ||
@@ -1203,7 +1203,7 @@ __metadata: | |||
1203 | "@types/lodash-es": ^4.17.5 | 1203 | "@types/lodash-es": ^4.17.5 |
1204 | "@types/ms": ^0.7.31 | 1204 | "@types/ms": ^0.7.31 |
1205 | "@types/node": ^17.0.5 | 1205 | "@types/node": ^17.0.5 |
1206 | chalk: ^4.1.2 | 1206 | chalk: ^5.0.0 |
1207 | electron: 16.0.5 | 1207 | electron: 16.0.5 |
1208 | electron-devtools-installer: ^3.2.0 | 1208 | electron-devtools-installer: ^3.2.0 |
1209 | esbuild: ^0.14.9 | 1209 | esbuild: ^0.14.9 |
@@ -2345,7 +2345,7 @@ __metadata: | |||
2345 | languageName: node | 2345 | languageName: node |
2346 | linkType: hard | 2346 | linkType: hard |
2347 | 2347 | ||
2348 | "chalk@npm:^4.0.0, chalk@npm:^4.1.0, chalk@npm:^4.1.1, chalk@npm:^4.1.2": | 2348 | "chalk@npm:^4.0.0, chalk@npm:^4.1.0, chalk@npm:^4.1.1": |
2349 | version: 4.1.2 | 2349 | version: 4.1.2 |
2350 | resolution: "chalk@npm:4.1.2" | 2350 | resolution: "chalk@npm:4.1.2" |
2351 | dependencies: | 2351 | dependencies: |
@@ -2355,6 +2355,13 @@ __metadata: | |||
2355 | languageName: node | 2355 | languageName: node |
2356 | linkType: hard | 2356 | linkType: hard |
2357 | 2357 | ||
2358 | "chalk@npm:^5.0.0": | ||
2359 | version: 5.0.0 | ||
2360 | resolution: "chalk@npm:5.0.0" | ||
2361 | checksum: 6eba7c518b9aa5fe882ae6d14a1ffa58c418d72a3faa7f72af56641f1bbef51b645fca1d6e05d42357b7d3c846cd504c0b7b64d12309cdd07867e3b4411e0d01 | ||
2362 | languageName: node | ||
2363 | linkType: hard | ||
2364 | |||
2358 | "char-regex@npm:^1.0.2": | 2365 | "char-regex@npm:^1.0.2": |
2359 | version: 1.0.2 | 2366 | version: 1.0.2 |
2360 | resolution: "char-regex@npm:1.0.2" | 2367 | resolution: "char-regex@npm:1.0.2" |