Skip to content

Commit

Permalink
πŸ—οΈ Transform project into a monorepo (#1235)
Browse files Browse the repository at this point in the history
* πŸ—οΈ Define monorepo architecture
* 🚚 Extract `gitmojis` as an isolated package
* 🚚 Extract `website` as an isolated package
* 🚚 Clean-up root package.json
* βž• Install `turbo`
* πŸ”§ Setup turborepo
* πŸ‘· Use `turbo` in `ci` workflow
* πŸ‘· Update `npm-publish` workflow with `turbo`
* ♻️ Migrate yarn from `classic` to `berry`
* πŸ“ Update contributing guide
* 🎨 Update readme
* πŸ“ Add readme file for `gitmojis` package
* 🚚 Move `public` folder to `website` package
  • Loading branch information
carloscuesta authored Dec 22, 2022
1 parent 8d467e9 commit 1ccef5a
Show file tree
Hide file tree
Showing 133 changed files with 10,446 additions and 6,556 deletions.
4 changes: 2 additions & 2 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
[lints]

[options]
module.name_mapper='src\/\(.*\)$' -> '<PROJECT_ROOT>/src/\1'
module.name_mapper='src\/\(.*\)$' -> '<PROJECT_ROOT>/packages/website/src/\1'
exact_by_default=true
react.runtime=automatic
react.runtime=automatic
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.yarn/releases/** binary
10 changes: 5 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ If you would like to add a new emoji to gitmoji, fill the provided `ISSUE_TEMPLA

## How to add a gitmoji

1. Open the **gitmojis.json** file located at `src/data/gitmojis.json`.
1. Open the **gitmojis.json** file located at `packages/gitmojis/src/gitmojis.json`.
2. Add your emoji using the following code inside of the `gitmojis array []`:
3. Add a new color to [the emojiColorsMap.js](https://github.com/carloscuesta/gitmoji/blob/master/src/components/GitmojiList/emojiColorsMap.js) file. Matching the name you added at the JSON file.
3. Add a new color to [the emojiColorsMap.js](https://github.com/carloscuesta/gitmoji/blob/master/packages/website/src/components/GitmojiList/emojiColorsMap.js) file. Matching the name you added at the JSON file.
4. Save the file and create a pull request.

```json
Expand All @@ -37,9 +37,9 @@ If you would like to add a new emoji to gitmoji, fill the provided `ISSUE_TEMPLA

If you want to find the hexadecimal entity of icon, search for it in this site: <a>http://graphemica.com/</a>

Every suggestion will be reviewed carefully, ⚠️ take into account that not every suggestion will be accepted!
Every suggestion will be reviewed carefully, ⚠️ take into account that not every suggestion will be accepted!

## How to start gitmoji
## How to start the website

If you want to make changes to the site, follow the next steps:

Expand All @@ -50,7 +50,7 @@ $ git clone https://github.com/carloscuesta/gitmoji.git
$ cd gitmoji
```

2. Install the dependencies and start the development task.
2. Install the dependencies and start the development server.

```bash
$ yarn install && yarn run dev
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@ jobs:
strategy:
matrix:
node-version: [16.x]
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
steps:
- uses: actions/checkout@v3
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version: ${{ matrix.node-version }}
- name: Install dependencies πŸ“¦
run: yarn
run: yarn install --immutable
- name: Lint 🎨
run: yarn run lint
run: yarn turbo lint
- name: Flow types 🏷
run: yarn run flow
run: yarn turbo flow
- name: Tests βœ…
run: yarn run test
- name: Gitmojis validation 😜
run: yarn run validate:gitmojis
run: yarn turbo test
5 changes: 3 additions & 2 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version: '16'
- name: Install dependencies πŸ“¦
run: yarn
run: yarn install --immutable
- name: Publish package to NPM πŸš€
env:
NPM_TOKEN: ${{ secrets.NPM_AUTOMATION_TOKEN }}
run: |
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
npm publish
yarn turbo publishPackage
- name: Publish GitHub Release πŸ“
uses: softprops/action-gh-release@v1
with:
Expand Down
18 changes: 15 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,24 @@ node_modules/
.next
out/
coverage/
public/robots.txt
public/sitemap.xml
.eslintcache
*.log
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# next-pwa
public/workbox-*.js
public/workbox-*.js
public/sw.js
public/sw.js
public/*.map
*.log

# next-sitemap
public/robots.txt
public/sitemap.xml
public/sitemap.xml
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn run flow && yarn run test
yarn turbo flow && yarn turbo test
4 changes: 4 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"*.json": ["prettier --write *.json"],
"*.md": ["prettier --write *.md"]
}
823 changes: 823 additions & 0 deletions .yarn/releases/yarn-3.3.1.cjs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
yarnPath: .yarn/releases/yarn-3.3.1.cjs
nodeLinker: node-modules
22 changes: 11 additions & 11 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
- Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities
Expand Down Expand Up @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ Are you using Gitmoji on your project? Set the Gitmoji badge on top of your read

```html
<a href="https://gitmoji.dev">
<img src="https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67.svg?style=flat-square" alt="Gitmoji">
<img
src="https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67.svg?style=flat-square"
alt="Gitmoji"
/>
</a>
```

Expand Down
172 changes: 8 additions & 164 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,180 +1,24 @@
{
"name": "gitmojis",
"version": "3.13.0",
"name": "gitmoji",
"private": true,
"engines": {
"node": "16"
},
"description": "An emoji guide for your commit messages.",
"private": false,
"main": "src/data/gitmojis.json",
"files": [
"src/data/gitmojis.json"
"workspaces": [
"packages/*"
],
"scripts": {
"build": "next build",
"dev": "next dev",
"flow": "flow",
"lint": "eslint src && prettier --check src/**/*.{js,json,css}",
"postbuild": "next-sitemap",
"start": "next start",
"test": "jest --coverage",
"validate:gitmojis": "jsonlint ./src/data/gitmojis.json -V ./src/data/schema.json",
"prepublishOnly": "npm run validate:gitmojis",
"prepare": "husky install"
"prepare": "husky install",
"dev": "yarn turbo dev"
},
"devDependencies": {
"@babel/core": "^7.19.6",
"@babel/eslint-parser": "^7.19.1",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.18.6",
"clipboard": "^2.0.4",
"eslint": "^8.26.0",
"eslint-config-next": "^13.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-jest": "^27.1.3",
"eslint-plugin-react": "^7.31.10",
"flow-bin": "^0.196.0",
"focus-trap-react": "^10.0.0",
"husky": "^8.0.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.0.1",
"jest-environment-jsdom": "^29.0.1",
"jest-fetch-mock": "^3.0.3",
"jsonlint": "^1.6.3",
"lint-staged": "^13.0.0",
"next": "^13.0.0",
"next-pwa": "^5.4.4",
"next-sitemap": "^2.1.5",
"next-themes": "^0.2.0",
"prettier": "2.8.1",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-test-renderer": "^18.2.0"
},
"author": {
"name": "carloscuesta",
"email": "[email protected]",
"url": "https://carloscuesta.me"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/carloscuesta/gitmoji/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/carloscuesta/gitmoji.git"
},
"homepage": "https://gitmoji.dev",
"keywords": [
"gitmoji",
"emoji",
"carloscuesta",
"commit"
],
"prettier": {
"semi": false,
"singleQuote": true,
"arrowParens": "always"
},
"lint-staged": {
"*.{js,jsx}": [
"eslint --cache --fix",
"prettier --write src/**/*.{js,json,css}",
"git add"
]
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx}"
],
"testMatch": [
"**/*.(spec).(js)"
],
"moduleNameMapper": {
"^.+\\.css$": "identity-obj-proxy",
"src/(.*)$": "<rootDir>/src/$1"
},
"testEnvironment": "jsdom"
"turbo": "^1.6.3"
},
"volta": {
"node": "16.15.0"
},
"eslintConfig": {
"parser": "@babel/eslint-parser",
"env": {
"jest": true,
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:flowtype/recommended",
"plugin:react/recommended",
"prettier",
"plugin:@next/next/recommended"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module",
"requireConfigFile": false,
"babelOptions": {
"presets": [
"next/babel",
"@babel/preset-react",
"@babel/preset-flow"
]
}
},
"plugins": [
"react",
"flowtype"
],
"rules": {
"flowtype/require-valid-file-annotation": [
2,
"always",
{
"annotationStyle": "line"
}
],
"react/react-in-jsx-scope": "off",
"@next/next/no-img-element": "off",
"react/no-unknown-property": ["error", { "ignore": ["jsx", "global"] }]
},
"overrides": [
{
"files": [
"*.spec.js",
"stubs.js",
"**/__mocks__/*.js"
],
"rules": {
"flowtype/require-valid-file-annotation": 0
}
}
],
"settings": {
"react": {
"version": "detect",
"flowVersion": "detect"
},
"import/resolver": {
"alias": {
"map": [
[
"src",
"./src"
]
]
}
}
}
},
"dependencies": {}
"packageManager": "[email protected]"
}
3 changes: 3 additions & 0 deletions packages/gitmojis/.lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"./src/*.json": ["prettier --write ./src/*.json"]
}
Loading

1 comment on commit 1ccef5a

@vercel
Copy link

@vercel vercel bot commented on 1ccef5a Dec 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

gitmoji – ./

gitmoji-carloscuesta.vercel.app
gitmoji.dev
gitmoji-git-master-carloscuesta.vercel.app

Please sign in to comment.