Skip to content

Commit

Permalink
Merge c538ef0 into d335cc8
Browse files Browse the repository at this point in the history
  • Loading branch information
ndaidong committed Jul 12, 2023
2 parents d335cc8 + c538ef0 commit 08e12ea
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 23 deletions.
16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ yarn add @extractus/article-extractor
```ts
// es6 module
import { extract } from '@extractus/article-extractor'

// CommonJS
const { extract } = require('@extractus/article-extractor')

// or specify exactly path to CommonJS variant
const { extract } = require('@extractus/article-extractor/dist/cjs/article-extractor.js')
```

### Deno
Expand All @@ -53,7 +47,7 @@ import { extract } from 'npm:@extractus/article-extractor'
### Browser

```ts
import { read } from 'https://unpkg.com/@extractus/article-extractor@latest/dist/article-extractor.esm.js'
import { extract } from '@extractus/article-extractor'
```

Please check [the examples](examples) for reference.
Expand Down Expand Up @@ -498,8 +492,8 @@ Read [sanitize-html](https://github.com/apostrophecms/sanitize-html#default-opti
```bash
git clone https://github.com/extractus/article-extractor.git
cd article-extractor
npm i
npm test
pnpm i
pnpm test
```

![article-extractor-test.png](https://i.imgur.com/TbRCUSS.png?110222)
Expand All @@ -510,8 +504,8 @@ npm test
```bash
git clone https://github.com/extractus/article-extractor.git
cd article-extractor
npm i
npm run eval {URL_TO_PARSE_ARTICLE}
pnpm i
pnpm eval {URL_TO_PARSE_ARTICLE}
```

## License
Expand Down
9 changes: 9 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"imports": {
"cross-fetch": "./src/deno/cross-fetch.js",
"linkedom": "https://deno.land/x/deno_dom@v0.1.38/deno-dom-wasm.ts",
"@mozilla/readability": "https://esm.sh/@mozilla/readability@0.4.4",
"sanitize-html": "https://esm.sh/sanitize-html@2.11.0",
"bellajs": "https://esm.sh/bellajs@11.1.2"
}
}
4 changes: 2 additions & 2 deletions eval.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// eval.js

import { execSync } from 'child_process'
import { readFileSync, writeFileSync, existsSync } from 'fs'
import { execSync } from 'node:child_process'
import { readFileSync, writeFileSync, existsSync } from 'node:fs'

import { slugify } from 'bellajs'

Expand Down
14 changes: 11 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "7.3.0",
"version": "8.0.0",
"name": "@extractus/article-extractor",
"description": "To extract main article from given URL",
"homepage": "https://github.com/extractus/article-extractor",
Expand All @@ -10,7 +10,15 @@
"author": "@extractus",
"main": "./src/main.js",
"type": "module",
"imports": {
"cross-fetch": "./src/deno/cross-fetch.js",
"linkedom": "https://deno.land/x/deno_dom@v0.1.38/deno-dom-wasm.ts",
"@mozilla/readability": "https://esm.sh/@mozilla/readability@0.4.4",
"sanitize-html": "https://esm.sh/sanitize-html@2.11.0",
"bellajs": "https://esm.sh/bellajs@11.1.2"
},
"browser": {
"cross-fetch": "./src/deno/cross-fetch.js",
"linkedom": "./src/browser/linkedom.js"
},
"types": "./index.d.ts",
Expand All @@ -35,8 +43,8 @@
"devDependencies": {
"@types/sanitize-html": "^2.9.0",
"eslint": "^8.44.0",
"https-proxy-agent": "^7.0.0",
"jest": "^29.6.0",
"https-proxy-agent": "^7.0.1",
"jest": "^29.6.1",
"nock": "^13.3.1"
},
"keywords": [
Expand Down
4 changes: 2 additions & 2 deletions reset.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import {
existsSync,
unlinkSync
} from 'fs'
} from 'node:fs'

import { execSync } from 'child_process'
import { execSync } from 'node:child_process'

const dirs = [
'evaluation',
Expand Down
2 changes: 1 addition & 1 deletion src/utils/extractMetaData.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// extractMetaData.test
/* eslint-env jest */

import { readFileSync } from 'fs'
import { readFileSync } from 'node:fs'

import { isObject, hasProperty } from 'bellajs'

Expand Down
2 changes: 1 addition & 1 deletion src/utils/extractWithReadability.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// extractWithReadability.test
/* eslint-env jest */

import { readFileSync } from 'fs'
import { readFileSync } from 'node:fs'

import { isString } from 'bellajs'

Expand Down
2 changes: 1 addition & 1 deletion src/utils/html.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// html.test
/* eslint-env jest */

import { readFileSync } from 'fs'
import { readFileSync } from 'node:fs'

import { isString } from 'bellajs'

Expand Down
2 changes: 1 addition & 1 deletion src/utils/linker.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// linker.test
/* eslint-env jest */

import { readFileSync } from 'fs'
import { readFileSync } from 'node:fs'

import { isString } from 'bellajs'

Expand Down
2 changes: 1 addition & 1 deletion src/utils/parseFromHtml.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// parseFromHtml.test
/* eslint-env jest */

import { readFileSync } from 'fs'
import { readFileSync } from 'node:fs'

import { isFunction } from 'bellajs'

Expand Down

0 comments on commit 08e12ea

Please sign in to comment.