Skip to content

Commit 533f2ac

Browse files
committed
refactor: migrate repo to pnpm
1 parent f918362 commit 533f2ac

File tree

40 files changed

+3001
-3010
lines changed

40 files changed

+3001
-3010
lines changed

.github/workflows/deploy.yml

+4-14
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,14 @@ jobs:
4141
rust-version: stable
4242
components: clippy
4343

44-
- name: Compile Memory lib 🔧
45-
run: |
46-
cd packages/tsprocess
47-
npm install
48-
npm run build
49-
5044
- name: Install Deps 🔧
5145
run: |
52-
npm install -g yarn
53-
yarn install --frozen-lockfile
54-
55-
- name: Compile TS 🔧
56-
run: |
57-
yarn ts:compile
46+
npm install -g pnpm@^8
47+
pnpm install --frozen-lockfile
5848
5949
- name: Build App 🔧
6050
run: |
61-
yarn compile
51+
pnpm run build
6252
6353
# - name: Upload Artifact (Linux)
6454
# if: startsWith( matrix.os, 'ubuntu' )
@@ -79,4 +69,4 @@ jobs:
7969
uses: actions/upload-artifact@v3
8070
with:
8171
name: ${{ matrix.os }}-${{ github.ref_name }}
82-
path: dist/tosu.exe
72+
path: packages/tosu/dist/tosu.exe

README.md

+9-21
Original file line numberDiff line numberDiff line change
@@ -38,53 +38,41 @@ Features Done
3838

3939
## Install
4040

41-
#### Install `yarn` (if you don't have it already)
41+
#### Install `pnpm` (if you don't have it already)
4242

4343
```sh
44-
npm install -g yarn
44+
npm install -g pnpm
4545
```
4646

4747
#### Install dependecies
4848
```sh
49-
yarn install
50-
```
51-
52-
#### Compile Memory lib
53-
54-
```sh
55-
cd packages/tsprocess && npm install && npm run build
49+
pnpm install
5650
```
5751

5852
## Build
5953

60-
#### Install `yarn` (if you don't have it already)
54+
#### Install `pnpm` (if you don't have it already)
6155

6256
```sh
63-
npm install -g yarn
57+
npm install -g pnpm
6458
```
6559

6660
#### Install dependecies (optional)
6761

6862
```sh
69-
yarn install
70-
```
71-
72-
#### Compile TS
73-
74-
```sh
75-
yarn ts:compile
63+
pnpm install
7664
```
7765

78-
#### Build App
66+
#### Compile TS & App
7967

8068
```sh
81-
yarn compile
69+
pnpm run compile
8270
```
8371

8472
## Usage
8573

8674
```sh
87-
yarn run:dev
75+
pnpm run start
8876
```
8977

9078
## Author

package.json

