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

feat: initial setup #3

Merged
merged 19 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0a0aea7
feat: default next.js app
Callenowy Jan 31, 2024
fbecf48
feat: extend eslint setup
Callenowy Jan 31, 2024
98a5a09
feat: setup prettier
Callenowy Jan 31, 2024
f50d932
chore: add ts-reset dependency
Callenowy Jan 31, 2024
91cb8db
feat(engines): add .nvmrc file and update package.json with browsersl…
Callenowy Jan 31, 2024
a27761d
ci: add commitlint configuration and related GitHub workflow
Callenowy Jan 31, 2024
3e02df6
feat(lint-staged): add pre-commit hook and lint-staged configuration
Callenowy Jan 31, 2024
735eb60
test(unit): add vitest and related testing libraries to devDependencies
Callenowy Jan 31, 2024
18b1b10
feat(tsconfig): add aseUrl and erbatimModuleSyntax options
Callenowy Jan 31, 2024
3c82b1c
feat(tailwind): simplify tailwind `content`, add cva, clsx deps
Callenowy Jan 31, 2024
2b53860
feat(package.json): add format, test and coverage scripts
Callenowy Jan 31, 2024
01c6b5f
feat(next.config): enable reactStrictMode
Callenowy Jan 31, 2024
e5c5323
feat(utils): add cn function for merging class names and its unit tests
Callenowy Jan 31, 2024
5fb00ab
refactor(globals): move globals.css to styles directory
Callenowy Jan 31, 2024
ef61661
feat(vscode): add recommended extensions and settings configuration
Callenowy Jan 31, 2024
37d2f7f
ci: add semantic-release
Callenowy Jan 31, 2024
c6ffd36
ci(Release): change target branch to fake branch name till v1 release
Callenowy Jan 31, 2024
1923dc4
ci(Release): add semantic-release config file
Callenowy Jan 31, 2024
5a83b2d
chore: update project name and enhance README documentation
Callenowy Jan 31, 2024
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
5 changes: 5 additions & 0 deletions .commitlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"@commitlint/config-conventional"
]
}
10 changes: 10 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.next/*
.github/*
.husky/*
.vscode/*
dist/*
public/*
out/*
node_modules/*
.eslintrc.cjs
postcss.*
38 changes: 38 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,

extends: [
'plugin:@typescript-eslint/recommended-type-checked',
'next/core-web-vitals',
],

plugins: ['prettier'],

parserOptions: {
project: true,
},

rules: {
'prettier/prettier': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{argsIgnorePattern: '^_', destructuredArrayIgnorePattern: '^_'},
],
'@typescript-eslint/consistent-type-exports': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-import-type-side-effects': 'error',
},

overrides: [
{
files: [
'**/__test__/**/*.[jt]s?(x)',
'**/?(*.)+test.[jt]s?(x)',
'!**/tests/playwright/**/*.ts',
],
plugins: ['testing-library'],
extends: ['plugin:testing-library/react', 'plugin:jest-dom/recommended'],
},
],
};
45 changes: 45 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Commitlint

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
commitlint:
name: Commitlint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: Print versions
run: |
git --version
node --version
npm --version
npx commitlint --version

- name: Setup commitlint
run: |
npm install conventional-changelog-conventionalcommits
npm install commitlint@latest

- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
run: npx commitlint --from HEAD~1 --to HEAD --verbose

- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run:
npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{
github.event.pull_request.commits }} --to ${{
github.event.pull_request.head.sha }} --verbose
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release
on:
push:
branches:
- main-branch

permissions:
contents: read # for checkout

jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- name: Install dependencies
run: npm clean-install
- name:
Verify the integrity of provenance attestations and registry
signatures for installed dependencies
run: npm audit signatures
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- commitlint --edit \
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
10 changes: 10 additions & 0 deletions .lintstagedrc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import path from 'node:path';

const buildEslintCommand = filenames =>
`next lint --fix --file ${filenames
.map(f => path.relative(process.cwd(), f))
.join(' --file ')}`;

export default {
'*.{js,jsx,ts,tsx}': [buildEslintCommand],
};
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v21.6.0
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dist
public
node_modules
.github
.husky
.vscode
.next
20 changes: 20 additions & 0 deletions .prettierrc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/** @type {import('prettier').Config} */

const config = {
arrowParens: 'avoid',
bracketSpacing: true,
endOfLine: 'lf',
bracketSameLine: false,
jsxSingleQuote: false,
printWidth: 80,
quoteProps: 'as-needed',
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
useTabs: false,

plugins: ['prettier-plugin-tailwindcss'],
};

export default config;
12 changes: 12 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
branches: ["main-branch"],
"plugins":
[
["@semantic-release/npm", { "npmPublish": false }],
"@semantic-release/release-notes-generator",
"@semantic-release/github",
"@semantic-release/commit-analyzer",
"@semantic-release/git",
"@semantic-release/changelog",
],
}
14 changes: 14 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"github.vscode-github-actions",
"esbenp.prettier-vscode",
"snyk-security.snyk-vulnerability-scanner",
"bradlc.vscode-tailwindcss",
"hbenl.vscode-test-explorer",
"ms-vscode.test-adapter-converter",
"ms-playwright.playwright",
"zixuanchen.vitest-explorer",
"ms-azuretools.vscode-docker"
]
}
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"editor.wordWrap": "on",
"tailwindCSS.experimental.classRegex": [
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
["cn\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
],
"vitest.commandLine": "npx vitest",
"vitest.enable": true,
}
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,44 @@
# atmosphere
<!-- Improved compatibility of back-to-top link: See: https://github.com/othneildrew/Best-README-Template/pull/73 -->

<a name="readme-top"></a>

# Next.js + Tailwind - template

## Table of Contents

- [Overview](#overview)
- [Stack](#stack)
- [Version Control and Maintenance](#version-control)
- [License](#license)

## <a name="overview">Overview</a>

This clean Next.js template provides a well-organized structure for setting up a project quickly, including essential configurations and commonly used libraries.

> WIP

## <a name="stack">Stack</a>

- Next.js
- TypeScript
- Tailwind
- CVA - Class Variance Authority
- Vitest
- Testing Library
- ESLint
- Prettier
- Commitlint
- Conventional Commits
- Lint Staged
- Husky
- Semantic Release
- TS Reset
- Renovate

## <a name="version-control">Version Control and Maintenance</a>

This project uses `semantic-release` for version management, ensuring automated versioning and changelog generation. Before committing, we provide code quality by using `lint-staged` and following the `Conventional Commits` standard for commit messages. Renovate helps in keeping dependencies up-to-date.

## <a name="license">License</a>

The Stack App is software licensed under the [MIT license](LICENSE).
9 changes: 9 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @type {import('next').NextConfig} */

const nextConfig = {
reactStrictMode: true,
poweredByHeader: false,
output: 'standalone',
};

export default nextConfig;
Loading
Loading