Skip to content

add initial app state for development with redux/theming set up #165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: testing-tooling
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,4 @@ cython_debug/
*.yaml

# Turn off UI related ignores, defer to ui/.gitignore
!ui/**/*.json
!ui/**
21 changes: 19 additions & 2 deletions ui/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,25 @@
"import/order": [
"error",
{
"groups": [["builtin", "external", "internal"]],
"newlines-between": "always"
"groups": [
["builtin", "external"],
["internal", "parent", "sibling", "index"]
],
"newlines-between": "always-and-inside-groups",
"pathGroups": [
{
"pattern": "{@,assets,classes,components,hooks,pages,store,tests,types,utils}/**",
"group": "internal",
"position": "before"
},
{
"pattern": "{.,..}/**",
"group": "internal",
"position": "after"
}
],
"pathGroupsExcludedImportTypes": ["builtin"],
"alphabetize": { "order": "asc", "caseInsensitive": true }
}
],
"import/no-extraneous-dependencies": [
Expand Down
1 change: 1 addition & 0 deletions ui/__mocks__/fileMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'test-file-stub';
1 change: 1 addition & 0 deletions ui/__mocks__/styleMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {};
3 changes: 3 additions & 0 deletions ui/__mocks__/svg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default 'svg';
export const ReactComponent = 'div';
//This was from svgr docs: https://react-svgr.com/docs/jest/
4 changes: 4 additions & 0 deletions ui/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ const customJestConfig = {
coverageReporters: ['json-summary'],
moduleFileExtensions: ['ts', 'tsx', 'js'],
moduleNameMapper: {
'^.+\\.(svg)$': '<rootDir>/__mocks__/svg.js',
'^@/(.*)$': '<rootDir>/src/$1',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/fileMock.js',
'\\.(css|less|scss|sass)$': '<rootDir>/__mocks__/styleMock.js',
},
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
testEnvironment: 'jest-environment-jsdom',
Expand Down
32 changes: 32 additions & 0 deletions ui/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'export',
webpack(config) {
// Grab the existing rule that handles SVG imports
const fileLoaderRule = config.module.rules.find((rule) => rule.test?.test?.('.svg'));

config.module.rules.push(
// Reapply the existing rule, but only for svg imports ending in ?url
{
...fileLoaderRule,
test: /\.svg$/i,
resourceQuery: /url/, // *.svg?url
},
// Convert all other *.svg imports to React components
{
test: /\.svg$/i,
issuer: fileLoaderRule.issuer,
resourceQuery: { not: [...fileLoaderRule.resourceQuery.not, /url/] }, // exclude if *.svg?url
use: ['@svgr/webpack'],
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
type: 'asset/resource',
generator: {
filename: 'static/fonts/[name][ext]',
},
}
);

// Modify the file loader rule to ignore *.svg, since we have it handled now.
fileLoaderRule.exclude = /\.svg$/i;

return config;
},
};

export default nextConfig;
Loading