Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierniki committed Sep 4, 2023
0 parents commit fa9a0bc
Show file tree
Hide file tree
Showing 44 changed files with 20,156 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"projectName": "next-enterprise",
"projectOwner": "Blazity",
"repoType": "github",
"repoHost": "https://github.com",
"files": [
"README.md"
],
"imageSize": 100,
"commit": true,
"commitConvention": "angular",
"contributors": [
{
"login": "bmstefanski",
"name": "Bart Stefanski",
"avatar_url": "https://avatars.githubusercontent.com/u/28964599?v=4",
"profile": "https://bstefanski.com/",
"contributions": [
"code"
]
},
{
"login": "jjablonski-it",
"name": "Jakub Jabłoński",
"avatar_url": "https://avatars.githubusercontent.com/u/51968772?v=4",
"profile": "https://github.com/jjablonski-it",
"contributions": [
"infra"
]
}
],
"contributorsPerLine": 7,
"linkToUsage": true
}
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.next
node_modules
79 changes: 79 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const fs = require("fs")

module.exports = {
extends: [
"next",
"prettier",
"react-app",
"react-app/jest",
"plugin:@typescript-eslint/recommended",
"plugin:storybook/recommended",
"plugin:tailwindcss/recommended",
],
parserOptions: {
babelOptions: {
presets: [require.resolve("next/babel")],
},
},
rules: {
"testing-library/prefer-screen-queries": "off",
"@next/next/no-html-link-for-pages": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
"sort-imports": [
"error",
{
ignoreCase: true,
ignoreDeclarationSort: true,
},
],
"tailwindcss/classnames-order": "off",
"import/order": [
1,
{
groups: ["external", "builtin", "internal", "sibling", "parent", "index"],
pathGroups: [
...getDirectoriesToSort().map((singleDir) => ({
pattern: `${singleDir}/**`,
group: "internal",
})),
{
pattern: "env",
group: "internal",
},
{
pattern: "theme",
group: "internal",
},
{
pattern: "public/**",
group: "internal",
position: "after",
},
],
pathGroupsExcludedImportTypes: ["internal"],
alphabetize: {
order: "asc",
caseInsensitive: true,
},
},
],
},
}

function getDirectoriesToSort() {
const ignoredSortingDirectories = [".git", ".next", ".vscode", "node_modules"]
return getDirectories(process.cwd()).filter((f) => !ignoredSortingDirectories.includes(f))
}

function getDirectories(path) {
return fs.readdirSync(path).filter(function (file) {
return fs.statSync(path + "/" + file).isDirectory()
})
}
1 change: 1 addition & 0 deletions .github/nodejs.version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.15.0
35 changes: 35 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Check

on:
push:
branches:
- main
- master
pull_request:
workflow_dispatch:

jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: echo "node_version=$(cat .github/nodejs.version)" >> $GITHUB_ENV
- name: "use node ${{ env.node_version }}"
uses: actions/setup-node@v3
with:
node-version: "${{ env.node_version }}"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Lint check
run: yarn lint
- name: Format check
run: yarn prettier
- name: Unit & Integration tests
run: yarn test
- name: Smoke & Acceptance tests
run: |
yarn build-storybook --quiet
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx http-server storybook-static --port 6006 --silent" \
"npx wait-on tcp:127.0.0.1:6006 && yarn test-storybook"
18 changes: 18 additions & 0 deletions .github/workflows/cr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Code Review
permissions:
contents: read
pull-requests: write
on:
pull_request:
types:
- opened
- reopened
- synchronize
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: anc95/ChatGPT-CodeReview@main
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
OPENAI_API_KEY: "${{ secrets.OPENAI_API_KEY }}"
118 changes: 118 additions & 0 deletions .github/workflows/nextjs_bundle_analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: "Next.js Bundle Analysis"

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

defaults:
run:
# change this if your nextjs app does not live at the root of the repo
working-directory: ./

