Welcome to the repository of my personal website dedicated to Photography πΈ
The project is open source so you can use part of the code but not entirely. Also, don't use the style (CSS and assets) as it is personal and makes this website unique.
This code is under MIT Licence βοΈ
To contribute to the project, you can read the Contributing document and the Code of Conduct π
Install nvm. Open the terminal and run one of the following :
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bashwget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bashTo verify that nvm has been installed, do:
command -v nvmInstall node.js using nvm by running :
# the last stable version like 16.17.0
nvm installTo display a list of node.js versions that are installed on your machine, enter:
nvm lsSwitch versions by passing the version the same way you do when installing:
# version like 18.12.1
nvm useCheck the node.js and npm versions by running :
node -v
npm -vTo get the latest LTS version of node and migrate your existing installed packages, use :
nvm install 'lts/*' --reinstall-packages-from=currentTo get the the latest version of npm, use one of the following command :
nvm install-latest-npm
npm install -g npm@latestAlways reinstall CLI packages after changing the node version
Install the dotenv cli globally by running :
npm install -g dotenv-cliUse env variables (e.g. API keys) by creating a .env file at the root of the project
Install the quicktype cli globally by running :
npm install -g quicktypeUse quicktype to generate a strongly typed API response :
quicktype --src tmp/imgkit.json --top-level ImageKit --just-types --nice-property-names --acronym-style pascal --lang ts -o tmp/tmp.tsTo run after generating the proper
.jsonfile
- Use the cURL command to download a sample response under
tmpfolder. - Run
quicktypecommand to generate atmp.tsfile and copy it under the global declartion of./types/imgkit.d.ts
// ./types/imgkit.d.ts
export {}
declare global {
// Copy Code Here
}Copy the current repo locally and install all node_modules via the following command :
dotenv npm installInstall Husky to perform actions when commiting or pushing code to GitHub :
# Create .husky folder
npx husky-initNuxt API commands (see Documentation)
# it will run "npx nuxi dev"
npm run devBuild the app without prerendering pages
# it will run "npx nuxi build"
npm run buildBuild the app and prerender all .vue files into .html static files
# it will run "npx nuxi generate"
npm run generatePreview the built / generated app
# it will run "npx nuxi preview"
npm run previewUsing directly npx
# please don't use `-f` | `--force` parameter
npx nuxi upgradeRemove manually
node_modulesandpackage-lock.jsonafter upgrade and rundotenv install
- Using npm command
dotenv npm updateNote that by default
npm updatewill not update the semver values of direct dependencies in the projectpackage.json
- Using npm-check-updates to force package.json to update to latest version (recommended)
# it will run "npx --yes npm-check-updates -u"
dotenv npm run upckRun
dotenv npm installinstead of the proposednpm installin order to use.envvariables
Run globally ESLint on the project to format the code.
# it will run "eslint . --fix"
npm run eslint-fixSemantic Versioning (SemVer) is a de facto standard for code versioning. It specifies that a version number always contains these three parts :
- MAJOR version is incremented when you add breaking changes, e.g. an incompatible API change
- MINOR version when you add functionality in a backwards compatible manner
- PATCH version when you make backwards compatible bug fixes
To generate the changelog for the first release, run:
# npm run script
npm run release -- --first-release# Enable Git Hooks
npm run prepare
# it will run "standard-version -a"
npm run release
# it will run "standard-version -a --release-as patch"
npm run release:patch
# it will run "standard-version -a --release-as minor"
npm run release:minor
# it will run "standard-version -a --release-as major"
npm run release:majorSee GitHub repo of Standard Version
Run Unlighthouse to scan an entire website (to define in package.json file) with Google LighthouseοΈ
# it will run "npx unlighthouse --site https://www.benjaminoddou-photographe.com"
npm run lighthouse# using -a to list all files, L <level> to define the depth of the tree and -I <pattern> to ignore patterns
tree -a -L 1 --charset utf-8check the Documentation by running :
tree --help- Create a file named
my.keywith aprivate API keyat the root of the project - Launch the following script to encode the API key
openssl enc -base64 -in my.key -out my.key.base64The output looks like this:
curl -X GET "https://api.imagekit.io/v1/files?<query>" \-u <private_API_key>: | json_pp > tmp/imgkit.json
curl "https://api.imagekit.io/v1/files?<query>" \-H 'Authorization: Basic <Base64_private_API_key>' | json_pp > tmp/imgkit.jsonjson_pp is used to format JSON. π¨ Output directory must exists (tmp folder here)
The two command lines output the same result. To see the different options for the <query>, check the documentation that can be found here
// In nuxt.config.ts
export default defineNuxtConfig({
runtimeConfig: {
IMAGEKIT_B64_API: process.env.IMAGEKIT_B64_API, // Defined in .env file
public: {
// public keys here
}
},
})
// In server/api/imgkit.ts
export default defineEventHandler(async () => {
const config = useRuntimeConfig()
const response = await $fetch('https://api.imagekit.io/v1/files', {
method: 'GET',
headers: {
Authorization: 'Basic ' + config.IMAGEKIT_B64_API
}
})
return response
})
// In pages/components
<script setup>
const { data: images } = useFetch<ImageKit[]>('/api/imgkit')
</script>Generated with tree
.
βββ .commitlintrc.json # Commitlint configuration file
βββ .env # Environment variables (not in GitHub repo - private π€)
βββ .github # Assets for GitHub repo
βββ .gitignore # List of files that should be ignored by Git
βββ .husky # Husky config folder (GitHub hooks)
β βββ _ # Generated by husky init command
β β βββ .gitignore
β β βββ husky.sh
β βββ commit-msg # Commitlint with GitHub hooks
βββ .npmrc # Npm config file with GSAP connection to private repository
βββ .nuxt # Nuxt uses the .nuxt/ directory in development to generate Vue application (not in GitHub repo β)
βββ .output # Nuxt creates the .output/ directory when building the application for production. (not in GitHub repo β)
βββ .versionrc.json # Changelog format configuration file
βββ .vscode
β βββ settings.json # VSCode local settings
βββ CHANGELOG.md # File that tracks all changes
βββ CODE_OF_CONDUCT.md # Code of conduct
βββ CONTRIBUTING.md # Contributing guide
βββ LICENSE # MIT License
βββ README.md # This document π
βββ app # Application files, see https://nuxt.com/docs/4.x/guide/directory-structure/app/app
βΒ Β βββ app.vue
βΒ Β βββ assets
βΒ Β βΒ Β βββ css
βΒ Β βΒ Β βΒ Β βββ tailwind.css
βΒ Β βΒ Β βββ svg
βΒ Β βΒ Β βββ checkmark.svg
βΒ Β βββ components
βΒ Β βΒ Β βββ FAQquestion.vue
βΒ Β βΒ Β βββ TheMenuLink.vue
βΒ Β βΒ Β βββ svg
βΒ Β βΒ Β βΒ Β βββ ArrowButton.vue
βΒ Β βΒ Β βΒ Β βββ Awwwards.vue
βΒ Β βΒ Β βΒ Β βββ LogoBO.vue
βΒ Β βΒ Β βΒ Β βββ MenuGit.vue
βΒ Β βΒ Β βΒ Β βββ MenuInsta.vue
βΒ Β βΒ Β βΒ Β βββ MenuMail.vue
βΒ Β βΒ Β βΒ Β βββ MenuYtbe.vue
βΒ Β βΒ Β βββ theAlert.vue
βΒ Β βΒ Β βββ theCursor.vue
βΒ Β βΒ Β βββ theFooter.vue
βΒ Β βΒ Β βββ theForm.vue
βΒ Β βΒ Β βββ theHeader.vue
βΒ Β βΒ Β βββ theMenu.vue
βΒ Β βΒ Β βββ thePreloader.vue
βΒ Β βββ error.vue
βΒ Β βββ pages
βΒ Β βΒ Β βββ about.vue
βΒ Β βΒ Β βββ gallery.vue
βΒ Β βΒ Β βββ index.vue
βΒ Β βββ plugins
βΒ Β βΒ Β βββ gsap.client.ts
βΒ Β βΒ Β βββ vue-masonry-wall.ts
βΒ Β βββ types
βΒ Β βΒ Β βββ gsap.d.ts
βΒ Β βΒ Β βββ imgkit.d.ts
βΒ Β βββ utils
βΒ Β βββ index.ts
βΒ Β βββ piniaStore.ts
βββ eslint.config.js # ESLint config file
βββ netlify.toml # Configuration file for Netlify
βββ nuxt.config.ts # Nuxt configuration file
βββ package-lock.json # Aggregates an immutable version of the package.json file
βββ package.json # Contains all the dependencies and scripts of the application
βββ public
βΒ Β βββ _redirects
βΒ Β βββ apple-touch-icon-180x180.png
βΒ Β βββ banner.jpg
βΒ Β βββ browserconfig.xml
βΒ Β βββ favicon.ico
βΒ Β βββ logo.png
βΒ Β βββ maskable-icon-512x512.png
βΒ Β βββ me.jpg
βΒ Β βββ mstile-150x150.png
βΒ Β βββ pwa-192x192.png
βΒ Β βββ pwa-512x512.png
βΒ Β βββ pwa-64x64.png
βΒ Β βββ robots.txt
βΒ Β βββ safari-pinned-tab.svg
βββ pwa-assets.config.ts # PWA assets configuration file
βββ scripts
β βββ init.sh # Initialization script
βββ server # Directory which registers API and server handlers (Nitro routes) with HMR support
β βββ api
β β βββ imgkit.ts # ImageKit API endpoint (acts as a proxy)
β βββ routes
β βββ sitemap.xml.ts # Sitemap generator
βββ tailwind.config.js # Tailwind config file
βββ tmp # Temporary files to perform tests on API
β βββ .gitkeep # Empty hidden file to keep tmp folder in GitHub repo
β βββ imgkit.json # Sample data from ImageKit cURL command (not in GitHub repo β)
β βββ tmp.ts # Output TypeScript API generated with QuickType command (not in GitHub repo β)
βββ tsconfig.jsonThe hosting of the website is made available by connecting this GitHub repository to
Netlify.
When deploying, the command script and environment variable(s) needs to be defined under Build & deploy | Site settings on Netlify.
Command scripts :
# Classic SSR build
npm run build
# Prerendering routes to optimize SEO and response time
npm run generateβοΈ Nitro used by
Nuxt 3 will detect automatically
Netlify hosting and deploy with preset='netlify'
Environment variable(s) :
MIT License Β© Benjamin Oddou