Skip to content

Commit

Permalink
Merge branch 'develop' into node20
Browse files Browse the repository at this point in the history
  • Loading branch information
puehringer authored Nov 20, 2023
2 parents 1959c18 + 9df508c commit 67d15e3
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 13 deletions.
3 changes: 2 additions & 1 deletion bin/commands/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
type: 'boolean',
}),
handler: (args) => {
call('eslint', `${args.cache ? '--cache' : ''} --no-error-on-unmatched-pattern ${(args.strings || []).join(' ')} "src/**/*.ts{,x}" "tests/**/*.ts{,x}" "cypress/**/*.ts{,x}"`);
// TODO: Remove --fix to ensure all linting errors are reported in CI. Disable until a codebase is fully migrated, as otherwise formatting causes merge conflicts.
call('eslint', `--fix ${args.cache ? '--cache' : ''} --no-error-on-unmatched-pattern ${(args.strings || []).join(' ')} "src/**/*.ts{,x}" "tests/**/*.ts{,x}" "cypress/**/*.ts{,x}"`);
},
};
3 changes: 3 additions & 0 deletions config/jest.config.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ module.exports = {
coveragePathIgnorePatterns: ['playwright'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
modulePaths: ['src'],
resolver: 'visyn_scripts/config/jest_export_maps_resolver.js',
transformIgnorePatterns: [`../node_modules/${pluginsNotToTransform}`, `node_modules/${pluginsNotToTransform}`],
globals: {
__VERSION__: 'TEST_VERSION',
__APP_CONTEXT__: 'TEST_CONTEXT',
},
moduleNameMapper: {
'^.+\\.(css|less|scss|sass|png|jpg|gif|svg|html)$': 'identity-obj-proxy',
// Add tslib alias as otherwise we get a TypeError: Cannot destructure property '__extends' of '_tslib.default' as it is undefined.
tslib: 'tslib/tslib.es6.js',
},
};
8 changes: 8 additions & 0 deletions config/jest_export_maps_resolver.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// temporary workaround while we wait for https://github.com/facebook/jest/issues/9771
// eslint-disable-next-line import/no-extraneous-dependencies
const resolver = require('enhanced-resolve').create.sync({
conditionNames: ['require', 'node', 'default', 'import'],
extensions: ['.js', '.json', '.node', '.ts', '.tsx'],
});

module.exports = (request, options) => resolver(options.basedir, request);
11 changes: 7 additions & 4 deletions config/tsconfig.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
"allowSyntheticDefaultImports": true,
"preserveWatchOutput": true
},
// Old "moduleResolution": "Node" option required for Cypress
// https://github.com/cypress-io/cypress/issues/26308#issuecomment-1663592648
//
// TODO: Remove when issue is resolved https://github.com/cypress-io/cypress/issues/27448
"ts-node": {
"compilerOptions": {
"module": "es2022",
"moduleResolution": "node16",
"sourceMap": false,
"module": "ESNext",
"moduleResolution": "Node"
}
},
}
}
17 changes: 16 additions & 1 deletion config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ module.exports = (webpackEnv, argv) => {
? {
static: path.resolve(workspacePath, 'bundles'),
compress: true,
host: 'localhost',
// Listen to all interfaces, as Node 18+ resolves IPv6 first: https://github.com/cypress-io/github-action/blob/master/README.md#wait-on-with-nodejs-18
host: '0.0.0.0',
open: true,
// Needs to be enabled to make SPAs work: https://stackoverflow.com/questions/31945763/how-to-tell-webpack-dev-server-to-serve-index-html-for-any-route
historyApiFallback: historyApiFallback == null ? true : historyApiFallback,
Expand Down Expand Up @@ -495,6 +496,20 @@ module.exports = (webpackEnv, argv) => {
},
},
},
// Process application TS with swc-loader even if they are coming from node_modules, i.e. from non-built dependencies.
{
test: /\.(ts|tsx)$/,
loader: 'swc-loader',
options: {
jsc: {
parser: {
syntax: 'typescript',
decorators: true,
// TODO: Check what other settings should be supported: https://swc.rs/docs/configuration/swcrc#compilation
},
},
},
},
// "postcss" loader applies autoprefixer to our CSS.
// "css" loader resolves paths in CSS and adds assets as dependencies.
// "style" loader turns CSS into JS modules that inject <style> tags.
Expand Down
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
"dependencies": {
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
"@svgr/webpack": "^6.5.1",
"@swc/core": "~1.3.77",
"@swc/core": "1.3.95",
"@swc/jest": "~0.2.24",
"@types/jest": "^29.0.0",
"@types/jest": "~27.4.1",
"@types/node": "^20.8.9",
"@types/webpack": "^5.28.0",
"@types/yeoman-environment": "2.10.8",
Expand Down Expand Up @@ -82,10 +82,9 @@
"ifdef-loader": "^2.3.2",
"imports-loader": "~4.0.1",
"inquirer": "7",
"jest": "^29.0.0",
"jest-environment-jsdom": "^29.7.0",
"jest": "^27.4.3",
"jest-raw-loader": "~1.0.1",
"jest-resolve": "^29.0.0",
"jest-resolve": "^27.4.2",
"lodash": "^4.17.21",
"mini-css-extract-plugin": "^2.7.5",
"npm-run-all": "^4.1.5",
Expand Down Expand Up @@ -113,7 +112,6 @@
"tailwindcss": "^3.2.7",
"terser-webpack-plugin": "^5.3.7",
"time-analytics-webpack-plugin": "^0.1.20",
"ts-jest": "~27.1.3",
"ts-node": "^10.9.1",
"tslib": "~2.6.2",
"typescript": "~5.2.2",
Expand All @@ -131,7 +129,7 @@
"devDependencies": {
"@types/yargs": "^17.0.22",
"http-server": "^14.1.1",
"jest-dev-server": "^9.0.1"
"jest-dev-server": "^6.1.1"
},
"peerDependencies": {
"@types/react": "^18.0.0",
Expand Down

0 comments on commit 67d15e3

Please sign in to comment.