1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2024-12-08 00:44:30 +01:00

feat(posts): add mistakes-as-junior-developer

This commit is contained in:
Divlo 2022-03-14 09:09:46 +01:00
parent 94212f9b5c
commit 919ebd5f3e
No known key found for this signature in database
GPG Key ID: 8F9478F220CE65E9
15 changed files with 1820 additions and 9004 deletions

View File

@ -11,6 +11,7 @@
}, },
"rules": { "rules": {
"prettier/prettier": "error", "prettier/prettier": "error",
"unicorn/prefer-node-protocol": "off" "unicorn/prefer-node-protocol": "off",
"@typescript-eslint/no-misused-promises": "off"
} }
} }

View File

@ -16,7 +16,7 @@ jobs:
language: ['javascript'] language: ['javascript']
steps: steps:
- uses: 'actions/checkout@v2.4.0' - uses: 'actions/checkout@v3.0.0'
- name: 'Initialize CodeQL' - name: 'Initialize CodeQL'
uses: 'github/codeql-action/init@v1' uses: 'github/codeql-action/init@v1'

View File

@ -10,10 +10,10 @@ jobs:
build: build:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
steps: steps:
- uses: 'actions/checkout@v2' - uses: 'actions/checkout@v3.0.0'
- name: 'Use Node.js' - name: 'Use Node.js'
uses: 'actions/setup-node@v2.5.1' uses: 'actions/setup-node@v3.0.0'
with: with:
node-version: '16.x' node-version: '16.x'
cache: 'npm' cache: 'npm'

View File

@ -10,10 +10,10 @@ jobs:
lint: lint:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
steps: steps:
- uses: 'actions/checkout@v2' - uses: 'actions/checkout@v3.0.0'
- name: 'Use Node.js' - name: 'Use Node.js'
uses: 'actions/setup-node@v2.5.1' uses: 'actions/setup-node@v3.0.0'
with: with:
node-version: '16.x' node-version: '16.x'
cache: 'npm' cache: 'npm'
@ -36,9 +36,6 @@ jobs:
- name: 'lint:prettier' - name: 'lint:prettier'
run: 'npm run lint:prettier' run: 'npm run lint:prettier'
- name: 'resume:validate'
run: 'npm run resume:validate'
- name: 'lint:dotenv' - name: 'lint:dotenv'
uses: 'dotenv-linter/action-dotenv-linter@v2' uses: 'dotenv-linter/action-dotenv-linter@v2'
with: with:

View File

@ -8,7 +8,7 @@ jobs:
release: release:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
steps: steps:
- uses: 'actions/checkout@v2.4.0' - uses: 'actions/checkout@v3.0.0'
with: with:
fetch-depth: 0 fetch-depth: 0
persist-credentials: false persist-credentials: false
@ -21,7 +21,7 @@ jobs:
git_commit_gpgsign: true git_commit_gpgsign: true
- name: 'Use Node.js' - name: 'Use Node.js'
uses: 'actions/setup-node@v2.4.0' uses: 'actions/setup-node@v3.0.0'
with: with:
node-version: '16.x' node-version: '16.x'
cache: 'npm' cache: 'npm'

View File

@ -10,10 +10,10 @@ jobs:
test-unit: test-unit:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
steps: steps:
- uses: 'actions/checkout@v2.4.0' - uses: 'actions/checkout@v3.0.0'
- name: 'Use Node.js' - name: 'Use Node.js'
uses: 'actions/setup-node@v2.5.1' uses: 'actions/setup-node@v3.0.0'
with: with:
node-version: '16.x' node-version: '16.x'
cache: 'npm' cache: 'npm'
@ -27,10 +27,10 @@ jobs:
test-lighthouse: test-lighthouse:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
steps: steps:
- uses: 'actions/checkout@v2.4.0' - uses: 'actions/checkout@v3.0.0'
- name: 'Use Node.js' - name: 'Use Node.js'
uses: 'actions/setup-node@v2.5.1' uses: 'actions/setup-node@v3.0.0'
with: with:
node-version: '16.x' node-version: '16.x'
cache: 'npm' cache: 'npm'
@ -52,10 +52,10 @@ jobs:
test-e2e: test-e2e:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
steps: steps:
- uses: 'actions/checkout@v2.4.0' - uses: 'actions/checkout@v3.0.0'
- name: 'Use Node.js' - name: 'Use Node.js'
uses: 'actions/setup-node@v2.5.1' uses: 'actions/setup-node@v3.0.0'
with: with:
node-version: '16.x' node-version: '16.x'
cache: 'npm' cache: 'npm'

