Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(deps): bump d3 and @types/d3 to 7.4 (#4081)
* chore(deps): bump d3 and @types/d3 Bumps [d3](https://github.com/d3/d3) and [@types/d3](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/d3). These dependencies needed to be updated together. Updates `d3` from 6.7.0 to 7.4.4 - [Release notes](https://github.com/d3/d3/releases) - [Changelog](https://github.com/d3/d3/blob/main/CHANGES.md) - [Commits](d3/d3@v6.7.0...v7.4.4) Updates `@types/d3` from 6.7.5 to 7.4.0 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/d3) --- updated-dependencies: - dependency-name: d3 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: "@types/d3" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Update package.json * feat: add support for jest * chore: upgrade recharts * test: update snapshot * fix: stop ignore transform node_modules * chore: udpate changelog * test: update snap * chore: move to option 2 Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jean-Michel FRANCOIS <jmfrancois@talend.com>
- Loading branch information
1 parent
5e01487
commit b02eb9e
Showing
7 changed files
with
466 additions
and
397 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@talend/react-components': minor | ||
'@talend/react-dataviz': minor | ||
'@talend/react-flow-designer': minor | ||
--- | ||
|
||
feat: upgrade d3 to 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@talend/scripts-config-jest': minor | ||
--- | ||
|
||
feat: transpile node_modules | ||
|
||
Since d3 7.x and its dependencies use es6 as main entry in package.json, we need this because jest support of [ECMAPScriptModules](https://github.com/facebook/jest/blob/64de4d7361367fd711a231d25c37f3be89564264/docs/ECMAScriptModules.md) is experiemental |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,68 @@ | ||
const path = require('path'); | ||
const { getBabelConfigPath } = require('@talend/scripts-config-babel/babel-resolver'); | ||
// took from d3/package.json | ||
const d3Pkgs = [ | ||
'd3', | ||
'd3-array', | ||
'd3-axis', | ||
'd3-brush', | ||
'd3-chord', | ||
'd3-color', | ||
'd3-contour', | ||
'd3-delaunay', | ||
'd3-dispatch', | ||
'd3-drag', | ||
'd3-dsv', | ||
'd3-ease', | ||
'd3-fetch', | ||
'd3-force', | ||
'd3-format', | ||
'd3-geo', | ||
'd3-hierarchy', | ||
'd3-interpolate', | ||
'd3-path', | ||
'd3-polygon', | ||
'd3-quadtree', | ||
'd3-random', | ||
'd3-scale', | ||
'd3-scale-chromatic', | ||
'd3-selection', | ||
'd3-shape', | ||
'd3-time', | ||
'd3-time-format', | ||
'd3-timer', | ||
'd3-transition', | ||
'd3-zoom', | ||
]; | ||
|
||
// option 1 map module to an bundled version of the package which is es5 | ||
const moduleNameMapper = d3Pkgs.reduce((acc, pkg) => { | ||
acc[`^${pkg}$`] = path.join(require.resolve(pkg), `../../dist/${pkg}.min.js`); | ||
return acc; | ||
}, {}); | ||
|
||
module.exports = { | ||
moduleNameMapper: { | ||
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|woff|woff2)$': path.join(__dirname, 'file-mock.js'), | ||
'^.+\\.(css|scss)$': path.join(__dirname, 'style-mock.js'), | ||
// option 1 | ||
// ...moduleNameMapper | ||
}, | ||
rootDir: process.cwd(), | ||
setupFilesAfterEnv: [path.join(__dirname, 'test-setup.js')], | ||
testEnvironment: 'jest-environment-jsdom-global', | ||
testRegex: 'src/.*\\.test.(js|ts|tsx)$', | ||
transform: { | ||
'^.+\\.jsx?$': ['babel-jest', { configFile: getBabelConfigPath() }], | ||
'^.+\\.mjs?$': ['babel-jest', { configFile: getBabelConfigPath() }], | ||
'^.+\\.tsx?$': ['babel-jest', { configFile: getBabelConfigPath() }], | ||
// match mjs js jsx ts tsx | ||
'^.+\\.m?[jt]sx?$': ['babel-jest', { configFile: getBabelConfigPath() }], | ||
}, | ||
// stop ignore node_modules transform since d3 and others start to put es6 as main of packages | ||
transformIgnorePatterns: [ | ||
// option 2, stop ignore transform on es6 packages | ||
`/node_modules/(?!${d3Pkgs.join('|')}|internmap|d3-delaunay|delaunator|robust-predicates)`, | ||
// option 3, stop ignore transform on all node_modules | ||
// `/node_modules/(?!.*)`, | ||
], | ||
snapshotSerializers: ['jest-serializer-html'], | ||
modulePathIgnorePatterns: ['<rootDir>/dist/cdn'], | ||
}; |
Oops, something went wrong.