From 962a445322f95ee1f46766a0e5e49887d4095664 Mon Sep 17 00:00:00 2001 From: Sam Therapy Date: Tue, 25 Oct 2022 18:13:17 +0200 Subject: [PATCH] idk anymore Signed-off-by: Sam Therapy --- README.md | 25 ++++++++++++++++++------- package.json | 6 +++--- src/{index.ts => bot.ts} | 0 3 files changed, 21 insertions(+), 10 deletions(-) rename src/{index.ts => bot.ts} (100%) diff --git a/README.md b/README.md index 22bbbd3..1479b4f 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ The full list of boorus supported is found [here](https://github.com/AtoraSuunva ## Downloading the bot -There are currently two ways to do this, either with a pre-built binary or building from source. Both are listed below. +There are currently three ways to do this, a pre-built binary that bundles in node, from npm, or building from source. Both are listed below. ### Downloading pre-built binaries @@ -24,13 +24,24 @@ Download prebuilt binaries from [here](https://git.froth.zone/sam/fediverse-imag [glibc or musl], macOS and Windows) 1. Run the bot with the `-w` flag to have it generate a configuration file to the local directory. - 2. Edit it for your use case. - -- If you want to generate a key you can use https://git.froth.zone/sam/js-feditoken - + - If you want to generate a key you can use 3. Run the bot by launching the executable! +### From NPM + +1. Set up using the [Gitea registry](https://git.froth.zone/sam/fediverse-imagebot/packages) + + ```sh + npm config set @froth:registry https://git.froth.zone/api/packages/sam/npm/ + ``` + +2. After setting up the registry, either install it permanently + + ```sh + npx --package=@froth/feditoken feditoken + ``` + ### Running from Source 1. You need to have `npm` and `nodejs` installed. @@ -48,7 +59,7 @@ Download prebuilt binaries from [here](https://git.froth.zone/sam/fediverse-imag `cp config.sample.jsonc config.jsonc` - If you want to generate a key you can use https://git.froth.zone/sam/js-feditoken 7. Run the bot: \ - `yarn bot` + `pnpm bot` You're done! The bot should post a local image to the fediverse instance of your choosing! @@ -60,7 +71,7 @@ The bot can be automated to post images at set times using a cronjob. \ Example cron configuration: ``` -0 * * * * cd /path/to/fediverse-imagebot && /usr/local/bin/yarn bot -c ./config.sample.jsonc +0 * * * * cd /path/to/fediverse-imagebot && pnpm bot -c ./config.sample.jsonc ``` This example will run the bot every hour on the hour with no message using images from the default `images` directory. diff --git a/package.json b/package.json index 41c526f..afaaf31 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,8 @@ "name": "@froth/fediverse-imagebot", "version": "2.1.1", "description": "Image bot for the fediverse (Pleroma, Mastodon, Misskey)", - "exports": "./dist/index.js", - "bin": "dist/index.js", + "main": "dist/bot.js", + "bin": "dist/bot.js", "pkg": { "scripts": "dist/**/*.js" }, @@ -20,7 +20,7 @@ "clean": "tsc -b --clean", "lint": "eslint --ext .ts ./src --fix && prettier --write ./src", "lint:ci": "eslint --ext .ts,.js ./src && prettier ./src --check", - "bot": "node ./dist/index.js", + "bot": "node ./dist/bot.js", "package": "pkg . -C Gzip", "test": "echo \"No tests yet!\" && exit 0", "prepublishOnly": "npm run build" diff --git a/src/index.ts b/src/bot.ts similarity index 100% rename from src/index.ts rename to src/bot.ts