diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bcaa543..34efd44 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ name: Release on: push: branches: - - main + - master jobs: release: runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index f5515fd..d0e1b6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,17 @@ # google-news-scraper CHANGELOG All notable changes to this project will be documented in this file. +## [2.0.0] - 2024-10-27 + +To update please run `npm update google-news-scraper` + +### Changed + +- Added support for both ESM and CJS. +- Added TypeScript support. +- Integrated Rollup to make shipping easier. +- Added release action, to bump version and ship to NPM every time we push to `master` branch`. + ## [1.2.2] - 2024-03-18 To update please run `npm update google-news-scraper` diff --git a/README.md b/README.md index ab7a471..8434f9d 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ A lightweight package that scrapes article data from [Google News](https://news. * [Usage](#usage-%EF%B8%8F) * [Output](#output-) * [Config](#config-%EF%B8%8F) +* [TypeScript](#typescript-) +* [CommonJS](#common-js-) * [Performance](#performance-) * [Upkeep](#upkeep-) * [Bugs](#bugs-) @@ -30,7 +32,7 @@ yarn add google-news-scraper ## Usage 🕹ī¸ Simply import the package and pass a config object. ```javascript -const googleNewsScraper = require('google-news-scraper'); +import googleNewsScraper from 'google-news-scraper'; const articles = await googleNewsScraper({ searchTerm: "The Oscars" }); @@ -145,6 +147,20 @@ Whether or not Puppeteer should run in [headless mode](https://www.browserstack. Defaults to `true` +## TypeScript 💙 +Google News Scraper includes full [TypeScript](https://typescriptlang.org/) definitions. + +Your IDE should pick the types up automatically, but if not you can find them in the `dist/tsc/` folder. + +## Common JS 👴đŸģ +Google News Scraper is built to work as an [ESM module](https://nodejs.org/api/esm.html) out of the box, but also works as a [Common JS module](https://nodejs.org/api/modules.html) too, just use `require` instead of `import`: +```javascript +const googleNewsScraper = require('google-news-scraper'); + +const articles = await googleNewsScraper({ searchTerm: "The Oscars" }); + +``` + ## Performance 📈 My test query returned 94 results, which took 4.5 seconds with article content and 3.6 seconds without it. I'm on a fibre connection, and other queries may return a different number of results, so your mileage may vary. diff --git a/package.json b/package.json index d12ce7f..ac6417e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "google-news-scraper", - "version": "2.0.0-alpha.7", + "version": "2.0.0", "description": "Lightweight async scraper for Google News", "main": "./dist/cjs/index.js", "module": "./dist/esm/index.mjs",