View File

@ -3,5 +3,6 @@
"http://localhost:3000/", "http://localhost:3000/",
"http://localhost:3000/blog", "http://localhost:3000/blog",
"http://localhost:3000/blog/hello-world" "http://localhost:3000/blog/hello-world"
] ],
"files": ["./public/curriculum-vitae.html"]
} }

View File

@ -10,7 +10,7 @@ interface HeadProps {
export const Head: React.FC<HeadProps> = (props) => { export const Head: React.FC<HeadProps> = (props) => {
const { const {
title = 'Divlo', title = 'Divlo',
image = '/images/icons/icon-96x96.png', image = 'https://divlo.fr/images/icons/icon-96x96.png',
description, description,
url = 'https://divlo.fr/' url = 'https://divlo.fr/'
} = props } = props

View File

@ -1,22 +1,22 @@
const path = require('path') import fs from 'fs'
const fs = require('fs') import { fileURLToPath } from 'url'
const ejs = require('ejs') import ejs from 'ejs'
const date = require('date-and-time') import date from 'date-and-time'
const { Parcel } = require('@parcel/core') import { Parcel } from '@parcel/core'
const render = async (resume) => { export const render = async (resume) => {
const themeIndexPath = path.join(__dirname, 'theme', 'index.ejs') const themeIndexURL = new URL('./theme/index.ejs', import.meta.url)
const themeBuildPath = path.join(__dirname, 'theme', 'index.html') const themeBuildURL = new URL('./theme/index.html', import.meta.url)
const indexHTMLPath = path.join(__dirname, 'dist', 'index.html') const indexHTMLURL = new URL('./dist/index.html', import.meta.url)
const html = await ejs.renderFile(themeIndexPath, { const themeBuildPath = fileURLToPath(themeBuildURL)
const html = await ejs.renderFile(fileURLToPath(themeIndexURL), {
date, date,
locals: { locals: {
...resume ...resume
} }
}) })
await fs.promises.writeFile(themeBuildURL, html, { encoding: 'utf-8' })
await fs.promises.writeFile(themeBuildPath, html, { encoding: 'utf-8' })
const bundler = new Parcel({ const bundler = new Parcel({
entries: themeBuildPath, entries: themeBuildPath,
source: themeBuildPath, source: themeBuildPath,
@ -24,9 +24,5 @@ const render = async (resume) => {
defaultConfig: '@parcel/config-default' defaultConfig: '@parcel/config-default'
}) })
await bundler.run() await bundler.run()
return await fs.promises.readFile(indexHTMLPath, { encoding: 'utf-8' }) return await fs.promises.readFile(indexHTMLURL, { encoding: 'utf-8' })
}
module.exports = {
render
} }

File diff suppressed because it is too large Load Diff

View File

@ -2,9 +2,10 @@
"name": "jsonresume-theme-custom", "name": "jsonresume-theme-custom",
"private": true, "private": true,
"version": "1.0.0", "version": "1.0.0",
"type": "module",
"scripts": {}, "scripts": {},
"dependencies": { "dependencies": {
"date-and-time": "2.1.2", "date-and-time": "2.3.0",
"ejs": "3.1.6", "ejs": "3.1.6",
"modern-normalize": "1.1.0" "modern-normalize": "1.1.0"
}, },

View File

@ -0,0 +1,18 @@
import fs from 'fs'
import { render } from '../index.js'
const jsonResumeURL = new URL('../../resume.json', import.meta.url)
const publicResumeURL = new URL(
'../../public/curriculum-vitae.html',
import.meta.url
)
const dataResumeStringJSON = await fs.promises.readFile(jsonResumeURL, {
encoding: 'utf-8'
})
const dataResumeJSON = JSON.parse(dataResumeStringJSON)
const dataResumeIndexHTML = await render(dataResumeJSON)
await fs.promises.writeFile(publicResumeURL, dataResumeIndexHTML, {
encoding: 'utf-8'
})

9997
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",
"start": "next start", "start": "next start",
"build": "npm run resume:export && next build", "build": "npm run resume:build && next build",
"export": "next export", "export": "next export",
"lint:commit": "commitlint", "lint:commit": "commitlint",
"lint:editorconfig": "editorconfig-checker", "lint:editorconfig": "editorconfig-checker",
@ -26,9 +26,7 @@
"test:lighthouse": "lhci autorun", "test:lighthouse": "lhci autorun",
"test:e2e": "start-server-and-test \"start\" \"http://localhost:3000\" \"cypress run\"", "test:e2e": "start-server-and-test \"start\" \"http://localhost:3000\" \"cypress run\"",
"test:e2e:dev": "start-server-and-test \"dev\" \"http://localhost:3000\" \"cypress open\"", "test:e2e:dev": "start-server-and-test \"dev\" \"http://localhost:3000\" \"cypress open\"",
"resume:validate": "resume validate", "resume:build": "node ./jsonresume-theme-custom/scripts/build.js",
"resume:serve": "resume serve --theme \"custom\"",
"resume:export": "resume export \"./public/curriculum-vitae.html\" --format \"html\" --theme \"custom\"",
"release": "semantic-release", "release": "semantic-release",
"deploy": "vercel", "deploy": "vercel",
"postinstall": "husky install" "postinstall": "husky install"
@ -40,23 +38,23 @@
"@fortawesome/free-solid-svg-icons": "6.0.0", "@fortawesome/free-solid-svg-icons": "6.0.0",
"@fortawesome/react-fontawesome": "0.1.17", "@fortawesome/react-fontawesome": "0.1.17",
"classnames": "2.3.1", "classnames": "2.3.1",
"date-and-time": "2.1.2", "date-and-time": "2.3.0",
"gray-matter": "4.0.3", "gray-matter": "4.0.3",
"html-react-parser": "1.4.8", "html-react-parser": "1.4.8",
"next": "12.1.0", "next": "12.1.0",
"next-mdx-remote": "4.0.0", "next-mdx-remote": "4.0.0",
"next-pwa": "5.4.4", "next-pwa": "5.4.6",
"next-themes": "0.1.1", "next-themes": "0.1.1",
"next-translate": "1.3.4", "next-translate": "1.3.5",
"react": "17.0.2", "react": "17.0.2",
"react-dom": "17.0.2", "react-dom": "17.0.2",
"read-pkg": "7.1.0", "read-pkg": "7.1.0",
"rehype-raw": "6.1.1", "rehype-raw": "6.1.1",
"rehype-slug": "5.0.1", "rehype-slug": "5.0.1",
"remark-gfm": "3.0.1", "remark-gfm": "3.0.1",
"sharp": "0.30.1", "sharp": "0.30.2",
"shiki": "0.10.1", "shiki": "0.10.1",
"unified": "10.1.1", "unified": "10.1.2",
"unist-util-visit": "4.1.0", "unist-util-visit": "4.1.0",
"universal-cookie": "4.0.4" "universal-cookie": "4.0.4"
}, },
@ -64,43 +62,41 @@
"@commitlint/cli": "16.2.1", "@commitlint/cli": "16.2.1",
"@commitlint/config-conventional": "16.2.1", "@commitlint/config-conventional": "16.2.1",
"@lhci/cli": "0.9.0", "@lhci/cli": "0.9.0",
"@saithodev/semantic-release-backmerge": "2.1.1", "@saithodev/semantic-release-backmerge": "2.1.2",
"@semantic-release/git": "10.0.1", "@semantic-release/git": "10.0.1",
"@tailwindcss/typography": "0.5.2", "@tailwindcss/typography": "0.5.2",
"@testing-library/jest-dom": "5.16.2", "@testing-library/jest-dom": "5.16.2",
"@testing-library/react": "12.1.3", "@testing-library/react": "12.1.4",
"@types/date-and-time": "0.13.0", "@types/jest": "27.4.1",
"@types/jest": "27.4.0", "@types/node": "17.0.21",
"@types/node": "17.0.19", "@types/react": "17.0.40",
"@types/react": "17.0.39",
"@types/unist": "2.0.6", "@types/unist": "2.0.6",
"@typescript-eslint/eslint-plugin": "5.12.1", "@typescript-eslint/eslint-plugin": "5.14.0",
"autoprefixer": "10.4.2", "autoprefixer": "10.4.2",
"cypress": "9.5.0", "cypress": "9.5.1",
"editorconfig-checker": "4.0.2", "editorconfig-checker": "4.0.2",
"eslint": "8.9.0", "eslint": "8.11.0",
"eslint-config-conventions": "1.1.0", "eslint-config-conventions": "1.1.0",
"eslint-config-next": "12.1.0", "eslint-config-next": "12.1.0",
"eslint-config-prettier": "8.4.0", "eslint-config-prettier": "8.5.0",
"eslint-plugin-import": "2.25.4", "eslint-plugin-import": "2.25.4",
"eslint-plugin-prettier": "4.0.0", "eslint-plugin-prettier": "4.0.0",
"eslint-plugin-promise": "6.0.0", "eslint-plugin-promise": "6.0.0",
"eslint-plugin-unicorn": "41.0.0", "eslint-plugin-unicorn": "41.0.0",
"html-w3c-validator": "1.0.0", "html-w3c-validator": "1.1.0",
"husky": "7.0.4", "husky": "7.0.4",
"jest": "27.5.1", "jest": "27.5.1",
"jsonresume-theme-custom": "file:./jsonresume-theme-custom", "jsonresume-theme-custom": "file:./jsonresume-theme-custom",
"lint-staged": "12.3.4", "lint-staged": "12.3.5",
"markdownlint-cli": "0.31.1", "markdownlint-cli": "0.31.1",
"next-secure-headers": "2.2.0", "next-secure-headers": "2.2.0",
"postcss": "8.4.6", "postcss": "8.4.8",
"prettier": "2.5.1", "prettier": "2.5.1",
"prettier-plugin-tailwindcss": "0.1.7", "prettier-plugin-tailwindcss": "0.1.8",
"resume-cli": "3.0.6",
"semantic-release": "19.0.2", "semantic-release": "19.0.2",
"start-server-and-test": "1.14.0", "start-server-and-test": "1.14.0",
"tailwindcss": "3.0.23", "tailwindcss": "3.0.23",
"typescript": "4.4.4", "typescript": "4.6.2",
"vercel": "24.0.0" "vercel": "24.0.0"
} }
} }

