@toptal/davinci-skeleton 5.0.2 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ yarn lint-staged
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ yarn davinci ci danger --local
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ ## 6.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#1163](https://github.com/toptal/davinci/pull/1163) [`2c8d4c8b`](https://github.com/toptal/davinci/commit/2c8d4c8b405782001bbbf92a5713013fb1426f87) Thanks [@dependabot](https://github.com/apps/dependabot)! - Bump husky from 4.3.0 to 7.0.4.
8
+
9
+ Please, follow the migration plan to upgrade husky in your projects - https://typicode.github.io/husky/#/?id=migrate-from-v4-to-v7. The upgrade is painless 👍.
10
+
11
+ ### Minor Changes
12
+
13
+ - [#1246](https://github.com/toptal/davinci/pull/1246) [`0ce6d842`](https://github.com/toptal/davinci/commit/0ce6d8429f6cebcf1ad7c20ae1316fccc4bb1642) Thanks [@denieler](https://github.com/denieler)! - Upgrade `react` to v18 in skeleton.
14
+
3
15
  ## 5.0.2
4
16
 
5
17
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toptal/davinci-skeleton",
3
- "version": "5.0.2",
3
+ "version": "6.0.0",
4
4
  "description": "Toptal frontend application created with Davinci CLI",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -39,21 +39,13 @@
39
39
  "lint-staged": {
40
40
  "*.{js,jsx,ts,tsx}": [
41
41
  "davinci syntax lint code",
42
- "prettier",
43
- "git add"
42
+ "prettier --write"
44
43
  ],
45
44
  "styles.{js,jsx,ts,tsx}": [
46
45
  "davinci syntax lint styles",
47
- "prettier --write",
48
- "git add"
46
+ "prettier --write"
49
47
  ]
50
48
  },
51
- "husky": {
52
- "hooks": {
53
- "pre-commit": "lint-staged",
54
- "pre-push": "davinci ci danger --local"
55
- }
56
- },
57
49
  "sideEffects": false,
58
50
  "main": "./src/index.tsx"
59
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toptal/davinci-skeleton",
3
- "version": "5.0.2",
3
+ "version": "6.0.0",
4
4
  "description": "Toptal frontend application created with Davinci CLI",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -39,21 +39,13 @@
39
39
  "lint-staged": {
40
40
  "*.{js,jsx,ts,tsx}": [
41
41
  "davinci syntax lint code",
42
- "prettier",
43
- "git add"
42
+ "prettier --write"
44
43
  ],
45
44
  "styles.{js,jsx,ts,tsx}": [
46
45
  "davinci syntax lint styles",
47
- "prettier --write",
48
- "git add"
46
+ "prettier --write"
49
47
  ]
50
48
  },
51
- "husky": {
52
- "hooks": {
53
- "pre-commit": "lint-staged",
54
- "pre-push": "davinci ci danger --local"
55
- }
56
- },
57
49
  "sideEffects": false,
58
50
  "main": "./src/index.tsx"
59
51
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toptal/davinci-skeleton",
3
- "version": "5.0.2",
3
+ "version": "6.0.0",
4
4
  "description": "Toptal frontend application created with Davinci CLI",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -39,21 +39,13 @@
39
39
  "lint-staged": {
40
40
  "*.{js,jsx,ts,tsx}": [
41
41
  "davinci syntax lint code",
42
- "prettier",
43
- "git add"
42
+ "prettier --write"
44
43
  ],
45
44
  "styles.{js,jsx,ts,tsx}": [
46
45
  "davinci syntax lint styles",
47
- "prettier --write",
48
- "git add"
46
+ "prettier --write"
49
47
  ]
50
48
  },
51
- "husky": {
52
- "hooks": {
53
- "pre-commit": "lint-staged",
54
- "pre-push": "davinci ci danger --local"
55
- }
56
- },
57
49
  "sideEffects": false,
58
50
  "main": "./src/index.tsx"
59
51
  }
package/src/index.tsx CHANGED
@@ -1,6 +1,12 @@
1
1
  import React from 'react'
2
- import ReactDOM from 'react-dom'
2
+ import { createRoot } from 'react-dom/client'
3
3
 
4
4
  import App from './App'
5
5
 
