Skip to content

Commit

Permalink
Upgrade tools and add GIFs (#38)
Browse files Browse the repository at this point in the history
Upgrades:
- node
- adds jest
- optimizes test runner
- installs yarn
- instals volta 
- adds gif adding node script
- adds a bunch of GIFs
  • Loading branch information
rileyhilliard authored Apr 22, 2022
1 parent a05cd41 commit e150d76
Show file tree
Hide file tree
Showing 18 changed files with 3,426 additions and 136 deletions.
110 changes: 109 additions & 1 deletion .cache.json
Original file line number Diff line number Diff line change
@@ -1 +1,109 @@
{"_names":["notfound","sheepit","dog","stimpy","shippingship","seeit","doggo","smash","judy","sendit","andy","kylo","awesome","glover","billclinton","lumberjack","jimmyfalon","nailedit","buttonmash","thor","bill","internetkid","bob","titanic","animate","deploy","wreckitralph","powerrangers","fedex","hangover","nickkroll","keanu","sandsendit","chucknorris","nohohank","charlieday","celeryman","waynesworld","eating","bobbyawesome","asiandad","spongebob","cartoonthumbsup","thumbsupemoji","dogokay","heyya","jonahhill","modernfamily","anime","stitch","alright","ironman","gameshow","borat","iasipyes","kramer","thumbkiss","frankthetank","tuco","spiderman"]}
{
"_names": [
"notfound",
"sheepit",
"dog",
"stimpy",
"shippingship",
"seeit",
"doggo",
"smash",
"judy",
"sendit",
"andy",
"kylo",
"awesome",
"glover",
"billclinton",
"lumberjack",
"jimmyfalon",
"nailedit",
"buttonmash",
"thor",
"bill",
"internetkid",
"bob",
"titanic",
"animate",
"deploy",
"wreckitralph",
"powerrangers",
"fedex",
"hangover",
"nickkroll",
"keanu",
"sandsendit",
"chucknorris",
"nohohank",
"charlieday",
"celeryman",
"waynesworld",
"eating",
"bobbyawesome",
"asiandad",
"spongebob",
"cartoonthumbsup",
"thumbsupemoji",
"dogokay",
"heyya",
"jonahhill",
"modernfamily",
"anime",
"stitch",
"alright",
"ironman",
"gameshow",
"borat",
"iasipyes",
"kramer",
"thumbkiss",
"frankthetank",
"tuco",
"spiderman",
"pacha",
"terminator",
"roughwater",
"shipsohard",
"ooishipit",
"setsail",
"astronaut",
"astronautpump",
"astronaut",
"powerteam",
"poweritup",
"powerrangersbump",
"powerrangersshipthat",
"iwillgodownwiththisship",
"downwiththeship",
"proud",
"weagree",
"nachoagree",
"prettygood",
"okok",
"alright",
"ehwellsee",
"wellseewhathappens",
"weregoodhere",
"larrybration",
"ohyeah",
"koolaidohyeah",
"kevinsmile",
"nailedit",
"naileditkip",
"younailedit",
"bravo",
"drake",
"yesss",
"impressive",
"impressive1",
"impressiveverynice",
"gottasayimimpressed",
"youreawesome",
"impressiveparentsproud",
"thatstalent",
"impressiveverynice1",
"thatsdamnimpressive",
"mostimpressive",
"thatsreallyimpressive"
]
}
6 changes: 3 additions & 3 deletions .github/workflows/npmpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
- run: npm run build
node-version: 16
- run: yarn && yarn build

publish-npm:
needs: build
Expand All @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm publish
env:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/npmtestpullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ jobs:

strategy:
matrix:
node-version: [10.x, 12.x]
node-version: [16.x]

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm test
- name: yarn test
run: |
npm test
yarn
yarn test
env:
CI: true
11 changes: 6 additions & 5 deletions .github/workflows/versionbump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,23 @@ jobs:

strategy:
matrix:
node-version: [10.x]
node-version: [16.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm test
- name: yarn test
run: |
npm test
yarn
yarn test
env:
CI: true
- name: update cache
run: |
npm run cache
yarn build:cache
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add -A
Expand All @@ -40,5 +41,5 @@ jobs:
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
npm version patch
yarn version --patch
git push
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
6 changes: 6 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn
yarn test
npx lint-staged
Empty file added .prettierrc
Empty file.
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"tabWidth": 2,
"singleQuote": true,
"printWidth": 120,
"bracketSpacing": true
}
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
language: node_js
node_js:
- "10.15.3"
- "9.0.0"
- "6.0.0"
- "16.14.2"
after_success:
- bash <(curl -s https://codecov.io/bash)
113 changes: 61 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,81 @@
# [shipit.gifs](https://www.shipit.today)

The database of GIFs for https://www.shipit.today

![](https://i.shipit.today)

# How to Contribute

## General Rules
+ Be a good person
+ Add GIFs that can be used in the context of shipping code reviews, design reviews or just any "Looks good to me" or "Ship it!" moments
+ You can add as many as you'd like
+ Use GIFs at a reasonable size, no more than 5MB.
+ GIFs should come from one of the approved domains in [domains.json](domains.json)
+ GIFs need to pass all tests and be approved in a Pull Request.
+ Keep names all lowercase, the only special character that is allowed is a dash `-`.
+ Include all fields: `_id`, `name`, `url`, `description`, `active`.
+ Don't remove or rename any previously submitted GIFs as they could be used in the wild already.
+ If a GIF is broken, mark the active state to 0 or fix the URL.
+ Add a description so it is easy to understand the content of the GIF without opening it.
+ No graphic content.

- Be a good person
- Add GIFs that can be used in the context of shipping code reviews, design reviews or just any "Looks good to me" or "Ship it!" moments
- You can add as many as you'd like
- Use GIFs at a reasonable size, no more than 5MB.
- GIFs should come from one of the approved domains in [domains.json](domains.json)
- GIFs need to pass all tests and be approved in a Pull Request.
- Keep names all lowercase, the only special character that is allowed is a dash `-`.
- Include all fields: `_id`, `name`, `url`, `description`, `active`.
- Don't remove or rename any previously submitted GIFs as they could be used in the wild already.
- If a GIF is broken, mark the active state to 0 or fix the URL.
- Add a description so it is easy to understand the content of the GIF without opening it.
- No graphic content.

## Rules that will be tested

+ The existing entries cannot be removed
+ The existing names cannot be changed
+ The _id is required
+ The _id needs to be the same as its index in the array
+ The _id needs to be a number
+ The name is required
+ The name must be less than 50 characters
+ The name must be greater than 1 character
+ The name must be unique
+ The name must only contain lowercase letters, numbers and dashes (-)
+ The name must start with a lowercase letter
+ The url paths must be unique
+ The url is required
+ The url must be less than 2000 characters
+ The url protocol must start with https://
+ The url domain must be an approved domain
+ The url must not have query params
+ The url must not have a fragment
+ The url path must end with .gif
+ The description cannot contain special characters
+ The description is required
+ The description must be less than 200 characters
+ The active state is required

## Structure of new submissions
- The existing entries cannot be removed
- The existing names cannot be changed
- The \_id is required
- The \_id needs to be the same as its index in the array
- The \_id needs to be a number
- The name is required
- The name must be less than 50 characters
- The name must be greater than 1 character
- The name must be unique
- The name must only contain lowercase letters, numbers and dashes (-)
- The name must start with a lowercase letter
- The url paths must be unique
- The url is required
- The url must be less than 2000 characters
- The url protocol must start with https://
- The url domain must be an approved domain
- The url must not have query params
- The url must not have a fragment
- The url path must end with .gif
- The description cannot contain special characters
- The description is required
- The description must be less than 200 characters
- The active state is required

## Submitting a contribution

### Adding a GIF via cli script

Follow the terminal prompts @ `yarn && yarn add:gif`

### Adding a GIF by hand

Add your gif to the end of the gifs array in [`gifs.json`](https://github.com/seantomburke/shipit.gifs/blob/master/gifs.json) with the correct JSON structure:

```json
{
"gifs": [
{
"_id": 10,
"name": "someuniquename",
"url": "https://foo.com/some.gif",
"description": "Some description",
"active": 1
}
]
"gifs": [
{
"_id": 10,
"name": "someuniquename",
"url": "https://foo.com/some.gif",
"description": "Some description",
"active": 1
}
]
}
```

## Submitting a contribution
### Validating and submitting your entry

1. Add your gif to the end of the gifs array in [`gifs.json`](https://github.com/seantomburke/shipit.gifs/blob/master/gifs.json) with the correct JSON structure
2. Run `npm test` to make sure everything passes
3. Create a pull request with the changed [`gifs.json`](https://github.com/seantomburke/shipit.gifs/blob/master/gifs.json) file
4. Make sure to include the GIF in an image tag in the comment section of the Pull Request for easy review
5. Wait for submission to be approved
1. Run `yarn test` to make sure everything passes
2. Create a pull request with the changed [`gifs.json`](https://github.com/seantomburke/shipit.gifs/blob/master/gifs.json) file
3. Make sure to include the GIF in an image tag in the comment section of the Pull Request for easy review
4. Wait for submission to be approved

Created by [@seantomburke](https://www.linkedin.com/in/seanthomasburke) ©2020
46 changes: 46 additions & 0 deletions add-gif.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const fs = require('fs');
const { exec } = require('child_process');
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});

let { gifs } = require('./gifs.json');
// const gifsBackup = JSON.stringify({ gifs }, null, 2);

rl.question('Enter the GIF URL:\n', function (url) {
rl.question('Enter the GIF name:\n', function (name) {
rl.question('Enter the GIF description:\n', function (description) {
gifs.push({
_id: gifs.length,
name,
url,
description,
active: 1,
});
rl.close();
});
});
});

rl.on('close', function () {
fs.writeFileSync('./gifs.json', JSON.stringify({ gifs }, null, 2));
console.log('Running tests...');
exec('yarn test', (err, stdout, stderr) => {
// NOTE: this _almost_ works. Need to figure out how to read the
// stderr to make a decision on whether to commit or revert the changes.
// if (stderr) {
// console.log(stdout, stderr);
// console.log('The GIF did not pass the tests.\nReverting entry\n(See test output above)\n');
// console.log('Attempted entry:\n', gifs.at(-1));
// fs.writeFileSync('./gifs.json', gifsBackup);
// process.exit(1);
// } else {
// console.log('GIF added and tests passed!', gifs.at(-1));
// }
console.log(stdout, stderr);
console.log('\nGIF was added\n', gifs.at(-1));
process.exit(0);
});
});
Loading

0 comments on commit e150d76

Please sign in to comment.