Skip to content

Commit

Permalink
some quality of life improvements
Browse files Browse the repository at this point in the history
- Replaced bluebird promise with regular Node.js Promise
- Removed deasync, i believe that package is no longer used?
- Updated README.md
- Fixed error in console about i18n "wait"
- Added steps to check webpack bundle size
  • Loading branch information
mve committed Oct 2, 2023
1 parent b0d1c12 commit 4814c2a
Show file tree
Hide file tree
Showing 6 changed files with 1,433 additions and 1,382 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
/node_modules
/npm-debug.log
/.DS_Store

# Scraped data
/src/data/car-class.json
/src/data/cars.json
/src/data/season.json
/src/data/tracks.json
/src/data/contributors.json

.idea
*.css.flow
*.scss.flow
Expand All @@ -15,7 +18,6 @@ coverage
.DS_Store

dist/*
# !.gitignore
!dist/static/
!dist/favicon.ico

Expand All @@ -25,3 +27,6 @@ cookie.txt

# Local Netlify folder
.netlify

# Webpack stats
stats.json
52 changes: 44 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,60 @@
[![codecov](https://codecov.io/gh/tmoitie/iRacing-week-planner/branch/master/graph/badge.svg?token=LZCUjPa0PU)](https://codecov.io/gh/tmoitie/iRacing-week-planner)

### Scrape
<br />
<div align="center">

It needs live iRacing data to work - this can be downloaded with your iRacing credentials
<h3 align="center">iRacing Week Planner</h3>

```
[email protected] IWP_PASSWORD=yourpassword yarn scrapeData
yarn debugRaces
<p align="center">
<a href="https://iracing-week-planner.tmo.lol/">Visit website</a>
<br />
<br />
<a href="https://github.com/tmoitie/iRacing-week-planner/issues">Report Bug</a>
·
<a href="https://github.com/tmoitie/iRacing-week-planner/issues">Request Feature</a>
</p>
</div>

## Getting Started

### Install dependencies

```bash
yarn install
```

### Scrape data

### Editing
It needs live iRacing data to work - this can be downloaded with your iRacing credentials

```bash
IWP_USERNAME='[email protected]' IWP_PASSWORD='yourpassword' yarn scrapeData
yarn debugRaces
```

### Starting the project

```bash
yarn start
open http://localhost:3000
```

### Updating for the next season
## Updating for the next season

Because this scrapes the data from the iRacing website, the tool can only be updated for the new season once it is
Because this scrapes the data from the iRacing website, the tool can only be updated for the new season once it is
published on the iRacing website. As such the planner won't be updated until the turn of the season, typically
within a few hours of the data going live - Tuesday 1am UTC on the first week of the season.

## Other information

### Inspect webpack bundle size

You can view the bundle size by running the following commands:

```bash
webpack --json > stats.json
```

```bash
yarn webpack-bundle-analyzer stats.json
```
11 changes: 3 additions & 8 deletions build/scrape.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
import Promise from 'bluebird';
import fs from 'fs';
import { writeFile } from 'fs/promises';
import path from 'path';
import { auth } from './api/iracingClient';
import getContributors from './api/getContributors';
import getCars from './api/getCars';
import getTracks from './api/getTracks';
import getSeason from './api/getSeason';

const writeFile = Promise.promisify(fs.writeFile);

(async () => {
const username = process.env.IWP_USERNAME || 'test';
const password = process.env.IWP_PASSWORD || 'test';

await auth(username, password);

const tracks = await getTracks();
await writeFile(
path.join(__dirname, '../src/data/tracks.json'),
JSON.stringify(tracks, null, 2),
);

await writeFile(path.join(__dirname, '../src/data/tracks.json'), JSON.stringify(tracks, null, 2));

const cars = await getCars();
await writeFile(
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"axios": "^0.27.2",
"babel-loader": "^8.1.0",
"babel-plugin-jest-hoist": "^29.0.2",
"bluebird": "^3.7.2",
"bootstrap-sass": "^3.3.6",
"classnames": "^2.2.6",
"cli-table": "^0.3.1",
Expand All @@ -54,7 +53,6 @@
"css-loader": "^6.5.1",
"css-minimizer-webpack-plugin": "^4.0.0",
"css-modules-flow-types-loader": "^2.0.0",
"deasync": "^0.1.28",
"enzyme": "^3.11.0",
"es5-shim": "^4.5.14",
"file-loader": "^6.0.0",
Expand All @@ -63,7 +61,7 @@
"html-webpack-plugin": "^5.5.0",
"html5shiv": "^3.7.3",
"http-cookie-agent": "^4.0.2",
"i18next": "^21.6.0",
"i18next": "^21.10.0",
"i18next-browser-languagedetector": "^6.0.1",
"ignore-styles": "^5.0.1",
"lodash.debounce": "^4.0.8",
Expand All @@ -84,7 +82,7 @@
"react-dom": "^17.0.2",
"react-gtm-module": "^2.0.11",
"react-hot-loader": "^4.12.21",
"react-i18next": "^11.7.2",
"react-i18next": "^11.18.6",
"react-modal": "^3.11.2",
"react-redux": "^7.2.1",
"redux": "^4.0.5",
Expand Down Expand Up @@ -130,6 +128,7 @@
"redux-mock-store": "^1.5.4",
"regenerator-runtime": "^0.13.7",
"snapshot-diff": "^0.9.0",
"webpack-bundle-analyzer": "^4.9.1",
"webpack-dev-server": "^4.6.0"
}
}
9 changes: 1 addition & 8 deletions src/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,9 @@ i18n
supportedLngs: Object.keys(languages),
interpolation: {
escapeValue: false,
// format: (value, format) => {
// if (value instanceof Date) {
// return moment(value).format(format);
// }

// return value;
// },
},
react: {
wait: true,
useSuspense: true,
},
});

Expand Down
Loading

0 comments on commit 4814c2a

Please sign in to comment.