Skip to content

Commit 28eef1d

Browse files
authored
Merge pull request #120 from extractus/dev
v7.0.8
2 parents 4a1cd0b + 156bae3 commit 28eef1d

File tree

11 files changed

+78
-14
lines changed

11 files changed

+78
-14
lines changed

.github/workflows/ci-test.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ on: [push, pull_request]
88
jobs:
99
test:
1010

11-
runs-on: ubuntu-22.04
11+
runs-on: ubuntu-latest
1212

1313
strategy:
1414
matrix:
15-
node_version: [16.x, 18.x, 20.x]
15+
node_version: [18.x, 20.x, 21.x]
1616

1717
steps:
1818
- uses: actions/checkout@v3
1919

2020
- name: setup Node.js v${{ matrix.node_version }}
21-
uses: actions/setup-node@v3
21+
uses: actions/setup-node@v4
2222
with:
2323
node-version: ${{ matrix.node_version }}
2424

@@ -31,8 +31,8 @@ jobs:
3131
npm run build --if-present
3232
npm run test
3333
34-
- name: sync to coveralls
35-
uses: coverallsapp/github-action@v1.1.2
34+
- name: Report Coveralls
35+
uses: coverallsapp/github-action@v2
3636
with:
3737
github-token: ${{ secrets.GITHUB_TOKEN }}
3838

.github/workflows/codeql-analysis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838

3939
steps:
4040
- name: Checkout repository
41-
uses: actions/checkout@v3
41+
uses: actions/checkout@v4
4242

4343
# Initializes the CodeQL tools for scanning.
4444
- name: Initialize CodeQL

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ pnpm-lock.yaml
1818

1919
output.json
2020
deno.lock
21+
22+
bundle.cjs
23+
bundle.cjs.map

README.md

+15
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,21 @@ import { extract } from 'https://esm.sh/@extractus/feed-extractor'
4949
Please check [the examples](https://github.com/extractus/feed-extractor/tree/main/examples) for reference.
5050

5151

52+
## Automate RSS feed extraction with GitHub Actions
53+
54+
[RSS Feed Fetch Action](https://github.com/Promptly-Technologies-LLC/rss-fetch-action) is a GitHub Action designed to automate the fetching of RSS feeds.
55+
It fetches an RSS feed from a given URL and saves it to a specified file in your GitHub repository.
56+
This action is particularly useful for populating content on GitHub Pages websites or other static site generators.
57+
58+
59+
## CJS Deprecated
60+
61+
CJS is deprecated for this package. When calling `require('@extractus/feed-extractor')` a deprecation warning is now logged. You should update your code to use the ESM export.
62+
63+
- You can ignore this warning via the environment variable `FEED_EXTRACTOR_CJS_IGNORE_WARNING=true`
64+
- To see where the warning is coming from you can set the environment variable `FEED_EXTRACTOR_CJS_TRACE_WARNING=true`
65+
66+
5267
## APIs
5368

5469
- [extract()](#extract)

build.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { build } from 'esbuild'
2+
import fs from 'fs'
3+
4+
const { dependencies } = JSON.parse(fs.readFileSync('./package.json', 'utf8'))
5+
// we need esbuild to process esm dependencies while leaving cjs compatible ones
6+
// out of the bundle
7+
const esmDependencies = new Set(['bellajs'])
8+
const externalDeps = Object.keys(dependencies)
9+
.filter(dep => !esmDependencies.has(dep))
10+
11+
build({
12+
entryPoints: ['./src/cjs-entry.js'],
13+
bundle: true,
14+
platform: 'node',
15+
target: 'node16',
16+
outfile: 'bundle.cjs',
17+
minify: true,
18+
sourcemap: true,
19+
external: externalDeps,
20+
})

examples/bun-feed-reader/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"start": "bun run index.ts"
66
},
77
"devDependencies": {
8-
"bun-types": "^0.6.13"
8+
"bun-types": "^1.0.14"
99
},
1010
"dependencies": {
1111
"@extractus/feed-extractor": "latest",
12-
"hono": "^3.2.7"
12+
"hono": "^3.10.2"
1313
}
1414
}

examples/deno-feed-reader/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { serve } from 'https://deno.land/std/http/server.ts'
22

3-
import { Hono } from 'https://deno.land/x/hono@v3.2.7/mod.ts'
3+
import { Hono } from 'https://deno.land/x/hono@v3.10.2/mod.ts'
44

55
import { extract } from 'npm:@extractus/feed-extractor'
66

examples/tsnode-feed-reader/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
22
"name": "tsnode-feed-reader",
33
"version": "1.0.0",
4+
"type": "module",
45
"main": "index.ts",
56
"scripts": {
67
"prestart": "npx tsc",
78
"start": "node dist/index.js"
89
},
910
"devDependencies": {
10-
"typescript": "^5.1.6"
11+
"typescript": "^5.3.2"
1112
},
1213
"dependencies": {
1314
"@extractus/feed-extractor": "latest",

examples/tsnode-feed-reader/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"compilerOptions": {
3-
"module": "commonjs",
3+
"module": "es6",
44
"esModuleInterop": true,
55
"target": "es6",
66
"moduleResolution": "node",

package.json

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "7.0.7",
2+
"version": "7.0.8",
33
"name": "@extractus/feed-extractor",
44
"description": "To read and normalize RSS/ATOM/JSON feed data",
55
"homepage": "https://extractor-demos.pages.dev",
@@ -10,6 +10,14 @@
1010
"author": "@extractus",
1111
"main": "./src/main.js",
1212
"type": "module",
13+
"exports": {
14+
".": {
15+
"types": "./index.d.ts",
16+
"import": "./src/main.js",
17+
"require": "./bundle.cjs",
18+
"default": "./src/main.js"
19+
}
20+
},
1321
"imports": {
1422
"cross-fetch": "./src/deno/cross-fetch.js"
1523
},
@@ -23,6 +31,8 @@
2331
"scripts": {
2432
"lint": "eslint .",
2533
"lint:fix": "eslint --fix .",
34+
"build": "node build",
35+
"prepublishOnly": "npm run build",
2636
"pretest": "npm run lint",
2737
"test": "NODE_ENV=test NODE_OPTIONS=--experimental-vm-modules jest --verbose --coverage=true",
2838
"eval": "node eval",
@@ -35,10 +45,11 @@
3545
"html-entities": "^2.4.0"
3646
},
3747
"devDependencies": {
38-
"eslint": "^8.53.0",
48+
"esbuild": "^0.19.8",
49+
"eslint": "^8.55.0",
3950
"https-proxy-agent": "^7.0.2",
4051
"jest": "^29.7.0",
41-
"nock": "^13.3.8"
52+
"nock": "^13.4.0"
4253
},
4354
"keywords": [
4455
"extractor",

src/cjs-entry.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function warnCjsUsage () {
2+
if (process.env.FEED_EXTRACTOR_CJS_IGNORE_WARNING?.toLowerCase() === 'true') return
3+
const yellow = (str) => `\u001b[33m${str}\u001b[39m`
4+
const log = process.env.FEED_EXTRACTOR_CJS_TRACE_WARNING?.toLowerCase() === 'true' ? console.trace : console.warn
5+
log(
6+
yellow(
7+
'The CJS build of @extractus/feed-extractor is deprecated. See https://github.com/extractus/feed-extractor#cjs-deprecated for details.'
8+
)
9+
)
10+
}
11+
12+
warnCjsUsage()
13+
14+
export * from './main'

0 commit comments

Comments
 (0)