diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..7334213 --- /dev/null +++ b/.env.example @@ -0,0 +1,6 @@ +# !STARTERCONF Duplicate this to .env.local + +# DEVELOPMENT TOOLS +# Ideally, don't add them to production deployment envs +# !STARTERCONF Change to true if you want to log data +NEXT_PUBLIC_SHOW_LOGGER="false" \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..241cdcb --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,84 @@ +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', + '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$'], + // Lib and hooks + ['^@/lib', '^@/hooks'], + // static data + ['^@/data'], + // components + ['^@/components', '^@/container'], + // zustand store + ['^@/store'], + // Other imports + ['^@/'], + // relative paths up until 3 level + [ + '^\\./?$', + '^\\.(?!/?$)', + '^\\.\\./?$', + '^\\.\\.(?!/?$)', + '^\\.\\./\\.\\./?$', + '^\\.\\./\\.\\.(?!/?$)', + '^\\.\\./\\.\\./\\.\\./?$', + '^\\.\\./\\.\\./\\.\\.(?!/?$)', + ], + ['^@/types'], + // other that didnt fit in + ['^'], + ], + }, + ], + //#endregion //*======== Import Sort =========== + }, + globals: { + React: true, + JSX: true, + }, +}; diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..fd592e8 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,14 @@ +# !STARTERCONF You can delete this file :) Your support is much appreciated! +# These are supported funding model platforms + +github: theodorusclarence +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +custom: ['https://saweria.co/theodorusclarence'] diff --git a/.github/issue-branch.yml b/.github/issue-branch.yml new file mode 100644 index 0000000..1626600 --- /dev/null +++ b/.github/issue-branch.yml @@ -0,0 +1,9 @@ +# https://github.com/robvanderleek/create-issue-branch#option-2-configure-github-action + +# ex: i4-lower_camel_upper +branchName: 'i${issue.number}-${issue.title,}' +branches: + - label: epic + skip: true + - label: debt + skip: true diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..a1738cd --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,15 @@ +# Description & Technical Solution + +Describe problems, if any, clearly and concisely. +Summarize the impact to the system. +Please also include relevant motivation and context. +Please include a summary of the technical solution and how it solves the problem. + +# Checklist + +- [ ] I have commented my code, particularly in hard-to-understand areas. +- [ ] Already rebased against main branch. + +# Screenshots + +Provide screenshots or videos of the changes made if any. diff --git a/.github/workflows/create-branch.yml b/.github/workflows/create-branch.yml new file mode 100644 index 0000000..b8d5195 --- /dev/null +++ b/.github/workflows/create-branch.yml @@ -0,0 +1,14 @@ +name: Create Branch from Issue + +on: + issues: + types: [assigned] + +jobs: + create_issue_branch_job: + runs-on: ubuntu-latest + steps: + - name: Create Issue Branch + uses: robvanderleek/create-issue-branch@main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/issue-autolink.yml b/.github/workflows/issue-autolink.yml new file mode 100644 index 0000000..0da8924 --- /dev/null +++ b/.github/workflows/issue-autolink.yml @@ -0,0 +1,16 @@ +name: 'Issue Autolink' +on: + pull_request: + types: [opened] + +jobs: + issue-links: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: tkt-actions/add-issue-links@v1.8.1 + with: + repo-token: '${{ secrets.GITHUB_TOKEN }}' + branch-prefix: 'i' + resolve: 'true' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..aeede5c --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,44 @@ +name: Code Check +on: + push: + branches: + - main + pull_request: {} + +concurrency: + group: ${{ github.job }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint: + name: ⏣ ESLint, ĘŚ TypeScript, đ Prettier, and đ Test + runs-on: ubuntu-latest + steps: + - name: âŹď¸ Checkout repo + uses: actions/checkout@v2 + + - name: đ¤ Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: â Setup node + uses: actions/setup-node@v3 + with: + node-version: 20 + cache: 'pnpm' + + - name: đĽ Download deps + run: pnpm install --frozen-lockfile + + - name: đŹ Lint + run: pnpm run lint:strict + + - name: đ Type check + run: pnpm run typecheck + + - name: đ Prettier check + run: pnpm run format:check + + - name: đ Run jest + run: pnpm run test diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..3659c86 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,17 @@ +name: release-please +on: + # !STARTERCONF Choose your preferred event + # !Option 1: Manual Trigger from GitHub + workflow_dispatch: + # !Option 2: Release on every push on main branch + # push: + # branches: + # - main +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: google-github-actions/release-please-action@v3 + with: + release-type: node + package-name: release-please-action diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c4e6a2d --- /dev/null +++ b/.gitignore @@ -0,0 +1,42 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.pnpm-debug.log* + +# local env files +.env +.env*.local + +# vercel +.vercel + +# typescript +*.tsbuildinfo +next-env.d.ts + +# next-sitemap +robots.txt +sitemap.xml +sitemap-*.xml \ No newline at end of file diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100755 index 0000000..0bd658f --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no-install commitlint --edit "$1" diff --git a/.husky/post-merge b/.husky/post-merge new file mode 100755 index 0000000..1fd4a5b --- /dev/null +++ b/.husky/post-merge @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +pnpm install diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..c37466e --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx lint-staged \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..b7425b9 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +enable-pre-post-scripts=true \ No newline at end of file diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..790e110 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v20.10.0 diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..b04160b --- /dev/null +++ b/.prettierignore @@ -0,0 +1,41 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# next.js +.next +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.pnpm-debug.log* + +# local env files +.env.local +.env.development.local +.env.test.local +.env.production.local + +# vercel +.vercel + +# changelog +CHANGELOG.md + +pnpm-lock.yaml diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..5c34464 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,7 @@ +module.exports = { + arrowParens: 'always', + singleQuote: true, + jsxSingleQuote: true, + tabWidth: 2, + semi: true, +}; diff --git a/.vscode/css.code-snippets b/.vscode/css.code-snippets new file mode 100644 index 0000000..82cc815 --- /dev/null +++ b/.vscode/css.code-snippets @@ -0,0 +1,10 @@ +{ + "Region CSS": { + "prefix": "regc", + "body": [ + "/* #region /**=========== ${1} =========== */", + "$0", + "/* #endregion /**======== ${1} =========== */" + ] + } +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..44bf298 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + // Tailwind CSS Intellisense + "bradlc.vscode-tailwindcss", + "esbenp.prettier-vscode", + "dbaeumer.vscode-eslint", + "aaron-bond.better-comments" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a775463 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,17 @@ +{ + "css.validate": false, + "editor.formatOnSave": true, + "editor.tabSize": 2, + "editor.codeActionsOnSave": { + "source.fixAll": "explicit" + }, + "[css]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, + // Tailwind CSS Autocomplete, add more if used in projects + "tailwindCSS.classAttributes": [ + "class", + "className", + "classNames", + "containerClassName" + ], + "typescript.preferences.importModuleSpecifier": "non-relative" +} diff --git a/.vscode/typescriptreact.code-snippets b/.vscode/typescriptreact.code-snippets new file mode 100644 index 0000000..1fce740 --- /dev/null +++ b/.vscode/typescriptreact.code-snippets @@ -0,0 +1,193 @@ +{ + //#region //*=========== React =========== + "import React": { + "prefix": "ir", + "body": ["import * as React from 'react';"] + }, + "React.useState": { + "prefix": "us", + "body": [ + "const [${1}, set${1/(^[a-zA-Z])(.*)/${1:/upcase}${2}/}] = React.useState<$3>(${2:initial${1/(^[a-zA-Z])(.*)/${1:/upcase}${2}/}})$0" + ] + }, + "React.useEffect": { + "prefix": "uf", + "body": ["React.useEffect(() => {", " $0", "}, []);"] + }, + "React.useReducer": { + "prefix": "ur", + "body": [ + "const [state, dispatch] = React.useReducer(${0:someReducer}, {", + " ", + "})" + ] + }, + "React.useRef": { + "prefix": "urf", + "body": ["const ${1:someRef} = React.useRef($0)"] + }, + "React Functional Component": { + "prefix": "rc", + "body": [ + "import * as React from 'react';\n", + "export default function ${1:${TM_FILENAME_BASE}}() {", + " return (", + "
Next.js + Tailwind CSS + TypeScript starter packed with useful development features.
+Made by Theodorus Clarence
+ +[![GitHub Repo stars](https://img.shields.io/github/stars/theodorusclarence/ts-nextjs-tailwind-starter)](https://github.com/theodorusclarence/ts-nextjs-tailwind-starter/stargazers) +[![Depfu](https://badges.depfu.com/badges/fc6e730632ab9dacaf7df478a08684a7/overview.svg)](https://depfu.com/github/theodorusclarence/ts-nextjs-tailwind-starter?project_id=30160) +[![Last Update](https://img.shields.io/badge/deps%20update-every%20sunday-blue.svg)](https://shields.io/) + ++ You can change primary color to any Tailwind CSS colors. See + globals.css to change your color. +
++ No style applied, differentiate internal and outside links, give + custom cursor for outside links. +
++ Add styling on top of UnstyledLink, giving a primary color to + the link. +
++ Add styling on top of UnstyledLink, giving a dotted and animated + underline. +
++ Useful for indicating navigation, I use this quite a lot, so why + not build a component with some whimsy touch? +
++ Button styled link with 3 variants. +
++ Ordinary button with style. +
++ Button with a text style +
++ Button with only icon inside +
++ Styled 404 page with some animation. +
++ Next Image with default props and skeleton animation +
++ Skeleton with shimmer effect +
++ A starter for Next.js, Tailwind CSS, and TypeScript with Absolute + Import, Seo, Link component, pre-configured with Husky{' '} +
+
+