Skip to content

Commit

Permalink
fix: replace language-flag-colors with country-code-to-flag-emoji dep…
Browse files Browse the repository at this point in the history
…endency

add typecheck script to husky and publish workflow
  • Loading branch information
yassinedoghri committed Apr 30, 2022
1 parent e6809f1 commit 7d4d408
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Publish Package

on:
push:
branches: [main, alpha]
branches: [develop, main, alpha]
pull_request:
branches: "*"

Expand All @@ -15,6 +15,7 @@ jobs:
with:
node-version: 16
- run: npm ci
- run: npm run typecheck
- run: npm run lint
- run: npm run prettier
- run: npm test
Expand Down
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run typecheck
npx lint-staged
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"lint": "eslint --ext js,ts,mts src",
"prettier": "prettier --check --ignore-path .gitignore .",
"prettier:fix": "prettier --write --ignore-path .gitignore .",
"typecheck": "tsc --noEmit",
"commit": "cz",
"prepare": "husky install",
"semantic-release": "semantic-release"
Expand Down Expand Up @@ -46,9 +47,9 @@
"astro": "^1.0.0-beta.1"
},
"dependencies": {
"country-code-to-flag-emoji": "^1.1.0",
"i18next": "^21.6.16",
"iso-639-1": "^2.1.13",
"language-flag-colors": "^2.0.4"
"iso-639-1": "^2.1.13"
},
"devDependencies": {
"@commitlint/cli": "^16.2.4",
Expand Down
6 changes: 3 additions & 3 deletions src/LanguageSelector.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
import i18next from "i18next";
import ISO6391 from "iso-639-1";
import { getEmoji } from "language-flag-colors";
import countryCodeToFlagEmoji from "country-code-to-flag-emoji";
export interface Props {
className?: string;
Expand All @@ -17,9 +17,9 @@ const { className } = Astro.props;
<select onchange="location = this.value;" class={className}>
{supportedLanguages.map((supportedLanguage: string) => {
const value = supportedLanguage === baseLanguage ? "/" : supportedLanguage
const label = `${getEmoji(supportedLanguage)} ${ISO6391.getNativeName(
const label = `${countryCodeToFlagEmoji(
supportedLanguage
)}`
)} ${ISO6391.getNativeName(supportedLanguage)}`

return (
<option value={value} selected={supportedLanguage === currentLanguage}>
Expand Down
1 change: 1 addition & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module "*.astro";

0 comments on commit 7d4d408

Please sign in to comment.