Skip to content

Commit

Permalink
refactor: migrate repo to pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
KotRikD committed Nov 21, 2023
1 parent f918362 commit 533f2ac
Show file tree
Hide file tree
Showing 40 changed files with 3,001 additions and 3,010 deletions.
18 changes: 4 additions & 14 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,14 @@ jobs:
rust-version: stable
components: clippy

- name: Compile Memory lib 🔧
run: |
cd packages/tsprocess
npm install
npm run build
- name: Install Deps 🔧
run: |
npm install -g yarn
yarn install --frozen-lockfile
- name: Compile TS 🔧
run: |
yarn ts:compile
npm install -g pnpm@^8
pnpm install --frozen-lockfile
- name: Build App 🔧
run: |
yarn compile
pnpm run build
# - name: Upload Artifact (Linux)
# if: startsWith( matrix.os, 'ubuntu' )
Expand All @@ -79,4 +69,4 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-${{ github.ref_name }}
path: dist/tosu.exe
path: packages/tosu/dist/tosu.exe
30 changes: 9 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,53 +38,41 @@ Features Done

## Install

#### Install `yarn` (if you don't have it already)
#### Install `pnpm` (if you don't have it already)

```sh
npm install -g yarn
npm install -g pnpm
```

#### Install dependecies
```sh
yarn install
```

#### Compile Memory lib

```sh
cd packages/tsprocess && npm install && npm run build
pnpm install
```

## Build

#### Install `yarn` (if you don't have it already)
#### Install `pnpm` (if you don't have it already)

```sh
npm install -g yarn
npm install -g pnpm
```

#### Install dependecies (optional)

```sh
yarn install
```

#### Compile TS

```sh
yarn ts:compile
pnpm install
```

#### Build App
#### Compile TS & App

```sh
yarn compile
pnpm run compile
```

## Usage

```sh
yarn run:dev
pnpm run start
```

