From 22763268379847a60d3ecc904eb4c7fbe93f8637 Mon Sep 17 00:00:00 2001 From: xinbenlv Date: Fri, 28 Jun 2024 22:44:33 -0700 Subject: [PATCH] Add dist data and fix test --- package.json | 4 ++-- {data => src/data}/gwtwc/README.md | 0 {data => src/data}/gwtwc/count_1w.txt | 0 {data => src/data}/mit10k-en-US.txt | 0 {data => src/data}/words_dictionary.json | 0 src/english-word-club.ts | 6 +++++- tsconfig.json | 2 +- 7 files changed, 8 insertions(+), 4 deletions(-) rename {data => src/data}/gwtwc/README.md (100%) rename {data => src/data}/gwtwc/count_1w.txt (100%) rename {data => src/data}/mit10k-en-US.txt (100%) rename {data => src/data}/words_dictionary.json (100%) diff --git a/package.json b/package.json index 46c69f7..03d8426 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "@namefi/cat", - "version": "1.0.0-beta.2", + "version": "1.0.0-beta.3", "description": "Namefi Categorizer", "homepage": "https://namefi.io", "scripts": { "test": "jest", - "build": "tsc" + "build": "tsc && cp -R src/data dist/data" }, "engines": { diff --git a/data/gwtwc/README.md b/src/data/gwtwc/README.md similarity index 100% rename from data/gwtwc/README.md rename to src/data/gwtwc/README.md diff --git a/data/gwtwc/count_1w.txt b/src/data/gwtwc/count_1w.txt similarity index 100% rename from data/gwtwc/count_1w.txt rename to src/data/gwtwc/count_1w.txt diff --git a/data/mit10k-en-US.txt b/src/data/mit10k-en-US.txt similarity index 100% rename from data/mit10k-en-US.txt rename to src/data/mit10k-en-US.txt diff --git a/data/words_dictionary.json b/src/data/words_dictionary.json similarity index 100% rename from data/words_dictionary.json rename to src/data/words_dictionary.json diff --git a/src/english-word-club.ts b/src/english-word-club.ts index 110816b..84d0c01 100644 --- a/src/english-word-club.ts +++ b/src/english-word-club.ts @@ -4,8 +4,12 @@ import * as fs from 'fs'; import path from 'path'; +const mit10k_en_us_path = path.resolve(__dirname, './data/mit10k-en-US.txt'); -const mit10k_en_us = fs.readFileSync(path.resolve(__dirname, './data/mit10k-en-US.txt'), 'utf8').split('\n'); +console.log(`XXX __dirname=`, __dirname); + +console.log(`XXX mit10k_en_us_path=`, mit10k_en_us_path); +const mit10k_en_us = fs.readFileSync(mit10k_en_us_path, 'utf8').split('\n'); const gwtwc_top_333k = fs.readFileSync(path.resolve(__dirname, './data/gwtwc/count_1w.txt'), 'utf8').split('\n') .map((line) => { const word = line.split('\t')[0]; diff --git a/tsconfig.json b/tsconfig.json index 36dee51..5dceeaa 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,5 +9,5 @@ "strict": false }, "include": ["src/**/*"], - "exclude": ["node_modules", "dist"] + "exclude": ["node_modules", "dist", "**/*.spec.ts"] } \ No newline at end of file