jobs:
analyze:
env:
SKIP_ENV_VALIDATION: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up node
uses: actions/setup-node@v3
with:
node-version: "18.x"

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Restore next build
uses: actions/cache@v3
id: restore-build-cache
env:
cache-name: cache-next-build
with:
path: .next/cache
# change this if you prefer a more strict cache
key: ${{ runner.os }}-build-${{ env.cache-name }}

- name: Build next.js app
env:
SKIP_BUILD_PRODUCT_REDIRECTS: 1
# change this if your site requires a custom build command
run: yarn build

# Here's the first place where next-bundle-analysis' own script is used
# This step pulls the raw bundle stats for the current bundle
- name: Analyze bundle
run: npx -p nextjs-bundle-analysis report

- name: Upload bundle
uses: actions/upload-artifact@v3
with:
name: bundle
path: .next/analyze/__bundle_analysis.json

- name: Download base branch bundle stats
uses: dawidd6/action-download-artifact@v2
if: success() && github.event.number
with:
workflow: nextjs_bundle_analysis.yml
branch: ${{ github.event.pull_request.base.ref }}
path: .next/analyze/base

# And here's the second place - this runs after we have both the current and
# base branch bundle stats, and will compare them to determine what changed.
# There are two configurable arguments that come from package.json:
#
# - budget: optional, set a budget (bytes) against which size changes are measured
# it's set to 350kb here by default, as informed by the following piece:
# https://infrequently.org/2021/03/the-performance-inequality-gap/
#
# - red-status-percentage: sets the percent size increase where you get a red
# status indicator, defaults to 20%
#
# Either of these arguments can be changed or removed by editing the `nextBundleAnalysis`
# entry in your package.json file.
- name: Compare with base branch bundle
if: success() && github.event.number
run: ls -laR .next/analyze/base && npx -p nextjs-bundle-analysis compare

- name: Get comment body
id: get-comment-body
if: success() && github.event.number
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const fs = require('fs')
const comment = fs.readFileSync('.next/analyze/__bundle_analysis_comment.txt', 'utf8')
core.setOutput('body', comment)
- name: Find Comment
uses: peter-evans/find-comment@v2
if: success() && github.event.number
id: fc
with:
issue-number: ${{ github.event.number }}
body-includes: "<!-- __NEXTJS_BUNDLE -->"

- name: Create Comment
uses: peter-evans/create-or-update-comment@v3
if: success() && github.event.number && steps.fc.outputs.comment-id == 0
with:
issue-number: ${{ github.event.number }}
body: ${{ steps.get-comment-body.outputs.body }}

- name: Update Comment
uses: peter-evans/create-or-update-comment@v3
if: success() && github.event.number && steps.fc.outputs.comment-id != 0
with:
issue-number: ${{ github.event.number }}
body: ${{ steps.get-comment-body.outputs.body }}
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
31 changes: 31 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Playwright Tests
on:
push:
branches:
- main
- master
pull_request: null
workflow_dispatch: null
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: echo "node_version=$(cat .github/nodejs.version)" >> $GITHUB_ENV
- name: "use node ${{ env.node_version }}"
uses: actions/setup-node@v3
with:
node-version: "${{ env.node_version }}"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Install Playwright Browsers
run: yarn playwright install --with-deps
- name: Run Playwright tests
run: yarn playwright test
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# 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/
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
/test-results/
/playwright-report/
/playwright/.cache/
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repos:
- repo: https://github.com/qoomon/git-conventional-commits
rev: v2.6.3
hooks:
- id: conventional-commits
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.next
node_modules
12 changes: 12 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
branches: ["main"],
"plugins":
[
["@semantic-release/npm", { "npmPublish": false }],
"@semantic-release/release-notes-generator",
"@semantic-release/github",
"@semantic-release/commit-analyzer",
"@semantic-release/git",
"@semantic-release/changelog",
],
}
Loading

0 comments on commit fa9a0bc

Please sign in to comment.