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

stardust_cookie_cutter_core

v1.0.0

Published

This repository contains the logic that powers the [Stardust Cookie Cutter](https://github.com/strdst-org/stardust_cookie_cutter.git).

Downloads

2

Readme

Stardust Cookie Cutter core library

This repository contains the logic that powers the Stardust Cookie Cutter.


Overview


The logic is located in ./src/logic.ts. There are two main functions available: checkProvider() and executeLogic(). The first one contains pre-defined element ids and class names for commonly used cookie pop-ups. This ensures faster closing times and that the pop-up is correctly closed on popular websites. The executeLogic() function implements a sequence of characteristic checks on all potential HTML elements to find the pop-up.

Those two functions are used in the Stardust Cookie Cutter extension. To simulate a similar a behaviour, this project uses Puppeteer to inject the functions into the browser context and show the execution in a Chromium-based browser window.

Getting Started


1. Installation

Requirements

Clone the repository

git clone https://github.com/strdst-org/stardust_core.git
cd stardust_core

Install dependencies

Run npm install

2. Start

Run npm run start -- [options]

The available options are -u, --url and -t, --timeout.

The --url determines which websites to open and the --timeout parameter determines how long to keep the browser window open (in milliseconds).

Example:

npm run start -- -u https://www.stardustnetwork.com --timeout 5000

The previous example opens a web browser at the Stardust homepage, tries to close the cookie pop-up and keeps the browser window open for 5 seconds.

3. Test

The testing framework is still experimental. The general idea is to run the logic on given websites and test if the correct pop-up was selected. Currently, there is only two websites included in the tests and the tests do not include closing pop-ups in iframes.

To run the tests, run

npm run test

This will run all the tests specified in the logic.test.js file in the ./tests folder. No browser window will be opened but rather it is tested whether the correct element was clicked.

Contributing

How to contribute

  1. Fork stardust_core
  2. Make your changes and test them sufficiently
  3. Create commits to a separate branch
  4. Push your branch to your stardust_core fork and open a pull request to the master branch

The logic currently is not able to close pop-ups which are located in shadow roots. Any help with fixing this issue would be greatly appreciated.