## Author
Expand Down
53 changes: 7 additions & 46 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,62 +1,23 @@
{
"author": "Mikhail Babynichev",
"name": "tosu",
"version": "1.3.0",
"main": "dist/index.js",
"bin": "dist/index.js",
"license": "GPL-3.0",
"version": "1.3.0",
"scripts": {
"prepare": "husky install",
"ts:run": "ts-node --transpile-only -r tsconfig-paths/register --project tsconfig.json",
"ts:compile": "ncc build src/index.ts -o dist -m -d",
"run:dev": "yarn ts:run src/index.ts",
"compile": "pkg --compress brotli . && yarn ts:run src/postBuild.ts",
"start": "pnpm run -C packages/tosu run:dev",
"build": "pnpm run -C packages/tosu compile",
"prettier:fix": "prettier --write \"**/*.{js,jsx,ts,tsx,css,scss}\""
},
"pkg": {
"scripts": "dist/**/*.js",
"assets": [
"dist/**/*.node",
"dist/target/**/*"
],
"targets": [
"node18-win-x64"
],
"outputPath": "dist"
},
"dependencies": {
"@koa/router": "^12.0.0",
"@types/koa": "^2.13.5",
"@vercel/ncc": "^0.36.1",
"dotenv": "^16.0.3",
"find-process": "^1.4.7",
"koa": "^2.14.1",
"koa-mount": "^4.0.0",
"koa-send": "^5.0.1",
"koa-static": "^5.0.0",
"koa-websocket": "^7.0.0",
"osu-catch-stable": "^4.0.0",
"osu-classes": "^3.0.0",
"osu-mania-stable": "^5.0.0",
"osu-parsers": "^4.1.0",
"osu-standard-stable": "^5.0.0",
"osu-taiko-stable": "^5.0.0",
"pkg": "^5.8.0",
"resedit": "^2.0.0",
"rosu-pp": "^0.9.4",
"ts-node": "^10.9.1",
"tsprocess": "file:./packages/tsprocess",
"winston": "^3.8.2"
"@types/node": "^18.14.6",
"tsconfig-paths": "^3.14.2",
"typescript": "^4.9.5"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
"@types/koa__router": "^12.0.0",
"@types/node": "^18.14.6",
"husky": "^8.0.3",
"lint-staged": "^13.2.0",
"prettier": "^2.8.5",
"tsconfig-paths": "^3.14.2",
"typescript": "^4.9.5"
"prettier": "^2.8.5"
},
"lint-staged": {
"**/*.{js,ts}": [
Expand Down
48 changes: 48 additions & 0 deletions packages/tosu/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "tosu",
"version": "1.3.0",
"main": "dist/index.js",
"bin": "dist/index.js",
"scripts": {
"ts:run": "ts-node --transpile-only -r tsconfig-paths/register --project tsconfig.json",
"ts:compile": "ncc build src/index.ts -o dist -m -d",
"run:dev": "pnpm run ts:run src/index.ts",
"compile": "pnpm run ts:compile && pkg --compress brotli . && pnpm run ts:run src/postBuild.ts"
},
"pkg": {
"scripts": "dist/**/*.js",
"assets": [
"dist/**/*.node",
"dist/target/**/*"
],
"targets": [
"node18-win-x64"
],
"outputPath": "dist"
},
"dependencies": {
"@types/koa__router": "^12.0.0",
"@koa/router": "^12.0.0",
"@types/koa": "^2.13.5",
"@vercel/ncc": "^0.36.1",
"dotenv": "^16.0.3",
"find-process": "^1.4.7",
"koa": "^2.14.1",
"koa-mount": "^4.0.0",
"koa-send": "^5.0.1",
"koa-static": "^5.0.0",
"koa-websocket": "^7.0.0",
"osu-catch-stable": "^4.0.0",
"osu-classes": "^3.0.0",
"osu-mania-stable": "^5.0.0",
"osu-parsers": "^4.1.0",
"osu-standard-stable": "^5.0.0",
"osu-taiko-stable": "^5.0.0",
"pkg": "^5.8.0",
"resedit": "^2.0.0",
"rosu-pp": "^0.9.4",
"ts-node": "^10.9.1",
"tsprocess": "workspace:*",
"winston": "^3.8.2"
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import path from 'path';

import { InstancesManager } from '@/Instances/InstancesManager';
import { LeaderboardPlayer as MemoryLeaderboardPlayer } from '@/Instances/Leaderboard';
import { DataRepo } from '@/Services/repo';
import { getOsuModsString } from '@/Utils/osuMods';
import { OsuMods } from '@/Utils/osuMods.types';
import { DataRepo } from '@/entities/DataRepoList';
import { LeaderboardPlayer as MemoryLeaderboardPlayer } from '@/entities/GamePlayData/Leaderboard';
import { InstanceManager } from '@/objects/instanceManager/instanceManager';
import { getOsuModsString } from '@/utils/osuMods';

import {
ApiAnswer,
LeaderboardPlayer,
TourneyIpcClient,
TourneyValues
} from './types';
} from '../types';

const defaultLBPlayer = {
name: '',
Expand Down Expand Up @@ -47,7 +46,7 @@ const convertMemoryPlayerToResult = (

export const buildResult = (
service: DataRepo,
instancesManager: InstancesManager
instancesManager: InstanceManager
): ApiAnswer => {
const {
settings,
Expand Down Expand Up @@ -242,7 +241,7 @@ export const buildResult = (
};

const buildTourneyData = (
instancesManager: InstancesManager
instancesManager: InstanceManager
): TourneyValues | undefined => {
const osuTourneyManager = Object.values(
instancesManager.osuInstances
Expand All @@ -258,7 +257,7 @@ const buildTourneyData = (
const mappedOsuTourneyClients = osuTourneyClients.map<TourneyIpcClient>(
(instance, iterator) => {
const { allTimesData, gamePlayData, tourneyUserProfileData } =
instance.servicesRepo.getServices([
instance.entities.getServices([
'allTimesData',
'gamePlayData',
'tourneyUserProfileData'
Expand Down Expand Up @@ -322,8 +321,9 @@ const buildTourneyData = (
}
);

const { tourneyManagerData } =
osuTourneyManager[0].servicesRepo.getServices(['tourneyManagerData']);
const { tourneyManagerData } = osuTourneyManager[0].entities.getServices([
'tourneyManagerData'
]);

return {
manager: {
Expand Down
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataRepo } from '../repo';
import { DataRepo } from '../DataRepoList';

export abstract class AbstractEntity {
services: DataRepo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DataRepo } from '@/Services/repo';
import { DataRepo } from '@/entities/DataRepoList';
import { wLogger } from '@/logger';

import { AbstractEntity } from '../types';
import { AbstractEntity } from '../AbstractEntity';

export class AllTimesData extends AbstractEntity {
Status: number = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DataRepo } from '@/Services/repo';
import { DataRepo } from '@/entities/DataRepoList';
import { wLogger } from '@/logger';

import { AbstractEntity } from '../types';
import { AbstractEntity } from '../AbstractEntity';

// yep each dto should have class!
export class BassDensityData extends AbstractEntity {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { BeatmapDecoder } from 'osu-parsers';
import path from 'path';
import { Beatmap, Calculator } from 'rosu-pp';

import { BeatmapStrains } from '@/Api/Utils/types';
import { DataRepo } from '@/Services/repo';
import { BeatmapStrains } from '@/api/types';
import { config } from '@/config';
import { DataRepo } from '@/entities/DataRepoList';
import { wLogger } from '@/logger';

import { AbstractEntity } from '../types';
import { AbstractEntity } from '../AbstractEntity';

interface BeatmapPPAcc {
'100': number;
Expand Down
21 changes: 11 additions & 10 deletions src/Services/repo.ts → packages/tosu/src/entities/DataRepoList.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import { Process } from 'tsprocess/dist/process';

import { Bases } from './Bases';
import { AllTimesData } from './Entities/AllTimesData';
import { BassDensityData } from './Entities/BassDensityData';
import { BeatmapPPData } from './Entities/BeatmapPpData';
import { GamePlayData } from './Entities/GamePlayData';
import { MenuData } from './Entities/MenuData';
import { ResultsScreenData } from './Entities/ResultsScreenData';
import { TourneyManagerData } from './Entities/TourneyManagerData';
import { TourneyUserProfileData } from './Entities/TourneyUserProfileData';
import { MemoryBase } from '@/objects/memoryBase';

import { AllTimesData } from './AllTimesData';
import { BassDensityData } from './BassDensityData';
import { BeatmapPPData } from './BeatmapPpData';
import { GamePlayData } from './GamePlayData';
import { MenuData } from './MenuData';
import { ResultsScreenData } from './ResultsScreenData';
import { Settings } from './Settings';
import { TourneyManagerData } from './TourneyManagerData';
import { TourneyUserProfileData } from './TourneyUserProfileData';

export interface DataRepoList {
process: Process;
bases: Bases;
bases: MemoryBase;
settings: Settings;
allTimesData: AllTimesData;
beatmapPpData: BeatmapPPData;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import path from 'path';
import { Beatmap, Calculator } from 'rosu-pp';
import { Process } from 'tsprocess/dist/process';

import { Leaderboard } from '@/Instances/Leaderboard';
import { DataRepo } from '@/Services/repo';
import { calculateGrade } from '@/Utils/calculateGrade';
import { OsuMods } from '@/Utils/osuMods.types';
import { resolvePassedObjects } from '@/Utils/resolvePassedObjects';
import { config } from '@/config';
import { DataRepo } from '@/entities/DataRepoList';
import { Leaderboard } from '@/entities/GamePlayData/Leaderboard';
import { wLogger } from '@/logger';
import { calculateGrade } from '@/utils/calculateGrade';
import { OsuMods } from '@/utils/osuMods.types';
import { resolvePassedObjects } from '@/utils/resolvePassedObjects';

import { AbstractEntity } from '../AbstractEntity';
import { MenuData } from '../MenuData';
import { AbstractEntity } from '../types';

export interface KeyOverlay {
K1Pressed: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DataRepo } from '@/Services/repo';
import { DataRepo } from '@/entities/DataRepoList';
import { wLogger } from '@/logger';

import { AbstractEntity } from '../types';
import { AbstractEntity } from '../AbstractEntity';

export class MenuData extends AbstractEntity {
Status: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { DataRepo } from '@/Services/repo';
import { OsuMods } from '@/Utils/osuMods.types';
import { DataRepo } from '@/entities/DataRepoList';
import { wLogger } from '@/logger';
import { OsuMods } from '@/utils/osuMods.types';

import { AbstractEntity } from '../types';
import { AbstractEntity } from '../AbstractEntity';

export class ResultsScreenData extends AbstractEntity {
PlayerName: string;
Expand Down
File renamed without changes.
Loading

0 comments on commit 533f2ac

Please sign in to comment.