eight04 / userscript-meta-cli

A CLI build tool for userscript metadata block
MIT License
2 stars 1 forks source link
cli nodejs userscript userscript-meta userscript-metadata

userscript-meta-cli

Build Status codecov install size

A CLI build tool for userscript metadata block

Features

Install

npm install -D userscript-meta-cli

Usage

usage:
  userscript-meta [--no-package] [--read=<file>...] [--update=<file>]
                  [--output=<file>] [--json]

options:
  -n --no-package Don't extract data from package.json

  -r --read       Read metadata from files. Support json or any text file
                  containing userscript metadata block.

  -u --update     Update the metadata block in the file, instead of writing to
                  output.

  -o --output     Write output meta block to file. If not provided, writing to
                  stdout.

  --json          Output json format.

  -v --version    Print version number.
  -h --help       Print help screen.

Reconized fields in package.json

Other fields like include, exclude, etc, could be set in userscript field.

{
    "userscript": {
        "include": ["http://example.com/*", "http://example2.com/*"]
    }
}

The metadata defined in userscript would overwrite the fields in package.json root.

API

getMeta

const metaObject = getMeta({
  findPackage?: Boolean,
  readFiles?: Array<String>
});

If findPackage is true then extract metadata from package.json. Default: true.

readFiles is an array of filenames.

stringify

The stringify method of userscript-meta.

parse

The parse method of userscript-meta.

Todos

Changelog