0.1.3 โข Published 3 years ago
@aps.king/gorilla v0.1.3
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.
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
// @match http://*/*
// Created with love using Gorilla
// ==/UserScript==
var hello = function (name) {
console.log("Hello " + name + "!");
};
hello('world');
Options
Help (--help
)
Display help menu.
eg.
gorilla --help
Input (--input, -i
)
The input handler for your script.
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 metablock data.
eg.
gorilla --config ./my-config.json ...
Config
The config is based off of the officially supported MetaBlock items found here: https://wiki.greasespot.net/Metadata_Block
The following JSON keys are supported:
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 script
If no config is supplied, the following default config is used:
{
"name": "New Userscript",
"namespace": "http://tampermonkey.net/",
"version": "0.1",
"description": "Gorilla-built, rock-solid, Monkey script",
"updateURL": "",
"downloadURL": "",
"author": "You",
"include": [],
"match": ["http://*/*"],
"grant": [],
}