carloscuesta / gitmoji-cli

A gitmoji interactive cli tool for using emojis on commits. 💻
https://www.npmjs.com/package/gitmoji-cli
MIT License
4.63k stars 206 forks source link

Fetch gitmoji list manually? #418

Closed yihengli closed 4 years ago

yihengli commented 4 years ago

Hello @carloscuesta!

Issue: Due to a company proxy issue, my linux environment cannot directly run gitmoji -u, with a typical timeout error. However, I can wget https://raw.githubusercontent.com, thus I tried to directly download the gitmojis.json file and put it under .gitmoji folder under home.

Then I still got into troubles to run gitmoji -l

TypeError: gitmojis.forEach is not a function

wondering if there is way that people can directly install from local json emojis.

OS: linux gitmoji -v: 3.2.6 Node version: 14.5

carloscuesta commented 4 years ago

Hello @yihengli

That's weird 🤔

If you saved the .gitmoji/gitmojis.json file at your ~ directory it should be working.

Let's try something, open up a terminal and execute the following command:

$ node 

After the node shell comes in just type

os.homedir()

Make sure the .gitmoji folder is inside of that directory!

yihengli commented 4 years ago

Yes, the node's os.homedir() gave me /home/USER

I also confirmed the json is put at /home/USER/.gitmoji/gitmojis.json

carloscuesta commented 4 years ago

What permissions have the .gitmoji folder and gitmojis.json file ?

carloscuesta commented 4 years ago

I figured out the problem.

If you take a look at the getEmojis function, you'll see that we're saving the data.gitmojis on the gitmojis.json file

https://github.com/carloscuesta/gitmoji-cli/blob/41429cea465b3153924c5bb520fd8ba72ec2c94d/src/utils/getEmojis.js#L16-L28

This means you don't need to copy the whole contents that come from

https://raw.githubusercontent.com/carloscuesta/gitmoji/master/src/data/gitmojis.json

You need to copy the array without the object, like this:

