generated from ixartz/Next-js-Boilerplate
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8724b34
Showing
115 changed files
with
45,608 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# FIXME: Configure environment variables for your project | ||
|
||
# For security reason, don't push secret key in your git repo. | ||
# Append .local to the environment files to prevent your secret key from being commited to Git. | ||
|
||
# Hosting | ||
# Replace by your domain name, only for production | ||
# NEXT_PUBLIC_APP_URL=https://example.com | ||
|
||
# Database | ||
# Using an incorrect DATABASE_URL value, Next.js build will timeout and you will get the following error: "because it took more than 60 seconds" | ||
# DATABASE_URL=libsql://[RANDOM-CHARS]-[DB-NAME]-[ORG-NAME].turso.io | ||
DATABASE_URL=file:next-js-boilerplate.db | ||
|
||
# Clerk authentication | ||
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_b3Blbi1zdGlua2J1Zy04LmNsZXJrLmFjY291bnRzLmRldiQ | ||
|
||
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in | ||
|
||
######## [BEGIN] SENSITIVE DATA ######## For security reason, don't update the following variables (secret key) directly in this file. | ||
######## Please create a new file named `.env.local`, all environment files ending with `.local` won't be tracked by Git. | ||
######## After creating the file, you can add the following variables. | ||
CLERK_SECRET_KEY=your_clerk_secret_key | ||
|
||
DATABASE_AUTH_TOKEN=your_database_auth_token | ||
|
||
# LOGTAIL_SOURCE_TOKEN= | ||
######## [END] SENSITIVE DATA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
out | ||
!.storybook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
{ | ||
// Configuration for JavaScript files | ||
"extends": [ | ||
"airbnb-base", | ||
"next/core-web-vitals", // Needed to avoid warning in next.js build: 'The Next.js plugin was not detected in your ESLint configuration' | ||
"plugin:prettier/recommended" | ||
], | ||
"rules": { | ||
"prettier/prettier": [ | ||
"error", | ||
{ | ||
"singleQuote": true, | ||
"endOfLine": "auto" | ||
} | ||
] // Avoid conflict rule between Prettier and Airbnb Eslint | ||
}, | ||
"overrides": [ | ||
// Configuration for TypeScript files | ||
{ | ||
"files": ["**/*.ts", "**/*.tsx", "**/*.mts"], | ||
"plugins": [ | ||
"@typescript-eslint", | ||
"unused-imports", | ||
"tailwindcss", | ||
"simple-import-sort" | ||
], | ||
"extends": [ | ||
"plugin:tailwindcss/recommended", | ||
"airbnb", | ||
"airbnb-typescript", | ||
"next/core-web-vitals", | ||
"plugin:prettier/recommended" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": "./tsconfig.json" | ||
}, | ||
"rules": { | ||
"prettier/prettier": [ | ||
"error", | ||
{ | ||
"singleQuote": true, | ||
"endOfLine": "auto" | ||
} | ||
], // Avoid conflict rule between Prettier and Airbnb Eslint | ||
"import/extensions": "off", // Avoid missing file extension errors, TypeScript already provides a similar feature | ||
"react/function-component-definition": "off", // Disable Airbnb's specific function type | ||
"react/destructuring-assignment": "off", // Vscode doesn't support automatically destructuring, it's a pain to add a new variable | ||
"react/require-default-props": "off", // Allow non-defined react props as undefined | ||
"react/jsx-props-no-spreading": "off", // _app.tsx uses spread operator and also, react-hook-form | ||
"@typescript-eslint/comma-dangle": "off", // Avoid conflict rule between Eslint and Prettier | ||
"@typescript-eslint/consistent-type-imports": "error", // Ensure `import type` is used when it's necessary | ||
"no-restricted-syntax": [ | ||
"error", | ||
"ForInStatement", | ||
"LabeledStatement", | ||
"WithStatement" | ||
], // Overrides Airbnb configuration and enable no-restricted-syntax | ||
"import/prefer-default-export": "off", // Named export is easier to refactor automatically | ||
"simple-import-sort/imports": "error", // Import configuration for `eslint-plugin-simple-import-sort` | ||
"simple-import-sort/exports": "error", // Export configuration for `eslint-plugin-simple-import-sort` | ||
"import/order": "off", // Avoid conflict rule between `eslint-plugin-import` and `eslint-plugin-simple-import-sort` | ||
"@typescript-eslint/no-unused-vars": "off", | ||
"unused-imports/no-unused-imports": "error", | ||
"unused-imports/no-unused-vars": [ | ||
"error", | ||
{ "argsIgnorePattern": "^_" } | ||
] | ||
} | ||
}, | ||
// Configuration for testing | ||
{ | ||
"files": ["**/*.test.ts", "**/*.test.tsx"], | ||
"plugins": ["vitest", "jest-formatting", "testing-library", "jest-dom"], | ||
"extends": [ | ||
"plugin:vitest/recommended", | ||
"plugin:jest-formatting/recommended", | ||
"plugin:testing-library/react", | ||
"plugin:jest-dom/recommended" | ||
] | ||
}, | ||
// Configuration for e2e testing (Playwright) | ||
{ | ||
"files": ["**/*.spec.ts"], | ||
"extends": ["plugin:playwright/recommended"] | ||
}, | ||
// Configuration for Storybook | ||
{ | ||
"files": ["*.stories.*"], | ||
"extends": ["plugin:storybook/recommended"], | ||
"rules": { | ||
"import/no-extraneous-dependencies": [ | ||
"error", | ||
{ | ||
"devDependencies": true | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
github: ixartz | ||
custom: | ||
["https://donate.stripe.com/7sI5m5146ehfddm7tj", "https://nextlessjs.com"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
node-version: [20.x, 22.x] | ||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | ||
|
||
name: Build with ${{ matrix.node-version }} | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: "npm" | ||
- run: npm ci | ||
- run: npm run build | ||
|
||
test: | ||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
|
||
name: Run all tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Retrieve Git history, needed to verify commits | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: "npm" | ||
- run: npm ci | ||
|
||
- name: Set SENTRY_AUTH_TOKEN env if secret exists | ||
run: | | ||
if [[ -n "${{ secrets.SENTRY_AUTH_TOKEN }}" ]]; then | ||
echo "SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}" >> $GITHUB_ENV | ||
fi | ||
- name: Build Next.js for E2E tests | ||
run: npm run build | ||
|
||
- if: github.event_name == 'pull_request' | ||
name: Validate all commits from PR | ||
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose | ||
|
||
- name: Linter | ||
run: npm run lint | ||
|
||
- name: Type checking | ||
run: npm run check-types | ||
|
||
- name: Run unit tests | ||
run: npm run test | ||
|
||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v3 | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
- name: Install Playwright (used for Storybook and E2E tests) | ||
run: npx playwright install --with-deps | ||
|
||
- name: Run storybook tests | ||
run: npm run test-storybook:ci | ||
|
||
- name: Run E2E tests | ||
run: npx percy exec -- npm run test:e2e | ||
env: | ||
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} | ||
|
||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: test-results | ||
path: test-results/ | ||
retention-days: 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Checkly | ||
|
||
on: [deployment_status] | ||
|
||
env: | ||
CHECKLY_API_KEY: ${{ secrets.CHECKLY_API_KEY }} | ||
CHECKLY_ACCOUNT_ID: ${{ secrets.CHECKLY_ACCOUNT_ID }} | ||
ENVIRONMENT_URL: ${{ github.event.deployment_status.environment_url }} | ||
CHECKLY_TEST_ENVIRONMENT: ${{ github.event.deployment_status.environment }} | ||
|
||
jobs: | ||
test-e2e: | ||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | ||
|
||
# Only run when the deployment was successful | ||
if: github.event.deployment_status.state == 'success' | ||
|
||
name: Test E2E on Checkly | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: "${{ github.event.deployment_status.deployment.ref }}" | ||
fetch-depth: 0 | ||
|
||
- name: Set branch name # workaround to detect branch name in "deployment_status" actions | ||
run: echo "CHECKLY_TEST_REPO_BRANCH=$(git show -s --pretty=%D HEAD | tr -s ',' '\n' | sed 's/^ //' | grep -e 'origin/' | head -1 | sed 's/\origin\///g')" >> $GITHUB_ENV | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: "npm" | ||
|
||
- name: Restore or cache node_modules | ||
id: cache-node-modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: node-modules-${{ hashFiles('package-lock.json') }} | ||
|
||
- name: Install dependencies | ||
if: steps.cache-node-modules.outputs.cache-hit != 'true' | ||
run: npm ci | ||
|
||
- name: Run checks # run the checks passing in the ENVIRONMENT_URL and recording a test session. | ||
id: run-checks | ||
run: npx checkly test -e ENVIRONMENT_URL=${{ env.ENVIRONMENT_URL }} --reporter=github --record | ||
|
||
- name: Create summary # export the markdown report to the job summary. | ||
id: create-summary | ||
run: cat checkly-github-report.md > $GITHUB_STEP_SUMMARY | ||
|
||
- name: Deploy checks # if the test run was successful and we are on Production, deploy the checks | ||
id: deploy-checks | ||
if: steps.run-checks.outcome == 'success' && github.event.deployment_status.environment == 'Production' | ||
run: npx checkly deploy --force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Crowdin Action | ||
|
||
on: | ||
push: | ||
branches: [ main ] # Run on push to the main branch | ||
schedule: | ||
- cron: "0 5 * * *" # Run every day at 5am | ||
workflow_dispatch: # Run manually | ||
|
||
jobs: | ||
synchronize-with-crowdin: | ||
name: Synchronize with Crowdin | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: crowdin action | ||
uses: crowdin/github-action@v1 | ||
with: | ||
upload_sources: true | ||
upload_translations: true | ||
download_translations: true | ||
localization_branch_name: l10n_crowdin_translations | ||
create_pull_request: true | ||
pull_request_title: 'New Crowdin Translations' | ||
pull_request_body: 'New Crowdin translations by [Crowdin GH Action](https://github.com/crowdin/github-action)' | ||
pull_request_base_branch_name: 'main' | ||
commit_message: 'chore: new Crowdin translations by GitHub Action' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} | ||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["CI"] | ||
types: | ||
- completed | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release: | ||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
|
||
name: Create a new 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 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: "npm" | ||
- run: HUSKY=0 npm ci | ||
|
||
- name: Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: npx semantic-release |
Oops, something went wrong.