Skip to content

Commit

Permalink
Merge branch 'main' into 345-donut-marker-white-boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
moontrip committed Apr 27, 2023
2 parents 8b351dc + ba7e7e4 commit b907f8a
Show file tree
Hide file tree
Showing 834 changed files with 2,783 additions and 89,635 deletions.
188 changes: 105 additions & 83 deletions packages/configs/base-webpack-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const webpackMerge = require('webpack-merge');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const isModern = process.env.BROWSERSLIST_ENV === 'modern';
const outputSubDir = isModern ? 'modern' : 'legacy';
console.log('BROWSERSLIST_ENV:', process.env.BROWSERSLIST_ENV)
console.log('BROWSERSLIST_ENV:', process.env.BROWSERSLIST_ENV);

/**
* Creates a configuration function that is used by webpack. Takes a
Expand All @@ -27,92 +27,114 @@ console.log('BROWSERSLIST_ENV:', process.env.BROWSERSLIST_ENV)
exports.merge = function merge(additionalConfig) {
return function (env, argv) {
const isDevelopment = argv.mode !== 'production';
return webpackMerge.smart([{
bail: true,
context: process.cwd(),
resolve: {
extensions: [ ".js", ".jsx", ".ts", ".tsx" ],
},
output: {
path: path.join(process.cwd(), 'dist', outputSubDir),
filename: '[name].bundle.js',
chunkFilename: '[id].bundle-[chunkhash].js',
hashDigestLength: 20
},
module: {
rules: [

// handle typescript source. reads `tsconfig.json` in cwd
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: [
{ loader: 'babel-loader', options: { configFile: path.join(process.cwd(), '.babelrc') } },
{ loader: 'ts-loader', options: { configFile: path.join(process.cwd(), 'tsconfig.json'), logLevel: 'info' } }
]
return webpackMerge.smart(
[
{
bail: true,
context: process.cwd(),
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},

// handle es source. reads `.babelrc` in cwd
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: [
{ loader: 'babel-loader', options: { configFile: path.join(process.cwd(), '.babelrc') } }
]
output: {
path: path.join(process.cwd(), 'dist', 'bundles', outputSubDir),
filename: '[name].bundle.js',
chunkFilename: '[id].bundle-[chunkhash].js',
hashDigestLength: 20,
},
module: {
rules: [
// handle typescript source. reads `tsconfig.json` in cwd
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
configFile: path.join(process.cwd(), '.babelrc'),
},
},
{
loader: 'ts-loader',
options: {
configFile: path.join(process.cwd(), 'tsconfig.json'),
logLevel: 'info',
},
},
],
},

// consumes too much memory
// {
// test: /\.js$/,
// enforce: 'pre',
// use: ['source-map-loader']
// },
// handle es source. reads `.babelrc` in cwd
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
configFile: path.join(process.cwd(), '.babelrc'),
},
},
],
},

{
test: /\.scss$/,
use: [
{ loader: MiniCssExtractPlugin.loader },
{ loader: 'css-loader', options: { sourceMap: true } },
{ loader: 'sass-loader', options: { sourceMap: true } }
]
},
// consumes too much memory
// {
// test: /\.js$/,
// enforce: 'pre',
// use: ['source-map-loader']
// },

{
test: /\.css$/,
use: [
{ loader: MiniCssExtractPlugin.loader },
{ loader: 'css-loader', options: { sourceMap: true } }
]
},
{
test: /\.scss$/,
use: [
{ loader: MiniCssExtractPlugin.loader },
{ loader: 'css-loader', options: { sourceMap: true } },
{ loader: 'sass-loader', options: { sourceMap: true } },
],
},

// inlines images as base64
{
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
loader: 'url-loader',
options: { limit: 100000 }
},
{
test: /\.css$/,
use: [
{ loader: MiniCssExtractPlugin.loader },
{ loader: 'css-loader', options: { sourceMap: true } },
],
},

]
},
devtool: 'source-map',
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
new webpack.LoaderOptionsPlugin({ debug: isDevelopment }),
new webpack.DefinePlugin({
__DEV__: JSON.stringify(isDevelopment),
__OUTPUT_SUBDIR__: JSON.stringify(outputSubDir + '/'),
__IS_LEGACY_BUNDLE__: JSON.stringify(!isModern)
}),
new MiniCssExtractPlugin({
filename: '[name].bundle.css',
chunkFilename: '[id].bundle-[chunkhash].css'
})
],
stats: {
maxModules: Infinity,
optimizationBailout: true,
modules: false
}
}].concat(typeof additionalConfig === 'function' ? additionalConfig(env, argv) : additionalConfig));
}
}
// inlines images as base64
{
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
loader: 'url-loader',
options: { limit: 100000 },
},
],
},
devtool: 'source-map',
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
new webpack.LoaderOptionsPlugin({ debug: isDevelopment }),
new webpack.DefinePlugin({
__DEV__: JSON.stringify(isDevelopment),
__OUTPUT_SUBDIR__: JSON.stringify(outputSubDir + '/'),
__IS_LEGACY_BUNDLE__: JSON.stringify(!isModern),
}),
new MiniCssExtractPlugin({
filename: '[name].bundle.css',
chunkFilename: '[id].bundle-[chunkhash].css',
}),
],
stats: {
maxModules: Infinity,
optimizationBailout: true,
modules: false,
},
},
].concat(
typeof additionalConfig === 'function'
? additionalConfig(env, argv)
: additionalConfig
)
);
};
};
3 changes: 2 additions & 1 deletion packages/libs/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"storybook": "start-storybook -s public",
"build": "npm-run-all build-npm-modules",
"build-storybook": "build-storybook -s public",
"build-npm-modules": "tsc -p tsconfig.build.json"
"build-npm-modules": "veupathdb-react-scripts prepare src"
},
"eslintConfig": {
"extends": [
Expand Down Expand Up @@ -101,6 +101,7 @@
"@types/stats-lite": "^2.2.0",
"@veupathdb/browserslist-config": "workspace:^",
"@veupathdb/eslint-config": "workspace:^",
"@veupathdb/react-scripts": "workspace:^",
"@veupathdb/tsconfig": "workspace:^",
"babel-loader": "^8.1.0",
"eslint": "^8.29.0",
Expand Down
29 changes: 15 additions & 14 deletions packages/libs/components/src/EntityDiagram/EntityDiagram.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from '@visx/hierarchy/lib/types';
import { Line } from '@visx/shape';
import { LinearGradient } from '@visx/gradient';
import './diagram.css';

interface CustomNodeProps {
node: HierarchyPointNode<StudyData>;
Expand Down Expand Up @@ -420,20 +421,20 @@ export default function EntityDiagram({
</defs>
{/*Node background shading definitions*/}
{entityCounts &&
Object.entries(
entityCounts
).map(([entityId, { total, filtered }]) => (
<LinearGradient
key={entityId}
vertical={false}
x1={0}
x2={filtered / total}
fromOffset={1}
id={`rect-gradient-${entityId}`}
from={shadingColor}
to={isExpanded ? '#cccccc' : 'white'}
/>
))}
Object.entries(entityCounts).map(
([entityId, { total, filtered }]) => (
<LinearGradient
key={entityId}
vertical={false}
x1={0}
x2={filtered / total}
fromOffset={1}
id={`rect-gradient-${entityId}`}
from={shadingColor}
to={isExpanded ? '#cccccc' : 'white'}
/>
)
)}
<Tree root={data} size={[treeWidth, treeHeight]}>
{(tree) => (
<Group left={treeLeft} top={treeTop}>
Expand Down
1 change: 1 addition & 0 deletions packages/libs/components/src/EntityDiagram/diagram.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.expanded-diagram {
margin: auto;
max-width: 100vw;
overflow: auto;
}

.expanded-diagram-enter {
Expand Down
Loading

0 comments on commit b907f8a

Please sign in to comment.