Skip to content

Commit 43d8dee

Browse files
Release 3.0.0 (#27)
## Release notes * Visyn core (#24) * Check if it is a workspace when reading tsconfig (#26) ### Release dependencies first In case of dependent Phovea/TDP repositories follow [dependency tree](https://wiki.datavisyn.io/phovea/fundamentals/development-process#dependency-hierarchy) from the top: ### 🏁 Finish line * [ ] Inform colleagues and customers about the release * [ ] Celebrate the new release 🥳
2 parents 86a0f11 + 4114c26 commit 43d8dee

File tree

10 files changed

+1180
-3362
lines changed

10 files changed

+1180
-3362
lines changed

bin/commands/docs.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
const { call } = require('./utils');
2-
31
module.exports = {
42
command: 'docs [strings...]',
53
describe: 'Generate docs of a repository using typedoc',
6-
handler: (args) => {
7-
call('typedoc', `--options ./typedoc.js ${(args.strings || []).join(' ')} src/**.ts`);
4+
handler: () => {
5+
console.log('No docs integration yet...');
86
},
97
};

config/jest.config.template.js

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,34 @@
1-
// test dependencies that require transformation
2-
let pluginsToTransform = [
3-
// datavisyn
4-
'tdp_*',
5-
'phovea_*',
6-
'lineupjs',
7-
// d3
8-
'd3-*',
9-
'internmap',
10-
'delaunator',
11-
'robust-predicates',
1+
const pluginsNotToTransform = [
2+
// Disable the transform for d3v3, as it otherwise leads to "Cannot read property 'document' of undefined": https://stackoverflow.com/a/35560440
3+
'd3v3',
124
].join('|');
135

14-
if (pluginsToTransform.length > 0) {
15-
/** Attention: Negative Lookahead! This regex adds the specified repos to a
16-
* whitelist that holds plugins that are excluded from the transformIgnorePatterns.
17-
* This means that pluginsToTransform should contain all repos that export ts files.
18-
* They can only be handled by the transformation. */
19-
pluginsToTransform = `(?!${pluginsToTransform})`;
20-
}
21-
226
/**
237
* TODO check if we can process inline webpack loaders (e.g. as found in https://github.com/phovea/phovea_ui/blob/master/src/_bootstrap.ts)
248
* see also https://jestjs.io/docs/en/webpack#mocking-css-modules
259
*/
2610
module.exports = {
2711
testEnvironment: 'jsdom',
2812
transform: {
29-
'^.+\\.(js|ts|tsx)$': 'ts-jest',
13+
'^.+\\.(js|ts|tsx|mjs|mts)$': ['@swc/jest', {
14+
// Exactly the same configuration as in the webpack.config.js
15+
jsc: {
16+
parser: {
17+
syntax: 'typescript',
18+
decorators: true,
19+
},
20+
},
21+
}],
3022
'\\.xml$': 'jest-raw-loader',
3123
},
3224
testRegex: '(.*(test|spec))\\.(tsx?)$',
3325
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
3426
modulePaths: ['src'],
35-
transformIgnorePatterns: [`../node_modules/${pluginsToTransform}`, `node_modules/${pluginsToTransform}`],
27+
resolver: 'visyn_scripts/config/jest_export_maps_resolver.js',
28+
transformIgnorePatterns: [`../node_modules/${pluginsNotToTransform}`, `node_modules/${pluginsNotToTransform}`],
3629
globals: {
3730
__VERSION__: 'TEST_VERSION',
3831
__APP_CONTEXT__: 'TEST_CONTEXT',
39-
'ts-jest': {
40-
// has to be set to true, otherwise i18n import fails
41-
tsconfig: {
42-
esModuleInterop: true,
43-
},
44-
},
4532
},
4633
moduleNameMapper: {
4734
'^.+\\.(css|less|scss|sass|png|jpg|gif|svg|html)$': 'identity-obj-proxy',
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// temporary workaround while we wait for https://github.com/facebook/jest/issues/9771
2+
// eslint-disable-next-line import/no-extraneous-dependencies
3+
const resolver = require('enhanced-resolve').create.sync({
4+
conditionNames: ['require', 'node', 'default', 'import'],
5+
extensions: ['.js', '.json', '.node', '.ts', '.tsx'],
6+
});
7+
8+
module.exports = (request, options) => resolver(options.basedir, request);

config/tsconfig.template.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"compilerOptions": {
3-
"module": "ES2020",
3+
"module": "ESNext",
44
"target": "ES2021",
55
"importHelpers": true,
66
"sourceMap": true,
77
"declaration": true,
88
"declarationMap": true,
9-
"moduleResolution": "node",
9+
"moduleResolution": "node16",
1010
"jsx": "react",
1111
"allowJs": true,
1212
"experimentalDecorators": true,

config/typedoc.template.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

config/webpack.config.js

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ const { CleanWebpackPlugin } = require('clean-webpack-plugin');
1919
const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
2020
const dotenv = require('dotenv');
2121
const dotenvExpand = require('dotenv-expand');
22+
const { parseTsconfig } = require('get-tsconfig');
23+
24+
let jquery = null;
25+
try {
26+
jquery = require.resolve('jquery');
27+
} catch {
28+
// pass
29+
}
30+
2231
// const { TimeAnalyticsPlugin } = require('time-analytics-webpack-plugin');
2332

2433
// Load the current .env and expand it
@@ -134,6 +143,12 @@ module.exports = (webpackEnv, argv) => {
134143
entries = {};
135144
}
136145

146+
const tsconfigJson = isSingleRepoMode ? parseTsconfig(path.join(workspacePath, 'tsconfig.json')) : null;
147+
const isLegacyModuleResolution = tsconfigJson?.compilerOptions?.moduleResolution?.toLowerCase() === 'node';
148+
if (isLegacyModuleResolution) {
149+
console.warn('visyn user: you are still using moduleResolution: node. Try to upgrade to node16 as soon as possible!');
150+
}
151+
137152
const copyAppFiles = copyFiles?.map((file) => ({
138153
from: path.join(defaultAppPath, file),
139154
to: path.join(workspacePath, 'bundles', path.basename(file)),
@@ -286,7 +301,7 @@ module.exports = (webpackEnv, argv) => {
286301
entry: Object.fromEntries(
287302
Object.entries(entries).map(([key, entry]) => [
288303
key,
289-
[workspaceRegistryFile, path.join(defaultAppPath, entry.js), entry.scss ? path.join(defaultAppPath, entry.scss) : './workspace.scss'],
304+
[workspaceRegistryFile, path.join(defaultAppPath, entry.js), entry.scss ? path.join(defaultAppPath, entry.scss) : './workspace.scss'].filter((v) => fs.existsSync(v)),
290305
]),
291306
),
292307
devServer: isEnvDevelopment
@@ -380,6 +395,12 @@ module.exports = (webpackEnv, argv) => {
380395
},
381396
resolve: {
382397
extensions: ['.tsx', '.ts', '.js'],
398+
// This is required to enable TS moduleResolution: node16, as there we have to add .js extensions which are actually .ts files.
399+
extensionAlias: isLegacyModuleResolution ? undefined : {
400+
'.js': ['.tsx', '.ts', '.js'],
401+
'.cjs': ['.cts', '.cjs'],
402+
'.mjs': ['.mts', '.mjs'],
403+
},
383404
// By default, always search for modules in the relative node_modules. However,
384405
// if the package can not be found, fall back to the workspace node_modules. This is
385406
// useful when using the resolveAliases to resolve a package to somewhere else.
@@ -578,13 +599,13 @@ module.exports = (webpackEnv, argv) => {
578599
],
579600
},
580601
// TODO: Is this legacy stuff, should it be included as well?
581-
{
582-
test: require.resolve('jquery'),
602+
jquery ? {
603+
test: jquery,
583604
loader: 'expose-loader',
584605
options: {
585606
exposes: ['window.jQuery', '$'],
586607
},
587-
},
608+
} : null,
588609
// "file" loader makes sure those assets get served by WebpackDevServer.
589610
// When you `import` an asset, you get its (virtual) filename.
590611
// In production, they would get copied to the `build` folder.
@@ -600,7 +621,7 @@ module.exports = (webpackEnv, argv) => {
600621
},
601622
// ** STOP ** Are you adding a new loader?
602623
// Make sure to add the new loader(s) before the "file" loader.
603-
],
624+
].filter(Boolean),
604625
},
605626
].filter(Boolean),
606627
},

package.json

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "visyn_scripts",
33
"description": "",
4-
"version": "2.0.0",
4+
"version": "3.0.0",
55
"author": {
66
"name": "datavisyn GmbH",
77
"email": "[email protected]",
@@ -32,38 +32,23 @@
3232
"dist": "npm run lint && npm run test"
3333
},
3434
"dependencies": {
35-
"@babel/core": "^7.16.0",
36-
"@babel/plugin-proposal-class-properties": "^7.16.7",
37-
"@babel/plugin-proposal-decorators": "^7.17.9",
38-
"@babel/plugin-transform-runtime": "^7.17.0",
39-
"@babel/preset-env": "^7.6.3",
40-
"@babel/preset-react": "^7.6.3",
41-
"@babel/preset-typescript": "^7.6.0",
4235
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.3",
4336
"@svgr/webpack": "^5.5.0",
44-
"@swc/core": "1.3.30",
37+
"@swc/core": "~1.3.35",
38+
"@swc/jest": "~0.2.24",
4539
"@types/jest": "~27.4.1",
46-
"@types/jquery": "^3.5.5",
4740
"@types/node": "^17.0.24",
4841
"@types/webpack": "^5.28.0",
4942
"@types/yeoman-environment": "2",
5043
"@types/yeoman-generator": "4",
51-
"@typescript-eslint/eslint-plugin": "~5.42.0",
52-
"@typescript-eslint/parser": "~5.42.0",
53-
"babel-jest": "^27.4.2",
54-
"babel-loader": "^8.2.3",
55-
"babel-plugin-named-asset-import": "^0.3.8",
56-
"babel-preset-react-app": "^10.0.1",
57-
"bfj": "^7.0.2",
44+
"@typescript-eslint/eslint-plugin": "~5.52.0",
45+
"@typescript-eslint/parser": "~5.52.0",
5846
"bluebird": "3",
5947
"browserslist": "^4.18.1",
60-
"camelcase": "^6.2.1",
61-
"case-sensitive-paths-webpack-plugin": "^2.4.0",
6248
"chalk": "4",
6349
"child-process-promise": "^2.2.1",
6450
"clean-webpack-plugin": "^4.0.0",
6551
"copy-webpack-plugin": "^10.2.4",
66-
"core-js": "^2.6.5",
6752
"cross-spawn": "^7.0.3",
6853
"css-loader": "^6.5.1",
6954
"css-minimizer-webpack-plugin": "^3.2.0",
@@ -78,7 +63,7 @@
7863
"eslint-config-react-app": "^7.0.1",
7964
"eslint-plugin-chai-friendly": "^0.7.2",
8065
"eslint-plugin-cypress": "^2.12.1",
81-
"eslint-plugin-import": "^2.25.4",
66+
"eslint-plugin-import": "^2.27.5",
8267
"eslint-plugin-jest": "^25.3.4",
8368
"eslint-plugin-jsx-a11y": "^6.5.1",
8469
"eslint-plugin-prettier": "^4.0.0",
@@ -89,6 +74,7 @@
8974
"file-loader": "^6.2.0",
9075
"fork-ts-checker-webpack-plugin": "^7.2.6",
9176
"fs-extra": "^10.0.0",
77+
"get-tsconfig": "^4.4.0",
9278
"glob": "^8.0.3",
9379
"html-loader": "~1.3.2",
9480
"html-webpack-plugin": "^5.5.0",
@@ -99,21 +85,16 @@
9985
"jest": "^27.4.3",
10086
"jest-raw-loader": "~1.0.1",
10187
"jest-resolve": "^27.4.2",
102-
"jest-watch-typeahead": "^1.0.0",
103-
"jquery": "~3.5.1",
10488
"lodash": "^4.17.21",
10589
"mini-css-extract-plugin": "^2.4.5",
10690
"npm-run-all": "^4.1.5",
107-
"npm-watch": "~0.11.0",
10891
"postcss": "^8.4.4",
10992
"postcss-flexbugs-fixes": "^5.0.2",
11093
"postcss-loader": "^6.2.1",
11194
"postcss-normalize": "^10.0.1",
11295
"postcss-preset-env": "^7.0.1",
11396
"prettier": "^2.5.1",
114-
"prompts": "^2.4.2",
11597
"raw-loader": "~4.0.2",
116-
"react-app-polyfill": "^3.0.0",
11798
"react-dev-utils": "^12.0.1",
11899
"react-refresh": "^0.11.0",
119100
"resolve": "^1.20.0",
@@ -134,17 +115,13 @@
134115
"ts-jest": "~27.1.3",
135116
"ts-node": "^10.7.0",
136117
"tslib": "~2.3.1",
137-
"type-fest": "^2.12.2",
138-
"typedoc": "~0.22.13",
139-
"typescript": "~4.6.2",
118+
"typescript": "~4.9.5",
140119
"url-loader": "~4.1.1",
141120
"util": "^0.12.4",
142121
"webpack": "^5.64.4",
143122
"webpack-bundle-analyzer": "^4.5.0",
144123
"webpack-cli": "^4.9.2",
145124
"webpack-dev-server": "^4.6.0",
146-
"webpack-manifest-plugin": "^4.0.2",
147-
"workbox-webpack-plugin": "^6.4.1",
148125
"yamljs": "^0.3.0",
149126
"yargs": "^17.5.1",
150127
"yeoman-environment": "2",

tests_fixtures/standalone_template/typedoc.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)