Skip to content

Commit

Permalink
Unify browserless instance
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Jun 29, 2018
1 parent 0bd4ab2 commit e7ef6a9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
5 changes: 0 additions & 5 deletions bin/cli/browserless.js

This file was deleted.

4 changes: 1 addition & 3 deletions bin/cli/extract-urls.js
Expand Up @@ -6,12 +6,10 @@ const getHTML = require('html-get')
const cheerio = require('cheerio') const cheerio = require('cheerio')
const { map } = require('lodash') const { map } = require('lodash')


const browserless = require('./browserless')

const { isXmlUrl } = fromXML const { isXmlUrl } = fromXML


const fromHTML = async (url, { selector, prerender, ...opts }) => { const fromHTML = async (url, { selector, prerender, ...opts }) => {
const { html: rawHtml } = await getHTML(url, { browserless, prerender }) const { html: rawHtml } = await getHTML(url, { prerender })
const $ = cheerio.load(rawHtml) const $ = cheerio.load(rawHtml)
const html = selector ? $(selector).html() : rawHtml const html = selector ? $(selector).html() : rawHtml
const urls = await getUrlsFromHtml({ url, html, ...opts }) const urls = await getUrlsFromHtml({ url, html, ...opts })
Expand Down
3 changes: 1 addition & 2 deletions bin/cli/index.js
Expand Up @@ -10,7 +10,6 @@ const { ci } = require('ci-env')


const extractUrls = require('./extract-urls') const extractUrls = require('./extract-urls')
const renderError = require('./render-error') const renderError = require('./render-error')
const browserless = require('./browserless')
const pkg = require('../../package.json') const pkg = require('../../package.json')
const getError = require('./get-error') const getError = require('./get-error')
const getUrl = require('./get-url') const getUrl = require('./get-url')
Expand Down Expand Up @@ -92,7 +91,7 @@ const cli = require('meow')(require('./help'), {


await build.start() await build.start()
const urls = await extractUrls(url, opts) const urls = await extractUrls(url, opts)
const emitter = await urlint(urls, { browserless, ...opts }) const emitter = await urlint(urls, opts)
view({ total: size(urls), emitter, ...opts }) view({ total: size(urls), emitter, ...opts })
} catch (genericError) { } catch (genericError) {
const error = getError(genericError) const error = getError(genericError)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -32,14 +32,14 @@
"validate" "validate"
], ],
"dependencies": { "dependencies": {
"@urlint/core": "~1.3.1", "@urlint/core": "~1.3.2",
"chalk": "~2.4.1", "chalk": "~2.4.1",
"cheerio": "~1.0.0-rc.2", "cheerio": "~1.0.0-rc.2",
"ci-env": "~1.6.1", "ci-env": "~1.6.1",
"clean-stack": "~1.3.0", "clean-stack": "~1.3.0",
"cosmiconfig": "~5.0.5", "cosmiconfig": "~5.0.5",
"github-build": "~1.2.0", "github-build": "~1.2.0",
"html-get": "~1.0.3", "html-get": "~1.0.6",
"html-urls": "~2.0.0", "html-urls": "~2.0.0",
"lodash": "~4.17.10", "lodash": "~4.17.10",
"meow": "~5.0.0", "meow": "~5.0.0",
Expand Down

0 comments on commit e7ef6a9

Please sign in to comment.