Skip to content

Commit c99e3a3

Browse files
committed
Full rewrite of chart parsing and issue detection, adding missing functionality and fixing many bugs. Added a more sophisticated track hashing algorithm, which is designed to uniquely identify the features of the chart that impact difficulty and scoring, and ignore any other changes, which makes it suitable for use with leaderboards. Clone Hero's leaderboards use this same system. The scope of this package has also been limited to just expose functions that parse a single chart file. This allows the package to run in both Node.js and Browser contexts.
1 parent fddcf8d commit c99e3a3

29 files changed

+5149
-4395
lines changed

.changeset/cold-walls-perform.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"scan-chart": major
3+
---
4+
5+
Full rewrite of chart parsing and issue detection, adding missing functionality and fixing many bugs. Added a more sophisticated track hashing algorithm, which is designed to uniquely identify the features of the chart that impact difficulty and scoring, and ignore any other changes, which makes it suitable for use with leaderboards. Clone Hero's leaderboards use this same system. The scope of this package has also been limited to just expose functions that parse a single chart file. This allows the package to run in both Node.js and Browser contexts.

.eslintrc.json

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{
22
"root": true,
33
"ignorePatterns": ["*.config"],
4+
"plugins": ["prettier"],
5+
"extends": [
6+
"eslint:recommended",
7+
"prettier"
8+
],
49
"overrides": [
510
{
611
"files": ["*.ts"],
@@ -12,12 +17,16 @@
1217
"prefer-arrow"
1318
],
1419
"extends": [
15-
"eslint:recommended",
1620
"plugin:@typescript-eslint/recommended",
1721
"plugin:@angular-eslint/recommended"
1822
],
1923
"rules": {
2024
"semi": "off",
25+
"eslint-plugin-vue/comma-dangle": "off",
26+
"no-mixed-spaces-and-tabs": "error",
27+
"no-trailing-spaces": "error",
28+
"@typescript-eslint/quotes": ["error", "single", { "avoidEscape": true }],
29+
"@typescript-eslint/comma-dangle": ["error", "always-multiline"],
2130
"@typescript-eslint/semi": ["error", "never"],
2231
"@typescript-eslint/consistent-type-definitions": "error",
2332
"@typescript-eslint/dot-notation": "off",
@@ -27,8 +36,8 @@
2736
"accessibility": "explicit"
2837
}
2938
],
30-
"@typescript-eslint/no-use-before-define": ["error", { "typedefs": false }],
31-
"@typescript-eslint/no-shadow": ["off"],
39+
"@typescript-eslint/no-use-before-define": ["error", { "typedefs": false, "functions": false, "classes": false }],
40+
"@typescript-eslint/no-shadow": "off",
3241
"@typescript-eslint/member-ordering": ["error", { "default": ["field", "public-constructor", "constructor", "method"] }],
3342
"@typescript-eslint/member-delimiter-style": ["error", { "multiline": { "delimiter": "none", "requireLast": true } }],
3443
"@typescript-eslint/no-non-null-assertion": "off",
@@ -40,7 +49,7 @@
4049
"error",
4150
{
4251
"ignorePattern": "^import |^export \\{(.*?)\\}|^\\s*@inject\\(",
43-
"code": 140
52+
"code": 150
4453
}
4554
],
4655
"@typescript-eslint/naming-convention": [
@@ -51,7 +60,8 @@
5160
"camelCase",
5261
"PascalCase",
5362
"UPPER_CASE"
54-
]
63+
],
64+
"leadingUnderscore": "allow"
5565
},
5666
{
5767
"selector": ["property", "parameter"],
@@ -79,27 +89,11 @@
7989
"max-len": ["error", 150]
8090
}
8191
},
82-
{
83-
"files": ["*.html"],
84-
"plugins": ["prettier"],
85-
"extends": ["plugin:prettier/recommended"],
86-
"rules": {
87-
"prettier/prettier": ["error", {
88-
"parser": "angular",
89-
"endOfLine": "auto",
90-
"printWidth": 150,
91-
"useTabs": true,
92-
"singleQuote": true,
93-
"htmlWhitespaceSensitivity": "css",
94-
"bracketSameLine": true
95-
}]
96-
}
97-
},
9892
{
9993
"files": ["*.test.ts", "*.spec.ts"],
10094
"rules": {
10195
"no-unused-expressions": "off",
102-
"@typescript-eslint/no-unused-expressions": ["off"]
96+
"@typescript-eslint/no-unused-expressions": "off"
10397
}
10498
}
10599
]

