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

gorilla-build

v0.1.16

Published

Gorilla: Stop monkeying around and build better scripts.

Downloads

52

Readme

Intro

Gorilla is a blazing fast, TypeScript build tool for creating better GreaseMonkey scripts. It handles the complex build chain, so you don't have to.

Get started

Input

helper.ts

export const hello = (name:string) => {
    console.log(`Hello ${name}!`);
}

main.ts

import { hello } from './helper';

hello('world');

package.json

...
"scripts": {
    "build": "gorilla --input ./main.ts --output ./script.user.js"
  },
...

Output

script.user.js

// ==UserScript==
// @name            New Userscript
// @namespace       http://tampermonkey.net/
// @version         0.1
// @description    Gorilla-built, rock-solid, Monkey script
// @updateURL
// @downloadURL
// @author          You
// @include         https://**
//
// Created with love using Gorilla
// ==/UserScript==

(function () {
  'use strict';

  function greet(name) {
      console.log(`Hello, ${name}!`);
  }

  greet("This is a greeting");

}());

Samples

You can find a collection of samples, here.

Options

Help (--help)

Display help menu.

eg.

gorilla --help

Input (--input, -i)

The input handler for your script.

Note: While not required, Gorilla recommends writing your scripts in TypeScript.

eg.

gorilla --input ./my-input-file.ts ...

Output (--output, -o)

The input handler for your script.

Note: While not required, GreaseMonkey scripts should end with .user.js.

eg.

gorilla --output ./my-script.user.js ...

Config (--config, -c)

JSON input Gorilla config including GreaseMonkey metadata block data.

eg.

gorilla --config ./my-config.json ...

Quiet (--quiet, -q)

Hide all warning messages.

eg.

gorilla --quiet true ...

Config

The config is based off of the officially supported Metadata Block items found here: https://wiki.greasespot.net/Metadata_Block

The following JSON keys are supported by GreaseMonkey:

  • author - (string) - Author of the script
  • description - (string) - Description of the script
  • exclude - (string[]) - URLs to exclude the script from
  • grant - (string[]) - Permissions to grant to the script
  • icon - (string) - Icon for the script
  • include - (string[]) - URLs to include the script in
  • match - (string[]) - URLs to match the script in
  • name - (string) - Name of the script
  • namespace - (string) - Namespace of the script
  • noframes - (string) - Whether or not to run in frames
  • require - (string[]) - Scripts to include within the script
  • resource - (string[]) - Resources to include within the script
  • version - (string) - Version number of the script
  • updateURL - (string) - URL location for script updates
  • downloadURL - (string) - URL location for script download

The config will be constructed by both the optional config argument and with information from the package.json file for your current project. Some information will be take from the root of your package.json (eg. author, name, etc.). Other information can be defined in a gorilla key in your package.json. For example:

...
"name": "This is my awesome script package.json!",
...
"gorilla": {
  "include": ["this_key", "and this one"],
  "updateURL": "this_url"
}

NOTE - any valid keys in the gorilla will override anything else from the root package.json!