Skip to content

Commit

Permalink
Merge branch 'main' into feat/SFS-1454-perf-import-function-on-demand
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoformiga committed Sep 25, 2024
2 parents 7f8d84d + 7948467 commit c32273c
Show file tree
Hide file tree
Showing 22 changed files with 144 additions and 138 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</a>
</p>
<h1 align="center">
FastStore v2
FastStore v3
</h1>
<p align="center">
<strong>
Expand Down
10 changes: 5 additions & 5 deletions apps/site/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "site",
"version": "3.0.108",
"version": "3.0.110",
"author": "Emerson Laurentino @emersonlaurentino",
"license": "MIT",
"private": true,
Expand All @@ -10,9 +10,9 @@
"start": "next start"
},
"dependencies": {
"@faststore/api": "^3.0.108",
"@faststore/sdk": "^3.0.108",
"@faststore/ui": "^3.0.103",
"@faststore/api": "^3.0.110",
"@faststore/sdk": "^3.0.110",
"@faststore/ui": "^3.0.110",
"next": "13.0.7",
"nextra": "^2.8.0",
"nextra-theme-docs": "^2.8.0",
Expand All @@ -21,7 +21,7 @@
"sass": "^1.57.1"
},
"devDependencies": {
"@faststore/eslint-config": "^3.0.97",
"@faststore/eslint-config": "^3.0.110",
"@types/node": "^18.11.16",
"eslint": "7.32.0",
"react-docgen-typescript": "^2.2.2",
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "3.0.108",
"version": "3.0.114",
"npmClient": "yarn",
"command": {
"publish": {
Expand Down
6 changes: 3 additions & 3 deletions packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@faststore/api",
"version": "3.0.108",
"version": "3.0.110",
"license": "MIT",
"main": "dist/cjs/src/index.js",
"typings": "dist/esm/src/index.d.ts",
Expand Down Expand Up @@ -51,8 +51,8 @@
},
"devDependencies": {
"@envelop/core": "^2.6.0",
"@faststore/eslint-config": "^3.0.97",
"@faststore/shared": "^3.0.97",
"@faststore/eslint-config": "^3.0.110",
"@faststore/shared": "^3.0.110",
"@graphql-codegen/cli": "2.2.0",
"@graphql-codegen/typescript": "2.2.2",
"@parcel/watcher": "^2.4.0",
Expand Down
16 changes: 8 additions & 8 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ $ npm install -g @faststore/cli
$ faststore COMMAND
running command...
$ faststore (--version)
@faststore/cli/3.0.108 linux-x64 node-v18.20.4
@faststore/cli/3.0.114 linux-x64 node-v18.20.4
$ faststore --help [COMMAND]
USAGE
$ faststore COMMAND
Expand Down Expand Up @@ -60,7 +60,7 @@ ARGUMENTS
PATH The path where the FastStore being built is. Defaults to cwd.
```

_See code: [dist/commands/build.ts](https://github.com/vtex/faststore/blob/v3.0.108/dist/commands/build.ts)_
_See code: [dist/commands/build.ts](https://github.com/vtex/faststore/blob/v3.0.114/dist/commands/build.ts)_

## `faststore cms-sync [PATH]`

Expand All @@ -75,7 +75,7 @@ FLAGS
-d, --dry-run
```

_See code: [dist/commands/cms-sync.ts](https://github.com/vtex/faststore/blob/v3.0.108/dist/commands/cms-sync.ts)_
_See code: [dist/commands/cms-sync.ts](https://github.com/vtex/faststore/blob/v3.0.114/dist/commands/cms-sync.ts)_

## `faststore create [PATH]`

Expand All @@ -95,7 +95,7 @@ EXAMPLES
$ yarn faststore create discovery
```

_See code: [dist/commands/create.ts](https://github.com/vtex/faststore/blob/v3.0.108/dist/commands/create.ts)_
_See code: [dist/commands/create.ts](https://github.com/vtex/faststore/blob/v3.0.114/dist/commands/create.ts)_

## `faststore dev [PATH]`

Expand All @@ -107,7 +107,7 @@ ARGUMENTS
PATH The path where the FastStore being run is. Defaults to cwd.
```

_See code: [dist/commands/dev.ts](https://github.com/vtex/faststore/blob/v3.0.108/dist/commands/dev.ts)_
_See code: [dist/commands/dev.ts](https://github.com/vtex/faststore/blob/v3.0.114/dist/commands/dev.ts)_

## `faststore generate-graphql [PATH]`

Expand All @@ -122,7 +122,7 @@ FLAGS
-d, --debug
```

_See code: [dist/commands/generate-graphql.ts](https://github.com/vtex/faststore/blob/v3.0.108/dist/commands/generate-graphql.ts)_
_See code: [dist/commands/generate-graphql.ts](https://github.com/vtex/faststore/blob/v3.0.114/dist/commands/generate-graphql.ts)_

## `faststore help [COMMAND]`

Expand Down Expand Up @@ -154,7 +154,7 @@ ARGUMENTS
PATH The path where the FastStore being run is. Defaults to cwd.
```

_See code: [dist/commands/start.ts](https://github.com/vtex/faststore/blob/v3.0.108/dist/commands/start.ts)_
_See code: [dist/commands/start.ts](https://github.com/vtex/faststore/blob/v3.0.114/dist/commands/start.ts)_

## `faststore test [PATH]`

Expand All @@ -166,5 +166,5 @@ ARGUMENTS
PATH The path where the FastStore being tested is. Defaults to cwd.
```

_See code: [dist/commands/test.ts](https://github.com/vtex/faststore/blob/v3.0.108/dist/commands/test.ts)_
_See code: [dist/commands/test.ts](https://github.com/vtex/faststore/blob/v3.0.114/dist/commands/test.ts)_
<!-- commandsstop -->
8 changes: 4 additions & 4 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@faststore/cli",
"version": "3.0.108",
"version": "3.0.114",
"description": "FastStore CLI",
"author": "Emerson Laurentino @emersonlaurentino",
"bin": {
Expand All @@ -18,7 +18,7 @@
],
"dependencies": {
"@antfu/ni": "^0.21.12",
"@faststore/core": "^3.0.108",
"@faststore/core": "^3.0.114",
"@inquirer/prompts": "^5.1.2",
"@oclif/core": "^1.16.4",
"@oclif/plugin-help": "^5",
Expand All @@ -31,8 +31,8 @@
"path": "^0.12.7"
},
"devDependencies": {
"@faststore/eslint-config": "^3.0.97",
"@faststore/shared": "^3.0.97",
"@faststore/eslint-config": "^3.0.110",
"@faststore/shared": "^3.0.110",
"@types/chai": "^4",
"@types/degit": "^2.8.6",
"@types/fs-extra": "^9.0.13",
Expand Down
6 changes: 3 additions & 3 deletions packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@faststore/components",
"version": "3.0.103",
"version": "3.0.110",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"typings": "dist/esm/index.d.ts",
Expand Down Expand Up @@ -35,8 +35,8 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@faststore/eslint-config": "^3.0.97",
"@faststore/shared": "^3.0.97",
"@faststore/eslint-config": "^3.0.110",
"@faststore/shared": "^3.0.110",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^14.3.0",
"@types/jest-axe": "^3.5.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const nextConfig = {
swcMinify: true,
images: {
domains: [`${storeConfig.api.storeId}.vtexassets.com`],
deviceSizes: [360, 540, 768, 1280, 1440],
deviceSizes: [360, 412, 540, 768, 1280, 1440],
imageSizes: [34, 68, 154, 320],
},
i18n: {
Expand Down
18 changes: 8 additions & 10 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@faststore/core",
"version": "3.0.108",
"version": "3.0.114",
"license": "MIT",
"repository": "vtex/faststore",
"browserslist": "supports es6-module and not dead",
Expand Down Expand Up @@ -43,12 +43,12 @@
"@envelop/graphql-jit": "^1.1.1",
"@envelop/parser-cache": "^2.2.0",
"@envelop/validation-cache": "^2.2.0",
"@faststore/api": "^3.0.108",
"@faststore/components": "^3.0.103",
"@faststore/graphql-utils": "^3.0.97",
"@faststore/lighthouse": "^3.0.97",
"@faststore/sdk": "^3.0.108",
"@faststore/ui": "^3.0.103",
"@faststore/api": "^3.0.110",
"@faststore/components": "^3.0.110",
"@faststore/graphql-utils": "^3.0.110",
"@faststore/lighthouse": "^3.0.110",
"@faststore/sdk": "^3.0.110",
"@faststore/ui": "^3.0.110",
"@graphql-codegen/cli": "^5.0.2",
"@graphql-codegen/client-preset": "^4.2.6",
"@graphql-codegen/typescript": "^4.0.7",
Expand All @@ -63,7 +63,6 @@
"@vtex/client-cms": "^0.2.12",
"@vtex/prettier-config": "1.0.0",
"autoprefixer": "^10.4.0",
"chalk": "^5.2.0",
"css-loader": "^6.7.1",
"deepmerge": "^4.3.1",
"draftjs-to-html": "^0.9.1",
Expand All @@ -72,7 +71,6 @@
"include-media": "^1.4.10",
"next": "^13.5.6",
"next-seo": "^6.4.0",
"nextjs-progressbar": "^0.0.14",
"postcss": "^8.4.4",
"prettier": "^2.2.0",
"react": "^18.2.0",
Expand All @@ -89,7 +87,7 @@
"devDependencies": {
"@cypress/code-coverage": "^3.12.1",
"@envelop/testing": "^6.0.0",
"@faststore/eslint-config": "^3.0.97",
"@faststore/eslint-config": "^3.0.110",
"@lhci/cli": "^0.9.0",
"@testing-library/cypress": "^10.0.1",
"@types/cypress": "^1.1.3",
Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/components/cms/GlobalSections.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Locator, Section } from '@vtex/client-cms'
import storeConfig from 'faststore.config'
import type { ComponentType } from 'react'
import { PropsWithChildren, lazy } from 'react'
import { PropsWithChildren } from 'react'
import CUSTOM_COMPONENTS from 'src/customizations/src/components'
import { PageContentType, getPage } from 'src/server/cms'

Expand All @@ -13,8 +13,8 @@ import Footer from 'src/components/sections/Footer'
import { OverriddenDefaultNavbar as Navbar } from 'src/components/sections/Navbar/OverriddenDefaultNavbar'
import { OverriddenDefaultRegionBar as RegionBar } from 'src/components/sections/RegionBar/OverriddenDefaultRegionBar'

const RegionModal = lazy(() => import('src/components/region/RegionModal'))
const CartSidebar = lazy(() => import('src/components/cart/CartSidebar'))
import CartSidebar from 'src/components/cart/CartSidebar'
import RegionModal from 'src/components/region/RegionModal'

export const GLOBAL_SECTIONS_CONTENT_TYPE = 'globalSections'

Expand Down Expand Up @@ -56,7 +56,7 @@ export const getGlobalSectionsData = async (
const page = cmsData[GLOBAL_SECTIONS_CONTENT_TYPE][0]

if (page) {
const pageData = await getPage<PageContentType>({
const pageData = getPage<PageContentType>({
contentType: GLOBAL_SECTIONS_CONTENT_TYPE,
documentId: page.documentId,
versionId: page.versionId,
Expand All @@ -66,11 +66,11 @@ export const getGlobalSectionsData = async (
}
}

const { sections } = await getPage<PageContentType>({
const pageData = getPage<PageContentType>({
...(previewData?.contentType === GLOBAL_SECTIONS_CONTENT_TYPE &&
previewData),
contentType: GLOBAL_SECTIONS_CONTENT_TYPE,
})

return { sections }
return pageData
}
7 changes: 2 additions & 5 deletions packages/core/src/components/cms/RenderSections.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import chalk from 'chalk'
import { ComponentType, PropsWithChildren, memo, useMemo } from 'react'

import SectionBoundary from './SectionBoundary'
Expand Down Expand Up @@ -30,10 +29,8 @@ const RenderSectionsBase = ({ sections = [], components }: Props) => {

if (!Component) {
// TODO: add a documentation link to help to do this
console.info(
`${chalk.yellow(
'warn'
)} - ${name} not found. Add a new component for this section or remove it from the CMS`
console.warn(
`${name} not found. Add a new component for this section or remove it from the CMS`
)

return null
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/sections/Hero/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const Hero = ({
alt={image.alt}
width={360}
height={240}
sizes="(max-width: 360px) 50vw, (max-width: 768px) 90vw, 50vw"
sizes="(max-width: 412px) 40vw, (max-width: 768px) 90vw, 50vw"
/>
</HeroImage.Component>
<HeroHeader.Component
Expand Down
7 changes: 0 additions & 7 deletions packages/core/src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { UIProvider } from '@faststore/ui'
import type { AppProps } from 'next/app'
import NextNProgress from 'nextjs-progressbar'
import Layout from 'src/Layout'
import AnalyticsHandler from 'src/sdk/analytics'
import ErrorBoundary from 'src/sdk/error/ErrorBoundary'
Expand All @@ -15,12 +14,6 @@ import { DefaultSeo } from 'next-seo'
function App({ Component, pageProps }: AppProps) {
return (
<ErrorBoundary>
<NextNProgress
color="var(--fs-color-primary-bkg);"
showOnShallow={false}
options={{ showSpinner: false }}
/>

<DefaultSeo {...SEO} />

<AnalyticsHandler />
Expand Down
37 changes: 18 additions & 19 deletions packages/core/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,30 +100,29 @@ export const getStaticProps: GetStaticProps<
Record<string, string>,
Locator
> = async ({ previewData }) => {
const serverData = await getDynamicContent({ pageType: 'home' })
const globalSections = await getGlobalSectionsData(previewData)
const globalSectionsPromise = getGlobalSectionsData(previewData)
const serverDataPromise = getDynamicContent({ pageType: 'home' })

let cmsPage = null
if (storeConfig.cms.data) {
const cmsData = JSON.parse(storeConfig.cms.data)
const page = cmsData['home'][0]

if (page) {
const pageData = await getPage<PageContentType>({
cmsPage = cmsData['home'][0]
}
const pagePromise = cmsPage
? getPage<PageContentType>({
contentType: 'home',
documentId: page.documentId,
versionId: page.versionId,
documentId: cmsPage.documentId,
versionId: cmsPage.versionId,
})

return {
props: { page: pageData, globalSections, serverData },
}
}
}

const page = await getPage<PageContentType>({
...(previewData?.contentType === 'home' && previewData),
contentType: 'home',
})
: getPage<PageContentType>({
...(previewData?.contentType === 'home' && previewData),
contentType: 'home',
})
const [page, globalSections, serverData] = await Promise.all([
pagePromise,
globalSectionsPromise,
serverDataPromise,
])

return {
props: { page, globalSections, serverData },
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/sdk/analytics/hooks/usePageViewEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const usePageViewEvent = () => {
return () => {
router.events.off('routeChangeComplete', sendPageViewEvent)
}
}, [router])
}, [router, sendPageViewEvent])

return { sendPageViewEvent }
}
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@faststore/eslint-config",
"version": "3.0.97",
"version": "3.0.110",
"main": "index.js",
"license": "MIT",
"repository": "vtex/faststore",
Expand Down
Loading

0 comments on commit c32273c

Please sign in to comment.