.prettierrc.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"overrides": [
3+
{
4+
"files": "*.html",
5+
"options": {
6+
"parser": "angular"
7+
}
8+
}
9+
],
10+
"endOfLine": "auto",
11+
"printWidth": 150,
12+
"useTabs": true,
13+
"experimentalTernaries": true,
14+
"singleQuote": true,
15+
"arrowParens": "avoid",
16+
"htmlWhitespaceSensitivity": "css",
17+
"bracketSameLine": true,
18+
"semi": false,
19+
"trailingComma": "all"
20+
}

.vscode/extensions.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"recommendations": [
3+
"rvest.vs-code-prettier-eslint",
4+
"mike-co.import-sorter"
5+
]
6+
}

.vscode/settings.json

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,25 @@
33
"typescript.tsdk": "./node_modules/typescript/lib",
44
"files.encoding": "utf8",
55
"editor.rulers": [
6-
140
6+
150
77
],
88
"editor.tabCompletion": "on",
99
"editor.detectIndentation": false,
1010
"editor.insertSpaces": false,
1111
"editor.tabSize": 2,
12+
"editor.formatOnType": false,
13+
"editor.formatOnPaste": true,
14+
"editor.formatOnSave": true,
1215
"files.trimTrailingWhitespace": true,
1316
"editor.trimAutoWhitespace": true,
1417
"files.insertFinalNewline": true,
1518
"typescript.preferences.quoteStyle": "single",
19+
"json.schemas": [
20+
{
21+
"fileMatch": ["/.prettierrc.json"],
22+
"url": "https://json.schemastore.org/prettierrc"
23+
}
24+
],
1625
"files.exclude": {
1726
"**/.git": true
1827
},
@@ -28,14 +37,20 @@
2837
}
2938
},
3039
"[typescript]": {
31-
"editor.defaultFormatter": "vscode.typescript-language-features",
32-
"editor.codeActionsOnSave": [ "source.fixAll.eslint" ],
33-
"editor.formatOnSave": true
40+
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint",
41+
"editor.formatOnSaveMode": "file"
3442
},
3543
"[css]": {
3644
"editor.defaultFormatter": "sibiraj-s.vscode-scss-formatter",
3745
"editor.formatOnSave": true
3846
},
47+
"[json]": {
48+
"editor.defaultFormatter": "vscode.json-language-features",
49+
"editor.quickSuggestions": {
50+
"strings": true
51+
},
52+
"editor.suggest.insertMode": "replace"
53+
},
3954
"importSorter.importStringConfiguration.maximumNumberOfImportExpressionsPerLine.type": "newLineEachExpressionAfterCountLimitExceptIfOnlyOne",
4055
"importSorter.generalConfiguration.sortImportsInDirectory": false,
4156
"importSorter.generalConfiguration.sortOnBeforeSave": true,

package.json

