Skip to content

Commit 5d8de0f

Browse files
Merge pull request #51 from technote-space/release/next-v0.1.14
release: v0.2.0
2 parents aa17211 + 6681e8a commit 5d8de0f

27 files changed

+3694
-3497
lines changed

ThirdPartyNotices.txt

Lines changed: 448 additions & 545 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@technote-space/hello-genetic-algorithm",
3-
"version": "0.1.15",
3+
"version": "0.2.0",
44
"description": "Hello Genetic Algorithm",
55
"keywords": [
66
"genetic algorithm"
@@ -24,60 +24,60 @@
2424
"check-types": "tsc",
2525
"clean": "rm -rf node_modules* build*",
2626
"clear": "rm -rf build*",
27-
"dev": "yarn clear && NODE_ENV=development webpack --progress --config webpack.dev.js",
27+
"dev": "yarn clear && NODE_ENV=development webpack --progress --config webpack.dev.js",
2828
"kill": "lsof -i:$npm_package_port -t | xargs kill -9",
2929
"lint": "eslint './src/**/*.{ts,js,jsx}' --cache",
3030
"lint:fix": "eslint './src/**/*.{ts,js,jsx}' --fix",
31-
"update": "npx npm-check-updates -u && yarn install && yarn upgrade && yarn audit",
32-
"watch": "yarn kill && NODE_ENV=none DEV_SERVER_PORT=$npm_package_port webpack serve"
31+
"serve": "yarn kill && NODE_ENV=none DEV_SERVER_PORT=$npm_package_port webpack serve",
32+
"update": "npm_config_yes=true npx npm-check-updates -u --timeout 100000 && yarn install && yarn upgrade && yarn audit"
3333
},
3434
"dependencies": {
35-
"@material-ui/core": "^4.12.3",
36-
"@technote-space/ga-framework": "^0.14.19",
37-
"@technote-space/genetic-algorithms-js": "^0.8.23",
38-
"axios": "^0.21.1",
39-
"encoding-japanese": "^1.0.30",
35+
"@mui/material": "^5.11.2",
36+
"@technote-space/ga-framework": "^0.15.1",
37+
"@technote-space/genetic-algorithms-js": "^0.8.27",
38+
"axios": "^1.2.1",
39+
"encoding-japanese": "^2.0.0",
4040
"fast-levenshtein": "^3.0.0",
4141
"file-saver": "^2.0.5",
42-
"react": "^17.0.2",
43-
"react-dom": "^17.0.2",
42+
"react": "^18.2.0",
43+
"react-dom": "^18.2.0",
4444
"sprintf-js": "^1.1.2"
4545
},
4646
"devDependencies": {
47-
"@babel/core": "^7.15.0",
48-
"@babel/plugin-proposal-class-properties": "^7.14.5",
49-
"@babel/plugin-proposal-object-rest-spread": "^7.14.7",
50-
"@babel/plugin-transform-react-inline-elements": "^7.14.5",
51-
"@babel/preset-env": "^7.15.0",
52-
"@babel/preset-flow": "^7.14.5",
53-
"@babel/preset-react": "^7.14.5",
54-
"@babel/preset-typescript": "^7.15.0",
55-
"@commitlint/cli": "^13.1.0",
56-
"@commitlint/config-conventional": "^13.1.0",
57-
"@types/encoding-japanese": "^1.0.18",
47+
"@babel/core": "^7.20.7",
48+
"@babel/plugin-proposal-class-properties": "^7.18.6",
49+
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
50+
"@babel/plugin-transform-react-inline-elements": "^7.18.6",
51+
"@babel/preset-env": "^7.20.2",
52+
"@babel/preset-flow": "^7.18.6",
53+
"@babel/preset-react": "^7.18.6",
54+
"@babel/preset-typescript": "^7.18.6",
55+
"@commitlint/cli": "^17.3.0",
56+
"@commitlint/config-conventional": "^17.3.0",
57+
"@types/encoding-japanese": "^2.0.1",
5858
"@types/fast-levenshtein": "^0.0.2",
59-
"@types/file-saver": "^2.0.3",
60-
"@typescript-eslint/eslint-plugin": "^4.29.3",
61-
"@typescript-eslint/parser": "^4.29.3",
62-
"babel-loader": "^8.2.2",
59+
"@types/file-saver": "^2.0.5",
60+
"@typescript-eslint/eslint-plugin": "^5.47.1",
61+
"@typescript-eslint/parser": "^5.47.1",
62+
"babel-loader": "^9.1.0",
6363
"babel-plugin-react-html-attrs": "^3.0.5",
6464
"babel-plugin-transform-class-properties": "^6.24.1",
65-
"copy-webpack-plugin": "^9.0.1",
66-
"eslint": "^7.32.0",
67-
"eslint-plugin-react": "^7.24.0",
68-
"eslint-plugin-react-hooks": "^4.2.0",
65+
"copy-webpack-plugin": "^11.0.0",
66+
"eslint": "^8.30.0",
67+
"eslint-plugin-react": "^7.31.11",
68+
"eslint-plugin-react-hooks": "^4.6.0",
6969
"file-loader": "^6.2.0",
70-
"html-loader": "^2.1.2",
71-
"html-webpack-plugin": "^5.3.2",
72-
"husky": "^7.0.2",
70+
"html-loader": "^4.2.0",
71+
"html-webpack-plugin": "^5.5.0",
72+
"husky": "^8.0.2",
7373
"license-checker-webpack-plugin": "^0.2.1",
74-
"lint-staged": "^11.1.2",
75-
"terser-webpack-plugin": "^5.1.4",
76-
"typescript": "^4.4.2",
77-
"webpack": "^5.51.1",
78-
"webpack-cli": "^4.8.0",
79-
"webpack-dev-server": "^4.0.0",
74+
"lint-staged": "^13.1.0",
75+
"terser-webpack-plugin": "^5.3.6",
76+
"typescript": "^4.9.4",
77+
"webpack": "^5.75.0",
78+
"webpack-cli": "^5.0.1",
79+
"webpack-dev-server": "^4.11.1",
8080
"webpack-merge": "^5.8.0"
8181
},
82-
"port": 5000
82+
"port": 5001
8383
}

