-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from breadadams/next
v3 Release
- Loading branch information
Showing
40 changed files
with
12,716 additions
and
2,455 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
ci: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: "12.x" | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v2 | ||
id: node-cache | ||
with: | ||
path: | | ||
~/.npm | ||
~/node_modules | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- name: Install dependencies | ||
if: steps.node-cache.outputs.cache-hit != 'true' | ||
run: npm install | ||
|
||
- name: Check formatting | ||
run: npm run format:check | ||
|
||
- name: Run tests | ||
run: npm test | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
files: ./coverage/coverage-final.json | ||
fail_ci_if_error: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Publish | ||
|
||
on: | ||
release: | ||
types: [released] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: "12.x" | ||
registry-url: "https://registry.npmjs.org" | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v2 | ||
id: node-cache | ||
with: | ||
path: | | ||
~/.npm | ||
~/node_modules | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- name: Install dependencies | ||
if: steps.node-cache.outputs.cache-hit != 'true' | ||
run: npm install | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
- name: Publish | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,119 @@ | ||
# OSX | ||
# | ||
# MacOS | ||
.DS_Store | ||
|
||
# node.js | ||
# | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
web_modules/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
.parcel-cache | ||
|
||
# Next.js build output | ||
.next | ||
out | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and not Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test | ||
|
||
# logs | ||
# | ||
*.log | ||
# yarn v2 | ||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npm run format:staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
dist | ||
coverage | ||
node_modules | ||
.cache | ||
.parcel-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Brad Adams | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,13 @@ | ||
# fetch-the-parrot | ||
|
||
[![npm version](https://badge.fury.io/js/fetch-the-parrot.svg)](https://badge.fury.io/js/fetch-the-parrot) | ||
[![Build Status](https://travis-ci.org/breadadams/fetch-the-parrot.svg?branch=master)](https://travis-ci.org/breadadams/fetch-the-parrot) | ||
[![CI](https://github.com/breadadams/fetch-the-parrot/actions/workflows/ci.yml/badge.svg?branch=master&event=push)](https://github.com/breadadams/fetch-the-parrot/actions/workflows/ci.yml) | ||
[![codecov](https://codecov.io/gh/breadadams/fetch-the-parrot/branch/master/graph/badge.svg?token=77ZPZ043CW)](https://codecov.io/gh/breadadams/fetch-the-parrot) | ||
|
||
A small JS client to handle fetching the ever-loved _Party Parrots_ (of all [varieties](http://cultofthepartyparrot.com/)). | ||
> For installation and usage instructions visit [the documentation](https://fetch-the-parrot.js.org). | ||
![Mega parrot!](https://g.redditmedia.com/F2mSqRceNQbYdWhAaTo0xy4uR4QxQlBMRFYAn1xrKK4.gif?w=320&s=b2d1e56e82733371048a7e2b6d61b7f8) | ||
![Party Parrot](/demo/assets/parrot.gif) | ||
|
||
## License | ||
|
||
## Installation | ||
|
||
#### NPM | ||
|
||
`npm i fetch-the-parrot --save` | ||
|
||
#### Yarn | ||
|
||
`yarn add fetch-the-parrot` | ||
|
||
|
||
## Basic examples | ||
|
||
##### ES5 | ||
|
||
``` | ||
var getParrotGif = require('fetch-the-parrot').getParrotGif; | ||
var parrot = getParrotGif({ | ||
'name': 'Parrot', | ||
'res': 'hd', | ||
'path': 'http://my-parrot-website.com/parrots/' | ||
}) | ||
console.log(parrot) | ||
/* Result */ | ||
http://my-parrot-website.com/parrots/parrots/hd/parrot.gif | ||
``` | ||
|
||
##### ES6 | ||
|
||
``` | ||
import { getParrotGif } from 'fetch-the-parrot' | ||
getParrotGif({ | ||
'name': 'Fiesta Parrot', | ||
'path': 'http://my-parrot-website.com/parrots/' | ||
}, gif => { | ||
console.log(gif) | ||
/* Result */ | ||
http://my-parrot-website.com/parrots/parrots/fiestaparrot.gif | ||
}) | ||
``` | ||
|
||
## Usage | ||
|
||
This library exposes 3 methods in total. | ||
|
||
So far we've seen `getParrotGif` in the above snippets, but `getParrotsJSON` & `searchParrotsByName` are also available. Let's run over all 3 methods in more detail: | ||
|
||
* `getParrotGif(options, callback)`: This is the method used to return a partyparrot's `.gif` URL. | ||
|
||
* **options** `object` | ||
|
||
* **name** `string`: Party parrot's name, case insensitive (use names as labelled [here](http://cultofthepartyparrot.com/)). | ||
|
||
* **res** `string`: The resolution for our gif, `sd` (default) or `hd`. Note, not all party parrots have _HD_ support, in the case of a hd request on an _"sd-only"_ parrot, the _SD_ version will be returned. | ||
|
||
* **path** `string`: Optional string to set the path of where the party parrot images are located. | ||
|
||
* **callback(gif)** `function`: Returns the gif URL if successful. | ||
|
||
* `getParrotsJSON(callback)`: Returns the main json object of _all_ parrots. | ||
|
||
* **callback(data)** `function`: Returns json object if successful. | ||
|
||
* `searchParrotsByName(name, callback)`: Returns the single object for a parrot. | ||
|
||
* **name** `string`: Name, case insensitive, of the parrot we're searching for (use names as labelled [here](http://cultofthepartyparrot.com/)). | ||
|
||
* **callback(data)** `function`: Returns json object for queried parrot if successful. | ||
|
||
|
||
## Also worth checking out | ||
|
||
* [cultofthepartyparrot.com/](http://cultofthepartyparrot.com/) | ||
**fetch-the-parrot** © [Brad Adams](https://github.com/breadadams), Released under the [MIT](https://github.com/breadadams/fetch-the-parrot/blob/master/LICENSE) License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module.exports = (api) => { | ||
const isTest = api.env("test"); | ||
|
||
if (isTest) { | ||
return { | ||
presets: [ | ||
"@babel/preset-typescript", | ||
["@babel/preset-env", { targets: { node: "current" } }], | ||
], | ||
}; | ||
} | ||
|
||
return {}; | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.