Lines changed: 59 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,61 @@
11
{
2-
"name": "scan-chart",
3-
"version": "3.4.8",
4-
"author": "Geo",
5-
"license": "MIT",
6-
"main": "dist/index.js",
7-
"module": "dist/index.mjs",
8-
"types": "dist/index.d.ts",
9-
"description": "A library that scans charts for rhythm games like Clone Hero.",
10-
"scripts": {
11-
"build": "tsup src/index.ts --format cjs,esm --dts",
12-
"test": "tsx src/test.ts",
13-
"release": "pnpm run build && changeset publish",
14-
"lint": "tsc"
15-
},
16-
"repository": {
17-
"type": "git",
18-
"url": "git+ssh://[email protected]/Geomitron/scan-chart.git"
19-
},
20-
"bugs": {
21-
"url": "https://github.com/Geomitron/scan-chart/issues"
22-
},
23-
"homepage": "https://github.com/Geomitron/scan-chart#readme",
24-
"dependencies": {
25-
"bottleneck": "^2.19.5",
26-
"charset-detector": "^0.0.2",
27-
"fluent-ffmpeg": "^2.1.2",
28-
"lodash": "^4.17.21",
29-
"midievents": "^2.0.0",
30-
"midifile": "^2.0.0",
31-
"parse-sng": "^3.1.2",
32-
"sanitize-filename": "^1.6.3",
33-
"sharp": "^0.32.1",
34-
"stream-audio-fingerprint": "git+https://github.com/Geomitron/stream-audio-fingerprint.git",
35-
"workerpool": "^6.4.0"
36-
},
37-
"devDependencies": {
38-
"@angular-eslint/builder": "^16.0.2",
39-
"@angular-eslint/eslint-plugin": "^16.0.2",
40-
"@angular-eslint/eslint-plugin-template": "^16.0.2",
41-
"@angular-eslint/schematics": "^16.0.2",
42-
"@angular-eslint/template-parser": "^16.0.2",
43-
"@changesets/cli": "^2.26.1",
44-
"@types/charset-detector": "^0.0.1",
45-
"@types/fluent-ffmpeg": "^2.1.21",
46-
"@types/lodash": "^4.14.194",
47-
"@types/node": "^18.16.16",
48-
"@types/workerpool": "^6.4.0",
49-
"@typescript-eslint/eslint-plugin": "^5.59.7",
50-
"@typescript-eslint/parser": "^5.59.7",
51-
"eslint": "^8.41.0",
52-
"eslint-config-prettier": "^8.8.0",
53-
"eslint-plugin-import": "^2.27.5",
54-
"eslint-plugin-jsdoc": "^44.2.7",
55-
"eslint-plugin-prefer-arrow": "^1.2.3",
56-
"eslint-plugin-prettier": "^4.2.1",
57-
"prettier": "^2.8.8",
58-
"prettier-eslint": "^15.0.1",
59-
"tsup": "^6.7.0",
60-
"tsx": "^3.12.8",
61-
"typescript": "^4.7.4"
62-
}
2+
"name": "scan-chart",
3+
"version": "3.4.8",
4+
"author": "Geo",
5+
"license": "MIT",
6+
"main": "dist/index.js",
7+
"module": "dist/index.mjs",
8+
"types": "dist/index.d.ts",
9+
"description": "A library that scans charts for rhythm games like Clone Hero.",
10+
"scripts": {
11+
"build": "tsup src/index.ts --format cjs,esm --dts",
12+
"release": "pnpm run build && changeset publish",
13+
"lint": "tsc"
14+
},
15+
"repository": {
16+
"type": "git",
17+
"url": "git+ssh://[email protected]/Geomitron/scan-chart.git"
18+
},
19+
"bugs": {
20+
"url": "https://github.com/Geomitron/scan-chart/issues"
21+
},
22+
"homepage": "https://github.com/Geomitron/scan-chart#readme",
23+
"dependencies": {
24+
"@noble/hashes": "^1.4.0",
25+
"bottleneck": "^2.19.5",
26+
"exifreader": "^4.23.2",
27+
"fluent-ffmpeg": "^2.1.2",
28+
"js-md5": "^0.8.3",
29+
"lodash": "^4.17.21",
30+
"midi-file": "^1.2.4",
31+
"rfc4648": "^1.5.3",
32+
"stream-audio-fingerprint": "git+https://github.com/Geomitron/stream-audio-fingerprint.git",
33+
"workerpool": "^6.4.0"
34+
},
35+
"devDependencies": {
36+
"@angular-eslint/builder": "^17.4.0",
37+
"@angular-eslint/eslint-plugin": "^17.4.0",
38+
"@angular-eslint/eslint-plugin-template": "^17.4.0",
39+
"@angular-eslint/schematics": "^17.4.0",
40+
"@angular-eslint/template-parser": "^17.4.0",
41+
"@changesets/cli": "^2.26.1",
42+
"@types/charset-detector": "^0.0.1",
43+
"@types/fluent-ffmpeg": "^2.1.21",
44+
"@types/js-md5": "^0.7.2",
45+
"@types/lodash": "^4.14.194",
46+
"@types/node": "^18.16.16",
47+
"@types/workerpool": "^6.4.0",
48+
"@typescript-eslint/eslint-plugin": "^7.8.0",
49+
"@typescript-eslint/parser": "^7.8.0",
50+
"eslint": "^8.57.0",
51+
"eslint-config-prettier": "^9.1.0",
52+
"eslint-plugin-import": "^2.29.1",
53+
"eslint-plugin-jsdoc": "^48.2.4",
54+
"eslint-plugin-prefer-arrow": "^1.2.3",
55+
"eslint-plugin-prettier": "^5.1.3",
56+
"prettier": "^3.2.5",
57+
"prettier-eslint": "^16.3.0",
58+
"tsup": "^6.7.0",
59+
"typescript": "^4.7.4"
60+
}
6361
}

0 commit comments

Comments
 (0)