src/GeneticAlgorithm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Ga} from './logic/ga/Algorithm/Ga';
1+
import { Ga } from './logic/ga/Algorithm/Ga';
22

33
global['GeneticAlgorithm'] = class GeneticAlgorithm extends Ga {
44
};

src/app/components/License.tsx

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
1-
import React, {useMemo, useCallback, FC} from 'react';
1+
import React, { useMemo, useCallback, FC } from 'react';
22
import axios from 'axios';
3-
import {saveAs} from 'file-saver';
4-
import {makeStyles, createStyles} from '@material-ui/core/styles';
3+
import { saveAs } from 'file-saver';
4+
import Box from '@mui/material/Box';
55
import license from '../../../ThirdPartyNotices.txt';
66

7-
const useStyles = makeStyles(() => createStyles({
8-
wrap: {
9-
background: '#555',
10-
marginTop: 10,
11-
padding: 5,
12-
textAlign: 'center',
13-
},
14-
link: {
15-
cursor: 'pointer',
16-
},
17-
}));
18-
197
const License: FC = () => {
20-
const classes = useStyles();
218
const handleClick = useCallback(async() => {
229
const res = await axios.get(license, {
2310
responseType: 'blob',
@@ -26,9 +13,11 @@ const License: FC = () => {
2613
saveAs(blob, 'ThirdPartyNotices.txt');
2714
}, []);
2815

29-
return useMemo(() => <div className={classes.wrap}>
30-
<a onClick={handleClick} className={classes.link}>License</a>
31-
</div>, [classes]);
16+
return useMemo(() => <Box sx={{ background: '#555', marginTop: '10px', padding: '5px', textAlign: 'center' }}>
17+
<Box sx={{ cursor: 'pointer' }}>
18+
<a onClick={handleClick}>License</a>
19+
</Box>
20+
</Box>, []);
3221
};
3322

3423
export default License;

src/app/components/Statistics.tsx

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,21 @@
1-
import React, {useMemo, FC} from 'react';
2-
import {makeStyles, createStyles} from '@material-ui/core/styles';
3-
import {useStoreContext} from '@technote-space/ga-framework';
4-
import {sprintf} from 'sprintf-js';
5-
6-
const useStyles = makeStyles(() => createStyles({
7-
wrap: {
8-
background: '#555',
9-
marginTop: 10,
10-
padding: 5,
11-
},
12-
param: {
13-
margin: 5,
14-
},
15-
}));
1+
import React, { useMemo, FC } from 'react';
2+
import { useStoreContext } from '@technote-space/ga-framework';
3+
import { sprintf } from 'sprintf-js';
4+
import Box from '@mui/material/Box';
165

176
const Statistics: FC = () => {
18-
const {store: {logic: {fitness, progress}}} = useStoreContext();
19-
const classes = useStyles();
7+
const { store: { logic: { fitness, progress } } } = useStoreContext();
208

21-
return useMemo(() => <div className={classes.wrap}>
9+
return useMemo(() => <Box sx={{ background: '#555', marginTop: '10px', padding: '5px' }}>
2210
<div>
23-
<div className={classes.param}>
11+
<Box sx={{ margin: '5px' }}>
2412
Progress: {sprintf('%.4f', progress)}
25-
</div>
26-
<div className={classes.param}>
13+
</Box>
14+
<Box sx={{ margin: '5px' }}>
2715
Fitness: {sprintf('%.3f', fitness)}
28-
</div>
16+
</Box>
2917
</div>
30-
</div>, [progress, classes]);
18+
</Box>, [progress]);
3119
};
3220

3321
export default Statistics;

src/app/pages/ListPage.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
import React, {FC} from 'react';
2-
import {List, useStoreContext} from '@technote-space/ga-framework';
3-
import {TableCell} from '@material-ui/core';
4-
import {sprintf} from 'sprintf-js';
1+
import React, { FC } from 'react';
2+
import { List, useStoreContext } from '@technote-space/ga-framework';
3+
import { TableCell } from '@mui/material';
4+
import { sprintf } from 'sprintf-js';
55

66
const ListPage: FC = () => {
7-
const {store: {logic: {population}}} = useStoreContext();
7+
const { store: { logic: { population } } } = useStoreContext();
88

99
return <List
1010
population={population}
1111
render={row => <>
12-
<TableCell component="th" scope="row" style={{width: 160}}>
12+
<TableCell component="th" scope="row" style={{ width: 160 }}>
1313
{sprintf('%.3f', row.fitness)}
1414
</TableCell>
1515
<TableCell>
1616
{row.value}
17-
</TableCell></>}
17+
</TableCell>
18+
</>}
1819
defaultPerPage={30}
1920
/>;
2021
};

src/app/pages/TimelinePage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import React, {FC} from 'react';
2-
import {Timeline, useStoreContext} from '@technote-space/ga-framework';
1+
import React, { FC } from 'react';
2+
import { Timeline, useStoreContext } from '@technote-space/ga-framework';
33

44
const TimelinePage: FC = () => {
5-
const {store: {histories}} = useStoreContext();
5+
const { store: { histories } } = useStoreContext();
66

77
return <Timeline data={histories}/>;
88
};

src/global.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module '*.txt' {
2+
const value: string;
3+
export default value;
4+
}

src/index.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React from 'react';
2-
import ReactDOM from 'react-dom';
3-
import {GaFramework} from '@technote-space/ga-framework';
2+
import { createRoot } from 'react-dom/client';
3+
import { GaFramework } from '@technote-space/ga-framework';
44
import {
55
ListPage,
66
TimelinePage,
77
} from './app/pages';
8-
import {Statistics, License} from './app/components';
8+
import { Statistics, License } from './app/components';
99

1010
const resultReducer = (store, result) => {
1111
return {
@@ -69,7 +69,7 @@ const options = {
6969
},
7070
},
7171
controllerListener: (dispatch, result) => {
72-
dispatch({type: 'RESULT', result});
72+
dispatch({ type: 'RESULT', result });
7373
},
7474
getWorkerContext: async store => {
7575
return {
@@ -88,7 +88,5 @@ const options = {
8888
},
8989
};
9090

91-
ReactDOM.render(
92-
<GaFramework options={options}/>,
93-
document.getElementById('root'),
94-
);
91+
const root = createRoot(document.getElementById('root'));
92+
root.render(<GaFramework options={options}/>);

src/logic/ga/Algorithm/Ga.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import {GeneticAlgorithmBase} from '@technote-space/ga-framework/dist/app/logic/Algorithm';
2-
import {ITermination, IMigration} from '@technote-space/genetic-algorithms-js';
3-
import {Genotype} from '../Genotype';
4-
import {Phenotype} from '../Phenotype';
5-
import {Termination} from '../Termination';
6-
import {Migration} from '../Migration';
7-
import {UpdateResult, Context} from '../../types';
8-
import {MggIsland} from '../Island/MggIsland';
9-
import {CulturalIsland} from '../Island/CulturalIsland';
10-
import {GaIsland} from '../Island/GaIsland';
11-
import {TestData} from '../TestData/TestData';
1+
import { GeneticAlgorithmBase } from '@technote-space/ga-framework/dist/app/logic/Algorithm';
2+
import { ITermination, IMigration } from '@technote-space/genetic-algorithms-js';
3+
import { Genotype } from '../Genotype';
4+
import { Phenotype } from '../Phenotype';
5+
import { Termination } from '../Termination';
6+
import { Migration } from '../Migration';
7+
import { UpdateResult, Context } from '../../types';
8+
import { MggIsland } from '../Island/MggIsland';
9+
import { CulturalIsland } from '../Island/CulturalIsland';
10+
import { GaIsland } from '../Island/GaIsland';
11+
import { TestData } from '../TestData/TestData';
1212

1313
export abstract class Ga extends GeneticAlgorithmBase<UpdateResult> {
1414
private readonly _islands: Array<GaIsland>;

0 commit comments

Comments
 (0)