scrabble-solver 2.18.2 → 2.18.4
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/.nx/workspace-data/d/server-process.json +3 -3
- package/.nx/workspace-data/file-map.json +1472 -1435
- package/.nx/workspace-data/lockfile-dependencies.hash +1 -1
- package/.nx/workspace-data/lockfile-nodes.hash +1 -1
- package/.nx/workspace-data/nx_files.nxt +0 -0
- package/.nx/workspace-data/parsed-lock-file.dependencies.json +528 -713
- package/.nx/workspace-data/parsed-lock-file.nodes.json +965 -1370
- package/.nx/workspace-data/project-graph.json +1561 -2156
- package/.nx/workspace-data/source-maps.json +48 -8
- package/.oxlintrc.json +0 -1
- package/CLAUDE.md +10 -8
- package/README.md +1 -1
- package/bun.lock +230 -279
- package/lerna.json +1 -1
- package/package.json +7 -6
- package/packages/configs/build/games/index.d.ts +1 -0
- package/packages/configs/build/games/index.js +1 -0
- package/packages/configs/build/games/wyrazy.d.ts +19 -0
- package/packages/configs/build/games/wyrazy.js +73 -0
- package/packages/configs/build/languages/polish.d.ts +1 -0
- package/packages/configs/build/languages/polish.js +39 -1
- package/packages/configs/package.json +5 -4
- package/packages/configs/src/games/index.ts +1 -0
- package/packages/configs/src/games/wyrazy.ts +71 -0
- package/packages/configs/src/languages/polish.ts +40 -1
- package/packages/constants/package.json +1 -1
- package/packages/dictionaries/bin/update-dictionaries.js +2 -5
- package/packages/dictionaries/build/Dictionaries.d.ts +1 -1
- package/packages/dictionaries/build/Dictionaries.js +9 -4
- package/packages/dictionaries/build/lib/DiskCache.js +1 -1
- package/packages/dictionaries/build/lib/downloadDictionary.d.ts +1 -1
- package/packages/dictionaries/build/lib/downloadDictionary.js +12 -7
- package/packages/dictionaries/package.json +4 -4
- package/packages/dictionaries/src/Dictionaries.ts +13 -6
- package/packages/dictionaries/src/lib/DiskCache.ts +2 -2
- package/packages/dictionaries/src/lib/downloadDictionary.ts +14 -6
- package/packages/logger/README.md +18 -0
- package/packages/logger/build/constants.d.ts +3 -0
- package/packages/logger/build/constants.js +4 -1
- package/packages/logger/build/describeError.d.ts +5 -0
- package/packages/logger/build/describeError.js +23 -0
- package/packages/logger/build/events.d.ts +92 -0
- package/packages/logger/build/events.js +13 -0
- package/packages/logger/build/formatCsvRow.d.ts +2 -0
- package/packages/logger/build/formatCsvRow.js +20 -0
- package/packages/logger/build/index.d.ts +5 -1
- package/packages/logger/build/index.js +13 -3
- package/packages/logger/build/logError.d.ts +4 -0
- package/packages/logger/build/logError.js +17 -0
- package/packages/logger/build/logEvent.d.ts +3 -0
- package/packages/logger/build/logEvent.js +29 -0
- package/packages/logger/package.json +7 -8
- package/packages/logger/scripts/export-csv.ts +113 -0
- package/packages/logger/scripts/readEvents.ts +34 -0
- package/packages/logger/scripts/tsconfig.json +10 -0
- package/packages/logger/src/constants.ts +9 -0
- package/packages/logger/src/describeError.test.ts +44 -0
- package/packages/logger/src/describeError.ts +30 -0
- package/packages/logger/src/events.ts +103 -0
- package/packages/logger/src/formatCsvRow.test.ts +41 -0
- package/packages/logger/src/formatCsvRow.ts +24 -0
- package/packages/logger/src/index.ts +13 -1
- package/packages/logger/src/logError.ts +24 -0
- package/packages/logger/src/logEvent.test.ts +59 -0
- package/packages/logger/src/logEvent.ts +26 -0
- package/packages/scrabble-solver/.next/BUILD_ID +1 -1
- package/packages/scrabble-solver/.next/build-manifest.json +15 -15
- package/packages/scrabble-solver/.next/cache/.previewinfo +1 -1
- package/packages/scrabble-solver/.next/cache/.rscinfo +1 -1
- package/packages/scrabble-solver/.next/cache/.tsbuildinfo +1 -1
- package/packages/scrabble-solver/.next/cache/webpack/client-production/0.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-production/index.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-production/index.pack.old +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/index.pack.old +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/0.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/index.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/index.pack.old +0 -0
- package/packages/scrabble-solver/.next/diagnostics/framework.json +1 -1
- package/packages/scrabble-solver/.next/dynamic-css-manifest.json +1 -1
- package/packages/scrabble-solver/.next/prerender-manifest.json +4 -4
- package/packages/scrabble-solver/.next/react-loadable-manifest.json +6 -6
- package/packages/scrabble-solver/.next/routes-manifest.json +1 -1
- package/packages/scrabble-solver/.next/server/chunks/546.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/612.js +5 -0
- package/packages/scrabble-solver/.next/server/chunks/67.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/712.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/715.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/812.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/961.js +1 -1
- package/packages/scrabble-solver/.next/server/dynamic-css-manifest.js +1 -1
- package/packages/scrabble-solver/.next/server/middleware-build-manifest.js +1 -1
- package/packages/scrabble-solver/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/packages/scrabble-solver/.next/server/pages/404.html +3 -3
- package/packages/scrabble-solver/.next/server/pages/500.html +3 -3
- package/packages/scrabble-solver/.next/server/pages/_app.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/_document.js +2 -2
- package/packages/scrabble-solver/.next/server/pages/_document.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale]/[word].js +2 -2
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale]/[word].js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale].js +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale].js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/solve.js +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/solve.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/verify.js +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/verify.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/visit.js +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/visit.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/index.html +3 -3
- package/packages/scrabble-solver/.next/server/pages/index.js +1 -1
- package/packages/scrabble-solver/.next/server/pages/index.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/index.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/not-found.html +3 -3
- package/packages/scrabble-solver/.next/server/pages/not-found.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/static/{nvGZh1gPuX98L07YmxlYD → TAqjh9l5VJQOfJ4SzgPk2}/_buildManifest.js +1 -1
- package/packages/scrabble-solver/.next/static/chunks/101-f341f70c10d71212.js +3 -0
- package/packages/scrabble-solver/.next/static/chunks/256.6a20b23a766cfebd.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/693.d295da7c7b873986.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/980.dd35e807b18063c1.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/{main-7e52da35a4beea0b.js → main-6e9ac37e28d2b899.js} +1 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-9340d51f5a6787fc.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/index-ea21d96a88f25000.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/{webpack-9f5c9d275348829b.js → webpack-d73aa4aae49cd800.js} +1 -1
- package/packages/scrabble-solver/.next/static/css/{92f85ce358a0a468.css → 4dbcacc1122ac6b9.css} +1 -1
- package/packages/scrabble-solver/.next/static/css/8b8087461767360a.css +1 -0
- package/packages/scrabble-solver/.next/static/css/{65bcc9440e067113.css → 98051ed25076b896.css} +1 -1
- package/packages/scrabble-solver/.next/trace +22 -21
- package/packages/scrabble-solver/.next/trace-build +1 -1
- package/packages/scrabble-solver/package.json +10 -10
- package/packages/scrabble-solver/public/llms.txt +1 -1
- package/packages/scrabble-solver/public/service-worker.js +1 -1
- package/packages/scrabble-solver/src/api/BadRequestError.ts +6 -0
- package/packages/scrabble-solver/src/api/index.ts +2 -1
- package/packages/scrabble-solver/src/api/withApiLog.ts +85 -0
- package/packages/scrabble-solver/src/components/Button/Button.module.scss +1 -1
- package/packages/scrabble-solver/src/components/Solver/Solver.module.scss +4 -4
- package/packages/scrabble-solver/src/components/Solver/Solver.tsx +2 -2
- package/packages/scrabble-solver/src/hooks/useColumns.ts +5 -7
- package/packages/scrabble-solver/src/modals/ResultsModal/ResultsModal.tsx +2 -2
- package/packages/scrabble-solver/src/modals/WordsModal/WordsModal.module.scss +1 -1
- package/packages/scrabble-solver/src/modals/WordsModal/WordsModal.tsx +2 -2
- package/packages/scrabble-solver/src/modals/WordsModal/components/WordsTable/WordsTable.tsx +2 -2
- package/packages/scrabble-solver/src/pages/api/dictionary/[locale]/[word].ts +22 -30
- package/packages/scrabble-solver/src/pages/api/dictionary/[locale]/index.ts +36 -42
- package/packages/scrabble-solver/src/pages/api/solve.ts +32 -42
- package/packages/scrabble-solver/src/pages/api/verify.ts +35 -43
- package/packages/scrabble-solver/src/pages/api/visit.ts +38 -13
- package/packages/scrabble-solver/src/pages/index.tsx +3 -3
- package/packages/scrabble-solver/src/parameters/index.ts +0 -2
- package/packages/scrabble-solver/src/sdk/solve.ts +3 -9
- package/packages/scrabble-solver/src/sdk/verify.ts +2 -10
- package/packages/scrabble-solver/src/sdk/visit.ts +8 -3
- package/packages/scrabble-solver/src/state/sagas.ts +7 -1
- package/packages/scrabble-solver/src/styles/_tokens.scss +0 -2
- package/packages/scrabble-solver/src/styles/mixins.scss +0 -5
- package/packages/scrabble-solver/src/styles/variables.module.scss +0 -1
- package/packages/scrabble-solver/src/styles/variables.module.scss.d.ts +0 -1
- package/packages/scrabble-solver/src/styles/variables.scss +1 -1
- package/packages/scrabble-solver/src/types/api.ts +7 -0
- package/packages/scrabble-solver/tsconfig.tsbuildinfo +1 -1
- package/packages/solver/package.json +5 -5
- package/packages/types/build/Game.d.ts +2 -1
- package/packages/types/build/Game.js +1 -0
- package/packages/types/package.json +2 -2
- package/packages/types/src/Game.ts +1 -0
- package/packages/word-definitions/package.json +2 -2
- package/packages/word-lists/package.json +2 -2
- package/playwright-report/index.html +1 -1
- package/packages/logger/build/logger.d.ts +0 -1
- package/packages/logger/build/logger.js +0 -28
- package/packages/logger/scripts/stats.js +0 -52
- package/packages/logger/src/logger.ts +0 -30
- package/packages/scrabble-solver/.next/server/chunks/392.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/101-829ab8a8d310e7a0.js +0 -3
- package/packages/scrabble-solver/.next/static/chunks/256.66ff9fb6d7db9ec7.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/693.677c88e0eb1340b5.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/980.7ce17464fc56648a.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-f9ec81278ffa7b1a.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/index-b5bf018100015277.js +0 -1
- package/packages/scrabble-solver/.next/static/css/a691348b788f8bc0.css +0 -1
- package/packages/scrabble-solver/src/api/getServerLoggingData.ts +0 -17
- package/packages/scrabble-solver/src/hooks/useIsCompactLayout.ts +0 -14
- /package/packages/scrabble-solver/.next/static/{nvGZh1gPuX98L07YmxlYD → TAqjh9l5VJQOfJ4SzgPk2}/_ssgManifest.js +0 -0
package/lerna.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scrabble-solver",
|
|
3
|
-
"version": "2.18.
|
|
4
|
-
"description": "Scrabble Solver 2 - Free, open-source, cross-platform, multi-language analysis tool for Scrabble, Scrabble Duel, Super Scrabble, Letter League, Crossplay, Literaki, and
|
|
3
|
+
"version": "2.18.4",
|
|
4
|
+
"description": "Scrabble Solver 2 - Free, open-source, cross-platform, multi-language analysis tool for Scrabble, Scrabble Duel, Super Scrabble, Letter League, Crossplay, Literaki, Kelimelik, and Wyrazy. Quickly find the top-scoring words using the given board and tiles.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"scrabble",
|
|
7
7
|
"scrabble-solver",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"crossplay",
|
|
18
18
|
"literaki",
|
|
19
19
|
"kelimelik",
|
|
20
|
+
"wyrazy",
|
|
20
21
|
"board game",
|
|
21
22
|
"gaddag"
|
|
22
23
|
],
|
|
@@ -79,22 +80,22 @@
|
|
|
79
80
|
"packages/scrabble-solver"
|
|
80
81
|
],
|
|
81
82
|
"dependencies": {
|
|
82
|
-
"@scrabble-solver/scrabble-solver": "^2.18.
|
|
83
|
+
"@scrabble-solver/scrabble-solver": "^2.18.4",
|
|
83
84
|
"open-cli": "^9.0.0",
|
|
84
85
|
"wait-on": "^9.1.0"
|
|
85
86
|
},
|
|
86
87
|
"devDependencies": {
|
|
87
88
|
"@playwright/test": "^1.62.1",
|
|
88
89
|
"@types/bun": "^1.4.0",
|
|
89
|
-
"@types/node": "^26.
|
|
90
|
+
"@types/node": "^26.3.0",
|
|
90
91
|
"eslint-import-resolver-typescript": "^4.4.5",
|
|
91
92
|
"eslint-plugin-import": "^2.32.0",
|
|
92
93
|
"eslint-plugin-playwright": "^2.11.0",
|
|
93
94
|
"eslint-plugin-react": "^7.37.5",
|
|
94
95
|
"lerna": "^10.0.1",
|
|
95
96
|
"np": "^12.0.1",
|
|
96
|
-
"oxfmt": "^0.
|
|
97
|
-
"oxlint": "^1.
|
|
97
|
+
"oxfmt": "^0.65.0",
|
|
98
|
+
"oxlint": "^1.80.0",
|
|
98
99
|
"oxlint-tsgolint": "^7.0.2001",
|
|
99
100
|
"rimraf": "^6.1.3",
|
|
100
101
|
"start-server-and-test": "^3.0.12",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Game } from '@scrabble-solver/types';
|
|
2
|
+
export declare const wyrazy: {
|
|
3
|
+
bingo: {
|
|
4
|
+
score: number;
|
|
5
|
+
};
|
|
6
|
+
blankScore: number;
|
|
7
|
+
blanksCount: number;
|
|
8
|
+
boardHeight: number;
|
|
9
|
+
boardWidth: number;
|
|
10
|
+
game: Game;
|
|
11
|
+
name: string;
|
|
12
|
+
rackSize: number;
|
|
13
|
+
bonuses: {
|
|
14
|
+
multiplier: number;
|
|
15
|
+
type: string;
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wyrazy = void 0;
|
|
4
|
+
const constants_1 = require("@scrabble-solver/constants");
|
|
5
|
+
const types_1 = require("@scrabble-solver/types");
|
|
6
|
+
exports.wyrazy = {
|
|
7
|
+
bingo: { score: 25 },
|
|
8
|
+
blankScore: 0,
|
|
9
|
+
blanksCount: 2,
|
|
10
|
+
boardHeight: 15,
|
|
11
|
+
boardWidth: 15,
|
|
12
|
+
game: types_1.Game.Wyrazy,
|
|
13
|
+
name: 'Wyrazy',
|
|
14
|
+
rackSize: 7,
|
|
15
|
+
bonuses: [
|
|
16
|
+
{ multiplier: 3, type: constants_1.BONUS_WORD, x: 2, y: 0 },
|
|
17
|
+
{ multiplier: 2, type: constants_1.BONUS_CHARACTER, x: 6, y: 0 },
|
|
18
|
+
{ multiplier: 2, type: constants_1.BONUS_CHARACTER, x: 8, y: 0 },
|
|
19
|
+
{ multiplier: 3, type: constants_1.BONUS_WORD, x: 12, y: 0 },
|
|
20
|
+
{ multiplier: 3, type: constants_1.BONUS_CHARACTER, x: 1, y: 1 },
|
|
21
|
+
{ multiplier: 2, type: constants_1.BONUS_WORD, x: 5, y: 1 },
|
|
22
|
+
{ multiplier: 2, type: constants_1.BONUS_WORD, x: 9, y: 1 },
|
|
23
|
+
{ multiplier: 3, type: constants_1.BONUS_CHARACTER, x: 13, y: 1 },
|
|
24
|
+
{ multiplier: 3, type: constants_1.BONUS_WORD, x: 0, y: 2 },
|
|
25
|
+
{ multiplier: 3, type: constants_1.BONUS_CHARACTER, x: 4, y: 2 },
|
|
26
|
+
{ multiplier: 3, type: constants_1.BONUS_CHARACTER, x: 10, y: 2 },
|
|
27
|
+
{ multiplier: 3, type: constants_1.BONUS_WORD, x: 14, y: 2 },
|
|
28
|
+
{ multiplier: 2, type: constants_1.BONUS_CHARACTER, x: 3, y: 3 },
|
|
29
|
+
{ multiplier: 2, type: constants_1.BONUS_WORD, x: 7, y: 3 },
|
|
30
|
+
{ multiplier: 2, type: constants_1.BONUS_CHARACTER, x: 11, y: 3 },
|
|
31
|
+
{ multiplier: 3, type: constants_1.BONUS_CHARACTER, x: 2, y: 4 },
|
|
32
|
+
{ multiplier: 2, type: constants_1.BONUS_CHARACTER, x: 6, y: 4 },
|
|
33
|
+
{ multiplier: 2, type: constants_1.BONUS_CHARACTER, x: 8, y: 4 },
|
|
34
|
+
{ multiplier: 3, type: constants_1.BONUS_CHARACTER, x: 12, y: 4 },
|
|
35
|
+
{ multiplier: 2, type: constants_1.BONUS_WORD, x: 1, y: 5 },
|
|
36
|
+
{ multiplier: 3, type: constants_1.BONUS_CHARACTER, x: 5, y: 5 },
|
|
37
|
+
{ multiplier: 3, type: constants_1.BONUS_CHARACTER, x: 9, y: 5 },
|
|
38
|
+
{ multiplier: 2, type: constants_1.BONUS_WORD, x: 13, y: 5 },
|
|
39
|
+
{ multiplier: 2, type: constants_1.BONUS_CHARACTER, x: 0, y: 6 },
|
|
40
|
+
{ multiplier: 2, type: constants_1.BONUS_CHARACTER, x: 4, y: 6 },
|
|
41
|
+
{ multiplier: 2, type: constants_1.BONUS_CHARACTER, x: 10, y: 6 },
|
|
42
|
+
{ multiplier: 2, type: constants_1.BONUS_CHARACTER, x: 14, y: 6 },
|
|
43
|
+
{ multiplier: 2, type: constants_1.BONUS_WORD, x: 3, y: 7 },
|
|
44
|
+
{ multiplier: 2, type: constants_1.BONUS_WORD, x: 11, y: 7 },
|
|
45
|
+
{ multiplier: 2, type: constants_1.BONUS_CHARACTER, x: 0, y: 8 },
|
|
46
|
+
{ multiplier: 2, type: constants_1.BONUS_CHARACTER, x: 4, y: 8 },
|
|
47
|
+
{ multiplier: 2, type: constants_1.BONUS_CHARACTER, x: 10, y: 8 },
|
|
48
|
+
{ multiplier: 2, type: constants_1.BONUS_CHARACTER, x: 14, y: 8 },
|
|
49
|
+
{ multiplier: 2, type: constants_1.BONUS_WORD, x: 1, y: 9 },
|
|
50
|
+
{ multiplier: 3, type: constants_1.BONUS_CHARACTER, x: 5, y: 9 },
|
|
51
|
+
{ multiplier: 3, type: constants_1.BONUS_CHARACTER, x: 9, y: 9 },
|
|
52
|
+
{ multiplier: 2, type: constants_1.BONUS_WORD, x: 13, y: 9 },
|
|
53
|
+
{ multiplier: 3, type: constants_1.BONUS_CHARACTER, x: 2, y: 10 },
|
|
54
|
+
{ multiplier: 2, type: constants_1.BONUS_CHARACTER, x: 6, y: 10 },
|
|
55
|
+
{ multiplier: 2, type: constants_1.BONUS_CHARACTER, x: 8, y: 10 },
|
|
56
|
+
{ multiplier: 3, type: constants_1.BONUS_CHARACTER, x: 12, y: 10 },
|
|
57
|
+
{ multiplier: 2, type: constants_1.BONUS_CHARACTER, x: 3, y: 11 },
|
|
58
|
+
{ multiplier: 2, type: constants_1.BONUS_WORD, x: 7, y: 11 },
|
|
59
|
+
{ multiplier: 2, type: constants_1.BONUS_CHARACTER, x: 11, y: 11 },
|
|
60
|
+
{ multiplier: 3, type: constants_1.BONUS_WORD, x: 0, y: 12 },
|
|
61
|
+
{ multiplier: 3, type: constants_1.BONUS_CHARACTER, x: 4, y: 12 },
|
|
62
|
+
{ multiplier: 3, type: constants_1.BONUS_CHARACTER, x: 10, y: 12 },
|
|
63
|
+
{ multiplier: 3, type: constants_1.BONUS_WORD, x: 14, y: 12 },
|
|
64
|
+
{ multiplier: 3, type: constants_1.BONUS_CHARACTER, x: 1, y: 13 },
|
|
65
|
+
{ multiplier: 2, type: constants_1.BONUS_WORD, x: 5, y: 13 },
|
|
66
|
+
{ multiplier: 2, type: constants_1.BONUS_WORD, x: 9, y: 13 },
|
|
67
|
+
{ multiplier: 3, type: constants_1.BONUS_CHARACTER, x: 13, y: 13 },
|
|
68
|
+
{ multiplier: 3, type: constants_1.BONUS_WORD, x: 2, y: 14 },
|
|
69
|
+
{ multiplier: 2, type: constants_1.BONUS_CHARACTER, x: 6, y: 14 },
|
|
70
|
+
{ multiplier: 2, type: constants_1.BONUS_CHARACTER, x: 8, y: 14 },
|
|
71
|
+
{ multiplier: 3, type: constants_1.BONUS_WORD, x: 12, y: 14 },
|
|
72
|
+
],
|
|
73
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.polishLiteraki = exports.polishScrabble = void 0;
|
|
3
|
+
exports.polishWyrazy = exports.polishLiteraki = exports.polishScrabble = void 0;
|
|
4
4
|
const types_1 = require("@scrabble-solver/types");
|
|
5
5
|
const games_1 = require("../games");
|
|
6
6
|
exports.polishScrabble = new types_1.Config({
|
|
@@ -79,3 +79,41 @@ exports.polishLiteraki = new types_1.Config({
|
|
|
79
79
|
{ character: 'ż', count: 1, score: 5 },
|
|
80
80
|
],
|
|
81
81
|
});
|
|
82
|
+
exports.polishWyrazy = new types_1.Config({
|
|
83
|
+
...games_1.wyrazy,
|
|
84
|
+
locale: types_1.Locale.PL_PL,
|
|
85
|
+
tiles: [
|
|
86
|
+
{ character: 'a', count: 9, score: 1 },
|
|
87
|
+
{ character: 'ą', count: 1, score: 5 },
|
|
88
|
+
{ character: 'b', count: 2, score: 3 },
|
|
89
|
+
{ character: 'c', count: 3, score: 2 },
|
|
90
|
+
{ character: 'ć', count: 1, score: 5 },
|
|
91
|
+
{ character: 'd', count: 3, score: 2 },
|
|
92
|
+
{ character: 'e', count: 7, score: 1 },
|
|
93
|
+
{ character: 'ę', count: 1, score: 5 },
|
|
94
|
+
{ character: 'f', count: 1, score: 5 },
|
|
95
|
+
{ character: 'g', count: 2, score: 3 },
|
|
96
|
+
{ character: 'h', count: 2, score: 3 },
|
|
97
|
+
{ character: 'i', count: 8, score: 1 },
|
|
98
|
+
{ character: 'j', count: 2, score: 3 },
|
|
99
|
+
{ character: 'k', count: 3, score: 2 },
|
|
100
|
+
{ character: 'l', count: 3, score: 2 },
|
|
101
|
+
{ character: 'ł', count: 2, score: 3 },
|
|
102
|
+
{ character: 'm', count: 3, score: 2 },
|
|
103
|
+
{ character: 'n', count: 5, score: 1 },
|
|
104
|
+
{ character: 'ń', count: 1, score: 5 },
|
|
105
|
+
{ character: 'o', count: 6, score: 1 },
|
|
106
|
+
{ character: 'ó', count: 1, score: 5 },
|
|
107
|
+
{ character: 'p', count: 3, score: 2 },
|
|
108
|
+
{ character: 'r', count: 4, score: 1 },
|
|
109
|
+
{ character: 's', count: 4, score: 1 },
|
|
110
|
+
{ character: 'ś', count: 1, score: 5 },
|
|
111
|
+
{ character: 't', count: 3, score: 2 },
|
|
112
|
+
{ character: 'u', count: 2, score: 3 },
|
|
113
|
+
{ character: 'w', count: 4, score: 1 },
|
|
114
|
+
{ character: 'y', count: 4, score: 2 },
|
|
115
|
+
{ character: 'z', count: 5, score: 1 },
|
|
116
|
+
{ character: 'ź', count: 1, score: 5 },
|
|
117
|
+
{ character: 'ż', count: 1, score: 5 },
|
|
118
|
+
],
|
|
119
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrabble-solver/configs",
|
|
3
|
-
"version": "2.18.
|
|
4
|
-
"description": "Game and language configs for Scrabble Solver: board layouts, bonus squares, tile distributions, and points for
|
|
3
|
+
"version": "2.18.4",
|
|
4
|
+
"description": "Game and language configs for Scrabble Solver: board layouts, bonus squares, tile distributions, and points for 8 games and 9 locales.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"scrabble",
|
|
7
7
|
"board-game",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"game-config",
|
|
10
10
|
"literaki",
|
|
11
11
|
"kelimelik",
|
|
12
|
+
"wyrazy",
|
|
12
13
|
"super-scrabble"
|
|
13
14
|
],
|
|
14
15
|
"main": "build/index.js",
|
|
@@ -32,8 +33,8 @@
|
|
|
32
33
|
"clean": "rimraf build/"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"@scrabble-solver/constants": "^2.18.
|
|
36
|
-
"@scrabble-solver/types": "^2.18.
|
|
36
|
+
"@scrabble-solver/constants": "^2.18.4",
|
|
37
|
+
"@scrabble-solver/types": "^2.18.4"
|
|
37
38
|
},
|
|
38
39
|
"gitHead": "1e2d1ad49a288d4a44196d8e3336740da132c637"
|
|
39
40
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { BONUS_CHARACTER, BONUS_WORD } from '@scrabble-solver/constants';
|
|
2
|
+
import { Game } from '@scrabble-solver/types';
|
|
3
|
+
|
|
4
|
+
export const wyrazy = {
|
|
5
|
+
bingo: { score: 25 },
|
|
6
|
+
blankScore: 0,
|
|
7
|
+
blanksCount: 2,
|
|
8
|
+
boardHeight: 15,
|
|
9
|
+
boardWidth: 15,
|
|
10
|
+
game: Game.Wyrazy,
|
|
11
|
+
name: 'Wyrazy',
|
|
12
|
+
rackSize: 7,
|
|
13
|
+
bonuses: [
|
|
14
|
+
{ multiplier: 3, type: BONUS_WORD, x: 2, y: 0 },
|
|
15
|
+
{ multiplier: 2, type: BONUS_CHARACTER, x: 6, y: 0 },
|
|
16
|
+
{ multiplier: 2, type: BONUS_CHARACTER, x: 8, y: 0 },
|
|
17
|
+
{ multiplier: 3, type: BONUS_WORD, x: 12, y: 0 },
|
|
18
|
+
{ multiplier: 3, type: BONUS_CHARACTER, x: 1, y: 1 },
|
|
19
|
+
{ multiplier: 2, type: BONUS_WORD, x: 5, y: 1 },
|
|
20
|
+
{ multiplier: 2, type: BONUS_WORD, x: 9, y: 1 },
|
|
21
|
+
{ multiplier: 3, type: BONUS_CHARACTER, x: 13, y: 1 },
|
|
22
|
+
{ multiplier: 3, type: BONUS_WORD, x: 0, y: 2 },
|
|
23
|
+
{ multiplier: 3, type: BONUS_CHARACTER, x: 4, y: 2 },
|
|
24
|
+
{ multiplier: 3, type: BONUS_CHARACTER, x: 10, y: 2 },
|
|
25
|
+
{ multiplier: 3, type: BONUS_WORD, x: 14, y: 2 },
|
|
26
|
+
{ multiplier: 2, type: BONUS_CHARACTER, x: 3, y: 3 },
|
|
27
|
+
{ multiplier: 2, type: BONUS_WORD, x: 7, y: 3 },
|
|
28
|
+
{ multiplier: 2, type: BONUS_CHARACTER, x: 11, y: 3 },
|
|
29
|
+
{ multiplier: 3, type: BONUS_CHARACTER, x: 2, y: 4 },
|
|
30
|
+
{ multiplier: 2, type: BONUS_CHARACTER, x: 6, y: 4 },
|
|
31
|
+
{ multiplier: 2, type: BONUS_CHARACTER, x: 8, y: 4 },
|
|
32
|
+
{ multiplier: 3, type: BONUS_CHARACTER, x: 12, y: 4 },
|
|
33
|
+
{ multiplier: 2, type: BONUS_WORD, x: 1, y: 5 },
|
|
34
|
+
{ multiplier: 3, type: BONUS_CHARACTER, x: 5, y: 5 },
|
|
35
|
+
{ multiplier: 3, type: BONUS_CHARACTER, x: 9, y: 5 },
|
|
36
|
+
{ multiplier: 2, type: BONUS_WORD, x: 13, y: 5 },
|
|
37
|
+
{ multiplier: 2, type: BONUS_CHARACTER, x: 0, y: 6 },
|
|
38
|
+
{ multiplier: 2, type: BONUS_CHARACTER, x: 4, y: 6 },
|
|
39
|
+
{ multiplier: 2, type: BONUS_CHARACTER, x: 10, y: 6 },
|
|
40
|
+
{ multiplier: 2, type: BONUS_CHARACTER, x: 14, y: 6 },
|
|
41
|
+
{ multiplier: 2, type: BONUS_WORD, x: 3, y: 7 },
|
|
42
|
+
{ multiplier: 2, type: BONUS_WORD, x: 11, y: 7 },
|
|
43
|
+
{ multiplier: 2, type: BONUS_CHARACTER, x: 0, y: 8 },
|
|
44
|
+
{ multiplier: 2, type: BONUS_CHARACTER, x: 4, y: 8 },
|
|
45
|
+
{ multiplier: 2, type: BONUS_CHARACTER, x: 10, y: 8 },
|
|
46
|
+
{ multiplier: 2, type: BONUS_CHARACTER, x: 14, y: 8 },
|
|
47
|
+
{ multiplier: 2, type: BONUS_WORD, x: 1, y: 9 },
|
|
48
|
+
{ multiplier: 3, type: BONUS_CHARACTER, x: 5, y: 9 },
|
|
49
|
+
{ multiplier: 3, type: BONUS_CHARACTER, x: 9, y: 9 },
|
|
50
|
+
{ multiplier: 2, type: BONUS_WORD, x: 13, y: 9 },
|
|
51
|
+
{ multiplier: 3, type: BONUS_CHARACTER, x: 2, y: 10 },
|
|
52
|
+
{ multiplier: 2, type: BONUS_CHARACTER, x: 6, y: 10 },
|
|
53
|
+
{ multiplier: 2, type: BONUS_CHARACTER, x: 8, y: 10 },
|
|
54
|
+
{ multiplier: 3, type: BONUS_CHARACTER, x: 12, y: 10 },
|
|
55
|
+
{ multiplier: 2, type: BONUS_CHARACTER, x: 3, y: 11 },
|
|
56
|
+
{ multiplier: 2, type: BONUS_WORD, x: 7, y: 11 },
|
|
57
|
+
{ multiplier: 2, type: BONUS_CHARACTER, x: 11, y: 11 },
|
|
58
|
+
{ multiplier: 3, type: BONUS_WORD, x: 0, y: 12 },
|
|
59
|
+
{ multiplier: 3, type: BONUS_CHARACTER, x: 4, y: 12 },
|
|
60
|
+
{ multiplier: 3, type: BONUS_CHARACTER, x: 10, y: 12 },
|
|
61
|
+
{ multiplier: 3, type: BONUS_WORD, x: 14, y: 12 },
|
|
62
|
+
{ multiplier: 3, type: BONUS_CHARACTER, x: 1, y: 13 },
|
|
63
|
+
{ multiplier: 2, type: BONUS_WORD, x: 5, y: 13 },
|
|
64
|
+
{ multiplier: 2, type: BONUS_WORD, x: 9, y: 13 },
|
|
65
|
+
{ multiplier: 3, type: BONUS_CHARACTER, x: 13, y: 13 },
|
|
66
|
+
{ multiplier: 3, type: BONUS_WORD, x: 2, y: 14 },
|
|
67
|
+
{ multiplier: 2, type: BONUS_CHARACTER, x: 6, y: 14 },
|
|
68
|
+
{ multiplier: 2, type: BONUS_CHARACTER, x: 8, y: 14 },
|
|
69
|
+
{ multiplier: 3, type: BONUS_WORD, x: 12, y: 14 },
|
|
70
|
+
],
|
|
71
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Config, Locale } from '@scrabble-solver/types';
|
|
2
2
|
|
|
3
|
-
import { literaki, scrabble } from '../games';
|
|
3
|
+
import { literaki, scrabble, wyrazy } from '../games';
|
|
4
4
|
|
|
5
5
|
export const polishScrabble = new Config({
|
|
6
6
|
...scrabble,
|
|
@@ -79,3 +79,42 @@ export const polishLiteraki = new Config({
|
|
|
79
79
|
{ character: 'ż', count: 1, score: 5 },
|
|
80
80
|
],
|
|
81
81
|
});
|
|
82
|
+
|
|
83
|
+
export const polishWyrazy = new Config({
|
|
84
|
+
...wyrazy,
|
|
85
|
+
locale: Locale.PL_PL,
|
|
86
|
+
tiles: [
|
|
87
|
+
{ character: 'a', count: 9, score: 1 },
|
|
88
|
+
{ character: 'ą', count: 1, score: 5 },
|
|
89
|
+
{ character: 'b', count: 2, score: 3 },
|
|
90
|
+
{ character: 'c', count: 3, score: 2 },
|
|
91
|
+
{ character: 'ć', count: 1, score: 5 },
|
|
92
|
+
{ character: 'd', count: 3, score: 2 },
|
|
93
|
+
{ character: 'e', count: 7, score: 1 },
|
|
94
|
+
{ character: 'ę', count: 1, score: 5 },
|
|
95
|
+
{ character: 'f', count: 1, score: 5 },
|
|
96
|
+
{ character: 'g', count: 2, score: 3 },
|
|
97
|
+
{ character: 'h', count: 2, score: 3 },
|
|
98
|
+
{ character: 'i', count: 8, score: 1 },
|
|
99
|
+
{ character: 'j', count: 2, score: 3 },
|
|
100
|
+
{ character: 'k', count: 3, score: 2 },
|
|
101
|
+
{ character: 'l', count: 3, score: 2 },
|
|
102
|
+
{ character: 'ł', count: 2, score: 3 },
|
|
103
|
+
{ character: 'm', count: 3, score: 2 },
|
|
104
|
+
{ character: 'n', count: 5, score: 1 },
|
|
105
|
+
{ character: 'ń', count: 1, score: 5 },
|
|
106
|
+
{ character: 'o', count: 6, score: 1 },
|
|
107
|
+
{ character: 'ó', count: 1, score: 5 },
|
|
108
|
+
{ character: 'p', count: 3, score: 2 },
|
|
109
|
+
{ character: 'r', count: 4, score: 1 },
|
|
110
|
+
{ character: 's', count: 4, score: 1 },
|
|
111
|
+
{ character: 'ś', count: 1, score: 5 },
|
|
112
|
+
{ character: 't', count: 3, score: 2 },
|
|
113
|
+
{ character: 'u', count: 2, score: 3 },
|
|
114
|
+
{ character: 'w', count: 4, score: 1 },
|
|
115
|
+
{ character: 'y', count: 4, score: 2 },
|
|
116
|
+
{ character: 'z', count: 5, score: 1 },
|
|
117
|
+
{ character: 'ź', count: 1, score: 5 },
|
|
118
|
+
{ character: 'ż', count: 1, score: 5 },
|
|
119
|
+
],
|
|
120
|
+
});
|
|
@@ -7,11 +7,8 @@ const rootDirectory = path.resolve(__dirname, '..');
|
|
|
7
7
|
const { dictionaries } = require(rootDirectory);
|
|
8
8
|
|
|
9
9
|
const updateDictionaries = async () => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} catch (error) {
|
|
13
|
-
console.error(error);
|
|
14
|
-
}
|
|
10
|
+
const failedLocales = await dictionaries.update();
|
|
11
|
+
process.exitCode = failedLocales.length > 0 ? 1 : 0;
|
|
15
12
|
};
|
|
16
13
|
|
|
17
14
|
updateDictionaries();
|
|
@@ -21,7 +21,6 @@ class Dictionaries {
|
|
|
21
21
|
return gaddag;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
logger_1.logger.info('Dictionaries - cache miss', { locale });
|
|
25
24
|
return this.updateDictionary(locale);
|
|
26
25
|
}
|
|
27
26
|
remove() {
|
|
@@ -30,14 +29,20 @@ class Dictionaries {
|
|
|
30
29
|
}
|
|
31
30
|
async update(force) {
|
|
32
31
|
const locales = force ? Object.values(types_1.Locale) : this.getLocalesToUpdate();
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const outcomes = await Promise.allSettled(locales.map((locale) => this.updateDictionary(locale)));
|
|
33
|
+
const failedLocales = [];
|
|
34
|
+
outcomes.forEach((outcome, index) => {
|
|
35
|
+
if (outcome.status === 'rejected') {
|
|
36
|
+
(0, logger_1.logError)('build', outcome.reason, { locale: locales[index] });
|
|
37
|
+
failedLocales.push(locales[index]);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return failedLocales;
|
|
35
41
|
}
|
|
36
42
|
getLocalesToUpdate() {
|
|
37
43
|
return Object.values(types_1.Locale).filter((locale) => this.cache.isStale(locale) !== false);
|
|
38
44
|
}
|
|
39
45
|
async updateDictionary(locale) {
|
|
40
|
-
logger_1.logger.info('Dictionaries - updateDictionary', { locale });
|
|
41
46
|
fs_1.default.mkdirSync(constants_1.OUTPUT_DIRECTORY, { recursive: true });
|
|
42
47
|
const downloadDictionaryProxy = this.downloadDictionaryProxies[locale];
|
|
43
48
|
const gaddag = await downloadDictionaryProxy();
|
|
@@ -28,7 +28,7 @@ class DiskCache {
|
|
|
28
28
|
return gaddag_1.Gaddag.deserialize(new Uint8Array(serialized.buffer, serialized.byteOffset, serialized.byteLength));
|
|
29
29
|
}
|
|
30
30
|
catch (error) {
|
|
31
|
-
logger_1.
|
|
31
|
+
(0, logger_1.logError)('cache', error, { level: 'warn', locale });
|
|
32
32
|
await fs_1.default.promises.rm(filepath, { force: true });
|
|
33
33
|
return undefined;
|
|
34
34
|
}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.downloadDictionary =
|
|
3
|
+
exports.downloadDictionary = downloadDictionary;
|
|
4
4
|
const gaddag_1 = require("@kamilmielnik/gaddag");
|
|
5
5
|
const logger_1 = require("@scrabble-solver/logger");
|
|
6
6
|
const word_lists_1 = require("@scrabble-solver/word-lists");
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
async function downloadDictionary(locale) {
|
|
8
|
+
const downloadStartedAt = performance.now();
|
|
9
9
|
const words = await (0, word_lists_1.getWordList)(locale);
|
|
10
|
-
|
|
10
|
+
const buildStartedAt = performance.now();
|
|
11
11
|
const gaddag = gaddag_1.Gaddag.fromArray(words);
|
|
12
|
-
logger_1.
|
|
12
|
+
(0, logger_1.logEvent)({
|
|
13
|
+
type: 'build',
|
|
14
|
+
locale,
|
|
15
|
+
words: words.length,
|
|
16
|
+
download_ms: Math.round(buildStartedAt - downloadStartedAt),
|
|
17
|
+
build_ms: Math.round(performance.now() - buildStartedAt),
|
|
18
|
+
});
|
|
13
19
|
return gaddag;
|
|
14
|
-
}
|
|
15
|
-
exports.downloadDictionary = downloadDictionary;
|
|
20
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrabble-solver/dictionaries",
|
|
3
|
-
"version": "2.18.
|
|
3
|
+
"version": "2.18.4",
|
|
4
4
|
"description": "Dictionary manager for Scrabble Solver: downloads per-locale word lists and serves them as GADDAG automata with layered disk/memory caching.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"scrabble",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@kamilmielnik/gaddag": "^2.0.0",
|
|
41
|
-
"@scrabble-solver/logger": "^2.18.
|
|
42
|
-
"@scrabble-solver/types": "^2.18.
|
|
43
|
-
"@scrabble-solver/word-lists": "^2.18.
|
|
41
|
+
"@scrabble-solver/logger": "^2.18.4",
|
|
42
|
+
"@scrabble-solver/types": "^2.18.4",
|
|
43
|
+
"@scrabble-solver/word-lists": "^2.18.4"
|
|
44
44
|
},
|
|
45
45
|
"gitHead": "1e2d1ad49a288d4a44196d8e3336740da132c637"
|
|
46
46
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Gaddag } from '@kamilmielnik/gaddag';
|
|
2
|
-
import {
|
|
2
|
+
import { logError } from '@scrabble-solver/logger';
|
|
3
3
|
import { Locale } from '@scrabble-solver/types';
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
|
|
@@ -28,7 +28,6 @@ export class Dictionaries {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
logger.info('Dictionaries - cache miss', { locale });
|
|
32
31
|
return this.updateDictionary(locale);
|
|
33
32
|
}
|
|
34
33
|
|
|
@@ -37,10 +36,19 @@ export class Dictionaries {
|
|
|
37
36
|
fs.rmdirSync(OUTPUT_DIRECTORY, { recursive: true });
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
public async update(force?: boolean): Promise<
|
|
39
|
+
public async update(force?: boolean): Promise<Locale[]> {
|
|
41
40
|
const locales = force ? Object.values(Locale) : this.getLocalesToUpdate();
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
const outcomes = await Promise.allSettled(locales.map((locale) => this.updateDictionary(locale)));
|
|
42
|
+
const failedLocales: Locale[] = [];
|
|
43
|
+
|
|
44
|
+
outcomes.forEach((outcome, index) => {
|
|
45
|
+
if (outcome.status === 'rejected') {
|
|
46
|
+
logError('build', outcome.reason, { locale: locales[index] });
|
|
47
|
+
failedLocales.push(locales[index]);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
return failedLocales;
|
|
44
52
|
}
|
|
45
53
|
|
|
46
54
|
private getLocalesToUpdate(): Locale[] {
|
|
@@ -48,7 +56,6 @@ export class Dictionaries {
|
|
|
48
56
|
}
|
|
49
57
|
|
|
50
58
|
private async updateDictionary(locale: Locale): Promise<Gaddag> {
|
|
51
|
-
logger.info('Dictionaries - updateDictionary', { locale });
|
|
52
59
|
fs.mkdirSync(OUTPUT_DIRECTORY, { recursive: true });
|
|
53
60
|
const downloadDictionaryProxy = this.downloadDictionaryProxies[locale];
|
|
54
61
|
const gaddag = await downloadDictionaryProxy();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Gaddag } from '@kamilmielnik/gaddag';
|
|
2
|
-
import {
|
|
2
|
+
import { logError } from '@scrabble-solver/logger';
|
|
3
3
|
import { type Locale } from '@scrabble-solver/types';
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
|
|
@@ -31,7 +31,7 @@ export class DiskCache implements Cache<Locale, Gaddag> {
|
|
|
31
31
|
const serialized = await fs.promises.readFile(filepath);
|
|
32
32
|
return Gaddag.deserialize(new Uint8Array(serialized.buffer, serialized.byteOffset, serialized.byteLength));
|
|
33
33
|
} catch (error) {
|
|
34
|
-
|
|
34
|
+
logError('cache', error, { level: 'warn', locale });
|
|
35
35
|
await fs.promises.rm(filepath, { force: true });
|
|
36
36
|
return undefined;
|
|
37
37
|
}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { Gaddag } from '@kamilmielnik/gaddag';
|
|
2
|
-
import {
|
|
2
|
+
import { logEvent } from '@scrabble-solver/logger';
|
|
3
3
|
import { type Locale } from '@scrabble-solver/types';
|
|
4
4
|
import { getWordList } from '@scrabble-solver/word-lists';
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
|
|
6
|
+
export async function downloadDictionary(locale: Locale): Promise<Gaddag> {
|
|
7
|
+
const downloadStartedAt = performance.now();
|
|
8
8
|
const words = await getWordList(locale);
|
|
9
|
-
|
|
9
|
+
const buildStartedAt = performance.now();
|
|
10
10
|
const gaddag = Gaddag.fromArray(words);
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
logEvent({
|
|
13
|
+
type: 'build',
|
|
14
|
+
locale,
|
|
15
|
+
words: words.length,
|
|
16
|
+
download_ms: Math.round(buildStartedAt - downloadStartedAt),
|
|
17
|
+
build_ms: Math.round(performance.now() - buildStartedAt),
|
|
18
|
+
});
|
|
19
|
+
|
|
12
20
|
return gaddag;
|
|
13
|
-
}
|
|
21
|
+
}
|
|
@@ -1,3 +1,21 @@
|
|
|
1
1
|
# @scrabble-solver/logger
|
|
2
2
|
|
|
3
3
|
Logger used server-side.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
$HOME/.scrabble-solver/logs/events.txt
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Export to CSV
|
|
10
|
+
|
|
11
|
+
```shell
|
|
12
|
+
bun run --filter @scrabble-solver/logger export # every year
|
|
13
|
+
bun run --filter @scrabble-solver/logger export 2026 # one year
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
writes one file per event type and year to `$HOME/.scrabble-solver/csv/<type>-YYYY.csv`, e.g. `visit-2026.csv`.
|
|
17
|
+
|
|
18
|
+
## Previous format
|
|
19
|
+
|
|
20
|
+
Before August 2026 the package wrote output to `all.log` and `error.log` in the same directory.
|
|
21
|
+
Those files are neither read nor written anymore and can be deleted.
|
|
@@ -3,7 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.OUTPUT_DIRECTORY = void 0;
|
|
6
|
+
exports.IS_TEST_RUN = exports.CSV_DIRECTORY = exports.EVENTS_FILEPATH = exports.OUTPUT_DIRECTORY = void 0;
|
|
7
7
|
const os_1 = __importDefault(require("os"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
exports.OUTPUT_DIRECTORY = path_1.default.resolve(os_1.default.homedir(), '.scrabble-solver', 'logs');
|
|
10
|
+
exports.EVENTS_FILEPATH = path_1.default.resolve(exports.OUTPUT_DIRECTORY, 'events.txt');
|
|
11
|
+
exports.CSV_DIRECTORY = path_1.default.resolve(os_1.default.homedir(), '.scrabble-solver', 'csv');
|
|
12
|
+
exports.IS_TEST_RUN = process.env.NODE_ENV === 'test' || typeof describe === 'function';
|