Skip to content

Commit 18852ce

Browse files
authored
♻️ Move website to Next.js (#368)
This commit updates the stack of the gitmoji website to Next.js. This was a thing I wanted to do a long time ago. Our current stack was a little bit outdated and had issues with the Developer UX. The concept is the same, the whole site is built into a Static HTML site. Also we can benefit from using React βš›οΈ ❀️ The current stack will be: Next.js React Flow Scss Prettier Jest
1 parent 224dba5 commit 18852ce

File tree

97 files changed

+14428
-5461
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+14428
-5461
lines changed

β€Ž.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
root = true
33

44
[*]
5-
indent_style = tab
6-
tab_width = 4
5+
indent_style = spaces
6+
tab_width = 2
77
charset = utf-8
88
trim_trailing_whitespace = true
99
insert_final_newline = true

β€Ž.flowconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[ignore]
2+
.*/node_modules/jsonlint/.*
3+
4+
[include]
5+
6+
[libs]
7+
8+
[lints]
9+
10+
[options]
11+
12+
[strict]

β€Ž.github/CONTRIBUTING.md

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ If you would like to add a new emoji to gitmoji, fill the provided `ISSUE_TEMPLA
3030
"name": "code (same as code but without ':' replace underscores for dashes _ => - )"
3131
}
3232
```
33+
3334
If you want to find the hexadecimal entity of icon, search for it in this site: <a>http://graphemica.com/</a>
3435

3536
Then, after that you'll need to add a new color to [the vars.scss](https://github.com/carloscuesta/gitmoji/blob/master/src/styles/_includes/_vars.scss) file.
3637

3738
You must follow the convention of adding a new item to the `$gitmojis array`. That matches the name that you added at the json file.
3839

39-
## How to start gitmoji and update
40+
## How to start gitmoji
4041

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

@@ -50,24 +51,7 @@ $ cd gitmoji
5051
2. Install the dependencies and start the development task.
5152

5253
```bash
53-
$ npm i && gulp
54-
```
55-
56-
3. Make sure the styles are using a link instead of being inlined.
57-
58-
_If you are updating the SCSS files and the styles doesn't get updated, go to the `index.pug` and `about.pug` paste the following code_
59-
60-
```jade
61-
link(href="css/style.css", type="text/css", rel="stylesheet")
54+
$ yarn install && yarn run dev
6255
```
6356

64-
_Remove this one_
65-
66-
```jade
67-
style
68-
include ../../dist/css/style.css
69-
```
70-
71-
**After making your changes, inline the styles as before.**
72-
73-
The project is built with [Pug](http://pugjs.org) and [SCSS](http://sass-lang.com)
57+
The project is built with [Next.js](http://nextjs.org) and [SCSS](http://sass-lang.com)

β€Ž.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
dist/
33
node_modules/
44
.publish/
5+
.next
6+
out/
7+
coverage/

β€Ž.travis.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
language: node_js
2-
node_js:
3-
- 6
2+
node_js: lts/*
43
cache:
54
directories:
65
- node_modules
7-
script: npm test
6+
script:
7+
- yarn run lint
8+
- yarn run flow
9+
- yarn run test
10+
before_deploy:
11+
- yarn run build
12+
- yarn run export
813
deploy:
914
provider: pages
10-
local-dir: dist
15+
local-dir: out
1116
skip-cleanup: true
1217
github-token: $GITHUB_PAGES_DEPLOY_TOKEN
1318
keep-history: true
@@ -18,3 +23,4 @@ deploy:
1823
notifications:
1924
slack:
2025
secure: oTOAM8T5Qo3sZ+oB54OfwRA/F1IFrt3J2TFGobYqSk5GZFBJZ/idlSFmKsMCfqVYTMzNhWlYj4H+isdAVzVh/TgbFKY88/GcbtNG8QYCJcFaWOanIp38XQ2RiSImt5T4aMquq/pFj1cE+CNTIWRoieDteukq/bIT3Z1I8hpz5QCSxAFr0suPSwCv1MLXR0ytVldF16eeTVQ0BR8l4L/K5IBt6ZfnpkebZMS0Q3MCobUosAgE1hIHFYxdXYugfmnG0cO2wtLvXwQWQ6VoRGJdc0iAL4CFJxKORX43Y//T0P5e0dBiGfek7QP5gJk+8qeFd5D2O34pB/POUy2vtFvBKTSsgOhz94fmS5v5M4X60oHsNWYt8AUU9CMicYQ2U2pbYAlttTGN3tguC/usdJRS9kWdn6MbI8T6cjk2BCyriFXXXumLEINiHYexcb0PdAm2Lwc//5QSxCdFPGr5UfdhAfwpNOy21QhvcioGUJbtLuyEMP+F9+ZMYWypfacD507yqtr5Z+rtInp4qOuKwZFSir7IzTBbuEUuxJLagbwUTbT302sYarOPvpAjgzPbPWFuUVigZ1y/SPbdObbolOh2yGEfYwIIIPT8ijKPN+sgDFOr0TJ1ZkB59Kb5zW/pDAykWqf2kmLHCFQGcatPzg1ROrrR5CH6/+LVQKhxUEaGLaE=
26+
email: false

β€Žgulpfile.babel.js

Lines changed: 0 additions & 77 deletions
This file was deleted.

β€Žnext.config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const withSass = require('@zeit/next-sass')
2+
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin')
3+
4+
module.exports = withSass({
5+
exportPathMap: function() {
6+
return {
7+
'/': { page: '/' },
8+
'/about': { page: '/about' },
9+
'/contributors': { page: '/contributors' }
10+
}
11+
},
12+
webpack: (config, { dev, isServer }) => {
13+
if (isServer) return config
14+
15+
config.optimization.minimizer.push(new OptimizeCSSAssetsPlugin({}))
16+
17+
return config
18+
}
19+
})

β€Žpackage.json

Lines changed: 54 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,68 @@
11
{
22
"name": "gitmoji",
33
"version": "1.0.0",
4-
"description": "An emoji guide for your commit messages",
5-
"main": "index.js",
4+
"private": true,
65
"scripts": {
7-
"jsonvalidate": "jsonlint ./src/data/gitmojis.json -V ./src/data/schema.json",
8-
"contributors": "curl https://api.github.com/repos/carloscuesta/gitmoji/contributors -o ./src/data/contributors.json",
9-
"build": "gulp build",
10-
"deploy": "gulp deploy",
11-
"start": "npm run contributors && gulp",
12-
"test": "npm run jsonvalidate && gulp build"
6+
"build": "next build",
7+
"dev": "next dev",
8+
"export": "next export && touch out/.nojekyll",
9+
"flow": "flow",
10+
"lint": "prettier --check src/**/*.{js,json,scss}",
11+
"start": "next start",
12+
"test": "jest --coverage",
13+
"validate:gitmojis": "jsonlint ./src/data/gitmojis.json -V ./src/data/schema.json"
1314
},
14-
"repository": {
15-
"type": "git",
16-
"url": "git+https://github.com/carloscuesta/gitmoji.git"
15+
"dependencies": {
16+
"@babel/preset-flow": "^7.0.0",
17+
"@zeit/next-sass": "^1.0.1",
18+
"next": "9.1.1",
19+
"node-sass": "^4.13.0",
20+
"react": "16.11.0",
21+
"react-dom": "16.11.0",
22+
"react-test-renderer": "^16.11.0"
23+
},
24+
"devDependencies": {
25+
"flow-bin": "^0.110.1",
26+
"husky": "^3.0.9",
27+
"identity-obj-proxy": "^3.0.0",
28+
"jest": "^24.9.0",
29+
"jsonlint": "^1.6.3",
30+
"lint-staged": "^10.0.0-1",
31+
"optimize-css-assets-webpack-plugin": "^5.0.3",
32+
"prettier": "1.18.2"
33+
},
34+
"prettier": {
35+
"semi": false,
36+
"singleQuote": true,
37+
"arrowParens": "always"
1738
},
18-
"author": "Carlos Cuesta",
19-
"license": "MIT",
20-
"bugs": {
21-
"url": "https://github.com/carloscuesta/gitmoji/issues"
39+
"lint-staged": {
40+
"*.{js,jsx}": [
41+
"prettier --write src/**/*.{js,json,scss}",
42+
"git add"
43+
]
2244
},
23-
"pugLintConfig": {
24-
"disallowHtmlText": true,
25-
"disallowDuplicateAttributes": true,
26-
"disallowClassAttributeWithStaticValue": true,
27-
"disallowIdAttributeWithStaticValue": true,
28-
"requireLowerCaseAttributes": true
45+
"husky": {
46+
"hooks": {
47+
"pre-commit": "lint-staged",
48+
"pre-push": "npm run flow && npm run test"
49+
}
2950
},
3051
"babel": {
3152
"presets": [
32-
"es2015"
53+
"next/babel",
54+
"@babel/preset-flow"
3355
]
3456
},
35-
"homepage": "https://github.com/carloscuesta/gitmoji#readme",
36-
"dependencies": {
37-
"async": "^2.1.2",
38-
"gulp": "^3.9.1",
39-
"gulp-plumber": "^1.1.0",
40-
"gulp-pug": "^3.3.0",
41-
"gulp-pug-lint": "^0.1.6",
42-
"gulp-sass": "^3.1.0",
43-
"pdfkit": "^0.8.0",
44-
"request": "^2.79.0"
45-
},
46-
"devDependencies": {
47-
"babel-core": "^6.26.0",
48-
"babel-preset-es2015": "^6.24.1",
49-
"browser-sync": "^2.18.13",
50-
"gulp-gh-pages": "^0.5.4",
51-
"jsonlint": "^1.6.2"
57+
"jest": {
58+
"collectCoverageFrom": [
59+
"src/**/*.{js,jsx}"
60+
],
61+
"testMatch": [
62+
"**/*.(spec).(js)"
63+
],
64+
"moduleNameMapper": {
65+
"\\.(scss)$": "identity-obj-proxy"
66+
}
5267
}
5368
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
Β (0)