Compare commits

...

10 Commits

Author SHA1 Message Date
icyrockcom
dbf6c78697 Merge pull request #9 from icyrockcom/dependabot/npm_and_yarn/nth-check-and-cheerio-2.1.1
Bump nth-check and cheerio
2023-04-20 08:20:35 -04:00
dependabot[bot]
14e91e917c Bump nth-check and cheerio
Bumps [nth-check](https://github.com/fb55/nth-check) to 2.1.1 and updates ancestor dependency [cheerio](https://github.com/cheeriojs/cheerio). These dependencies need to be updated together.


Updates `nth-check` from 1.0.2 to 2.1.1
- [Release notes](https://github.com/fb55/nth-check/releases)
- [Commits](https://github.com/fb55/nth-check/compare/v1.0.2...v2.1.1)

Updates `cheerio` from 1.0.0-rc.3 to 1.0.0-rc.12
- [Release notes](https://github.com/cheeriojs/cheerio/releases)
- [Commits](https://github.com/cheeriojs/cheerio/compare/1.0.0-rc.3...v1.0.0-rc.12)

---
updated-dependencies:
- dependency-name: nth-check
  dependency-type: indirect
- dependency-name: cheerio
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-20 04:38:05 +00:00
icyrockcom
0920b63b0b v0.2.3 → v0.2.4 2021-08-16 22:44:38 -04:00
icyrockcom
4f50076221 Update to psc 0.14.3, dep ver and spago.dhall, fix typos 2021-08-16 22:42:37 -04:00
icyrockcom
b7ffb74ab3 v0.2.3 2020-07-15 20:52:59 -04:00
icyrockcom
c6b48b1597 Updated dependency version 2020-07-15 20:51:13 -04:00
icyrockcom
7a395b0c37 v0.2.2 2020-04-19 13:44:55 -04:00
icyrockcom
ec0a903f7d Move to spago 2020-04-17 22:03:59 -04:00
icyrockcom
a2f0cb8c4e v0.2.1 2019-11-02 00:15:45 -04:00
icyrockcom
370fa4b23e Updated dependencies versions 2019-11-02 00:10:54 -04:00
13 changed files with 209 additions and 2980 deletions

8
.gitignore vendored
View File

@@ -1,9 +1,7 @@
/bower_components/
/node_modules/
/.pulp-cache/
/output/
/generated-docs/
/.psc-package/
/.psc*
/.purs*
/.psa*
.psc-ide-port
.purs-repl
/.spago

1
.purs-repl Normal file
View File

@@ -0,0 +1 @@
import Prelude

View File

@@ -3,9 +3,9 @@ node_js:
- "stable"
sudo: false
install:
- npm install -g purescript pulp bower
- npm install -g purescript pulp spago
- npm install
- bower install
- spago install
after_success:
- >-
test $TRAVIS_TAG &&

View File

@@ -8,19 +8,25 @@ Basic bindings for [cheerio](https://cheerio.js.org/). Only includes read-only f
Install [cheerio](https://www.npmjs.com/package/cheerio) dependency:
$ npm install --save cheerio
```bash
$ npm install --save cheerio
```
Install this package:
Install this package using [spago](https://github.com/purescript/spago):
* Using [bower](https://bower.io/):
* Add package to your `spago.dhall`:
$ bower install --save purescript-cheerio
```dhall
...
dependencies = [ ..., "cheerio" ]
...
```
* Using [psc-package](https://github.com/purescript/psc-package):
* Install packages by running:
$ psc-package install cheerio
You might need to set up a [custom package set](https://github.com/purescript/psc-package#add-a-package-to-the-package-set).
```bash
$ spago install
```
## Example
@@ -28,29 +34,37 @@ From [basic example](examples/Basic.purs).
Imports:
import Cheerio (Cheerio, find, length)
import Cheerio.Static (loadRoot)
```purescript
import Cheerio (Cheerio, find, length)
import Cheerio.Static (loadRoot)
```
Example html:
htmlEx :: String
htmlEx = """
```purescript
htmlEx :: String
htmlEx = """
<ul id="fruits">
<li class="apple">Apple</li>
<li class="orange">Orange</li>
<li class="pear">Pear</li>
</ul>
"""
"""
```
Load it and get the root element:
root :: Cheerio
root = loadRoot htmlEx
```purescript
root :: Cheerio
root = loadRoot htmlEx
```
Use the query functions:
let fruitCount = find "#fruits" root # length
in log $ "Number of fruits: " <> show fruitCount
```purescript
let fruitCount = root # find "#fruits" # find "li" # length
in log $ "Number of fruits: " <> show fruitCount
```
For more examples, please take a look at the [unit tests](test/Test/Main.purs). They cover most of the read-only cheerio functions.

View File

@@ -1,31 +1,25 @@
{
"name": "purescript-cheerio",
"description": "PureScript bindings for Cheerio",
"main": "index.js",
"authors": [
"icyrock.com@icyrock.com"
"license": [
"MIT"
],
"license": "MIT",
"homepage": "https://github.com/icyrockcom/purescript-cheerio",
"repository": {
"type": "git",
"url": "https://github.com/icyrockcom/purescript-cheerio.git"
"url": "https://github.com/icyrockcom/purescript-cheerio"
},
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
"output"
],
"dependencies": {
"purescript-console": "^4.1.0",
"purescript-effect": "^2.0.0",
"purescript-functions": "^4.0.0",
"purescript-prelude": "^4.1.0",
"purescript-test-unit": "^14.0.0"
},
"devDependencies": {
"purescript-psci-support": "^4.0.0"
"purescript-arrays": "^v6.0.1",
"purescript-effect": "^v3.0.0",
"purescript-functions": "^v5.0.0",
"purescript-maybe": "^v5.0.0",
"purescript-prelude": "^v5.0.1",
"purescript-psci-support": "^v5.0.0",
"purescript-test-unit": "^v16.0.0"
}
}

View File

@@ -4,8 +4,8 @@ import Prelude
import Cheerio (Cheerio, find, length)
import Cheerio.Static (loadRoot)
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, log)
import Effect (Effect)
import Effect.Console (log)
htmlEx :: String
htmlEx = """
@@ -19,7 +19,7 @@ htmlEx = """
root :: Cheerio
root = loadRoot htmlEx
example :: forall eff. Eff (console :: CONSOLE | eff) Unit
example =
let fruitCount = find "#fruits" root # length
main :: Effect Unit
main =
let fruitCount = root # find "#fruits" # find "li" # length
in log $ "Number of fruits: " <> show fruitCount

2958
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +1,13 @@
{
"name": "purescript-cheerio",
"version": "0.2.0",
"version": "0.2.3",
"description": "PureScript bindings for Cheerio",
"main": "index.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "pulp test"
"test": "spago test"
},
"repository": {
"type": "git",
@@ -20,8 +20,6 @@
},
"homepage": "https://github.com/icyrockcom/purescript-cheerio#readme",
"dependencies": {
"cheerio": "^1.0.0-rc.2",
"lodash": "^4.17.5",
"npm": "^6.3.0"
"cheerio": "^1.0.0-rc.12"
}
}

8
packages.dhall Normal file
View File

@@ -0,0 +1,8 @@
let upstream =
https://github.com/purescript/package-sets/releases/download/psc-0.14.3-20210811/packages.dhall sha256:a2de7ef2f2e753733eddfa90573a82da0c7c61d46fa87d015b7f15ef8a6e97d5
let overrides = {=}
let additions = {=}
in upstream // overrides // additions

View File

@@ -1,13 +1,13 @@
{
"name": "purescript-cheerio",
"set": "psc-0.12.0-20180704",
"set": "psc-0.13.6-20200404",
"source": "https://github.com/purescript/package-sets.git",
"depends": [
"functions",
"test-unit",
"psci-support",
"console",
"effect",
"prelude"
"depends":
[ "console"
, "effect"
, "functions"
, "prelude"
, "psci-support"
, "test-unit"
]
}

15
spago.dhall Normal file
View File

@@ -0,0 +1,15 @@
{ name = "cheerio"
, license = "MIT"
, repository = "https://github.com/icyrockcom/purescript-cheerio"
, dependencies =
[ "arrays"
, "effect"
, "functions"
, "maybe"
, "prelude"
, "psci-support"
, "test-unit"
]
, packages = ./packages.dhall
, sources = [ "src/**/*.purs", "test/**/*.purs" ]
}

View File

@@ -1,20 +1,20 @@
module Cheerio (
Cheerio,
attr,
children,
eq,
first,
find,
hasClass,
html,
last,
length,
next,
parent,
prev,
siblings,
text,
toArray
module Cheerio
( Cheerio
, attr
, children
, eq
, first
, find
, hasClass
, html
, last
, length
, next
, parent
, prev
, siblings
, text
, toArray
) where
import Prelude hiding (eq)

View File

@@ -1,11 +1,12 @@
module Cheerio.Static (
CheerioStatic,
html,
load,
loadRoot,
select,
selectDeep,
root) where
module Cheerio.Static
( CheerioStatic
, html
, load
, loadRoot
, select
, selectDeep
, root
) where
import Prelude
import Cheerio (Cheerio)