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

@prosopo/scripts

v2.2.3

Published

Dev scripts for working with prosopo packages

Downloads

514

Readme

Prosopo Dev Scripts Package

This package contains the scripts and configuration for setting up a development environment for Prosopo.

Prerequisites

Dev Setup

Quickstart

git clone https://github.com/prosopo/captcha
cd captcha
npm i
npm run build:all
docker compose --file docker/docker-compose.development.yml up -d
cp demos/client-example-server/env.development demos/client-example-server/.env.development
cp demos/client-example/env.development demos/client-example/.env.development
cp dev/scripts/env.development .env.development
cp dev/scripts/env.development dev/scripts/.env.development
cp dev/scripts/env.development packages/cli/.env.development
cp dev/scripts/env.development packages/procaptcha-bundle/.env.development
npm run setup:all

In different terminals run

Terminal 1

npm run start:server

Terminal 2

npm run start:provider

Terminal 3

npm run start:demo

Go to http://localhost:9230 in your browser.

In-depth

Set up Containers

Setup your containers by running the following command from the root of the scripts repository.

docker compose --file ./docker/docker-compose.development.yml up -d

Install node modules

Install the node modules by running the following command from the root of the captcha workspace.

npm i

Build all packages

Build all packages by running the following command from the root of the captcha workspace.

npm run build:all

Deploy contracts (Optional)

If you want to deploy the Procaptcha protocol contract, you can do so by running the following command from the root of the captcha workspace. Any .env files will be updated with the new contract addresses.

npm run deploy_protocol
npm run setup

Alternatively, run npm setup:all to run both of the above commands.

Env file

You must have a valid env file in ./dev/scripts/ for these commands to work. You can use the file ./dev/scripts/env.development as a template.

Set up a Provider and Register a Dapp

Providers are the nodes in the network that supply CAPTCHA. Run the following command from the root of the captcha workspace to register a Provider and a Dapp in the Protocol contract and start the Provider API.

npm run setup && npm run start:provider

The Protocol contract must exist on the substrate node for the setup script to run.

Testing

Run tests

Run all the tests using the following command from the root of the captcha workspace.

npm run test

CLI

The development scripts package contains a CLI tool that can be used for various development tasks.

Deploy Protocol Contract

From the root of the captcha workspace run:

npm run deploy_protocol

This is shorthand for the following command:

npm run -w @prosopo/scripts cli deploy_protocol --update_env

Specify the current working directory if you are running from a different location.

npm run -w @prosopo/scripts cli deploy_protocol --update_env --cwd $(pwd)

The default environment is development. To deploy to a different environment, set the NODE_ENV environment variable.

NODE_ENV=test npm run -w @prosopo/scripts cli deploy_protocol --update_env

Create env files

TODO

Setup the Protocol Contract

npm run setup

Import Contracts using Typechain

...

Import All Contracts

...

Fund Dapps

Maintenance script to fund dapps in contract that are not Active.

npm run -w @prosopo/scripts -- cli fund_dapps

Transfer Contract between networks

By default, the current .env setup will be used as the --transfer-to network.

Transfer dapps and providers from one contract to another

Options:
  --help                Show help                                      [boolean]
  --version             Show version number                            [boolean]
  --transfer-from       The name of the network and the contract address to tran
                        sfer from `{ network, address }`     [string] [required]
  --transfer-to         The name of the network and the contract address to tran
                        sfer to `{ network, address }`                  [string]
  --transfer-providers  Whether to transfer providers or not
                                           [boolean] [required] [default: false]
  --transfer-dapps      Whether to transfer dapps or not
                                           [boolean] [required] [default: false]

From the root of the workspace run:

npm run -w @prosopo/scripts -- cli transfer_contract --transfer-from '{"network":"rococo", "address":"..."}' --transfer-dapps=true --transfer-providers=true

Display Version

From the root of the workspace run:

npm run -w @prosopo/scripts -- cli --version