No description
Find a file
Ethan Lane 448a2f8f11
Some checks failed
Stage / build (push) Successful in 20s
Stage / package (push) Failing after 8s
Update build pipeline to upload artifacts for the binary (#256)
# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

- Update the staging workflow to also test `release/*` branches
- Move testing `hotfix/*` branches to the staging pipeline
- Update the staging workflow to upload the built binaries to artifacts
- Split the deploy workflow to package and upload the binaries to a separate stage to uploading to NPM

#247, #248

## Type of change

Please delete options that are not relevant.

- [x] New feature (non-breaking change which adds functionality)

# How Has This Been Tested?

Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration.

- As this is a workflow change it will be tested once merged

# Checklist

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that provde my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules

Reviewed-on: #256
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2025-01-14 18:31:43 +00:00
.forgejo/workflows Update build pipeline to upload artifacts for the binary (#256) 2025-01-14 18:31:43 +00:00
.gitea Add Gitea templates 2023-02-24 17:33:39 +00:00
.github Create FUNDING.yml 2021-05-10 21:50:20 +01:00
.gitlab Update default.md 2021-01-15 18:15:14 +00:00
docs Add "Gallery" field to return multiple images in 1 post (#242) 2024-10-26 22:00:55 +01:00
src Fix bug where you weren't able to use both the -q and -j flags at the same time (#227) 2024-12-07 22:21:43 +00:00
tests Fix bug where you weren't able to use both the -q and -j flags at the same time (#227) 2024-12-07 22:21:43 +00:00
.gitignore Add binary building (#151) 2024-03-01 19:51:12 +00:00
.gitlab-ci.yml Add aslant to gitlab project ci 2021-01-13 21:08:47 +00:00
.npmignore Add binary building (#151) 2024-03-01 19:51:12 +00:00
CODE_OF_CONDUCT.md hotfix/2.0.3 (#41) 2022-12-18 15:27:03 +00:00
CONTRIBUTING.md Fix documentation code breaks (#58) 2023-04-28 17:31:34 +01:00
eslint.config.mjs Update eslint (#198) 2024-07-26 18:21:28 +01:00
jest.config.cjs Setup Jest (#57) 2023-04-22 13:20:30 +01:00
jest.setup.js Setup Jest (#57) 2023-04-22 13:20:30 +01:00
LICENSE Update licence copyright to 2023 (#59) 2023-04-28 17:31:55 +01:00
package.json Upgrade @yao-pkg/pkg version (#254) 2024-12-02 18:03:26 +00:00
readme.md Add "Gallery" field to return multiple images in 1 post (#242) 2024-10-26 22:00:55 +01:00
renovate.json Add type/dependency label to renovate config (#197) 2024-07-26 18:19:44 +01:00
tsconfig.json Setup Jest (#57) 2023-04-22 13:20:30 +01:00
yarn.lock Upgrade @yao-pkg/pkg version (#254) 2024-12-02 18:03:26 +00:00

random-bunny

Get a random image url from a subreddit of your choosing.

Install

npm install --save random-bunny

or if you're using yarn

yarn add random-bunny

Binary

The project can be downloaded as a binary for your system via the GitHub Releases or Gitea Releases page.

Usage

import randomBunny from "random-bunny";

// ... In an async function
const result = await randomBunny('rabbits', 'hot');
console.log(result);

API

randomBunny()

Returns a json string for a random post. Accepts 3 arguments: subreddit, sortby ('new', 'hot', 'top'), and limit (1-100, default 100)

The json string which gets returned consists of:

  • archived
  • author
  • downs
  • gallery
  • hidden
  • permalink
  • subreddit
  • subredditSubscribers
  • title
  • ups
  • url

sortBy will default to 'hot' if not given or invalid

CLI

Random bunny can also be used as a CLI. This is accessible via the executable (see git releases) or via src/cli.ts

For more details, see the documentation.

Notes

License

MIT © Vylpes