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

scriptwriter

v0.1.1

Published

✍️ An authoring tool for playwrights.

Downloads

16

Readme

✍️ Scriptwriter npm GitHub last commit

Learn what Playwright can do in each of the various browsers it supports. By default, Scriptwriter loads Chromium and creates a Chrome Devtools Protocol (CDP) client for more repl fun!

Installation

node npm peer dependency version

  1. Ensure you have node 10.15.0 or higher.
  2. Install Playwright globally: npm i -g playwright (tested with 1.5.2).
  3. Install Scriptwriter: npm i -g scriptwriter.
  4. (some tools that manage multiple versions of node may require you to npm link playwright for scriptwriter's global-import to work).
  5. Or clone this repo, install, and use npm link or npm start.

Get Started

  1. scriptwriter --no-headless will launch the repl and Chromium.
  2. Use await right away: await page.goto('https://github.com')
  3. The prompt will change on load: github.com ~>
  4. .help lists the global commands.
  5. Pressing Tab twice will display autocomplete help.
  6. Save and load your repl sessions!

Config

You can use cli flags to set the config scriptwriter --help:

  Usage
    $ scriptwriter [--no-headless] [--device <name>] [--config <file>]
                   [--browser <browser>] [--no-js] [--no-csp]
  Options
    --no-headless, --no-h  Run as headless=false
    --device, -d           Load a device profile from Playwright
    --config, -c           Pass a config file to Scriptwriter
    --browser, -b          Change browsers (default: chromium)
    --no-js                Disable JavaScript
    --no-csp               Bypass CSP
    --aom, -a              Launch with Accessibility Object Model (AOM) enabled
    --user, -u             Launch with a Persistent Context
  Examples
    $ scriptwriter
    $ scriptwriter --no-headless
    $ scriptwriter --device 'iPhone X'
    $ scriptwriter --config ./config.js
    $ scriptwriter -c ./config.json --no-h
    $ scriptwriter --no-js --b firefox

Config File

You can also load a config from a file.

// iphonex.json
{
	"launch": {
		"headless": true,
		"args": ["--some-blink-specific-tag-name"]
	},
	"context": {},
	"device": "iPhone X"
}

scriptwriter --config iphonex.json

Custom Commands

You can load your own commands. Scriptwriter exposes some helpful utility functions.

Example:

// my-command.js
scriptwriter.completion = '.louder';
director.defineCommand('louder', {
	help: `make something louder`,
	async action(str) {
		const { log, color } = scriptwriter;
		log(color.red(`${str.toUpperCase()}!!`));
		director.displayPrompt();
	},
});
// in the scriptwriter repl
> .load my-command.js
> .louder test
TEST!!

Mac Firewall

On a mac, you may get the firewall popup.

  1. Open keychain access.
  2. In the top menu, choose Keychain Access > Certificate Assistant > Create a Certificate.
  3. Name it Playwright.
  4. Change the Certificate Type to Code Signing.
  5. Click create.
  6. Right click your new certificate and choose Get Info.
  7. Open Trust disclosure.
  8. Change When using this certificate: to Always Trust.
  9. Start Scriptwriter.
  10. When Chromium starts, right click the icon in the menu bar, choose Options > Show in Finder.
  11. Right click Chromium and select New Terminal Here.
  12. In the terminal type pwd and copy the path.
  13. Use the following to assign the certificate: sudo codesign -s Playwright -f <PATH_TO_CHROMIUM> --deep.

Similar Projects