gorilla-build
v0.1.16
Published
Gorilla: Stop monkeying around and build better scripts.
Downloads
23
Maintainers
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 scriptdescription
- (string
) - Description of the scriptexclude
- (string[]
) - URLs to exclude the script fromgrant
- (string[]
) - Permissions to grant to the scripticon
- (string
) - Icon for the scriptinclude
- (string[]
) - URLs to include the script inmatch
- (string[]
) - URLs to match the script inname
- (string
) - Name of the scriptnamespace
- (string
) - Namespace of the scriptnoframes
- (string
) - Whether or not to run in framesrequire
- (string[]
) - Scripts to include within the scriptresource
- (string[]
) - Resources to include within the scriptversion
- (string
) - Version number of the scriptupdateURL
- (string
) - URL location for script updatesdownloadURL
- (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
!