npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bs-puppeteer

v0.13.0

Published

Bucklescript bindings for Puppeteer (headless chrome browser) written in Reason

Downloads

373

Readme

bs-puppeteer

BuckleScript bindings to Puppeteer (the Headless Chrome Node API) written in ReasonML. This allows programmatic control of an instance of the Chrome or Chromium browser from BuckleScript or Reason.

NPM bs-puppeteer package Travis build status Greenkeeper badge

Status

These bindings are a work in progress. Most bindings for navigation and interaction with web pages have been implemented. There may be some minor breaking changes as we refine the API. Bindings to the page events API are planned for a future version. See examples and the test suite for examples of usage. Features of the Puppeteer API are implemented as we need or get to them. We do our best to track upstream API changes. If you would like to add or fix some bindings, see Contributing.

Changes are documented in HISTORY.md.

Creating a project using bs-puppeteer

Create a new BuckleScript project if you have not already:

bsb -init my-project -theme basic-reason
cd my-project

See the BuckleScript documentation for more information about starting a project.

Add bs-puppeteer as a dependency. This will install the currently supported version of Puppeteer.

yarn
yarn add bs-puppeteer

Edit your bsconfig.json file to add bs-puppeteer to bs-dependencies:

  "bs-dependencies" : [
    "bs-puppeteer",
  ],

Now run:

yarn start

While the start command is running, it will attempt to recompile your code each time you save it. One-off builds can be done with yarn build.

The BsPuppeteer module should now be available in your source files. You can launch a new browser instance using BsPuppeteer.Puppeteer.launch(). See the examples for a more detailed demonstration.

For interacting with the DOM on pages you navigate to we recommend using bs-webapi.

Contributing

Contributions are welcome. Get started by cloning the respository and starting the compiler in watch mode. We recommend using yarn, but npm should also work.

Basic development workflow

git clone https://github.com/zploskey/bs-puppeteer.git
cd bs-puppeteer
yarn
yarn start

Any changes should pass the test suite (yarn test). One great way to contribute is by writing tests for features that don't yet have them. Tests can be found in the __tests__ directory. A git hook will automatically run refmt on your code and run the test suite each time you commit.

Snapshot diffs

If you would like to see a diff of the compiled javascript code from your changes, you can take a snapshot of the built JS you would like to compare to with our snap and snap-diff package commands. A typical workflow might look like this:

git checkout master # you may want to stash any changes with git stash
yarn snap # snapshot the built JS to the snap/ directory
# edit the code to make whatever changes
yarn snap-diff

This should rebuild and display git diff --no-index output comparing lib/js and snap/js. This can be handy in making sure that the right code is being generated.

References

Good references for contributing to this library are:

Projects using bs-puppeteer