About
Generate StackApps is a post Markdown generator for userscript projects reducing the amount of busywork required to publish userscripts for the benefit of the Stack Exchange network users. The package is highly customizable and takes a lot of the information from the project's package.json file (on an off-chance you are unfamiliar, here are the NPM docs).
Usage example
CLI usage:
generate-stackapps \
--install "https://www.npmjs.com/package/@userscripters/generate-stackapps" \
--language "TypeScript" \
--org-name "UserScripters" \
--org-url "https://github.com/userscripters" \
--room "https://chat.stackoverflow.com/rooms/214345" \
--tag "library" \
--tag "typescript" \
--thumbnail "https://i.sstatic.net/Cbt4Z.png"
Programmatic usage as a module:
import { generate } from "@userscripters/generate-stackapps";
const { body, tags, title } = await generate({
installURL: "https://www.npmjs.com/package/@userscripters/generate-stackapps",
languages: ["TypeScript"],
orgName: "UserScripters",
orgURL: "https://github.com/userscripters",
roomURL: "https://chat.stackoverflow.com/rooms/214345",
tags: ["library", "typescript"],
testedIn: {
chrome: "100.0.0"
},
thumbnailURL: "https://i.sstatic.net/Cbt4Z.png"
});
License
The script is licensed under the GPL-3.0-or-later license.
Download
Latest version: 1.0.3
The package is published as both an NPM package and a GitHub package. Can be installed via a package manager like NPM as usual:
npm install --save-dev @userscripters/generate-stackapps
If you opt to install it from the GitHub registry, please note that it only supports scoped packages, you will need a simple .npmrc file at your project root:
@userscripters:registry=https://npm.pkg.github.com
You will also need to be logged in to GitHub. An easy way to do so is to have a global .npmrc
with your PAT (personal access token) set as an access token:
//npm.pkg.github.com/:_authToken=<your token here>
CLI Usage
The package exposes a CLI interface with the following syntax:
generate-stackapps [options]
There are various options one can provide to customize the output:
Long | Short | Required | Default | Value | Description |
---|---|---|---|---|---|
about |
a |
no | <pkg.description> |
string | Long project description |
chrome |
cr |
no | - | string | Last tested Chrome version |
direct |
d |
no | false |
boolean | Send output to process.stdout (CLI-only) |
excerpt |
e |
no | <pkg.description> |
string | Short project description |
edge |
ed |
no | - | string | Last tested Edge version |
explorer |
ie |
no | - | string | Last tested Internet Explorer version |
firefox |
ff |
no | - | string | Last tested Firefox version |
install |
iu |
yes | - | valid URL | Project installation URL |
language |
l |
no | - | string[] |
Programming languages used (repeatable) |
minified |
mu |
no | - | valid URL | Minified version installation URL |
opera |
op |
no | - | string | Last tested Opera version |
org-name |
on |
no | - | string | GitHub organization name |
org-url |
ou |
no | - | valid URL | GitHub organization URL |
output |
o |
no | ./STACKAPPS.md |
filepath | Output file path (CLI-only) |
package |
p |
no | ./package.json |
filepath | Path to project's package.json |
room |
r |
no | - | valid URL | Chat room URL |
screenshot-alt |
sa |
no | - | string | Project screenshot alt text |
screenshot-url |
su |
no | - | valid URL | Project screenshot URL |
tag |
tg |
no | ["script"] |
string[] |
StackApps post tag (repeatable) |
thumbnail |
th |
no | - | valid URL | StackApps post thumbnail |
title |
tl |
no | <pkg.name> - <description> |
string | StackApps post title |
Platform
This is a Node.js package (tested on LTS 16.13.2), so it requires Node to be installed. Best used with TypeScript, but contains type declaration files for autocompletion as well.
Contact
Author: Oleg Valter
Organization: UserScripters
Please, submit bug reports on the source repository.
Before adding a new one, please check if it hasn't been raised before.
You can also drop by to chat, we are a friendly bunch.
Code
Source code is written in TypeScript.
Contributions are welcome, you can always submit a PR here.