+7-46
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,23 @@
11
{
22
"author": "Mikhail Babynichev",
3-
"name": "tosu",
4-
"version": "1.3.0",
5-
"main": "dist/index.js",
6-
"bin": "dist/index.js",
73
"license": "GPL-3.0",
4+
"version": "1.3.0",
85
"scripts": {
96
"prepare": "husky install",
10-
"ts:run": "ts-node --transpile-only -r tsconfig-paths/register --project tsconfig.json",
11-
"ts:compile": "ncc build src/index.ts -o dist -m -d",
12-
"run:dev": "yarn ts:run src/index.ts",
13-
"compile": "pkg --compress brotli . && yarn ts:run src/postBuild.ts",
7+
"start": "pnpm run -C packages/tosu run:dev",
8+
"build": "pnpm run -C packages/tosu compile",
149
"prettier:fix": "prettier --write \"**/*.{js,jsx,ts,tsx,css,scss}\""
1510
},
16-
"pkg": {
17-
"scripts": "dist/**/*.js",
18-
"assets": [
19-
"dist/**/*.node",
20-
"dist/target/**/*"
21-
],
22-
"targets": [
23-
"node18-win-x64"
24-
],
25-
"outputPath": "dist"
26-
},
2711
"dependencies": {
28-
"@koa/router": "^12.0.0",
29-
"@types/koa": "^2.13.5",
30-
"@vercel/ncc": "^0.36.1",
31-
"dotenv": "^16.0.3",
32-
"find-process": "^1.4.7",
33-
"koa": "^2.14.1",
34-
"koa-mount": "^4.0.0",
35-
"koa-send": "^5.0.1",
36-
"koa-static": "^5.0.0",
37-
"koa-websocket": "^7.0.0",
38-
"osu-catch-stable": "^4.0.0",
39-
"osu-classes": "^3.0.0",
40-
"osu-mania-stable": "^5.0.0",
41-
"osu-parsers": "^4.1.0",
42-
"osu-standard-stable": "^5.0.0",
43-
"osu-taiko-stable": "^5.0.0",
44-
"pkg": "^5.8.0",
45-
"resedit": "^2.0.0",
46-
"rosu-pp": "^0.9.4",
47-
"ts-node": "^10.9.1",
48-
"tsprocess": "file:./packages/tsprocess",
49-
"winston": "^3.8.2"
12+
"@types/node": "^18.14.6",
13+
"tsconfig-paths": "^3.14.2",
14+
"typescript": "^4.9.5"
5015
},
5116
"devDependencies": {
5217
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
53-
"@types/koa__router": "^12.0.0",
54-
"@types/node": "^18.14.6",
5518
"husky": "^8.0.3",
5619
"lint-staged": "^13.2.0",
57-
"prettier": "^2.8.5",
58-
"tsconfig-paths": "^3.14.2",
59-
"typescript": "^4.9.5"
20+
"prettier": "^2.8.5"
6021
},
6122
"lint-staged": {
6223
"**/*.{js,ts}": [

packages/tosu/package.json

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "tosu",
3+
"version": "1.3.0",
4+
"main": "dist/index.js",
5+
"bin": "dist/index.js",
6+
"scripts": {
7+
"ts:run": "ts-node --transpile-only -r tsconfig-paths/register --project tsconfig.json",
8+
"ts:compile": "ncc build src/index.ts -o dist -m -d",
9+
"run:dev": "pnpm run ts:run src/index.ts",
10+
"compile": "pnpm run ts:compile && pkg --compress brotli . && pnpm run ts:run src/postBuild.ts"
11+
},
12+
"pkg": {
13+
"scripts": "dist/**/*.js",
14+
"assets": [
15+
"dist/**/*.node",
16+
"dist/target/**/*"
17+
],
18+
"targets": [
19+
"node18-win-x64"
20+
],
21+
"outputPath": "dist"
22+
},
23+
"dependencies": {
24+
"@types/koa__router": "^12.0.0",
25+
"@koa/router": "^12.0.0",
26+
"@types/koa": "^2.13.5",
27+
"@vercel/ncc": "^0.36.1",
28+
"dotenv": "^16.0.3",
29+
"find-process": "^1.4.7",
30+
"koa": "^2.14.1",
31+
"koa-mount": "^4.0.0",
32+
"koa-send": "^5.0.1",
33+
"koa-static": "^5.0.0",
34+
"koa-websocket": "^7.0.0",
35+
"osu-catch-stable": "^4.0.0",
36+
"osu-classes": "^3.0.0",
37+
"osu-mania-stable": "^5.0.0",
38+
"osu-parsers": "^4.1.0",
39+
"osu-standard-stable": "^5.0.0",
40+
"osu-taiko-stable": "^5.0.0",
41+
"pkg": "^5.8.0",
42+
"resedit": "^2.0.0",
43+
"rosu-pp": "^0.9.4",
44+
"ts-node": "^10.9.1",
45+
"tsprocess": "workspace:*",
46+
"winston": "^3.8.2"
47+
}
48+
}
File renamed without changes.

src/Api/Utils/BuildResult.ts packages/tosu/src/api/utils/buildResult.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
import path from 'path';
22

3-
import { InstancesManager } from '@/Instances/InstancesManager';
4-
import { LeaderboardPlayer as MemoryLeaderboardPlayer } from '@/Instances/Leaderboard';
5-
import { DataRepo } from '@/Services/repo';
6-
import { getOsuModsString } from '@/Utils/osuMods';
7-
import { OsuMods } from '@/Utils/osuMods.types';
3+
import { DataRepo } from '@/entities/DataRepoList';
4+
import { LeaderboardPlayer as MemoryLeaderboardPlayer } from '@/entities/GamePlayData/Leaderboard';
5+
import { InstanceManager } from '@/objects/instanceManager/instanceManager';
6+
import { getOsuModsString } from '@/utils/osuMods';
87

98
import {
109
ApiAnswer,
1110
LeaderboardPlayer,
1211
TourneyIpcClient,
1312
TourneyValues
14-
} from './types';
13+
} from '../types';
1514

1615
const defaultLBPlayer = {
1716
name: '',
@@ -47,7 +46,7 @@ const convertMemoryPlayerToResult = (
4746

4847
export const buildResult = (
4948
service: DataRepo,
50-
instancesManager: InstancesManager
49+
instancesManager: InstanceManager
5150
): ApiAnswer => {
5251
const {
5352
settings,
@@ -242,7 +241,7 @@ export const buildResult = (
242241
};
243242

244243
const buildTourneyData = (
245-
instancesManager: InstancesManager
244+
instancesManager: InstanceManager
246245
): TourneyValues | undefined => {
247246
const osuTourneyManager = Object.values(
248247
instancesManager.osuInstances
@@ -258,7 +257,7 @@ const buildTourneyData = (
258257
const mappedOsuTourneyClients = osuTourneyClients.map<TourneyIpcClient>(
259258
(instance, iterator) => {
260259
const { allTimesData, gamePlayData, tourneyUserProfileData } =
261-
instance.servicesRepo.getServices([
260+
instance.entities.getServices([
262261
'allTimesData',
263262
'gamePlayData',
264263
'tourneyUserProfileData'
@@ -322,8 +321,9 @@ const buildTourneyData = (
322321
}
323322
);
324323

325-
const { tourneyManagerData } =
326-
osuTourneyManager[0].servicesRepo.getServices(['tourneyManagerData']);
324+
const { tourneyManagerData } = osuTourneyManager[0].entities.getServices([
325+
'tourneyManagerData'
326+
]);
327327

328328
return {
329329
manager: {
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/Services/Entities/types.ts packages/tosu/src/entities/AbstractEntity/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { DataRepo } from '../repo';
1+
import { DataRepo } from '../DataRepoList';
22

33
export abstract class AbstractEntity {
44
services: DataRepo;

src/Services/Entities/AllTimesData/index.ts packages/tosu/src/entities/AllTimesData/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { DataRepo } from '@/Services/repo';
1+
import { DataRepo } from '@/entities/DataRepoList';
22
import { wLogger } from '@/logger';
33

4-
import { AbstractEntity } from '../types';
4+
import { AbstractEntity } from '../AbstractEntity';
55

66
export class AllTimesData extends AbstractEntity {
77
Status: number = 0;

src/Services/Entities/BassDensityData/index.ts packages/tosu/src/entities/BassDensityData/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { DataRepo } from '@/Services/repo';
1+
import { DataRepo } from '@/entities/DataRepoList';
22
import { wLogger } from '@/logger';
33

4-
import { AbstractEntity } from '../types';
4+
import { AbstractEntity } from '../AbstractEntity';
55

66
// yep each dto should have class!
77
export class BassDensityData extends AbstractEntity {

src/Services/Entities/BeatmapPpData/index.ts packages/tosu/src/entities/BeatmapPpData/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import { BeatmapDecoder } from 'osu-parsers';
33
import path from 'path';
44
import { Beatmap, Calculator } from 'rosu-pp';
55

6-
import { BeatmapStrains } from '@/Api/Utils/types';
7-
import { DataRepo } from '@/Services/repo';
6+
import { BeatmapStrains } from '@/api/types';
87
import { config } from '@/config';
8+
import { DataRepo } from '@/entities/DataRepoList';
99
import { wLogger } from '@/logger';
1010

11-
import { AbstractEntity } from '../types';
11+
import { AbstractEntity } from '../AbstractEntity';
1212

1313
interface BeatmapPPAcc {
1414
'100': number;

src/Services/repo.ts packages/tosu/src/entities/DataRepoList.ts

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
import { Process } from 'tsprocess/dist/process';
22

3-
import { Bases } from './Bases';
4-
import { AllTimesData } from './Entities/AllTimesData';
5-
import { BassDensityData } from './Entities/BassDensityData';
6-
import { BeatmapPPData } from './Entities/BeatmapPpData';
7-
import { GamePlayData } from './Entities/GamePlayData';
8-
import { MenuData } from './Entities/MenuData';
9-
import { ResultsScreenData } from './Entities/ResultsScreenData';
10-
import { TourneyManagerData } from './Entities/TourneyManagerData';
11-
import { TourneyUserProfileData } from './Entities/TourneyUserProfileData';
3+
import { MemoryBase } from '@/objects/memoryBase';
4+
5+
import { AllTimesData } from './AllTimesData';
6+
import { BassDensityData } from './BassDensityData';
7+
import { BeatmapPPData } from './BeatmapPpData';
8+
import { GamePlayData } from './GamePlayData';
9+
import { MenuData } from './MenuData';
10+
import { ResultsScreenData } from './ResultsScreenData';
1211
import { Settings } from './Settings';
12+
import { TourneyManagerData } from './TourneyManagerData';
13+
import { TourneyUserProfileData } from './TourneyUserProfileData';
1314

1415
export interface DataRepoList {
1516
process: Process;
16-
bases: Bases;
17+
bases: MemoryBase;
1718
settings: Settings;
1819
allTimesData: AllTimesData;
1920
beatmapPpData: BeatmapPPData;

src/Services/Entities/GamePlayData/index.ts packages/tosu/src/entities/GamePlayData/index.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ import path from 'path';
22
import { Beatmap, Calculator } from 'rosu-pp';
33
import { Process } from 'tsprocess/dist/process';
44

5-
import { Leaderboard } from '@/Instances/Leaderboard';
6-
import { DataRepo } from '@/Services/repo';
7-
import { calculateGrade } from '@/Utils/calculateGrade';
8-
import { OsuMods } from '@/Utils/osuMods.types';
9-
import { resolvePassedObjects } from '@/Utils/resolvePassedObjects';
105
import { config } from '@/config';
6+
import { DataRepo } from '@/entities/DataRepoList';
7+
import { Leaderboard } from '@/entities/GamePlayData/Leaderboard';
118
import { wLogger } from '@/logger';
9+
import { calculateGrade } from '@/utils/calculateGrade';
10+
import { OsuMods } from '@/utils/osuMods.types';
11+
import { resolvePassedObjects } from '@/utils/resolvePassedObjects';
1212

13+
import { AbstractEntity } from '../AbstractEntity';
1314
import { MenuData } from '../MenuData';
14-
import { AbstractEntity } from '../types';
1515

1616
export interface KeyOverlay {
1717
K1Pressed: boolean;

src/Services/Entities/MenuData/index.ts packages/tosu/src/entities/MenuData/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { DataRepo } from '@/Services/repo';
1+
import { DataRepo } from '@/entities/DataRepoList';
22
import { wLogger } from '@/logger';
33

4-
import { AbstractEntity } from '../types';
4+
import { AbstractEntity } from '../AbstractEntity';
55

66
export class MenuData extends AbstractEntity {
77
Status: number;

src/Services/Entities/ResultsScreenData/index.ts packages/tosu/src/entities/ResultsScreenData/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { DataRepo } from '@/Services/repo';
2-
import { OsuMods } from '@/Utils/osuMods.types';
1+
import { DataRepo } from '@/entities/DataRepoList';
32
import { wLogger } from '@/logger';
3+
import { OsuMods } from '@/utils/osuMods.types';
44

5-
import { AbstractEntity } from '../types';
5+
import { AbstractEntity } from '../AbstractEntity';
66

77
export class ResultsScreenData extends AbstractEntity {
88
PlayerName: string;
File renamed without changes.

0 commit comments

Comments
 (0)