Skip to content

Commit

Permalink
client: initial setup
Browse files Browse the repository at this point in the history
  • Loading branch information
andresgnlez committed Sep 27, 2023
1 parent 9f97ecc commit 8095eb0
Show file tree
Hide file tree
Showing 43 changed files with 7,797 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/e2e_client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: e2e_client
on:
push:
paths:
- 'client/**'
- '.github/workflows/e2e-client.yml'
- '!client/README.md'

jobs:
e2e_client:
timeout-minutes: 15
runs-on: ubuntu-22.04
strategy:
fail-fast: false
defaults:
run:
working-directory: client
steps:
- name: checkout pull
uses: actions/checkout@v3

- name: Node setup
uses: actions/setup-node@v3
with:
node-version-file: 'client/.nvmrc'
cache: yarn
cache-dependency-path: 'client/yarn.lock'

- name: Changes Yarn version
run: corepack enable

- name: Install dependencies
run: yarn install --immutable

- name: Install Playwright Browsers
run: yarn playwright install --with-deps

- name: Run Playwright tests
run: yarn playwright test
env:
NEXT_PUBLIC_URL: http://localhost:3000
NEXT_PUBLIC_API_URL: http://localhost:1337/cms
NEXT_PUBLIC_MAPBOX_API_TOKEN: ${{ secrets.NEXT_PUBLIC_MAPBOX_API_TOKEN }}
# Recommended: pass the GitHub token lets this action correctly
# determine the unique run id necessary to re-run the checks
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
4 changes: 4 additions & 0 deletions client/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# defaults means > 0.5%, last 2 versions, Firefox ESR, not dead
defaults
not IE 11
maintained node versions
6 changes: 6 additions & 0 deletions client/.env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
NEXT_PUBLIC_URL=http://localhost:$PORT
NEXT_PUBLIC_API_URL=http://0.0.0.0:1337/cms
NEXT_PUBLIC_GA_TRACKING_ID=UA-000000-01
RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED=false
NEXTAUTH_URL=http://localhost:$PORT
NEXTAUTH_SECRET=cat
3 changes: 3 additions & 0 deletions client/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/.next
/node_modules
/public
111 changes: 111 additions & 0 deletions client/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
{
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:@tanstack/eslint-plugin-query/recommended",
"next/core-web-vitals"
],
"rules": {
"no-console": [1, { "allow": ["info", "error", "debug"] }],
"import/order": [
"warn",
{
"groups": ["builtin", "external", "internal", "parent", "sibling"],
"newlines-between": "always",
"alphabetize": {
"order": "asc",
"caseInsensitive": true
},
"pathGroups": [
{
"pattern": "react",
"group": "builtin",
"position": "before"
},
{
"pattern": "react**",
"group": "builtin"
},
{
"pattern": "@react**",
"group": "builtin"
},
{
"pattern": "next",
"group": "builtin",
"position": "after"
},
{
"pattern": "next/**",
"group": "builtin",
"position": "after"
},
{
"pattern": "node_modules/**",
"group": "builtin"
},
{
"pattern": "@/env.mjs",
"group": "internal",
"position": "before"
},
{
"pattern": "@/lib/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@/store",
"group": "internal",
"position": "before"
},
{
"pattern": "@/store/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@/services/**",
"group": "internal",
"position": "after"
},
{
"pattern": "@/types/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@/app/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@/constants/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@/hooks/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@/containers/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@/components/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@/styles/**",
"group": "internal"
}
],
"pathGroupsExcludedImportTypes": ["react"]
}
]
}
}
52 changes: 52 additions & 0 deletions client/.github/workflows/e2e-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: e2e_client
on:
push:
paths:
- 'client/**'
- '.github/workflows/e2e-client.yml'
- '!client/README.md'

jobs:
e2e_client:
timeout-minutes: 15
runs-on: ubuntu-22.04
strategy:
fail-fast: false
defaults:
run:
working-directory: client
steps:
- name: checkout pull
uses: actions/checkout@v3

- name: Node setup
uses: actions/setup-node@v3
with:
node-version-file: 'client/.nvmrc'
cache: yarn
cache-dependency-path: 'client/yarn.lock'

- name: Changes Yarn version
run: corepack enable

- name: Install dependencies
run: yarn install --immutable

- name: Install Playwright Browsers
run: yarn playwright install --with-deps

- name: Run Playwright tests
run: yarn playwright test
env:
NEXT_PUBLIC_URL: http://localhost:3000
NEXT_PUBLIC_API_URL: http://localhost:1337/cms
NEXT_PUBLIC_MAPBOX_API_TOKEN: ${{ secrets.NEXT_PUBLIC_MAPBOX_API_TOKEN }}
# Recommended: pass the GitHub token lets this action correctly
# determine the unique run id necessary to re-run the checks
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
39 changes: 39 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/*

# 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
/test-results/
/playwright-report/
/playwright/.cache/
4 changes: 4 additions & 0 deletions client/.husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

cd ./client && yarn lint --fix && yarn check-types
1 change: 1 addition & 0 deletions client/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.18
9 changes: 9 additions & 0 deletions client/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const config = {
semi: true,
tabWidth: 2,
printWidth: 100,
singleQuote: false,
plugins: ['prettier-plugin-tailwindcss'],
};

module.exports = config;
1 change: 1 addition & 0 deletions client/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
36 changes: 36 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
16 changes: 16 additions & 0 deletions client/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.ts",
"css": "src/app/globals.css",
"baseColor": "slate",
"cssVariables": true
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
25 changes: 25 additions & 0 deletions client/e2e/example.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { test, expect } from "@playwright/test";

test("has title", async ({ page }) => {
await page.goto(`/`);

// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Create Next App/);
});

// test("has title", async ({ page }) => {
// await page.goto("https://playwright.dev/");

// // Expect a title "to contain" a substring.
// await expect(page).toHaveTitle(/Playwright/);
// });

// test("get started link", async ({ page }) => {
// await page.goto("https://playwright.dev/");

// // Click the get started link.
// await page.getByRole("link", { name: "Get started" }).click();

// // Expects page to have a heading with the name of Installation.
// await expect(page.getByRole("heading", { name: "Installation" })).toBeVisible();
// });
Loading

0 comments on commit 8095eb0

Please sign in to comment.