Skip to content

Commit 96ef170

Browse files
committed
chore: update dependencies (#106)
* chore(release): 1.5.0 * chore(dependencies): update * chore: revert babel config * chore: update dependencies * refactor: eslint rules made simpler * refactor: moving to graphql codegen * refactor: revert to graphql pre 16 * test: remove constants from coverage * ci(lhci): use preview url
1 parent e38ed53 commit 96ef170

38 files changed

+5225
-3939
lines changed

.env

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ PORT=3000
33
# https://nextjs.org/docs/basic-features/environment-variables#exposing-environment-variables-to-the-browser
44
NEXT_PUBLIC_HOST=http://$HOSTNAME:$PORT
55
# You can start with this url, but you may need to configure your own database as this is only an example with a read only user !
6-
DATABASE_URL=postgresql://baby_kirby:1234@kirby.cgqxnhhl7oal.eu-west-3.rds.amazonaws.com:5432/kirby?schema=public
6+
DATABASE_URL=postgresql://baby_kirby:1234@kirby.cgqxnhhl7oal.eu-west-3.rds.amazonaws.com:5432/kirby?schema=public
7+
GRAPHQL_ENDPOINT=http://localhost:3000/api/graphql

.eslintrc.json

+2-68
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,6 @@
11
{
2-
"env": {
3-
"browser": true,
4-
"es2021": true
5-
},
6-
"extends": [
7-
"airbnb",
8-
"plugin:react/recommended",
9-
"plugin:react-hooks/recommended",
10-
"plugin:prettier/recommended",
11-
"plugin:@typescript-eslint/recommended"
12-
],
13-
"parser": "@typescript-eslint/parser",
14-
"parserOptions": {
15-
"ecmaFeatures": {
16-
"jsx": true
17-
}
18-
},
19-
"overrides": [
20-
{
21-
"files": ["*.ts", "*.tsx"],
22-
"parserOptions": {
23-
"project": ["./tsconfig.json", "./cypress/tsconfig.json"]
24-
}
25-
}
26-
],
27-
"settings": {
28-
"import/resolver": {
29-
"typescript": {}
30-
}
31-
},
32-
"plugins": ["react", "@typescript-eslint"],
33-
"ignorePatterns": ["**/*.js"],
2+
"extends": ["next/core-web-vitals", "prettier", "plugin:@next/next/recommended"],
343
"rules": {
35-
"import/extensions": [
36-
0,
37-
"ignorePackages",
38-
{
39-
"js": "never",
40-
"jsx": "never",
41-
"ts": "never",
42-
"tsx": "never"
43-
}
44-
],
45-
"import/no-extraneous-dependencies": [
46-
2,
47-
{
48-
"devDependencies": true
49-
}
50-
],
51-
"react/jsx-filename-extension": [1, { "extensions": [".tsx", ".ts"] }],
52-
"prettier/prettier": [2, { "usePrettierrc": true }],
53-
"react/require-default-props": 0,
54-
"react/prop-types": 0,
55-
"react/react-in-jsx-scope": 0,
56-
"react/jsx-props-no-spreading": [1, { "html": "ignore", "exceptions": ["Component"] }],
57-
"arrow-parens": 0,
58-
"no-undef": 0,
59-
"no-console": 1,
60-
"no-plusplus": [
61-
2,
62-
{
63-
"allowForLoopAfterthoughts": true
64-
}
65-
],
66-
"@typescript-eslint/no-shadow": 0,
67-
"no-shadow": 0,
68-
"react-hooks/rules-of-hooks": 2,
69-
"react-hooks/exhaustive-deps": 1,
70-
"@typescript-eslint/explicit-module-boundary-types": 0
4+
"import/no-anonymous-default-export": 0
715
}
726
}

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ jobs:
100100
run: yarn install
101101

102102
- name: Install Lhci
103-
run: npm install -g @lhci/cli@0.7.x
103+
run: npm install -g @lhci/cli@0.8.x
104104

105105
- name: Lhci
106106
run: lhci autorun

CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## 1.5.0 (2021-10-30)
6+
7+
8+
### Features
9+
10+
* design-system ([#7](https://github.com/FabienGreard/kirby-boilerplate/issues/7)) ([bf61341](https://github.com/FabienGreard/kirby-boilerplate/commit/bf613412bcaa781a7b65f342b053ecc0dbe13ff9)), closes [#16](https://github.com/FabienGreard/kirby-boilerplate/issues/16) [#15](https://github.com/FabienGreard/kirby-boilerplate/issues/15) [#11](https://github.com/FabienGreard/kirby-boilerplate/issues/11) [#12](https://github.com/FabienGreard/kirby-boilerplate/issues/12) [#14](https://github.com/FabienGreard/kirby-boilerplate/issues/14) [#17](https://github.com/FabienGreard/kirby-boilerplate/issues/17) [#21](https://github.com/FabienGreard/kirby-boilerplate/issues/21) [#22](https://github.com/FabienGreard/kirby-boilerplate/issues/22) [#20](https://github.com/FabienGreard/kirby-boilerplate/issues/20) [#18](https://github.com/FabienGreard/kirby-boilerplate/issues/18) [#26](https://github.com/FabienGreard/kirby-boilerplate/issues/26) [#25](https://github.com/FabienGreard/kirby-boilerplate/issues/25) [#23](https://github.com/FabienGreard/kirby-boilerplate/issues/23) [#19](https://github.com/FabienGreard/kirby-boilerplate/issues/19) [#24](https://github.com/FabienGreard/kirby-boilerplate/issues/24) [#31](https://github.com/FabienGreard/kirby-boilerplate/issues/31) [#30](https://github.com/FabienGreard/kirby-boilerplate/issues/30) [#29](https://github.com/FabienGreard/kirby-boilerplate/issues/29) [#27](https://github.com/FabienGreard/kirby-boilerplate/issues/27) [#28](https://github.com/FabienGreard/kirby-boilerplate/issues/28) [#32](https://github.com/FabienGreard/kirby-boilerplate/issues/32) [#33](https://github.com/FabienGreard/kirby-boilerplate/issues/33) [#34](https://github.com/FabienGreard/kirby-boilerplate/issues/34) [#35](https://github.com/FabienGreard/kirby-boilerplate/issues/35)
11+
* graphQL ([#36](https://github.com/FabienGreard/kirby-boilerplate/issues/36)) ([5381151](https://github.com/FabienGreard/kirby-boilerplate/commit/538115108802804256f16b6ed2ed0ec74efbe4f2))
12+
* prisma db connector ([#47](https://github.com/FabienGreard/kirby-boilerplate/issues/47)) ([36a762b](https://github.com/FabienGreard/kirby-boilerplate/commit/36a762ba87055021193022dd669b78815de77b4b))
13+
* pwa support ([#6](https://github.com/FabienGreard/kirby-boilerplate/issues/6)) ([d28489d](https://github.com/FabienGreard/kirby-boilerplate/commit/d28489d7d5b28bafb474bab38c6e87ee411c003b))
14+
15+
16+
### Bug Fixes
17+
18+
* **codql:** code quality ([8bc3602](https://github.com/FabienGreard/kirby-boilerplate/commit/8bc36020981facf918a5fa4c80b2dac38b00b5af))
19+
520
### 1.4.2 (2021-06-01)
621

722

README.md

+24-26
Original file line numberDiff line numberDiff line change
@@ -37,31 +37,29 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the
3737

3838
## Commands
3939

40-
| Commands | Info | Description |
41-
| --------------- | :-------------------------------------------------------------------------------------------------------------------------------------------: | -------------------------------------------------------------------------: |
42-
| dev | next dev | Launch app in dev mode |
43-
| dev:test | jest --watch | Launch test |
44-
| dev:coverage | jest --coverage --watch | Generate a coverage from test |
45-
| dev:e2e | cypress open | Launch e2e test |
46-
| build | next build | Build the app for production use |
47-
| start | next start | Launch app from build |
48-
| format | prettier --write . | Format project |
49-
| lint | eslint --fix . | Lint project |
50-
| test | jest --silent | Launch test |
51-
| coverage | jest --coverage --silent | Generate a coverage from test |
52-
| e2e | cypress run --headless | Launch e2e test |
53-
| storybook | start-storybook -p 6006 | Launch storybook (design-system) |
54-
| bump:patch | standard-version --release-as patch --no-verify | v.0.0.0 => v.0.0.1 |
55-
| bump:minor | standard-version --release-as minor --no-verify | v.0.0.0 => v.0.1.0 |
56-
| bump:major | standard-version --release-as major --no-verify | v.0.0.0 => v.1.0.0 |
57-
| apollo:download | npx apollo service:download --endpoint=http://localhost:3000/api/graphql graphql-schema.json | download a graphql schema from an endpoint |
58-
| apollo:generate | npx apollo codegen:generate types --localSchemaFile=graphql-schema.json --target=typescript --tagName=gql --outputFlat --tsFileExtension=d.ts | use for generating typing files from a graphql schema |
59-
| ts-node | ts-node --compiler-options '{\"module\":\"CommonJS\"}' | use by prisma:seed |
60-
| prisma:migrate | prisma migrate dev | prisma database schema migration tool |
61-
| prisma:seed | prisma db seed --preview-feature | prisma database seed tool |
62-
| prisma:generate | prisma generate | generate prisma client |
63-
| clear | node scripts/clear.js | clear node_modules and \*lock |
64-
| prepare | husky install && prisma:generate | This is needed from husky to set up the project and generate prisma client |
40+
| Commands | Info | Description |
41+
| --------------- | :---------------------------------------------: | -------------------------------------------------------------------------: |
42+
| dev | next dev | Launch app in dev mode |
43+
| dev:test | jest --watch | Launch test |
44+
| dev:coverage | jest --coverage --watch | Generate a coverage from test |
45+
| dev:e2e | cypress open | Launch e2e test |
46+
| build | next build | Build the app for production use |
47+
| start | next start | Launch app from build |
48+
| format | prettier --write . | Format project |
49+
| lint | eslint --fix . | Lint project |
50+
| test | jest --silent | Launch test |
51+
| coverage | jest --coverage --silent | Generate a coverage from test |
52+
| e2e | cypress run --headless | Launch e2e test |
53+
| storybook | start-storybook -p 6006 | Launch storybook (design-system) |
54+
| bump:patch | standard-version --release-as patch --no-verify | v.0.0.0 => v.0.0.1 |
55+
| bump:minor | standard-version --release-as minor --no-verify | v.0.0.0 => v.0.1.0 |
56+
| bump:major | standard-version --release-as major --no-verify | v.0.0.0 => v.1.0.0 |
57+
| codegen | npx apollo client:codegen --target typescript | use for generating typing files from a graphql schema |
58+
| prisma:migrate | prisma migrate dev | prisma database schema migration tool |
59+
| prisma:seed | prisma db seed --preview-feature | prisma database seed tool |
60+
| prisma:generate | prisma generate | generate prisma client |
61+
| clear | node scripts/clear.js | clear node_modules and \*lock |
62+
| prepare | husky install && prisma:generate | This is needed from husky to set up the project and generate prisma client |
6563

6664
## Acknowledgement
6765

@@ -133,7 +131,7 @@ You could also seed your database with `yarn prisma:seed` or `npm run prisma:see
133131

134132
You may need to look at [apollo-tooling](https://github.com/apollographql/apollo-tooling)
135133

136-
With the graphql endpoint running launch `yarn apollo:download` follow by `yarn apollo:generate`, this will create under `types` a typing file for each query under `apollo/operations`.
134+
With the graphql endpoint running launch `yarn codegen`, this will create under `types` a typing file for each query under `apollo/operations`.
137135

138136
## Hosting
139137

apollo.config.js

-8
This file was deleted.

apollo/client.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable global-require */
2-
/* eslint-disable @typescript-eslint/no-var-requires */
31
import { ApolloClient, InMemoryCache, NormalizedCacheObject } from '@apollo/client';
42
import { useMemo } from 'react';
53

Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import { gql } from '@apollo/client';
22

3-
export const ViewerQuery = gql`
3+
export default gql`
44
query ViewerQuery {
55
viewer {
66
id
77
name
88
}
99
}
1010
`;
11-
12-
export default null;

apollo/schema.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { makeExecutableSchema } from 'apollo-server-micro';
1+
import { makeExecutableSchema } from '@graphql-tools/schema';
2+
23
import typeDefs from './type-defs';
34
import resolvers from './resolvers';
45

codegen.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
schema:
2+
- ${GRAPHQL_ENDPOINT}
3+
generates:
4+
./types/schema.ts:
5+
plugins:
6+
- typescript

components/Head.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import NextHead from 'next/head';
22

3-
import { SEO, HOST } from 'utils/constant';
3+
import { SEO, HOST } from 'utils/constants';
44

55
interface Props {
66
title?: string;

components/Layout.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { withLink } from 'components/Link';
66

77
import Button from 'design-system/Button';
88

9-
import { VERSION, GITHUB_URL } from 'utils/constant';
9+
import { VERSION, GITHUB_URL } from 'utils/constants';
1010

1111
import * as langs from 'langs';
1212

components/__tests__/Head.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { render } from '@testing-library/react';
22
import Head from 'components/Head';
33

4-
import { SEO } from 'utils/constant';
4+
import { SEO } from 'utils/constants';
55

66
describe('Header', () => {
77
test('Should had default values', () => {

hooks/__tests__/useClientQuery.test.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { render } from 'utils/customTestRender';
22

33
import useClientQuery from 'hooks/useClientQuery';
4-
import { ViewerQuery } from 'apollo/operations/viewer';
5-
import { ViewerQuery as ViewerQueryType } from 'types/ViewerQuery';
4+
import VIEWER_QUERY from 'apollo/queries/viewer';
5+
import { Query } from 'types/schema';
66

77
const Viewer = () => {
8-
const { data } = useClientQuery<ViewerQueryType>(ViewerQuery);
8+
const { data } = useClientQuery<Query>(VIEWER_QUERY);
99

1010
return <h1>{data?.viewer?.name}</h1>;
1111
};
@@ -14,7 +14,7 @@ describe('useClientQuery', () => {
1414
test('Should return a response data from query after mounted', async () => {
1515
const viewerMock = {
1616
request: {
17-
query: ViewerQuery,
17+
query: VIEWER_QUERY,
1818
},
1919
result: {
2020
data: {

hooks/__tests__/useServiceWorker.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { fireEvent } from '@testing-library/react';
44

55
import useServiceWorker from 'hooks/useServiceWorker';
66

7-
jest.mock('utils/constant', () => {
7+
jest.mock('utils/constants', () => {
88
return {
99
__esModule: true,
1010
default: null,

hooks/useClientQuery.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { DocumentNode, useQuery, QueryResult, QueryHookOptions } from '@apollo/client';
22

33
import useHasMounted from 'hooks/useHasMounted';
4+
import { Query } from 'types/schema';
45

5-
export default function useClientQuery<T extends unknown>(
6+
export default function useClientQuery<T = Query>(
67
query: DocumentNode,
78
options?: QueryHookOptions<T>,
89
): Partial<QueryResult<T>> {

hooks/useServiceWorker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable no-console */
22
import { useEffect } from 'react';
3-
import { IS_RUNNING_DEV } from 'utils/constant';
3+
import { IS_RUNNING_DEV } from 'utils/constants';
44

55
export interface Props {
66
isForce?: boolean;

jest.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = {
2626
'design-system/**/*.(ts|tsx)',
2727
'utils/**/*.(ts|tsx)',
2828
'!utils/customTestRender.(ts|tsx)',
29+
'!utils/constants.(ts|tsx)',
2930
],
3031
coverageThreshold: {
3132
global: {

lighthouserc.json

+9-10
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@
33
"collect": {
44
"startServerCommand": "yarn start",
55
"url": ["http://localhost:3000/", "http://localhost:3000/ssr", "http://localhost:3000/ssg"],
6-
"startServerReadyPattern": "started",
7-
"settings": {
8-
"skipAudits": ["redirects-http", "uses-http2"]
9-
}
6+
"startServerReadyPattern": "started"
107
},
118
"assert": {
12-
"preset": "lighthouse:recommended",
139
"assertions": {
14-
"unused-javascript": ["error", { "maxLength": 1 }],
15-
"legacy-javascript": "off"
10+
"categories:performance": ["error", { "minScore": 0.8 }],
11+
"categories:accessibility": ["error", { "minScore": 0.9 }],
12+
"categories:best-practices": ["error", { "minScore": 0.9 }],
13+
"categories:seo": ["error", { "minScore": 0.9 }],
14+
"categories:pwa": ["error", { "minScore": 0.9 }]
15+
},
16+
"upload": {
17+
"target": "temporary-public-storage"
1618
}
17-
},
18-
"upload": {
19-
"target": "temporary-public-storage"
2019
}
2120
}
2221
}

0 commit comments

Comments
 (0)