Skip to content

Commit

Permalink
Fix type exports.
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisdonovan committed Oct 27, 2024
1 parent 19bb785 commit c3b4138
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 19 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 7 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
{
"name": "google-news-scraper",
"version": "1.2.7",
"version": "2.0.0-alpha.7",
"description": "Lightweight async scraper for Google News",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"module": "./dist/esm/index.mjs",
"types": "./dist/tsc/index.d.ts",
"exports": {
"import": "./dist/esm/index.js",
"import": "./dist/esm/index.mjs",
"require": "./dist/cjs/index.js"
},
"files": [
"dist/cjs/index.js",
"dist/cjs/min/index.min.js",
"dist/esm/index.js",
"dist/esm/min/index.min.js",
"dist/tsc/index.d.ts"
"dist/cjs/**/*.cjs",
"dist/esm/**/*.js",
"dist/tsc/**/*.d.ts"
],
"scripts": {
"test": "jest",
"build:ts": "tsc",
"build:rollup": "rollup -c",
"build": "rm -rf ./dist/* && npm run build:ts && npm run build:rollup"
},
"type": "module",
"repository": {
"type": "git",
"url": "https://github.com/lewisdonovan/google-news-scraper"
Expand All @@ -39,7 +36,7 @@
"google crawler"
],
"author": "Lewis Donovan",
"license": "SEE LICENSE IN LICENSE.txt",
"license": "SEE LICENSE IN LICENSE.txt",
"dependencies": {
"@mozilla/readability": "^0.5.0",
"@rollup/plugin-babel": "^6.0.4",
Expand Down
4 changes: 2 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ export default {
format: 'esm',
sourcemap: true,
preserveModules: false,
entryFileNames: '[name].js',
entryFileNames: '[name].mjs',
},
{
dir: './dist/esm/min',
format: 'esm',
plugins: [terser()],
sourcemap: true,
entryFileNames: '[name].min.js',
entryFileNames: '[name].min.mjs',
},
{
dir: './dist/cjs',
Expand Down
2 changes: 1 addition & 1 deletion src/getLogger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LogLevel } from "./types";
import { LogLevel } from "./types"
import winston from 'winston';

const config = {
Expand Down
1 change: 0 additions & 1 deletion src/global.d.ts

This file was deleted.

9 changes: 8 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ import getArticleType from './getArticleType';
import getPrettyUrl from './getPrettyUrl';
import buildQueryString from './buildQueryString';
import getArticleContent from './getArticleContent';
import { Article, Articles, GNSConfig, GNSUserConfig, QueryVars } from './types';
import {
QueryVars,
GNSUserConfig,
GNSConfig,
Article,
Articles
} from "./types"

const googleNewsScraper = async (userConfig: GNSUserConfig) => {
const config: GNSConfig = {
Expand Down Expand Up @@ -131,4 +137,5 @@ const googleNewsScraper = async (userConfig: GNSUserConfig) => {

}

export * from "./types";
export default googleNewsScraper;
6 changes: 5 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,8 @@ export interface ExtractArticleContentAndFaviconProps {
browser: Browser;
filterWords: string[];
logger: winston.Logger;
}
}

declare const googleNewsScraper: (userConfig: GNSUserConfig) => Promise<Article[]>;

export default googleNewsScraper;
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"target": "ES6",
"module": "ESNext",
"declaration": true,
"declarationMap": false,
"outDir": "./dist/tsc",
"rootDir": "./src",
"strict": true,
Expand Down

0 comments on commit c3b4138

Please sign in to comment.