From 95742405e4525715a977409376607d6d77c397df Mon Sep 17 00:00:00 2001 From: David Dias Date: Sat, 13 Aug 2022 14:55:22 -0400 Subject: [PATCH] add localize --- .env.example | 6 +++ .github/workflows/production-deployment.yml | 11 +++++ .github/workflows/staging-deployment.yml | 10 +++-- .gitignore | 3 ++ .npmrc | 1 + README.md | 33 +-------------- lint-staged.config.js | 4 +- pnpm-lock.yaml | 46 +++++++-------------- public/rss/feed.xml | 2 +- public/rss/fr/feed.xml | 2 +- 10 files changed, 50 insertions(+), 68 deletions(-) diff --git a/.env.example b/.env.example index 5818fafe..eb964b9b 100644 --- a/.env.example +++ b/.env.example @@ -39,3 +39,9 @@ SPOTIFY_REFRESH_TOKEN= YOUTUBE_CHANNEL_ID= GOOGLE_CLIENT_EMAIL= GOOGLE_PRIVATE_KEY= + +# Mailbox +MAILBOX_VALIDATOR_KEY= + +# Simple Localize +SIMPLE_LOCALIZE_KEY= diff --git a/.github/workflows/production-deployment.yml b/.github/workflows/production-deployment.yml index d88ea845..c26faeff 100644 --- a/.github/workflows/production-deployment.yml +++ b/.github/workflows/production-deployment.yml @@ -1,6 +1,9 @@ name: Production deployment on: + push: + branches: + - main workflow_dispatch: jobs: @@ -36,6 +39,14 @@ jobs: version: 7 run_install: false + - name: SimpleLocalize Download + uses: simplelocalize/download@2 + with: + apiKey: ${{ secrets.SIMPLE_LOCALIZE_KEY }} + downloadPath: ./locales/{lang}/{ns}.json + downloadFormat: single-language-json + uploadOptions: 'WRITE_NESTED,ESCAPE_NEW_LINES' + - name: Vercel deployment uses: amondnet/vercel-action@v20 with: diff --git a/.github/workflows/staging-deployment.yml b/.github/workflows/staging-deployment.yml index d3d4f98e..c0e64488 100644 --- a/.github/workflows/staging-deployment.yml +++ b/.github/workflows/staging-deployment.yml @@ -1,9 +1,6 @@ name: Staging deployment on: - # push: - # branches: - # - main pull_request: types: [opened, synchronize, reopened] branches: @@ -64,6 +61,13 @@ jobs: path: ~/.cache/Cypress key: cypress-binary-${{ hashFiles('**/pnpm-lock.yaml') }} + - name: Upload translations + uses: simplelocalize/upload@latest + with: + apiKey: ${{ secrets.SIMPLE_LOCALIZE_KEY }} + uploadPath: ./locales/{lang}/{ns}.json + uploadFormat: single-language-json + - name: Build Next.js project run: pnpm build env: diff --git a/.gitignore b/.gitignore index 40cdb9c8..fbfa6c0b 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,6 @@ public/sitemap-0.xml # Sentry .sentryclirc + +# Simple Localize +simplelocalize.yml diff --git a/.npmrc b/.npmrc index 516948cf..c7b730ca 100644 --- a/.npmrc +++ b/.npmrc @@ -1,2 +1,3 @@ strict-peer-dependencies=false enable-pre-post-scripts=true +auto-install-peers=true diff --git a/README.md b/README.md index b6b8bc20..31827574 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,5 @@ # David Dias's personal website -## Getting Started - -First, run the development the server: - -```bash -npm run dev -# or -yarn dev -``` - -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. - -You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file. - -[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`. - -The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. - -## Learn More - -To learn more about Next.js, take a look at the following resources: - -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. - -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! - -## Deploy on Vercel - -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. - -Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. +- Simple Localize: help with translations ## Design inspiration diff --git a/lint-staged.config.js b/lint-staged.config.js index 9f7ec37a..6e03ac2c 100644 --- a/lint-staged.config.js +++ b/lint-staged.config.js @@ -29,10 +29,12 @@ module.exports = { }, // Format YAML, MarkDown, JSON - '**/*.(yml|md)': (filenames) => `prettier --write ${filenames.join(' ')}`, + '**/*.(yml|md|mdx)': (filenames) => `prettier --write ${filenames.join(' ')}`, 'public/images/**/*': 'imageoptim', + 'locales/**/*.json': 'simplelocalize upload', + // Format the package.json // 'package.json': 'npx sort-package-json', } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c8e5100a..758b1f06 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -87,7 +87,7 @@ dependencies: feed: 4.2.2 googleapis: 105.0.0 gray-matter: 4.0.3 - next: 12.2.4_biqbaboplfbrettd7655fr4n2y + next: 12.2.4_qugu52izettqdqqm5qcjcltcia next-mdx-remote: 4.1.0_biqbaboplfbrettd7655fr4n2y next-plausible: 3.2.0_vyccxgqxcnj5vudpssiumaxlme next-seo: 5.5.0_vyccxgqxcnj5vudpssiumaxlme @@ -106,7 +106,7 @@ devDependencies: '@next/env': 12.2.4 '@nick22985/wakatime-api': 1.0.1 '@octokit/graphql': 5.0.0 - '@sentry/nextjs': 7.10.0_next@12.2.4+react@18.2.0 + '@sentry/nextjs': 7.10.0_iphjcfrqrktwghis427jlwhi6y '@sentry/node': 7.10.0 '@svgr/webpack': 6.3.1 '@testing-library/cypress': 8.0.3_cypress@10.4.0 @@ -162,7 +162,6 @@ packages: dependencies: '@jridgewell/gen-mapping': 0.1.1 '@jridgewell/trace-mapping': 0.3.14 - dev: true /@babel/code-frame/7.18.6: resolution: {integrity: sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==} @@ -173,7 +172,6 @@ packages: /@babel/compat-data/7.18.8: resolution: {integrity: sha512-HSmX4WZPPK3FUxYp7g2T6EyO8j96HlZJlxmKPSh6KAcqwyDrfx7hKjXpAW/0FhFfTJsR0Yt4lAjLI2coMptIHQ==} engines: {node: '>=6.9.0'} - dev: true /@babel/core/7.18.9: resolution: {integrity: sha512-1LIb1eL8APMy91/IMW+31ckrfBM4yCoLaVzoDhZUKSM4cu1L1nIidyxkCgzPAgrC5WEz36IPEr/eSeSF9pIn+g==} @@ -196,7 +194,6 @@ packages: semver: 6.3.0 transitivePeerDependencies: - supports-color - dev: true /@babel/generator/7.18.9: resolution: {integrity: sha512-wt5Naw6lJrL1/SGkipMiFxJjtyczUWTP38deiP1PO60HsBjDeKk08CGC3S8iVuvf0FmTdgKwU1KIXzSKL1G0Ug==} @@ -231,7 +228,6 @@ packages: '@babel/helper-validator-option': 7.18.6 browserslist: 4.21.3 semver: 6.3.0 - dev: true /@babel/helper-create-class-features-plugin/7.18.9_@babel+core@7.18.9: resolution: {integrity: sha512-WvypNAYaVh23QcjpMR24CwZY2Nz6hqdOcFdPbNpV56hL5H6KiFheO7Xm1aPdlLQ7d5emYZX7VZwPp9x3z+2opw==} @@ -329,7 +325,6 @@ packages: '@babel/types': 7.18.9 transitivePeerDependencies: - supports-color - dev: true /@babel/helper-optimise-call-expression/7.18.6: resolution: {integrity: sha512-HP59oD9/fEHQkdcbgFCnbmgH5vIQTJbxh2yf+CdM89/glUNnuzr87Q8GIjGEnOktTROemO0Pe0iPAYbqZuOUiA==} @@ -376,7 +371,6 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/types': 7.18.9 - dev: true /@babel/helper-skip-transparent-expression-wrappers/7.18.9: resolution: {integrity: sha512-imytd2gHi3cJPsybLRbmFrF7u5BIEuI2cNheyKi3/iOBC63kNn3q8Crn2xVuESli0aM4KYsyEqKyS7lFL8YVtw==} @@ -398,7 +392,6 @@ packages: /@babel/helper-validator-option/7.18.6: resolution: {integrity: sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==} engines: {node: '>=6.9.0'} - dev: true /@babel/helper-wrap-function/7.18.9: resolution: {integrity: sha512-cG2ru3TRAL6a60tfQflpEfs4ldiPwF6YW3zfJiRgmoFVIaC1vGnBBgatfec+ZUziPHkHSaXAuEck3Cdkf3eRpQ==} @@ -421,7 +414,6 @@ packages: '@babel/types': 7.18.9 transitivePeerDependencies: - supports-color - dev: true /@babel/highlight/7.18.6: resolution: {integrity: sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==} @@ -444,7 +436,6 @@ packages: hasBin: true dependencies: '@babel/types': 7.18.9 - dev: true /@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/7.18.6_@babel+core@7.18.9: resolution: {integrity: sha512-Dgxsyg54Fx1d4Nge8UnvTrED63vrwOdPmyvPzlNN/boaliRP54pm3pGzZD1SJUwrBA+Cs/xdG8kXX6Mn/RfISQ==} @@ -1456,7 +1447,6 @@ packages: globals: 11.12.0 transitivePeerDependencies: - supports-color - dev: true /@babel/traverse/7.18.9_supports-color@5.5.0: resolution: {integrity: sha512-LcPAnujXGwBgv3/WHv01pHtb2tihcyW1XuL9wd7jqh1Z8AQkTd+QVjMrMijrln0T7ED3UXLIy36P9Ao7W75rYg==} @@ -1606,7 +1596,6 @@ packages: dependencies: '@jridgewell/set-array': 1.1.2 '@jridgewell/sourcemap-codec': 1.4.14 - dev: true /@jridgewell/gen-mapping/0.3.2: resolution: {integrity: sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==} @@ -1942,7 +1931,7 @@ packages: tslib: 1.14.1 dev: true - /@sentry/nextjs/7.10.0_next@12.2.4+react@18.2.0: + /@sentry/nextjs/7.10.0_iphjcfrqrktwghis427jlwhi6y: resolution: {integrity: sha512-e0csRmRGNxStK8A48hM8/4f/B00EkAnwpZC6qR4JlxOTTgMpm88pydiIchBeB3yAivTsc7WI1Ia17/wLiRNthw==} engines: {node: '>=8'} peerDependencies: @@ -1963,8 +1952,8 @@ packages: '@sentry/types': 7.10.0 '@sentry/utils': 7.10.0 '@sentry/webpack-plugin': 1.19.0 - jscodeshift: 0.13.1 - next: 12.2.4_biqbaboplfbrettd7655fr4n2y + jscodeshift: 0.13.1_@babel+preset-env@7.18.9 + next: 12.2.4_qugu52izettqdqqm5qcjcltcia react: 18.2.0 tslib: 1.14.1 transitivePeerDependencies: @@ -3349,7 +3338,6 @@ packages: resolution: {integrity: sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==} dependencies: safe-buffer: 5.1.2 - dev: true /cookie/0.4.2: resolution: {integrity: sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==} @@ -4757,7 +4745,6 @@ packages: /gensync/1.0.0-beta.2: resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} engines: {node: '>=6.9.0'} - dev: true /get-intrinsic/1.1.2: resolution: {integrity: sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==} @@ -5606,7 +5593,7 @@ packages: resolution: {integrity: sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==} dev: true - /jscodeshift/0.13.1: + /jscodeshift/0.13.1_@babel+preset-env@7.18.9: resolution: {integrity: sha512-lGyiEbGOvmMRKgWk4vf+lUrCWO/8YR8sUR3FKF1Cq5fovjZDlIcw3Hu5ppLHAnEXshVffvaM0eyuY/AbOeYpnQ==} hasBin: true peerDependencies: @@ -5618,6 +5605,7 @@ packages: '@babel/plugin-proposal-nullish-coalescing-operator': 7.18.6_@babel+core@7.18.9 '@babel/plugin-proposal-optional-chaining': 7.18.9_@babel+core@7.18.9 '@babel/plugin-transform-modules-commonjs': 7.18.6_@babel+core@7.18.9 + '@babel/preset-env': 7.18.9_@babel+core@7.18.9 '@babel/preset-flow': 7.18.6_@babel+core@7.18.9 '@babel/preset-typescript': 7.18.6_@babel+core@7.18.9 '@babel/register': 7.18.9_@babel+core@7.18.9 @@ -5680,7 +5668,6 @@ packages: resolution: {integrity: sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==} engines: {node: '>=6'} hasBin: true - dev: true /jsonfile/6.1.0: resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} @@ -6701,7 +6688,7 @@ packages: react: ^16.8.0 || ^17.0.0 || ^18.0.0 react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 dependencies: - next: 12.2.4_biqbaboplfbrettd7655fr4n2y + next: 12.2.4_qugu52izettqdqqm5qcjcltcia react: 18.2.0 react-dom: 18.2.0_react@18.2.0 dev: false @@ -6713,7 +6700,7 @@ packages: react: '>=16.0.0' react-dom: '>=16.0.0' dependencies: - next: 12.2.4_biqbaboplfbrettd7655fr4n2y + next: 12.2.4_qugu52izettqdqqm5qcjcltcia react: 18.2.0 react-dom: 18.2.0_react@18.2.0 dev: false @@ -6729,7 +6716,7 @@ packages: '@corex/deepmerge': 4.0.29 '@next/env': 12.2.4 minimist: 1.2.6 - next: 12.2.4_biqbaboplfbrettd7655fr4n2y + next: 12.2.4_qugu52izettqdqqm5qcjcltcia dev: true /next-themes/0.2.0_vyccxgqxcnj5vudpssiumaxlme: @@ -6739,7 +6726,7 @@ packages: react: '*' react-dom: '*' dependencies: - next: 12.2.4_biqbaboplfbrettd7655fr4n2y + next: 12.2.4_qugu52izettqdqqm5qcjcltcia react: 18.2.0 react-dom: 18.2.0_react@18.2.0 dev: false @@ -6750,11 +6737,11 @@ packages: next: '>= 10.0.0' react: '>= 16.8.0' dependencies: - next: 12.2.4_biqbaboplfbrettd7655fr4n2y + next: 12.2.4_qugu52izettqdqqm5qcjcltcia react: 18.2.0 dev: false - /next/12.2.4_biqbaboplfbrettd7655fr4n2y: + /next/12.2.4_qugu52izettqdqqm5qcjcltcia: resolution: {integrity: sha512-b1xlxEozmAWokAXzXsi5vlmU/IfJcFNIJA8dpU5UdkFbyDPio8wwb8mAQ/Y7rGtfTgG/t/u49BiyEA+xAgFvow==} engines: {node: '>=12.22.0'} hasBin: true @@ -6778,7 +6765,7 @@ packages: postcss: 8.4.14 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 - styled-jsx: 5.0.2_react@18.2.0 + styled-jsx: 5.0.2_lxeixztqul6ae7cp3cpkyxlhzm use-sync-external-store: 1.2.0_react@18.2.0 optionalDependencies: '@next/swc-android-arm-eabi': 12.2.4 @@ -7877,7 +7864,6 @@ packages: /safe-buffer/5.1.2: resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} - dev: true /safe-buffer/5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} @@ -7921,7 +7907,6 @@ packages: /semver/6.3.0: resolution: {integrity: sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==} hasBin: true - dev: true /semver/7.0.0: resolution: {integrity: sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==} @@ -8364,7 +8349,7 @@ packages: styled-components: 4.4.1_biqbaboplfbrettd7655fr4n2y dev: false - /styled-jsx/5.0.2_react@18.2.0: + /styled-jsx/5.0.2_lxeixztqul6ae7cp3cpkyxlhzm: resolution: {integrity: sha512-LqPQrbBh3egD57NBcHET4qcgshPks+yblyhPlH2GY8oaDgKs8SK4C3dBh3oSJjgzJ3G5t1SYEZGHkP+QEpX9EQ==} engines: {node: '>= 12.0.0'} peerDependencies: @@ -8377,6 +8362,7 @@ packages: babel-plugin-macros: optional: true dependencies: + '@babel/core': 7.18.9 react: 18.2.0 /stylis-rule-sheet/0.0.10_stylis@3.5.4: diff --git a/public/rss/feed.xml b/public/rss/feed.xml index fa0b9696..f906a97c 100644 --- a/public/rss/feed.xml +++ b/public/rss/feed.xml @@ -4,7 +4,7 @@ The David Dias | Front-End Developer, podcaster & content creator https://thedaviddias.dev Hey, I'm David Dias! Front-End Developer based in Toronto/Canada. I love talking about code, technology, expatriation and life. - Sat, 13 Aug 2022 16:45:23 GMT + Sat, 13 Aug 2022 17:54:53 GMT https://validator.w3.org/feed/docs/rss2.html https://github.com/jpmonette/feed en diff --git a/public/rss/fr/feed.xml b/public/rss/fr/feed.xml index 7e81fa6f..b0348712 100644 --- a/public/rss/fr/feed.xml +++ b/public/rss/fr/feed.xml @@ -4,7 +4,7 @@ The David Dias | Développeur Front-End, podcasteur & créateur de contenu https://thedaviddias.dev Salut toi! Je m'appele David Dias. Je suis développeur Front-End, podcasteur, créateur de contenu numérique passioné pour résoudre les problèmes digitaux et humains! J'aime rencontrer de nouvelles personnes, bâtir des communautées et parler de tech, d'expatriation et de web. - Sat, 13 Aug 2022 16:45:23 GMT + Sat, 13 Aug 2022 17:54:53 GMT https://validator.w3.org/feed/docs/rss2.html https://github.com/jpmonette/feed fr