Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert: remove Storyblok CMS integration #46

Merged
merged 18 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 5 additions & 65 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,76 +1,16 @@
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
plugins: ['@typescript-eslint', 'simple-import-sort', 'unused-imports'],
extends: [
'eslint:recommended',
'next',
'next/core-web-vitals',
'plugin:@typescript-eslint/recommended',
'next/core-web-vitals',
'prettier',
],
rules: {
'no-unused-vars': 'off',
'no-console': 'warn',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'react/no-unescaped-entities': 'off',

'react/display-name': 'off',
'react/jsx-curly-brace-presence': [
'warn',
{ props: 'never', children: 'never' },
],

//#region //*=========== Unused Import ===========
'@typescript-eslint/no-unused-vars': 'off',
'unused-imports/no-unused-imports': 'warn',
'unused-imports/no-unused-vars': [
'warn',
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
},
],
//#endregion //*======== Unused Import ===========

//#region //*=========== Import Sort ===========
'simple-import-sort/exports': 'warn',
'simple-import-sort/imports': [
'warn',
{
groups: [
// ext library & side effect imports
['^@?\\w', '^\\u0000'],
// {s}css files
['^.+\\.s?css$'],
// Other imports
['^@/'],
// relative paths up until 3 level
[
'^\\./?$',
'^\\.(?!/?$)',
'^\\.\\./?$',
'^\\.\\.(?!/?$)',
'^\\.\\./\\.\\./?$',
'^\\.\\./\\.\\.(?!/?$)',
'^\\.\\./\\.\\./\\.\\./?$',
'^\\.\\./\\.\\./\\.\\.(?!/?$)',
],
['^@/types'],
// other that didnt fit in
['^'],
],
},
],
//#endregion //*======== Import Sort ===========
},
globals: {
React: true,
JSX: true,
},
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'no-relative-import-paths'],
reportUnusedDisableDirectives: true,
root: true,
};
14 changes: 7 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: ⎔ Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

- name: 📥 Download deps
uses: u0reo/npm-install@fix/restore-failure
uses: u0reo/npm-install@v1
with:
useRollingCache: true

- name: 🔬 Lint
run: yarn lint:strict
run: yarn lint

# - name: 🔎 Type check
# run: yarn typecheck
- name: 🔎 Type check
run: yarn typecheck

- name: 💅 Prettier check
run: yarn format:check
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
singleQuote: true,
plugins: ['prettier-plugin-tailwindcss'],
plugins: ['prettier-plugin-organize-imports', 'prettier-plugin-tailwindcss'],
tailwindConfig: './tailwind.config.ts',
tailwindFunctions: ['clsx', 'cn'],
};
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"typescriptreact"
],
"files.associations": {
"globals.scss": "tailwindcss"
"*.css": "tailwindcss"
},
"tailwindCSS.classAttributes": [
"class",
Expand Down
67 changes: 50 additions & 17 deletions next.config.js → next.config.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,45 @@
/* eslint-disable @typescript-eslint/no-var-requires */
// @ts-check
import { flatten } from 'lodash';
import type { NextConfig } from 'next';

const { flatten } = require('lodash');
const { withPlausibleProxy } = require('next-plausible');

/** @type {import('next').NextConfig} */
module.exports = withPlausibleProxy()({
const nextConfig: NextConfig = {
eslint: {
dirs: ['src'],
},

reactStrictMode: true,
swcMinify: true,

images: {
remotePatterns: [
{ protocol: 'https', hostname: 'cdn.hashnode.com' },
{ protocol: 'https', hostname: 'i.scdn.co' },
{ protocol: 'https', hostname: 'img.transistor.fm' },
{ protocol: 'https', hostname: 'a.storyblok.com' },
{ protocol: 'https', hostname: 'cdn.sanity.io' },
{ protocol: 'https', hostname: 'avatars.githubusercontent.com' },
],
},

async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'Referrer-Policy',
value: 'strict-origin-when-cross-origin',
},
// {
// key: 'Strict-Transport-Security',
// value: 'max-age=31536000; includeSubDomains; preload',
// },
],
},
];
},