[
    {
      "emoji": "🎨",
      "entity": "🎨",
      "code": ":art:",
      "description": "Improving structure / format of the code.",
      "name": "art"
    },
    {
      "emoji": "⚡️",
      "entity": "⚡",
      "code": ":zap:",
      "description": "Improving performance.",
      "name": "zap"
    },
    {
      "emoji": "🔥",
      "entity": "🔥",
      "code": ":fire:",
      "description": "Removing code or files.",
      "name": "fire"
    },
    {
      "emoji": "🐛",
      "entity": "🐛",
      "code": ":bug:",
      "description": "Fixing a bug.",
      "name": "bug"
    },
    {
      "emoji": "🚑",
      "entity": "🚑",
      "code": ":ambulance:",
      "description": "Critical hotfix.",
      "name": "ambulance"
    },
    {
      "emoji": "✨",
      "entity": "✨",
      "code": ":sparkles:",
      "description": "Introducing new features.",
      "name": "sparkles"
    },
    {
      "emoji": "📝",
      "entity": "📝",
      "code": ":pencil:",
      "description": "Writing docs.",
      "name": "pencil"
    },
    {
      "emoji": "🚀",
      "entity": "🚀",
      "code": ":rocket:",
      "description": "Deploying stuff.",
      "name": "rocket"
    },
    {
      "emoji": "💄",
      "entity": "&#ff99cc;",
      "code": ":lipstick:",
      "description": "Adding or updating the UI and style files.",
      "name": "lipstick"
    },
    {
      "emoji": "🎉",
      "entity": "🎉",
      "code": ":tada:",
      "description": "Beginning a project.",
      "name": "tada"
    },
    {
      "emoji": "✅",
      "entity": "✅",
      "code": ":white_check_mark:",
      "description": "Adding or updating tests.",
      "name": "white-check-mark"
    },
    {
      "emoji": "🔒",
      "entity": "🔒",
      "code": ":lock:",
      "description": "Fixing security issues.",
      "name": "lock"
    },
    {
      "emoji": "🔖",
      "entity": "🔖",
      "code": ":bookmark:",
      "description": "Releasing / Version tags.",
      "name": "bookmark"
    },
    {
      "emoji": "🚨",
      "entity": "🚨",
      "code": ":rotating_light:",
      "description": "Removing linter warnings.",
      "name": "rotating-light"
    },
    {
      "emoji": "🚧",
      "entity": "🚧",
      "code": ":construction:",
      "description": "Work in progress.",
      "name": "construction"
    },
    {
      "emoji": "💚",
      "entity": "💚",
      "code": ":green_heart:",
      "description": "Fixing CI Build.",
      "name": "green-heart"
    },
    {
      "emoji": "⬇️",
      "entity": "⬇️",
      "code": ":arrow_down:",
      "description": "Downgrading dependencies.",
      "name": "arrow-down"
    },
    {
      "emoji": "⬆️",
      "entity": "⬆️",
      "code": ":arrow_up:",
      "description": "Upgrading dependencies.",
      "name": "arrow-up"
    },
    {
      "emoji": "📌",
      "entity": "📌",
      "code": ":pushpin:",
      "description": "Pinning dependencies to specific versions.",
      "name": "pushpin"
    },
    {
      "emoji": "👷",
      "entity": "👷",
      "code": ":construction_worker:",
      "description": "Adding or updating CI build system.",
      "name": "construction-worker"
    },
    {
      "emoji": "📈",
      "entity": "📈",
      "code": ":chart_with_upwards_trend:",
      "description": "Adding or updating analytics or tracking code.",
      "name": "chart-with-upwards-trend"
    },
    {
      "emoji": "♻️",
      "entity": "♲",
      "code": ":recycle:",
      "description": "Refactoring code.",
      "name": "recycle"
    },
    {
      "emoji": "➕",
      "entity": "➕",
      "code": ":heavy_plus_sign:",
      "description": "Adding a dependency.",
      "name": "heavy-plus-sign"
    },
    {
      "emoji": "➖",
      "entity": "➖",
      "code": ":heavy_minus_sign:",
      "description": "Removing a dependency.",
      "name": "heavy-minus-sign"
    },
    {
      "emoji": "🔧",
      "entity": "🔧",
      "code": ":wrench:",
      "description": "Adding or updating configuration files.",
      "name": "wrench"
    },
    {
      "emoji": "🔨",
      "entity": "🔨",
      "code": ":hammer:",
      "description": "Adding or updating build scripts.",
      "name": "hammer"
    },
    {
      "emoji": "🌐",
      "entity": "🌐",
      "code": ":globe_with_meridians:",
      "description": "Internationalization and localization.",
      "name": "globe-with-meridians"
    },
    {
      "emoji": "✏️",
      "entity": "",
      "code": ":pencil2:",
      "description": "Fixing typos.",
      "name": "pencil2"
    },
    {
      "emoji": "💩",
      "entity": "",
      "code": ":poop:",
      "description": "Writing bad code that needs to be improved.",
      "name": "poop"
    },
    {
      "emoji": "⏪",
      "entity": "⏪",
      "code": ":rewind:",
      "description": "Reverting changes.",
      "name": "rewind"
    },
    {
      "emoji": "🔀",
      "entity": "🔀",
      "code": ":twisted_rightwards_arrows:",
      "description": "Merging branches.",
      "name": "twisted-rightwards-arrows"
    },
    {
      "emoji": "📦",
      "entity": "&#1F4E6;",
      "code": ":package:",
      "description": "Adding or updating compiled files or packages.",
      "name": "package"
    },
    {
      "emoji": "👽",
      "entity": "&#1F47D;",
      "code": ":alien:",
      "description": "Updating code due to external API changes.",
      "name": "alien"
    },
    {
      "emoji": "🚚",
      "entity": "&#1F69A;",
      "code": ":truck:",
      "description": "Moving or renaming files.",
      "name": "truck"
    },
    {
      "emoji": "📄",
      "entity": "&#1F4C4;",
      "code": ":page_facing_up:",
      "description": "Adding or updating license.",
      "name": "page-facing-up"
    },
    {
      "emoji": "💥",
      "entity": "💥",
      "code": ":boom:",
      "description": "Introducing breaking changes.",
      "name": "boom"
    },
    {
      "emoji": "🍱",
      "entity": "&#1F371",
      "code": ":bento:",
      "description": "Adding or updating assets.",
      "name": "bento"
    },
    {
      "emoji": "♿️",
      "entity": "♿",
      "code": ":wheelchair:",
      "description": "Improving accessibility.",
      "name": "wheelchair"
    },
    {
      "emoji": "💡",
      "entity": "💡",
      "code": ":bulb:",
      "description": "Adding or updating comments in source code.",
      "name": "bulb"
    },
    {
      "emoji": "🍻",
      "entity": "🍻",
      "code": ":beers:",
      "description": "Writing code drunkenly.",
      "name": "beers"
    },
    {
      "emoji": "💬",
      "entity": "💬",
      "code": ":speech_balloon:",
      "description": "Adding or updating text and literals.",
      "name": "speech-balloon"
    },
    {
      "emoji": "🗃",
      "entity": "🗃",
      "code": ":card_file_box:",
      "description": "Performing database related changes.",
      "name": "card-file-box"
    },
    {
      "emoji": "🔊",
      "entity": "🔊",
      "code": ":loud_sound:",
      "description": "Adding or updating logs.",
      "name": "loud-sound"
    },
    {
      "emoji": "🔇",
      "entity": "🔇",
      "code": ":mute:",
      "description": "Removing logs.",
      "name": "mute"
    },
    {
      "emoji": "👥",
      "entity": "👥",
      "code": ":busts_in_silhouette:",
      "description": "Adding or updating contributor(s).",
      "name": "busts-in-silhouette"
    },
    {
      "emoji": "🚸",
      "entity": "🚸",
      "code": ":children_crossing:",
      "description": "Improving user experience / usability.",
      "name": "children-crossing"
    },
    {
      "emoji": "🏗",
      "entity": "&#1f3d7;",
      "code": ":building_construction:",
      "description": "Making architectural changes.",
      "name": "building-construction"
    },
    {
      "emoji": "📱",
      "entity": "📱",
      "code": ":iphone:",
      "description": "Working on responsive design.",
      "name": "iphone"
    },
    {
      "emoji": "🤡",
      "entity": "🤡",
      "code": ":clown_face:",
      "description": "Mocking things.",
      "name": "clown-face"
    },
    {
      "emoji": "🥚",
      "entity": "🥚",
      "code": ":egg:",
      "description": "Adding or updating an easter egg.",
      "name": "egg"
    },
    {
      "emoji": "🙈",
      "entity": "&#8bdfe7;",
      "code": ":see_no_evil:",
      "description": "Adding or updating a .gitignore file",
      "name": "see-no-evil"
    },
    {
      "emoji": "📸",
      "entity": "📸",
      "code": ":camera_flash:",
      "description": "Adding or updating snapshots",
      "name": "camera-flash"
    },
    {
      "emoji": "⚗",
      "entity": "📸",
      "code": ":alembic:",
      "description": "Experimenting new things",
      "name": "alembic"
    },
    {
      "emoji": "🔍",
      "entity": "🔍",
      "code": ":mag:",
      "description": "Improving SEO",
      "name": "mag"
    },
    {
      "emoji": "🏷️",
      "entity": "🏷",
      "code": ":label:",
      "description": "Adding or updating types (Flow, TypeScript)",
      "name": "label"
    },
    {
      "emoji": "🌱",
      "entity": "🌱",
      "code": ":seedling:",
      "description": "Adding or updating seed files",
      "name": "seedling"
    },
    {
      "emoji": "🚩",
      "entity": "🚩",
      "code": ":triangular_flag_on_post:",
      "description": "Adding, updating, or removing feature flags",
      "name": "triangular-flag-on-post"
    },
    {
      "emoji": "🥅",
      "entity": "🥅",
      "code": ":goal_net:",
      "description": "Catching errors",
      "name": "goal-net"
    },
    {
      "emoji": "💫",
      "entity": "💫",
      "code": ":dizzy:",
      "description": "Adding or updating animations and transitions",
      "name": "animation"
    },
    {
      "emoji": "🗑",
      "entity": "🗑",
      "code": ":wastebasket:",
      "description": "Deprecating code that needs to be cleaned up.",
      "name": "wastebasket"
    }
  ]
yihengli commented 4 years ago

This worked, thanks!