Skip to content

Commit

Permalink
misc: Switch to biome, add missing exports.
Browse files Browse the repository at this point in the history
vxern committed Oct 16, 2023

Verified

This commit was signed with the committer’s verified signature.
vxern Dorian M. Oszczęda
1 parent 222963e commit 87feb84
Showing 8 changed files with 194 additions and 240 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.1.1

- Switch from `rome` to `biome`.
- Add missing exports.

## 0.1.0

- Migrated package from Deno to Node.
7 changes: 6 additions & 1 deletion rome.json → biome.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
{
"$schema": "https://docs.rome.tools/schemas/12.1.3/schema.json",
"linter": {
"enabled": true,
"rules": {
"all": true,
"suspicious": {
"noEmptyInterface": "off"
},
"nursery": {
"useImportRestrictions": "off"
},
"style": {
"useNamingConvention": "off"
}
}
},
373 changes: 157 additions & 216 deletions package-lock.json

Large diffs are not rendered by default.

27 changes: 14 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
"name": "dexonline-scraper",
"description": "A lightweight Dexonline.ro page scraper to fetch information about words in the Romanian language.",
"license": "MIT",
"version": "0.1.0",
"version": "0.1.1",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"type": "module",
@@ -18,9 +18,9 @@
"language",
"dictionary"
],
"homepage": "https://github.com/wordcollector/dexonline-scraper",
"homepage": "https://github.com/vxern/dexonline-scraper",
"bugs": {
"url": "https://github.com/wordcollector/dexonline-scraper/issues",
"url": "https://github.com/vxern/dexonline-scraper/issues",
"email": "contact@wordcollector.co.uk"
},
"contributors": [
@@ -32,23 +32,24 @@
],
"repository": {
"type": "git",
"url": "https://github.com/wordcollector/dexonline-scraper"
"url": "https://github.com/vxern/dexonline-scraper"
},
"scripts": {
"build": "tsc",
"test": "mocha --no-warnings",
"format": "biome check src/ --apply-unsafe",
"publish": "tsc && npm publish"
},
"devDependencies": {
"@types/chai": "^4.3.5",
"@types/mocha": "^10.0.1",
"chai": "^4.3.7",
"mocha": "^10.2.0",
"rome": "12.1.3",
"ts-node": "^10.9.1",
"typescript": "^5.1.3"
},
"dependencies": {
"cheerio": "^1.0.0-rc.12"
},
"devDependencies": {
"@biomejs/biome": "1.2.2",
"@types/chai": "^4.3.8",
"@types/mocha": "^10.0.2",
"@types/node": "^20.8.6",
"chai": "^4.3.10",
"mocha": "^10.2.0",
"typescript": "^5.2.2"
}
}
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as cheerio from "cheerio";
import Links from "./constants/links.js";
import { DictionaryFlags, MatchingModes, ParserOptions, SearchOptionsWithWord } from "./options.js";
import * as Inflection from "./tabs/inflection.js";
import * as Synthesis from "./tabs/synthesis.js";
import { DictionaryFlags, MatchingModes, ParserOptions, SearchOptionsWithWord } from "./options.js";

/** The default search options. */
const defaultSearchOptions: ParserOptions = {
@@ -70,5 +70,7 @@ export function parse(
return { synthesis, inflection };
}

export { DictionaryFlags, MatchingModes, Synthesis, Links };
export * from "./tabs/inflection.js";
export * from "./tabs/synthesis.js";
export { DictionaryFlags, MatchingModes, Synthesis, Inflection, Links };
export type { ParserOptions };
2 changes: 1 addition & 1 deletion src/tabs/inflection.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CheerioAPI, Cheerio, Element } from "cheerio";
import { Cheerio, CheerioAPI, Element } from "cheerio";
import Expressions from "../constants/expressions.js";
import Selectors from "../constants/selectors.js";
import { ContentTabs, SearchOptionsWithWord } from "../options.js";
12 changes: 6 additions & 6 deletions src/tabs/synthesis.ts
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ interface Body extends Tree {
etymology: Etymology[];
}

type RelationTypes = "synonym" | "antonym" | "diminutive" | "augmentative";
export type RelationTypes = "synonym" | "antonym" | "diminutive" | "augmentative";

const relationTypeNameToRelationType: Record<string, RelationTypes> = {
sinonime: "synonym",
@@ -31,21 +31,21 @@ const relationTypeNameToRelationType: Record<string, RelationTypes> = {
augmentative: "augmentative",
};

type Relations = Record<`${RelationTypes}s`, string[]>;
export type Relations = Record<`${RelationTypes}s`, string[]>;

interface Example extends Row.Row {}
interface Definition extends Row.Row {
export interface Example extends Row.Row {}
export interface Definition extends Row.Row {
definitions: Definition[];
examples: Example[];
expressions: Expression[];
relations: Relations;
}
interface Expression extends Row.Row {
export interface Expression extends Row.Row {
examples: Example[];
expressions: Expression[];
relations: Relations;
}
interface Etymology extends Row.Row {}
export interface Etymology extends Row.Row {}

export function parse($: CheerioAPI, options: SearchOptionsWithWord): Lemma[] {
const synthesis = $(Selectors.contentTab(ContentTabs.Synthesis));
2 changes: 1 addition & 1 deletion src/tabs/synthesis/row.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CheerioAPI, Cheerio, Element } from "cheerio";
import { Cheerio, CheerioAPI, Element } from "cheerio";
import copyrightedDictionaries from "../../constants/copyright.js";
import Selectors from "../../constants/selectors.js";
import { ParserOptions } from "../../options.js";

0 comments on commit 87feb84

Please sign in to comment.