async redirects() {
return [
{
Expand Down Expand Up @@ -125,23 +143,24 @@ module.exports = withPlausibleProxy()({
async rewrites() {
return [
{
source: '/api/analytics',
destination: 'https://user-analytics.hashnode.com/api/analytics',
source: '/js/script.js',
destination: 'https://plausible.io/js/script.outbound-links.js',
},
{
source: '/api/ingest/static/:path*',
destination: 'https://eu-assets.i.posthog.com/static/:path*',
source: '/api/event',
destination: 'https://plausible.io/api/event',
},
{
source: '/api/ingest/:path*',
destination: 'https://eu.i.posthog.com/:path*',
source: '/api/analytics',
destination: 'https://user-analytics.hashnode.com/api/analytics',
},
];
},

webpack(config) {
// Grab the existing rule that handles SVG imports
const fileLoaderRule = config.module.rules.find((rule) =>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const fileLoaderRule = config.module.rules.find((rule: any) =>
rule.test?.test?.('.svg'),
);

Expand Down Expand Up @@ -171,7 +190,21 @@ module.exports = withPlausibleProxy()({
return config;
},

compiler:
process.env.NEXT_PUBLIC_VERCEL_ENV === 'production'
? {
reactRemoveProperties: true,
removeConsole: true,
}
: undefined,

experimental: {
staleTimes: {
dynamic: 30,
},
taint: true,
webpackBuildWorker: true,
},
});
};

export default nextConfig;
75 changes: 33 additions & 42 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,92 +5,83 @@
"scripts": {
"dev": "next dev",
"build": "next build",
"codegen": "graphql-codegen --config codegen.yml && yarn format",
"codegen": "graphql-codegen --config codegen.yml && prettier -w src/generated/hashnode",
"start": "next start",
"lint": "next lint",
"lint:fix": "eslint src --fix && yarn format",
"lint:strict": "eslint --max-warnings=0 src",
"typecheck": "tsc --noEmit --incremental false",
"format": "prettier -w .",
"format:check": "prettier -c .",
"optimize": "svgo -rf ."
},
"dependencies": {
"@graphql-typed-document-node/core": "3.2.0",
"@headlessui/react": "2.1.2",
"@hookform/resolvers": "3.9.0",
"@next/third-parties": "14.2.5",
"@storyblok/react": "^3.0.10",
"@headlessui/react": "2.2.0",
"@hookform/resolvers": "3.9.1",
"@next/third-parties": "15.0.2",
"clsx": "2.1.1",
"entities": "5.0.0",
"feed": "4.2.2",
"github-slugger": "2.0.0",
"graphql": "16.9.0",
"graphql-request": "7.1.0",
"html-react-parser": "5.1.12",
"html-react-parser": "5.1.18",
"js-cookie": "3.0.5",
"lodash": "4.17.21",
"next": "14.2.5",
"next-plausible": "3.12.0",
"next": "15.0.2",
"next-share": "0.27.0",
"posthog-js": "1.154.2",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-google-recaptcha": "3.1.0",
"react-hook-form": "7.52.1",
"react-icons": "5.2.1",
"react-infinite-scroll-hook": "4.1.1",
"react-hook-form": "7.53.1",
"react-icons": "5.3.0",
"react-infinite-scroll-hook": "5.0.1",
"react-markdown": "9.0.1",
"react-syntax-highlighter": "15.5.0",
"react-syntax-highlighter": "15.6.1",
"rehype-raw": "7.0.0",
"remark": "15.0.1",
"remark-gfm": "4.0.0",
"remark-smartypants": "3.0.2",
"sass": "^1.77.8",
"server-only": "0.0.1",
"sharp": "0.33.4",
"storyblok-react": "^0.1.2",
"storyblok-rich-text-react-renderer": "^2.9.2",
"tailwind-merge": "2.4.0",
"sharp": "0.33.5",
"tailwind-merge": "2.5.4",
"zod": "3.23.8",
"zod-form-data": "2.0.2"
},
"devDependencies": {
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"@graphql-codegen/cli": "5.0.2",
"@graphql-codegen/typed-document-node": "5.0.9",
"@graphql-codegen/typescript": "4.0.9",
"@graphql-codegen/typescript-operations": "4.2.3",
"@commitlint/cli": "19.5.0",
"@commitlint/config-conventional": "19.5.0",
"@graphql-codegen/cli": "5.0.3",
"@graphql-codegen/typed-document-node": "5.0.11",
"@graphql-codegen/typescript": "4.1.1",
"@graphql-codegen/typescript-operations": "4.3.1",
"@svgr/webpack": "8.1.0",
"@tailwindcss/forms": "0.5.7",
"@tailwindcss/forms": "0.5.9",
"@types/js-cookie": "3.0.6",
"@types/lodash": "4.17.7",
"@types/react": "18.3.3",
"@types/lodash": "4.17.13",
"@types/react": "18.3.12",
"@types/react-google-recaptcha": "2.1.9",
"@types/react-syntax-highlighter": "15.5.13",
"@typescript-eslint/eslint-plugin": "7.18.0",
"@typescript-eslint/parser": "7.18.0",
"@typescript-eslint/eslint-plugin": "8.12.2",
"@typescript-eslint/parser": "8.12.2",
"autoprefixer": "10.4.20",
"encoding": "0.1.13",
"eslint": "8.57.0",
"eslint-config-next": "14.2.5",
"eslint": "9.13.0",
"eslint-config-next": "15.0.2",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-simple-import-sort": "12.1.1",
"eslint-plugin-unused-imports": "4.0.1",
"husky": "9.1.4",
"lint-staged": "15.2.7",
"postcss": "8.4.40",
"eslint-plugin-no-relative-import-paths": "1.5.5",
"husky": "9.1.6",
"lint-staged": "15.2.10",
"postcss": "8.4.47",
"prettier": "3.3.3",
"prettier-plugin-tailwindcss": "0.6.5",
"prettier-plugin-organize-imports": "4.1.0",
"prettier-plugin-tailwindcss": "0.6.8",
"schema-dts": "1.1.2",
"svgo": "3.3.2",
"tailwindcss": "3.4.7",
"typescript": "5.4.5"
"tailwindcss": "3.4.14",
"typescript": "5.6.3"
},
"lint-staged": {
"**/*.{js,jsx,ts,tsx}": [
"eslint",
"prettier -w"
],
"**/*.{json,css,scss,md,webmanifest}": [
Expand Down
10 changes: 10 additions & 0 deletions prettier.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/** @type {import("prettier").Config} */
const config = {
plugins: ['prettier-plugin-organize-imports', 'prettier-plugin-tailwindcss'],
singleQuote: true,
tailwindConfig: './tailwind.config.ts',
tailwindAttributes: ['tw'],
tailwindFunctions: ['clsx', 'cn'],
};

export default config;
Binary file removed public/android-chrome-192x192.png
Binary file not shown.
Binary file removed public/android-chrome-512x512.png
Binary file not shown.
Binary file modified public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/favicon-16x16.png
Binary file not shown.
Binary file removed public/favicon-32x32.png
Binary file not shown.
Binary file modified public/favicon.ico
Binary file not shown.
Binary file added public/icon-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icon-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading