├── README.md ├── package.json ├── bitmojis ├── brendan.json ├── bao.json ├── chris.json ├── alexg.json └── vivian.json ├── .circleci └── config.yml ├── tests └── bitmojis.test.js └── .gitignore /README.md: -------------------------------------------------------------------------------- 1 | # bitmoji 2 | 3 | Learn Pull Requests by creating your own Bitmoji! 4 | 5 | Link to the Bitmoji Wall [here](https://os-bitmoji.glitch.me/)! 6 | 7 | Follow the tutorial [here](https://bitmoji-tutorial.glitch.me/) to learn how to contribute to this repository! 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "tape tests/*.test.js" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "devDependencies": { 12 | "libmoji": "^2.3.0", 13 | "node-fetch": "^2.6.0", 14 | "tape": "^4.11.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /bitmojis/brendan.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Brendan", 3 | "gender": "male", 4 | "traits": { 5 | "beard": "742", 6 | "brow": "755", 7 | "cheek_details": "-1", 8 | "eye_details": "-1", 9 | "face_lines": "-1", 10 | "glasses": "972", 11 | "hair": "1289", 12 | "hat": "1177", 13 | "mouth": "990", 14 | "nose": "761", 15 | "beard_tone": "0", 16 | "blush_tone": "-1", 17 | "brow_tone": "0", 18 | "eyeshadow_tone": "-1", 19 | "hair_tone": "2039326", 20 | "lipstick_tone": "-1", 21 | "pupil_tone": "5977116", 22 | "skin_tone": "9655597", 23 | "body": "1", 24 | "face_proportion": "0" 25 | }, 26 | "outfit": "1017909" 27 | } -------------------------------------------------------------------------------- /bitmojis/bao.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Bao", 3 | "gender": "male", 4 | "traits": { 5 | "beard": "-1", 6 | "brow": "755", 7 | "cheek_details": "-1", 8 | "eye_details": "939", 9 | "face_lines": "942", 10 | "glasses": "954", 11 | "hair": "813", 12 | "hat": "1081", 13 | "mouth": "763", 14 | "nose": "761", 15 | "beard_tone": "3875595", 16 | "blush_tone": "-1", 17 | "brow_tone": "0", 18 | "eyeshadow_tone": "-1", 19 | "hair_tone": "2566954", 20 | "lipstick_tone": "-1", 21 | "pupil_tone": "5977116", 22 | "skin_tone": "11170379", 23 | "body": "2", 24 | "face_proportion": "3" 25 | }, 26 | "outfit": "1018481" 27 | } 28 | -------------------------------------------------------------------------------- /bitmojis/chris.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Chris R.", 3 | "gender": "male", 4 | "traits": { 5 | "beard": "-1", 6 | "brow": "756", 7 | "cheek_details": "-1", 8 | "eye_details": "-1", 9 | "face_lines": "-1", 10 | "glasses": "959", 11 | "hair": "754", 12 | "hat": "1197", 13 | "mouth": "763", 14 | "nose": "761", 15 | "beard_tone": "0", 16 | "blush_tone": "16748658", 17 | "brow_tone": "0", 18 | "eyeshadow_tone": "14440532", 19 | "hair_tone": "6700839", 20 | "lipstick_tone": "-1", 21 | "pupil_tone": "5977116", 22 | "skin_tone": "16764057", 23 | "body": "0", 24 | "face_proportion": "1" 25 | }, 26 | "outfit": "962370" 27 | } -------------------------------------------------------------------------------- /bitmojis/alexg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Alex", 3 | "gender": "male", 4 | "traits": { 5 | "beard": "742", 6 | "brow": "758", 7 | "cheek_details": "999", 8 | "eye_details": "936", 9 | "face_lines": "944", 10 | "glasses": "1071", 11 | "hair": "813", 12 | "hat": "1173", 13 | "mouth": "991", 14 | "nose": "1026", 15 | "beard_tone": "3615014", 16 | "blush_tone": "-1", 17 | "brow_tone": "3615014", 18 | "eyeshadow_tone": "6881280", 19 | "hair_tone": "5587258", 20 | "lipstick_tone": "-1", 21 | "pupil_tone": "3763125", 22 | "skin_tone": "15838344", 23 | "body": "5", 24 | "face_proportion": "6" 25 | }, 26 | "outfit": "889224" 27 | } 28 | -------------------------------------------------------------------------------- /bitmojis/vivian.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Vivian", 3 | "gender": "female", 4 | "traits": { 5 | "brow": "768", 6 | "cheek_details": "-1", 7 | "eyelash": "-1", 8 | "eye_details": "934", 9 | "face_lines": "-1", 10 | "glasses": "-1", 11 | "hair": "1259", 12 | "hat": "1192", 13 | "mouth": "1055", 14 | "nose": "762", 15 | "blush_tone": "16749739", 16 | "brow_tone": "0", 17 | "eyeshadow_tone": "11366322", 18 | "hair_tone": "5587258", 19 | "lipstick_tone": "8611708", 20 | "pupil_tone": "5977116", 21 | "skin_tone": "15838344", 22 | "body": "9", 23 | "breast": "0", 24 | "face_proportion": "3" 25 | }, 26 | "outfit": "1010239" 27 | } 28 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | # Javascript Node CircleCI 2.0 configuration file 2 | # 3 | # Check https://circleci.com/docs/2.0/language-javascript/ for more details 4 | # 5 | version: 2 6 | jobs: 7 | build: 8 | docker: 9 | - image: circleci/node:7.10 10 | 11 | working_directory: ~/repo 12 | 13 | steps: 14 | - checkout 15 | 16 | - restore_cache: 17 | keys: 18 | - v1-dependencies-{{ checksum "package.json" }} 19 | - v1-dependencies- 20 | 21 | - run: yarn install 22 | 23 | - save_cache: 24 | paths: 25 | - node_modules 26 | key: v1-dependencies-{{ checksum "package.json" }} 27 | 28 | - run: yarn test 29 | -------------------------------------------------------------------------------- /tests/bitmojis.test.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const libmoji = require('libmoji'); 3 | const fetch = require('node-fetch'); 4 | const path = require('path'); 5 | 6 | const test = require('tape'); 7 | 8 | function getBitmojiOS( params = {} ){ 9 | if(!params) params = {}; 10 | const {gender='', traits={}, outfit=''} = params; 11 | 12 | return libmoji.buildPreviewUrl( 13 | "fashion", 14 | 1, 15 | gender === 'female' ? 2 : 1, 16 | 4, 0, 17 | Object.keys(traits).map(k => [k, traits[k]]), 18 | outfit 19 | ); 20 | } 21 | 22 | function getJSON(s) { 23 | try{ 24 | return JSON.parse(s); 25 | } 26 | catch(e) { 27 | return null; 28 | } 29 | } 30 | 31 | test('bitmojis', async t => { 32 | const files = fs.readdirSync(path.join(__dirname, '../bitmojis')); 33 | 34 | for(let i in files) { 35 | const filename = files[i]; 36 | t.test(`Bitmoji at ${filename}`, async st => { 37 | 38 | const contents = fs.readFileSync(path.join(__dirname, '../bitmojis/', filename), 'utf8'); 39 | const obj = getJSON(contents); 40 | 41 | st.notEqual(obj, null, `Bitmoji JSON at ${filename} must be valid JSON`); 42 | 43 | const url = getBitmojiOS(obj); 44 | const res = await fetch(url).catch(() => null); 45 | 46 | st.equal(res.ok, true, `Generated Bitmoji picture for ${filename} must return a picture - ${url}`); 47 | st.end(); 48 | }) 49 | } 50 | t.end(); 51 | }) 52 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # next.js build output 79 | .next 80 | 81 | # nuxt.js build output 82 | .nuxt 83 | 84 | # gatsby files 85 | .cache/ 86 | public 87 | 88 | # vuepress build output 89 | .vuepress/dist 90 | 91 | # Serverless directories 92 | .serverless/ 93 | 94 | # FuseBox cache 95 | .fusebox/ 96 | 97 | # DynamoDB Local files 98 | .dynamodb/ 99 | 100 | # TernJS port file 101 | .tern-port 102 | --------------------------------------------------------------------------------