6
- ReactDOM.render(<App />, document.getElementById('root'))
6
+ const container = document.getElementById('root')
7
+
8
+ if (container) {
9
+ const root = createRoot(container)
10
+
11
+ root.render(<App />)
12
+ }
@@ -10,7 +10,11 @@ const NUMBER_OF_COUNTRIES = 5
10
10
  const AddressDetails = () => {
11
11
  const { showError } = useNotifications()
12
12
 
13
- const { loading: countriesLoading, data: countriesData, error } = useGetCountries()
13
+ const {
14
+ loading: countriesLoading,
15
+ data: countriesData,
16
+ error
17
+ } = useGetCountries()
14
18
 
15
19
  useEffect(() => {
16
20
  if (error) {
@@ -24,7 +28,7 @@ const AddressDetails = () => {
24
28
 
25
29
  if (countriesLoading) {
26
30
  return (
27
- <Container data-testid='countriesLoader'>
31
+ <Container data-testid='countries-loader'>
28
32
  <SkeletonLoader.Typography rows={1} />
29
33
  </Container>
30
34
  )
@@ -35,10 +39,12 @@ const AddressDetails = () => {
35
39
  <Typography>
36
40
  Top {NUMBER_OF_COUNTRIES} countries from GQL Gateway API:
37
41
  </Typography>
38
- <Container data-testid='countriesList'>
39
- {countriesData?.countries.nodes.slice(0, NUMBER_OF_COUNTRIES).map(country => (
40
- <Typography key={country.id}>{country.googleName}</Typography>
41
- ))}
42
+ <Container data-testid='countries-list'>
43
+ {countriesData?.countries.nodes
44
+ .slice(0, NUMBER_OF_COUNTRIES)
45
+ .map(country => (
46
+ <Typography key={country.id}>{country.googleName}</Typography>
47
+ ))}
42
48
  </Container>
43
49
  </>
44
50
  )
@@ -1,14 +1,8 @@
1
1
  import React from 'react'
2
2
  import { MockedProvider, MockedProviderProps } from '@apollo/client/testing'
3
- import {
4
- render,
5
- act,
6
- waitFor,
7
- fireEvent,
8
- screen
9
- } from '@toptal/picasso/test-utils'
10
-
11
- import CountriesList, { COUNTRIES_ERROR_MESSAGE} from './CountriesList'
3
+ import { render, waitFor, screen } from '@toptal/picasso/test-utils'
4
+
5
+ import CountriesList, { COUNTRIES_ERROR_MESSAGE } from './CountriesList'
12
6
  import { createGetCountriesMock } from './data'
13
7
 
14
8
  const mockedShowError = jest.fn()
@@ -25,7 +19,7 @@ jest.mock('@toptal/picasso/utils', () => {
25
19
  }
26
20
  })
27
21
 
28
- const delay = (ms = 0) => new Promise((resolve) => setTimeout(resolve, ms))
22
+ const delay = (ms = 0) => new Promise(resolve => setTimeout(resolve, ms))
29
23
 
30
24
  const renderCountriesList = (mocks: MockedProviderProps['mocks']) =>
31
25
  render(
@@ -43,17 +37,17 @@ describe('CountriesList', () => {
43
37
  const countryName = 'Ukraine'
44
38
  const getCountriesMockData = {
45
39
  countries: {
46
- nodes: [{
47
- id: '1',
48
- googleName: countryName
49
- }]
40
+ nodes: [
41
+ {
42
+ id: '1',
43
+ googleName: countryName
44
+ }
45
+ ]
50
46
  }
51
47
  }
52
48
 
53
49
  it('shows list of countries', async () => {
54
- const mocks = [
55
- createGetCountriesMock(getCountriesMockData)
56
- ]
50
+ const mocks = [createGetCountriesMock(getCountriesMockData)]
57
51
 
58
52
  renderCountriesList(mocks)
59
53
 
@@ -78,7 +72,7 @@ describe('CountriesList', () => {
78
72
  })
79
73
 
80
74
  it('shows nothing', () => {
81
- expect(screen.queryByTestId('countriesList')).not.toBeInTheDocument()
75
+ expect(screen.queryByTestId('countries-list')).not.toBeInTheDocument()
82
76
  })
83
77
  })
84
78
  })
@@ -3,9 +3,7 @@ import { Link, Image } from '@toptal/picasso'
3
3
 
4
4
  import { Layout } from '../../../core'
5
5
  import * as Documentation from '../../../documentation'
6
-
7
6
  import { CountriesList } from '../../components'
8
-
9
7
  import packageJson from '../../../../../package.json'
10
8
 
11
9
  const GIF_URL = 'https://media.giphy.com/media/Ln2dAW9oycjgmTpjX9/giphy.gif'
@@ -4,17 +4,16 @@ import { render, screen } from '@toptal/picasso/test-utils'
4
4
  import WelcomePage, { TestId } from './WelcomePage'
5
5
  import packageJson from '../../../../../package.json'
6
6
 
7
-
8
7
  jest.mock('../../components', () => ({
9
8
  __esModule: true,
10
9
  CountriesList: () => null
11
10
  }))
12
11
 
13
-
14
12
  const expectParagraphWithLinkIsFound = (text: string, link: string) => {
15
13
  const paragraph = screen.queryByText(
16
14
  (_, element) => element.textContent === text
17
15
  )
16
+
18
17
  expect(paragraph.querySelector(':scope > a')).toHaveProperty('href', link)
19
18
  }
20
19
 
@@ -23,6 +22,7 @@ describe('WelcomePage', () => {
23
22
  render(<WelcomePage />)
24
23
 
25
24
  const image = screen.queryByTestId(TestId.Image)
25
+
26
26
  expect(image.src).toBe(
27
27
  'https://media.giphy.com/media/Ln2dAW9oycjgmTpjX9/giphy.gif'
28
28
  )