View File

@ -1,44 +1,66 @@
--- ---
title: '❌ Mistakes I made as a junior developer' title: '❌ Mistakes I made as a junior developer'
description: 'Here are mistakes I made when I started, to prevent you from making the same mistakes.' description: 'Here are mistakes I made when I started, to prevent you from making the same mistakes.'
isPublished: false isPublished: true
publishedOn: '2021-12-06T22:06:33.818Z' publishedOn: '2022-03-14T07:42:52.989Z'
--- ---
Hello! 👋 Hello! 👋
I will explain some of my mistakes I made as a junior developer, so you can avoid doing them. I will explain some of the mistakes I made as a junior developer, so you can avoid doing them.
## 1. Skipped learning how to do automated tests ## 1. Skipped learning how to do automated tests
Probably one of the most common error junior developers do. Probably one of the most common errors junior developers does.
When you begin in programming, you learn a programming language, so you learn variables, conditions, loops, functions, etc. When you begin in programming, you learn a programming language, so you learn variables, conditions, loops, functions, etc.
With these concepts, you might start a new project, thinking that you will be able to do everything. With these concepts, you might start a new project, but as the project grows, you will end up using functions at multiple places in code, so if you change the behavior of a function, it will affect the whole project.
But as the project grows, you will end up using functions at multiple places in code, so if you change the behavior of a function, it will affect the whole project. And because the code grows, you might do some refactoring to make it more maintainable, but because we are humans, we make mistakes, you could accidentally break the entire project even with a tiny change you thought was safe to do.
And because the code grows, you might do some refactoring, but because we are humans, we make mistakes, you could accidentally break the whole project even with a tiny change you thought was safe to do. If you had automated tests, you would have a way to know if you made a mistake even before deploying to production.
If you would have automated tests, you would have a way to know if you made a mistake even before deploying to production.
Depending on the programming language you are using, and what is the project you are working on, writing tests will be different. Depending on the programming language you are using, and what is the project you are working on, writing tests will be different.
Be aware that there are 3 main testing strategy: Be aware that there are 3 main testing strategies:
- [Unit testing](https://en.wikipedia.org/wiki/Unit_testing) - [Unit testing](https://en.wikipedia.org/wiki/Unit_testing)
- [Integration testing](https://en.wikipedia.org/wiki/Integration_testing) - [Integration testing](https://en.wikipedia.org/wiki/Integration_testing)
- [End-to-end testing](https://en.wikipedia.org/wiki/End-to-end_testing) - [End-to-end testing](https://en.wikipedia.org/wiki/End-to-end_testing)
After you learnt the basic of programming, learn how to write automated tests, it will save you a lot of time and debugging. After you learned the basics of programming, learn how to write automated tests, it will save you a lot of time and debugging.
I would even say that you should get used-to writing tests, it should be an automatism, you should not even have to think about it to do it.
## 2. Thinking too big, with too much abstraction ## 2. Thinking too big, with too much abstraction
Abstraction is great, but it can be harder to understand what is going on if actally don't need this abstraction. Abstraction is great, but it can be harder to understand what is going on if actually don't need this abstraction.
Find the right balance, between abstraction and implementation, start simple, and then gradually improve and add more features. Find the right balance, between abstraction and simple implementation, start simple, and then gradually improve and add more features.
When you start a new project, you should focus on the core of the project, not on the details, to release as soon as possible, a working usable version of your project also called a [**Minimum Viable Product** (MVP)](https://en.wikipedia.org/wiki/Minimum_viable_product). When you start a new project, you should focus on the core of the project, not on the details, to release as soon as possible, a working usable version of your project also called a [**Minimum Viable Product** (MVP)](https://en.wikipedia.org/wiki/Minimum_viable_product), it is better than a half-functioning, over-engineered project.
## 3. Focusing on the thing that don't add value to a project I made this mistake while developing [Thream](https://thream.divlo.fr), your **open source** platform to stay close with your friends and communities, **talk**, chat, **collaborate**, share and **have fun**.
Basically, I thought it was cool, to do a "big" v1.0.0 release with a lot of features, but in fact, it was not, because I could not even show what I was developing (to the end-users, not technical people) as I was making multiple features at the same time and also mainly focused on the **REST API** side and not at all the **website (frontend)**.
What I recommend you to do is to start with a **v1.0.0** release as soon as possible with the minimum required features needed for your project idea, and then gradually add new features and release new versions.
In my example for [Thream](https://thream.divlo.fr), I could release a v1.0.0 without these features:
- English/French translation (could be only English)
- Light/Dark theme (could be only Dark)
- OAuth2 Authentication (could be only simple email/password authentication)
- User public profile
- Channels (maybe could be only one channel per guild to start with)
And probably more, what was really required with [Thream](https://thream.divlo.fr), is that users could authenticate, create a community of friends, and then they could communicate with each other with messages in real-time, really that was enough.
And then with this basis, I could release, v1.1.0, v1.2.0 etc. with more features, and release new versions more often to show the progress of the project, it is also more motivating to have users testing our project and to **get feedback sooner**.
**Start simple, improve later.**
## Conclusion
The real key to success is to **be passionate**, **keep learning** on your own, and **look at mistakes as learning experiences**.