Skip to content

Commit facfc8c

Browse files
[NPM INSTALL] Fix issue with lib tests and ESM incompatibility
1 parent 8dcf520 commit facfc8c

6 files changed

Lines changed: 323 additions & 2692 deletions

File tree

extension/dev-docs/UPDATING_DEPENDENCIES.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,11 @@ See list below of libs to skip
9090

9191
### DO NOT UPDATE THESE LIBS
9292

93-
> SCRATCH THIS - You can update these, but there is a cost.
94-
>
95-
> We use commonjs for our VSCode extension compile targets. When we do this, we can't
96-
> strictly check imports from ESM libraries. You will see errors in the editor, but
97-
> not at compile time.
98-
>
99-
> For active dev, this isn't an issue, but for upgrading ESM libraries to newer APIs, we need
100-
> to be most stringent and thoroughly check.
93+
> Jest doesn't offer full support for ESM, so this is a big problem when running tests
10194
10295
There's a few libraries that we _CANNOT_ update because new versions are ESM which does not play well with TypeScript and the NX configuration.
10396

97+
- ansi-styles
10498
- chalk
10599
- case-anything
106100
- json-stringify-pretty-compact

libs/logger/src/lib/logger.class.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ObjectifyError } from '@idl/error-shared';
2-
import chalk from 'chalk';
2+
import * as chalk from 'chalk';
33

44
import { LogInterceptor } from './log-manager.interface';
55
import {
@@ -12,7 +12,7 @@ import {
1212
import { StringifyData, StringifyDataForLog } from './stringify-data';
1313

1414
// force chalk to be enabled
15-
chalk.level = 2;
15+
(chalk as any).level = 2;
1616

1717
/**
1818
* Simply class that emulates the library Minilog which doesn't have types. Since we can use the library

libs/logger/src/lib/logger.interface.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import chalk from 'chalk';
1+
import * as chalk from 'chalk';
22

33
// force chalk to be enabled
4-
chalk.level = 2;
4+
(chalk as any).level = 2;
55

66
import { Logger } from './logger.class';
77

libs/strip-ansi/project.json

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,6 @@
77
"targets": {
88
"lint": {
99
"executor": "@nx/eslint:lint"
10-
},
11-
"build": {
12-
"executor": "@nx/js:tsc",
13-
"outputs": ["{options.outputPath}"],
14-
"options": {
15-
"outputPath": "dist/libs/strip-ansi",
16-
"tsConfig": "libs/strip-ansi/tsconfig.lib.json",
17-
"packageJson": "libs/strip-ansi/package.json",
18-
"main": "libs/strip-ansi/src/index.ts",
19-
"assets": ["libs/strip-ansi/*.md"]
20-
}
2110
}
2211
}
2312
}

0 commit comments

Comments
 (0)