Skip to content

Commit

Permalink
Merge pull request #120 from extractus/dev
Browse files Browse the repository at this point in the history
v7.0.8
  • Loading branch information
ndaidong authored Dec 2, 2023
2 parents 4a1cd0b + 156bae3 commit 28eef1d
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 14 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ on: [push, pull_request]
jobs:
test:

runs-on: ubuntu-22.04
runs-on: ubuntu-latest

strategy:
matrix:
node_version: [16.x, 18.x, 20.x]
node_version: [18.x, 20.x, 21.x]

steps:
- uses: actions/checkout@v3

- name: setup Node.js v${{ matrix.node_version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}

Expand All @@ -31,8 +31,8 @@ jobs:
npm run build --if-present
npm run test
- name: sync to coveralls
uses: coverallsapp/github-action@v1.1.2
- name: Report Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ pnpm-lock.yaml

output.json
deno.lock

bundle.cjs
bundle.cjs.map
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ import { extract } from 'https://esm.sh/@extractus/feed-extractor'
Please check [the examples](https://github.com/extractus/feed-extractor/tree/main/examples) for reference.


## Automate RSS feed extraction with GitHub Actions

[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.
It fetches an RSS feed from a given URL and saves it to a specified file in your GitHub repository.
This action is particularly useful for populating content on GitHub Pages websites or other static site generators.


## CJS Deprecated

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.

- You can ignore this warning via the environment variable `FEED_EXTRACTOR_CJS_IGNORE_WARNING=true`
- To see where the warning is coming from you can set the environment variable `FEED_EXTRACTOR_CJS_TRACE_WARNING=true`


## APIs

- [extract()](#extract)
Expand Down
20 changes: 20 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { build } from 'esbuild'
import fs from 'fs'

const { dependencies } = JSON.parse(fs.readFileSync('./package.json', 'utf8'))
// we need esbuild to process esm dependencies while leaving cjs compatible ones
// out of the bundle
const esmDependencies = new Set(['bellajs'])
const externalDeps = Object.keys(dependencies)
.filter(dep => !esmDependencies.has(dep))

build({
entryPoints: ['./src/cjs-entry.js'],
bundle: true,
platform: 'node',
target: 'node16',
outfile: 'bundle.cjs',
minify: true,
sourcemap: true,
external: externalDeps,
})
4 changes: 2 additions & 2 deletions examples/bun-feed-reader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"start": "bun run index.ts"
},
"devDependencies": {
"bun-types": "^0.6.13"
"bun-types": "^1.0.14"
},
"dependencies": {
"@extractus/feed-extractor": "latest",
"hono": "^3.2.7"
"hono": "^3.10.2"
}
}
2 changes: 1 addition & 1 deletion examples/deno-feed-reader/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { serve } from 'https://deno.land/std/http/server.ts'

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

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

Expand Down
3 changes: 2 additions & 1 deletion examples/tsnode-feed-reader/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "tsnode-feed-reader",
"version": "1.0.0",
"type": "module",
"main": "index.ts",
"scripts": {
"prestart": "npx tsc",
"start": "node dist/index.js"
},
"devDependencies": {
"typescript": "^5.1.6"
"typescript": "^5.3.2"
},
"dependencies": {
"@extractus/feed-extractor": "latest",
Expand Down
2 changes: 1 addition & 1 deletion examples/tsnode-feed-reader/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"module": "commonjs",
"module": "es6",
"esModuleInterop": true,
"target": "es6",
"moduleResolution": "node",
Expand Down
17 changes: 14 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "7.0.7",
"version": "7.0.8",
"name": "@extractus/feed-extractor",
"description": "To read and normalize RSS/ATOM/JSON feed data",
"homepage": "https://extractor-demos.pages.dev",
Expand All @@ -10,6 +10,14 @@
"author": "@extractus",
"main": "./src/main.js",
"type": "module",
"exports": {
".": {
"types": "./index.d.ts",
"import": "./src/main.js",
"require": "./bundle.cjs",
"default": "./src/main.js"
}
},
"imports": {
"cross-fetch": "./src/deno/cross-fetch.js"
},
Expand All @@ -23,6 +31,8 @@
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"build": "node build",
"prepublishOnly": "npm run build",
"pretest": "npm run lint",
"test": "NODE_ENV=test NODE_OPTIONS=--experimental-vm-modules jest --verbose --coverage=true",
"eval": "node eval",
Expand All @@ -35,10 +45,11 @@
"html-entities": "^2.4.0"
},
"devDependencies": {
"eslint": "^8.53.0",
"esbuild": "^0.19.8",
"eslint": "^8.55.0",
"https-proxy-agent": "^7.0.2",
"jest": "^29.7.0",
"nock": "^13.3.8"
"nock": "^13.4.0"
},
"keywords": [
"extractor",
Expand Down
14 changes: 14 additions & 0 deletions src/cjs-entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function warnCjsUsage () {
if (process.env.FEED_EXTRACTOR_CJS_IGNORE_WARNING?.toLowerCase() === 'true') return
const yellow = (str) => `\u001b[33m${str}\u001b[39m`
const log = process.env.FEED_EXTRACTOR_CJS_TRACE_WARNING?.toLowerCase() === 'true' ? console.trace : console.warn
log(
yellow(
'The CJS build of @extractus/feed-extractor is deprecated. See https://github.com/extractus/feed-extractor#cjs-deprecated for details.'
)
)
}

warnCjsUsage()

export * from './main'

0 comments on commit 28eef1d

Please sign in to comment.