osu-stable-db 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -23
- package/dist/node.d.mts +4 -1
- package/dist/node.mjs +10 -1
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -55,13 +55,6 @@ const collectionDatabase: CollectionDatabase = {
|
|
|
55
55
|
const collectionBytes = writeCollectionDatabase(collectionDatabase)
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
Main entry exports:
|
|
59
|
-
|
|
60
|
-
- All public types and constants
|
|
61
|
-
- readOsuDatabase and writeOsuDatabase
|
|
62
|
-
- readCollectionDatabase and writeCollectionDatabase
|
|
63
|
-
- readScoresDatabase and writeScoresDatabase
|
|
64
|
-
|
|
65
58
|
## Node Usage
|
|
66
59
|
|
|
67
60
|
Use the Node subpath when you want to work with a full osu! folder or with direct file reads and writes through node:fs/promises.
|
|
@@ -71,7 +64,8 @@ import {
|
|
|
71
64
|
OsuFolder,
|
|
72
65
|
} from 'osu-stable-db/node'
|
|
73
66
|
|
|
74
|
-
const osuFolder = new OsuFolder('C:/
|
|
67
|
+
const osuFolder = new OsuFolder('C:/osu!')
|
|
68
|
+
|
|
75
69
|
const osuDatabase = await osuFolder.readOsuDatabase()
|
|
76
70
|
const scoresDatabase = await osuFolder.readScoresDatabase()
|
|
77
71
|
|
|
@@ -106,23 +100,13 @@ This project is 100% AI-generated.
|
|
|
106
100
|
|
|
107
101
|
Committed minimal fixtures live in [tests/files](tests/files).
|
|
108
102
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
- [tests/files/local](tests/files/local)
|
|
112
|
-
- [tests/files/local/osu!](tests/files/local/osu!) via a directory link created by the package script below
|
|
103
|
+
To run tests and local scripts against your real osu! installation, set this in [.env](.env):
|
|
113
104
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
- parse them
|
|
117
|
-
- verify byte-for-byte round-trip for osu!.db, collection.db, and scores.db
|
|
118
|
-
|
|
119
|
-
To link your real local osu! folder into the workspace on Windows, run:
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
pnpm run local:link -- "C:\\path\\to\\osu!"
|
|
105
|
+
```dotenv
|
|
106
|
+
OSU_STABLE_DIR=C:/osu!
|
|
123
107
|
```
|
|
124
108
|
|
|
125
|
-
|
|
109
|
+
When OSU_STABLE_DIR is set, local validation reads your real database files and verifies byte-for-byte round-trip for osu!.db, collection.db, and scores.db.
|
|
126
110
|
|
|
127
111
|
You can also generate a local inspection report for a specific beatmap identifier with:
|
|
128
112
|
|
|
@@ -145,7 +129,7 @@ pnpm run build
|
|
|
145
129
|
|
|
146
130
|
## Notes On Validation
|
|
147
131
|
|
|
148
|
-
Local validation also passes against private real-world database files
|
|
132
|
+
Local validation also passes against private real-world database files referenced by OSU_STABLE_DIR:
|
|
149
133
|
|
|
150
134
|
- osu!.db: 58,295,932 bytes, 72,038 beatmaps
|
|
151
135
|
- collection.db: 195,402 bytes, 11 collections, 5,743 stored beatmap references
|
package/dist/node.d.mts
CHANGED
|
@@ -2,6 +2,9 @@ import { b as ScoresDatabase, m as OsuDatabase, n as CollectionDatabase, t as Be
|
|
|
2
2
|
|
|
3
3
|
//#region src/node.d.ts
|
|
4
4
|
type DatabaseFilePath = string | URL;
|
|
5
|
+
declare const OSU_STABLE_DIR_ENV_VAR = "OSU_STABLE_DIR";
|
|
6
|
+
declare function getConfiguredOsuFolderPath(): string | null;
|
|
7
|
+
declare function getConfiguredOsuFolder(): OsuFolder | null;
|
|
5
8
|
declare function readOsuDatabaseFile(path: DatabaseFilePath): Promise<OsuDatabase>;
|
|
6
9
|
declare function writeOsuDatabaseFile(path: DatabaseFilePath, database: OsuDatabase): Promise<void>;
|
|
7
10
|
declare function readCollectionDatabaseFile(path: DatabaseFilePath): Promise<CollectionDatabase>;
|
|
@@ -24,4 +27,4 @@ declare class OsuFolder {
|
|
|
24
27
|
getOsrFilePath(score: ScoreEntry): string;
|
|
25
28
|
}
|
|
26
29
|
//#endregion
|
|
27
|
-
export { DatabaseFilePath, OsuFolder, readCollectionDatabaseFile, readOsuDatabaseFile, readScoresDatabaseFile, writeCollectionDatabaseFile, writeOsuDatabaseFile, writeScoresDatabaseFile };
|
|
30
|
+
export { DatabaseFilePath, OSU_STABLE_DIR_ENV_VAR, OsuFolder, getConfiguredOsuFolder, getConfiguredOsuFolderPath, readCollectionDatabaseFile, readOsuDatabaseFile, readScoresDatabaseFile, writeCollectionDatabaseFile, writeOsuDatabaseFile, writeScoresDatabaseFile };
|
package/dist/node.mjs
CHANGED
|
@@ -2,6 +2,15 @@ import { a as writeOsuDatabase, i as readOsuDatabase, n as writeScoresDatabase,
|
|
|
2
2
|
import { readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
//#region src/node.ts
|
|
5
|
+
const OSU_STABLE_DIR_ENV_VAR = "OSU_STABLE_DIR";
|
|
6
|
+
function getConfiguredOsuFolderPath() {
|
|
7
|
+
const folderPath = process.env[OSU_STABLE_DIR_ENV_VAR]?.trim();
|
|
8
|
+
return folderPath === void 0 || folderPath.length === 0 ? null : folderPath;
|
|
9
|
+
}
|
|
10
|
+
function getConfiguredOsuFolder() {
|
|
11
|
+
const folderPath = getConfiguredOsuFolderPath();
|
|
12
|
+
return folderPath === null ? null : new OsuFolder(folderPath);
|
|
13
|
+
}
|
|
5
14
|
async function readOsuDatabaseFile(path) {
|
|
6
15
|
return readOsuDatabase(new Uint8Array(await readFile(path)));
|
|
7
16
|
}
|
|
@@ -62,4 +71,4 @@ var OsuFolder = class {
|
|
|
62
71
|
}
|
|
63
72
|
};
|
|
64
73
|
//#endregion
|
|
65
|
-
export { OsuFolder, readCollectionDatabaseFile, readOsuDatabaseFile, readScoresDatabaseFile, writeCollectionDatabaseFile, writeOsuDatabaseFile, writeScoresDatabaseFile };
|
|
74
|
+
export { OSU_STABLE_DIR_ENV_VAR, OsuFolder, getConfiguredOsuFolder, getConfiguredOsuFolderPath, readCollectionDatabaseFile, readOsuDatabaseFile, readScoresDatabaseFile, writeCollectionDatabaseFile, writeOsuDatabaseFile, writeScoresDatabaseFile };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "osu-stable-db",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"description": "TypeScript reader and writer for osu!stable database files.",
|
|
6
6
|
"author": "zzzzv",
|
|
7
7
|
"license": "MIT",
|
|
@@ -29,10 +29,9 @@
|
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "tsdown",
|
|
31
31
|
"dev": "tsdown --watch",
|
|
32
|
-
"local:
|
|
33
|
-
"local:
|
|
34
|
-
"
|
|
35
|
-
"test": "vitest",
|
|
32
|
+
"local:inspect": "pnpm run build && node --env-file=.env scripts/local-inspect.mjs",
|
|
33
|
+
"local:roundtrip": "pnpm run build && node --env-file=.env scripts/local-roundtrip.mjs",
|
|
34
|
+
"test": "node --env-file=.env ./node_modules/vitest/vitest.mjs",
|
|
36
35
|
"typecheck": "tsc --noEmit",
|
|
37
36
|
"prepublishOnly": "pnpm run build"
|
|
38
37
|
},
|