kopia lustrzana https://github.com/drastus/sejm-calculator
Update libraries
rodzic
2b1c478f0e
commit
4688cadbe3
Plik diff jest za duży
Load Diff
86
package.json
86
package.json
|
@ -7,7 +7,7 @@
|
|||
"url": "https://github.com/drastus/sejm-calculator.git"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "webpack-dev-server --mode=development --hot",
|
||||
"start": "webpack-dev-server --mode=development",
|
||||
"test": "jest",
|
||||
"build": "webpack --mode=production",
|
||||
"deploy": "gh-pages -d dist"
|
||||
|
@ -18,55 +18,49 @@
|
|||
],
|
||||
"author": "Michał Górny",
|
||||
"dependencies": {
|
||||
"chartist": "^0.11.4",
|
||||
"modern-normalize": "^0.5.0"
|
||||
"chartist": "^1.3.0",
|
||||
"modern-normalize": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.12.3",
|
||||
"@babel/preset-env": "^7.12.1",
|
||||
"@babel/preset-typescript": "^7.12.1",
|
||||
"@babel/register": "^7.12.1",
|
||||
"@testing-library/dom": "^8.17.1",
|
||||
"@testing-library/jest-dom": "^5.16.5",
|
||||
"@types/chartist": "^0.9.46",
|
||||
"@types/html-webpack-plugin": "^3.2.5",
|
||||
"@types/jest": "^28.1.7",
|
||||
"@types/mini-css-extract-plugin": "^1.4.3",
|
||||
"@types/pug": "^2.0.4",
|
||||
"@types/webpack": "^4.41.29",
|
||||
"@types/webpack-dev-server": "^3.11.4",
|
||||
"@types/webpack-livereload-plugin": "^2.3.2",
|
||||
"@typescript-eslint/eslint-plugin": "^5.36.1",
|
||||
"@typescript-eslint/parser": "^5.36.1",
|
||||
"babel-loader": "^8.1.0",
|
||||
"css-loader": "^3.2.0",
|
||||
"cssnano": "^5.1.6",
|
||||
"eslint": "^7.11.0",
|
||||
"eslint-config-airbnb-base": "^14.2.0",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-webpack-plugin": "^2.5.4",
|
||||
"gh-pages": "^2.1.1",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
"jest": "^28.1.3",
|
||||
"jest-environment-jsdom": "^28.1.3",
|
||||
"@babel/core": "^7.22.10",
|
||||
"@babel/preset-env": "^7.22.10",
|
||||
"@babel/preset-typescript": "^7.22.5",
|
||||
"@testing-library/dom": "^9.3.1",
|
||||
"@testing-library/jest-dom": "^6.0.1",
|
||||
"@types/html-webpack-plugin": "^3.2.6",
|
||||
"@types/jest": "^29.5.3",
|
||||
"@types/pug": "^2.0.6",
|
||||
"@types/webpack": "^5.28.1",
|
||||
"@typescript-eslint/eslint-plugin": "^6.4.0",
|
||||
"@typescript-eslint/parser": "^6.4.0",
|
||||
"@webdiscus/pug-loader": "^2.10.5",
|
||||
"babel-loader": "^9.1.3",
|
||||
"css-loader": "^6.8.1",
|
||||
"cssnano": "^6.0.1",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint-config-airbnb-base": "^15.0.0",
|
||||
"eslint-plugin-import": "^2.28.1",
|
||||
"eslint-webpack-plugin": "^4.0.1",
|
||||
"gh-pages": "^6.0.0",
|
||||
"html-webpack-plugin": "^5.5.3",
|
||||
"jest": "^29.6.2",
|
||||
"jest-environment-jsdom": "^29.6.2",
|
||||
"jest-transform-pug": "github:drastus/jest-transform-pug",
|
||||
"jest-transform-stub": "^2.0.0",
|
||||
"mini-css-extract-plugin": "^1.2.1",
|
||||
"postcss": "^8.2.15",
|
||||
"postcss-import": "^12.0.1",
|
||||
"postcss-loader": "^4.0.4",
|
||||
"postcss-preset-env": "^6.7.0",
|
||||
"pug": "^3.0.1",
|
||||
"pug-loader": "^2.4.0",
|
||||
"stylelint": "^13.7.2",
|
||||
"stylelint-config-standard": "^20.0.0",
|
||||
"stylelint-webpack-plugin": "^2.1.1",
|
||||
"ts-jest": "^28.0.8",
|
||||
"mini-css-extract-plugin": "^2.7.6",
|
||||
"postcss": "^8.4.28",
|
||||
"postcss-import": "^15.1.0",
|
||||
"postcss-loader": "^7.3.3",
|
||||
"postcss-preset-env": "^9.1.1",
|
||||
"pug": "^3.0.2",
|
||||
"stylelint": "^14.16.1",
|
||||
"stylelint-config-standard": "^29.0.0",
|
||||
"stylelint-webpack-plugin": "^4.1.1",
|
||||
"ts-jest": "^29.1.1",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.0.5",
|
||||
"webpack": "^4.44.2",
|
||||
"webpack-cli": "^4.9.2",
|
||||
"webpack-dev-server": "^4.9.0",
|
||||
"webpack-livereload-plugin": "^2.3.0"
|
||||
"typescript": "^5.1.6",
|
||||
"webpack": "^5.88.2",
|
||||
"webpack-cli": "^5.1.4",
|
||||
"webpack-dev-server": "^4.15.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Chartist, {ChartistStatic, IChartistSvg} from 'chartist';
|
||||
import {BarChart, PieChart} from 'chartist';
|
||||
import {committees, constituencies} from './data';
|
||||
import calculateMandates from './mandates';
|
||||
import constituencyTemplate from './templates/constituency.pug';
|
||||
|
@ -7,8 +7,8 @@ import './styles/styles.css';
|
|||
|
||||
const {location} = window;
|
||||
|
||||
let barChart: ChartistStatic['Bar'];
|
||||
let pieChart: ChartistStatic['Pie'];
|
||||
let barChart: BarChart | null = null;
|
||||
let pieChart: PieChart | null = null;
|
||||
|
||||
export const clearInputs = (): void => {
|
||||
const inputs = document.querySelectorAll<HTMLInputElement>('tr td:nth-child(2) input');
|
||||
|
@ -21,8 +21,8 @@ export const clearResults = (): void => {
|
|||
document.querySelectorAll<HTMLTableCellElement>('tr td:last-child').forEach((td) => {
|
||||
td.innerHTML = '';
|
||||
});
|
||||
barChart.detach();
|
||||
pieChart.detach();
|
||||
if (barChart) barChart.detach();
|
||||
if (pieChart) pieChart.detach();
|
||||
document.getElementById('url')!.innerHTML = '';
|
||||
document.getElementById('support-bar-chart')!.innerHTML = '';
|
||||
document.getElementById('division-pie-chart')!.innerHTML = '';
|
||||
|
@ -66,8 +66,8 @@ const displayBarChart = (support: number[]) => {
|
|||
const chartOptions = {
|
||||
distributeSeries: true,
|
||||
};
|
||||
const chart = new Chartist.Bar('#support-bar-chart', chartData, chartOptions);
|
||||
chart.on('draw', (data: {type: string; element: IChartistSvg}) => {
|
||||
const chart = new BarChart('#support-bar-chart', chartData, chartOptions);
|
||||
chart.on<'draw'>('draw', (data) => {
|
||||
if (data.type === 'bar') {
|
||||
data.element.attr({
|
||||
style: 'stroke-width: 30px',
|
||||
|
@ -97,7 +97,7 @@ const displayPieChart = (mandates: number[]) => {
|
|||
value < 15 ? '' : `${sortedMandates[index].label} ${value}`
|
||||
),
|
||||
};
|
||||
return new Chartist.Pie('#division-pie-chart', chartData, chartOptions);
|
||||
return new PieChart('#division-pie-chart', chartData, chartOptions);
|
||||
};
|
||||
|
||||
const displayConstituencyResults = () => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
@import 'modern-normalize/modern-normalize.css';
|
||||
@import 'chartist/dist/chartist.min.css';
|
||||
@import url('modern-normalize/modern-normalize.css');
|
||||
@import url('chartist/dist/index.css');
|
||||
|
||||
body {
|
||||
color: #333;
|
||||
|
@ -54,7 +54,7 @@ li {
|
|||
fill: white;
|
||||
}
|
||||
|
||||
@media (max-width: 500px) {
|
||||
@media (width <= 500px) {
|
||||
.charts-row {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
import path from 'path';
|
||||
import ESLintPlugin from 'eslint-webpack-plugin';
|
||||
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
||||
import LiveReloadPlugin from 'webpack-livereload-plugin';
|
||||
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
||||
import StyleLintPlugin from 'stylelint-webpack-plugin';
|
||||
|
||||
export default {
|
||||
target: 'web',
|
||||
entry: './src/index.ts',
|
||||
output: {
|
||||
filename: 'bundle.js',
|
||||
|
@ -25,7 +25,7 @@ export default {
|
|||
{
|
||||
test: /\.pug$/,
|
||||
exclude: /node_modules/,
|
||||
use: 'pug-loader',
|
||||
use: '@webdiscus/pug-loader',
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
|
@ -61,8 +61,8 @@ export default {
|
|||
context: path.resolve(__dirname, './src'),
|
||||
files: '**/*.css',
|
||||
}),
|
||||
new LiveReloadPlugin({
|
||||
appendScriptTag: true,
|
||||
}),
|
||||
],
|
||||
devServer: {
|
||||
watchFiles: ['src/**/*'],
|
||||
},
|
||||
};
|
||||
|
|
Ładowanie…
Reference in New Issue