Skip to content

Commit

Permalink
Bump deps (#1)
Browse files Browse the repository at this point in the history
* Update package.json

* Add node version

* Add CI step

* Bump nock to 13.5.6

* Add chrome to test-web

* Partition nock tests for browser compat

* Update dependabot

* Run chrome headless

* Fix dependabot
  • Loading branch information
jocmp authored Dec 2, 2024
1 parent e8ba7ec commit 0a4fcb0
Show file tree
Hide file tree
Showing 15 changed files with 129 additions and 356 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: weekly
29 changes: 29 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI

on: push

jobs:
test-node:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: 'yarn'
node-version-file: '.tool-versions'
- run: yarn install
- run: yarn test:node

test-web:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: browser-actions/setup-chrome@v1
- uses: actions/setup-node@v4
with:
cache: 'yarn'
node-version-file: '.tool-versions'
- run: yarn install
- run: yarn test:web


1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ dist/mercury_test.js.map
dist/mercury_test.web.js
tmp/artifacts
test-output.json
.tool-versions
.yarnrc.yml
**/.DS_Store
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 22.11.0
File renamed without changes.
201 changes: 0 additions & 201 deletions LICENSE-APACHE

This file was deleted.

26 changes: 8 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,25 @@
# Postlight Parser - Extracting content from chaos
# Mercury Parser - Extracting content from chaos

[![CircleCI](https://circleci.com/gh/postlight/parser.svg?style=svg&circle-token=3026c2b527d3767750e767872d08991aeb4f8f10)](https://circleci.com/gh/postlight/mercury-parser) [![Greenkeeper badge](https://badges.greenkeeper.io/postlight/mercury-parser.svg)](https://greenkeeper.io/) [![Apache License][license-apach-badge]][license-apach] [![MITC License][license-mit-badge]][license-mit]
[![Gitter chat](https://badges.gitter.im/postlight/mercury.png)](https://gitter.im/postlight/mercury)
Mercury Parser extracts the bits that humans care about from any URL you give it. That includes article content, titles, authors, published dates, excerpts, lead images, and more.

[license-apach-badge]: https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square
[license-apach]: https://github.com/postlight/mercury-parser/blob/master/LICENSE-APACHE
[license-mit-badge]: https://img.shields.io/badge/License-MIT%202.0-blue.svg?style=flat-square
[license-mit]: https://github.com/postlight/mercury-parser/blob/master/LICENSE-MIT

[Postlight](https://postlight.com)'s Parser extracts the bits that humans care about from any URL you give it. That includes article content, titles, authors, published dates, excerpts, lead images, and more.

Postlight Parser powers [Postlight Reader](https://reader.postlight.com/), a browser extension that removes ads and distractions, leaving only text and images for a beautiful reading view on any site.

Postlight Parser allows you to easily create custom parsers using simple JavaScript and CSS selectors. This allows you to proactively manage parsing and migration edge cases. There are [many examples available](https://github.com/postlight/parser/tree/master/src/extractors/custom) along with [documentation](https://github.com/postlight/parser/blob/master/src/extractors/custom/README.md).
Mercury Parser allows you to easily create custom parsers using simple JavaScript and CSS selectors. This allows you to proactively manage parsing and migration edge cases. There are [many examples available](https://github.com/jocmp/mercury-parser/tree/master/src/extractors/custom) along with [documentation](https://github.com/jocmp/mercury-parser/blob/master/src/extractors/custom/README.md).

## How? Like this.

### Installation

```bash
# If you're using yarn
yarn add @postlight/parser
yarn add @jocmp/mercury-parser

# If you're using npm
npm install @postlight/parser
npm install @jocmp/mercury-parser
```

### Usage

```javascript
import Parser from '@postlight/parser';
import Parser from '@jocmp/mercury-parser';

Parser.parse(url).then(result => console.log(result));

Expand Down Expand Up @@ -113,9 +103,9 @@ Postlight Parser also ships with a CLI, meaning you can use it from your command

```bash
# Install Postlight Parser globally
yarn global add @postlight/parser
yarn global add @jocmp/mercury-parser
# or
npm -g install @postlight/parser
npm -g install @jocmp/mercury-parser

# Then
postlight-parser https://postlight.com/trackchanges/mercury-goes-open-source
Expand Down
9 changes: 3 additions & 6 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
module.exports = function (config) {
module.exports = function(config) {
config.set({

basePath: '',

frameworks: ['jasmine', 'browserify'],
files: [
{ pattern: 'src/**/*.test.js', included: true },
],
files: [{ pattern: 'src/**/*.test.js', included: true }],

exclude: [],

Expand All @@ -24,7 +21,7 @@ module.exports = function (config) {
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
browsers: ['Chrome'],
browsers: ['ChromeHeadless'],
singleRun: true,
concurrency: Infinity,
});
Expand Down
4 changes: 2 additions & 2 deletions src/mercury.test.js → nock/mercury.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from 'assert';
import { record } from 'test-helpers';
import Parser from './mercury';
import { record } from './test-recorder';
import Parser from '../src/mercury';

const fs = require('fs');

Expand Down
6 changes: 3 additions & 3 deletions src/resource/index.test.js → nock/resource/index.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'assert';
import cheerio from 'cheerio';
import { getEncoding } from 'utils/text';
import { getEncoding } from '../../src/utils/text';

import { record } from 'test-helpers';
import Resource from './index';
import { record } from '../test-recorder';
import Resource from '../../src/resource/index';

describe('Resource', () => {
const recorder = record('resource-test');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import assert from 'assert';
import URL from 'url';

import { record } from 'test-helpers';
import fetchResource, { baseDomain, validateResponse } from './fetch-resource';
import { MAX_CONTENT_LENGTH } from './constants';
import { record } from '../../test-recorder';
import fetchResource, {
baseDomain,
validateResponse,
} from '../../../src/resource/utils/fetch-resource';
import { MAX_CONTENT_LENGTH } from '../../../src/resource/utils/constants';

describe('fetchResource(url)', () => {
const recorder = record('fetch-resource-test');
Expand Down
Loading

0 comments on commit 0a4fcb0

Please sign in to comment.