From 1e3a19f63dd9c4c3c327b901926c469d760f87e0 Mon Sep 17 00:00:00 2001 From: Paul Hachmang Date: Mon, 16 Dec 2024 23:40:52 +0100 Subject: [PATCH 01/11] Cleanup --- .../RowColumnOne/RowColumnOneBoxed.tsx | 13 -- .../RowColumnOne/RowColumnOneCentered.tsx | 13 -- .../RowColumnOne/RowColumnOneDoubleSpread.tsx | 22 --- .../RowColumnOne/RowColumnOneSpread.tsx | 20 --- .../RowColumnTwo/RowColumnTwoSpread.tsx | 51 ------ examples/magento-graphcms/lib/sw.ts | 7 +- knip.ts | 71 ++++++++ package.json | 1 + .../mesh/algoliaHitToMagentoCategory.ts | 2 +- .../mesh/algoliaHitToMagentoProduct.ts | 2 +- .../mesh/getRecommendationArgs.ts | 1 + .../algolia-search/hooks/useSearchRoute.ts | 6 - .../utils/createRouterProxy.ts | 15 -- packages/graphql-mesh/customFetch.ts | 2 + .../graphql-mesh/plugin/forward-headers.ts | 2 + .../hygraph-dynamic-rows-ui/types/index.ts | 38 ----- packages/lighthouse/CHANGELOG.md | 153 ------------------ packages/lighthouse/lighthouse.ts | 21 --- packages/lighthouse/lighthouserc.json | 28 ---- packages/lighthouse/package.json | 21 --- packages/lighthouse/tsconfig.json | 5 - packages/lingui-next/document/index.ts | 1 - .../components/CartItems/CartItems.tsx | 26 --- .../SelectedCustomizableOptions/index.ts | 2 - .../hooks/adyenHppExpandMethods.ts | 4 +- .../ProductPageGallery/ProductImage.tsx | 10 -- .../ProductPageGallery/ProductVideo.tsx | 10 -- packages/next-ui/Intl/DateTimeFormat/index.ts | 1 + packages/next-ui/Intl/DisplayNames/index.ts | 1 + packages/next-ui/Intl/ListFormat/index.ts | 1 + packages/next-ui/Intl/NumberFormat/index.ts | 1 + .../next-ui/Intl/RelativeTimeFormat/index.ts | 1 + packages/next-ui/Intl/index.ts | 2 +- packages/next-ui/docs/building-components.mdx | 3 - .../docs/components/ComponentBasic.tsx | 26 --- .../docs/components/ComponentChild.tsx | 49 ------ .../docs/components/ComponentChildVariant.tsx | 55 ------- .../ComponentChildVariantExtendable.tsx | 64 -------- .../docs/components/ComponentStylable.tsx | 32 ---- .../docs/pages/building-components.tsx | 62 ------- .../react-hook-form/src/utils/debounce.ts | 85 ---------- .../src/utils/useDebounceCallback.ts | 21 --- .../src/graphql.ts | 30 ---- .../src/config/utils/mergeEnvIntoConfig.ts | 4 +- .../next-config/src/interceptors/Visitor.ts | 2 - .../src/interceptors/extractExports.ts | 47 +----- .../src/interceptors/generateInterceptor.ts | 4 + 47 files changed, 94 insertions(+), 944 deletions(-) delete mode 100644 examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOneBoxed.tsx delete mode 100644 examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOneCentered.tsx delete mode 100644 examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOneDoubleSpread.tsx delete mode 100644 examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOneSpread.tsx delete mode 100644 examples/magento-graphcms/components/GraphCMS/RowColumnTwo/RowColumnTwoSpread.tsx create mode 100644 knip.ts delete mode 100644 packages/algolia-search/hooks/useSearchRoute.ts delete mode 100644 packages/framer-next-pages/utils/createRouterProxy.ts delete mode 100644 packages/hygraph-dynamic-rows-ui/types/index.ts delete mode 100644 packages/lighthouse/CHANGELOG.md delete mode 100644 packages/lighthouse/lighthouse.ts delete mode 100644 packages/lighthouse/lighthouserc.json delete mode 100644 packages/lighthouse/package.json delete mode 100644 packages/lighthouse/tsconfig.json delete mode 100644 packages/lingui-next/document/index.ts delete mode 100644 packages/magento-cart-items/components/CartItems/CartItems.tsx delete mode 100644 packages/magento-cart-items/components/SelectedCustomizableOptions/index.ts delete mode 100644 packages/magento-product/components/ProductPageGallery/ProductImage.tsx delete mode 100644 packages/magento-product/components/ProductPageGallery/ProductVideo.tsx delete mode 100644 packages/next-ui/docs/building-components.mdx delete mode 100644 packages/next-ui/docs/components/ComponentBasic.tsx delete mode 100644 packages/next-ui/docs/components/ComponentChild.tsx delete mode 100644 packages/next-ui/docs/components/ComponentChildVariant.tsx delete mode 100644 packages/next-ui/docs/components/ComponentChildVariantExtendable.tsx delete mode 100644 packages/next-ui/docs/components/ComponentStylable.tsx delete mode 100644 packages/next-ui/docs/pages/building-components.tsx delete mode 100644 packages/react-hook-form/src/utils/debounce.ts delete mode 100644 packages/react-hook-form/src/utils/useDebounceCallback.ts delete mode 100644 packagesDev/graphql-codegen-markdown-docs/src/graphql.ts diff --git a/examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOneBoxed.tsx b/examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOneBoxed.tsx deleted file mode 100644 index 822bb0893c..0000000000 --- a/examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOneBoxed.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { RichText } from '@graphcommerce/hygraph-ui' -import { ColumnOneBoxed } from '@graphcommerce/next-ui' -import { RowColumnOneProps } from './RowColumnOne' - -export function RowColumnOneBoxed(props: RowColumnOneProps) { - const { colOne, richTextOne } = props - - return ( - - - - ) -} diff --git a/examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOneCentered.tsx b/examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOneCentered.tsx deleted file mode 100644 index 36c8fd01a8..0000000000 --- a/examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOneCentered.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { RichText } from '@graphcommerce/hygraph-ui' -import { ColumnOneCentered } from '@graphcommerce/next-ui' -import { RowColumnOneProps } from './RowColumnOne' - -export function RowColumnOneCentered(props: RowColumnOneProps) { - const { colOne, richTextOne } = props - - return ( - - - - ) -} diff --git a/examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOneDoubleSpread.tsx b/examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOneDoubleSpread.tsx deleted file mode 100644 index a64892b2f4..0000000000 --- a/examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOneDoubleSpread.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { RichText } from '@graphcommerce/hygraph-ui' -import { ColumnOne } from '@graphcommerce/next-ui' -import { RowColumnOneFragment } from './RowColumnOne.gql' - -type RowColumnOneDoubleSpreadProps = RowColumnOneFragment - -export function RowColumnOneDoubleSpread(props: RowColumnOneDoubleSpreadProps) { - const { colOne } = props - return ( - - ({ - columnCount: { sm: 2, lg: 3 }, - columnGap: theme.spacings.md, - }), - }} - /> - - ) -} diff --git a/examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOneSpread.tsx b/examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOneSpread.tsx deleted file mode 100644 index 53f77c28fc..0000000000 --- a/examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOneSpread.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { RichText } from '@graphcommerce/hygraph-ui' -import { ColumnOne } from '@graphcommerce/next-ui' -import { RowColumnOneFragment } from './RowColumnOne.gql' - -export function RowColumnOneSpread(props: RowColumnOneFragment) { - const { colOne } = props - return ( - - ({ - columnCount: { md: 2 }, - columnGap: theme.spacings.md, - }), - }} - /> - - ) -} diff --git a/examples/magento-graphcms/components/GraphCMS/RowColumnTwo/RowColumnTwoSpread.tsx b/examples/magento-graphcms/components/GraphCMS/RowColumnTwo/RowColumnTwoSpread.tsx deleted file mode 100644 index 2b9a678f97..0000000000 --- a/examples/magento-graphcms/components/GraphCMS/RowColumnTwo/RowColumnTwoSpread.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { getNodeLength, RichText } from '@graphcommerce/hygraph-ui' -import { ElementOrTextNode } from '@graphcommerce/hygraph-ui/components/RichText/types' -import { ColumnTwoSpread } from '@graphcommerce/next-ui' -import { RowColumnTwoFragment } from './RowColumnTwo.gql' - -const getColumnCount = (props: RowColumnTwoFragment, columnId: number) => { - const colOneLength = getNodeLength(props.colOne.raw as ElementOrTextNode) - const colTwoLength = getNodeLength(props.colTwo.raw as ElementOrTextNode) - - if (colOneLength >= colTwoLength && columnId === 1) return 2 - if (colOneLength >= colTwoLength && columnId === 2) return 1 - if (colOneLength < colTwoLength && columnId === 1) return 1 - if (colOneLength < colTwoLength && columnId === 2) return 2 - return 1 -} - -export function RowColumnTwoSpread(props: RowColumnTwoFragment) { - const { colOne, colTwo } = props - - return ( - = - getNodeLength(colTwo.raw as ElementOrTextNode) - } - colOneContent={ - ({ - columnCount: { xs: 1, md: getColumnCount(props, 1) }, - columnGap: theme.spacings.md, - }), - }} - /> - } - colTwoContent={ - ({ - columnCount: { xs: 1, md: getColumnCount(props, 2) }, - columnGap: theme.spacings.md, - }), - }} - /> - } - /> - ) -} diff --git a/examples/magento-graphcms/lib/sw.ts b/examples/magento-graphcms/lib/sw.ts index 601be2dccc..d848478ca4 100644 --- a/examples/magento-graphcms/lib/sw.ts +++ b/examples/magento-graphcms/lib/sw.ts @@ -1,9 +1,4 @@ -import { - runtimeCaching, - PrecacheEntry, - Serwist, - productionCaching, -} from '@graphcommerce/service-worker' +import { PrecacheEntry, Serwist, productionCaching } from '@graphcommerce/service-worker' // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents declare const self: ServiceWorkerGlobalScope & { diff --git a/knip.ts b/knip.ts new file mode 100644 index 0000000000..5c8d251094 --- /dev/null +++ b/knip.ts @@ -0,0 +1,71 @@ +import type { KnipConfig } from 'knip' + +type WorkspaceEntry = NonNullable[string] + +const skip: WorkspaceEntry = { + ignore: ['**/*.*'], +} + +const asNextjsDir: WorkspaceEntry = { + ignore: ['.next', 'public', 'copy/**'], + entry: [ + 'next.config.js', + 'graphcommerce.config.js', + 'lingui.config.js', + 'next-sitemap.config.js', + 'next.config.{ts,cjs,mjs}', + 'middleware.{ts}', + 'app/**/route.{ts}', + 'app/**/{error,layout,loading,not-found,page,template}.{jsx,ts,tsx}', + 'instrumentation.{ts}', + 'app/{manifest,sitemap,robots}.{ts}', + 'app/**/{icon,apple-icon}.{ts,tsx}', + 'app/**/{opengraph,twitter}-image.{ts,tsx}', + 'pages/**/*.{jsx,ts,tsx}', + 'plugins/**/*.{ts,tsx}', + 'lib/sw.ts', + ], +} + +const config: KnipConfig = { + // eslint: false, + // playwright: false, + // next: false, + include: [ + 'files', + 'exports', + // Enable when files and exports are handled. + // "nsExports", + // "types" + // "nsTypes" + // "duplicates" + ], + workspaces: { + // '.': skip, + 'packagesDev/*': { + ignore: ['__tests__', '**/*.interceptor.tsx', 'dist'], + entry: ['index.{js,mjs,cjs,ts,tsx}', 'src/index.{js,mjs,cjs,ts,tsx}'], + }, + 'packagesDev/next-config': { + ignore: ['__tests__', '**/*.interceptor.tsx', 'src/generated/config.ts'], + }, + 'packages/*': { + ignore: ['**/__tests__', 'test', '**/*.interceptor.tsx'], + entry: [ + 'plugins/**/*.{ts,tsx}', + 'src/bin/*.ts', + '**/*.{js,mjs,cjs}', + 'index.ts', + 'src/index.ts', + ], + }, + scripts: skip, + 'packages/*/example': skip, + 'packages/magento-pagebuilder': skip, + 'examples/magento-graphcms': asNextjsDir, + 'examples/magento-open-source': asNextjsDir, + 'packages/hygraph-dynamic-rows-ui': asNextjsDir, + }, +} + +export default config diff --git a/package.json b/package.json index bae9144544..00d23ace44 100644 --- a/package.json +++ b/package.json @@ -83,6 +83,7 @@ "jest": "next", "jest-diff": "^29.7.0", "jest-environment-jsdom": "^29.7.0", + "knip": "^5.41.0", "next": "15.1.0", "prettier": "^3", "typescript": "5.7.2", diff --git a/packages/algolia-categories/mesh/algoliaHitToMagentoCategory.ts b/packages/algolia-categories/mesh/algoliaHitToMagentoCategory.ts index 0d581c2995..e6fd53d179 100644 --- a/packages/algolia-categories/mesh/algoliaHitToMagentoCategory.ts +++ b/packages/algolia-categories/mesh/algoliaHitToMagentoCategory.ts @@ -20,7 +20,7 @@ export type AlgoliaCategoryHitAddiotonalProperties = AlgoliaProductHitAdditional level: number } -export function assertAdditional( +function assertAdditional( additional: unknown, ): additional is AlgoliaCategoryHitAddiotonalProperties { return true diff --git a/packages/algolia-products/mesh/algoliaHitToMagentoProduct.ts b/packages/algolia-products/mesh/algoliaHitToMagentoProduct.ts index cb23b90a12..8c4a41a66a 100644 --- a/packages/algolia-products/mesh/algoliaHitToMagentoProduct.ts +++ b/packages/algolia-products/mesh/algoliaHitToMagentoProduct.ts @@ -13,7 +13,7 @@ import type { } from '@graphcommerce/graphql-mesh' import type { GetStoreConfigReturn } from './getStoreConfig' -export function assertAdditional( +function assertAdditional( additional: unknown, ): additional is AlgoliaProductHitAdditionalProperties { return true diff --git a/packages/algolia-recommend/mesh/getRecommendationArgs.ts b/packages/algolia-recommend/mesh/getRecommendationArgs.ts index a6ac7eb889..abb32e7d22 100644 --- a/packages/algolia-recommend/mesh/getRecommendationArgs.ts +++ b/packages/algolia-recommend/mesh/getRecommendationArgs.ts @@ -6,6 +6,7 @@ import type { QueryproductsArgs, } from '@graphcommerce/graphql-mesh' +/** @public */ export async function getRecommendationQueryInput( args: QueryproductsArgs, context: MeshContext, diff --git a/packages/algolia-search/hooks/useSearchRoute.ts b/packages/algolia-search/hooks/useSearchRoute.ts deleted file mode 100644 index 45257b28a2..0000000000 --- a/packages/algolia-search/hooks/useSearchRoute.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { useRouter } from 'next/router' - -export function useSearchRoute() { - const router = useRouter() - return router.asPath.includes('/search') -} diff --git a/packages/framer-next-pages/utils/createRouterProxy.ts b/packages/framer-next-pages/utils/createRouterProxy.ts deleted file mode 100644 index 563cb9aac1..0000000000 --- a/packages/framer-next-pages/utils/createRouterProxy.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { NextRouter } from 'next/router' - -export type OverrideProps = Partial> - -export function createRouterProxy(router: NextRouter, override?: OverrideProps): NextRouter { - // We create an object with the current stale properties - const { asPath, pathname, query, locale } = router - - const overrideProps: OverrideProps = { asPath, pathname, query, locale, ...override } - - return new Proxy(router, { - get: (target, prop: string, receiver) => - overrideProps[prop] ?? Reflect.get(target, prop, receiver), - }) -} diff --git a/packages/graphql-mesh/customFetch.ts b/packages/graphql-mesh/customFetch.ts index cabf538709..881ea755b8 100644 --- a/packages/graphql-mesh/customFetch.ts +++ b/packages/graphql-mesh/customFetch.ts @@ -7,6 +7,7 @@ const fetcher = fetchRetry( ) /** + * @public * @param {RequestInfo | URL} url * @param {import('fetch-retry').RequestInitWithRetry | undefined} options * @returns {Promise} @@ -28,4 +29,5 @@ export const fetch = ( }) } +/** @public */ export default fetch diff --git a/packages/graphql-mesh/plugin/forward-headers.ts b/packages/graphql-mesh/plugin/forward-headers.ts index 16b729fa79..914c457aac 100644 --- a/packages/graphql-mesh/plugin/forward-headers.ts +++ b/packages/graphql-mesh/plugin/forward-headers.ts @@ -8,6 +8,8 @@ interface ForwardHeaderConfig { } /** + * @public + * * Configure in your meshrc.yaml: * * ```yaml diff --git a/packages/hygraph-dynamic-rows-ui/types/index.ts b/packages/hygraph-dynamic-rows-ui/types/index.ts deleted file mode 100644 index bfcc8fd3e9..0000000000 --- a/packages/hygraph-dynamic-rows-ui/types/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -export type ProductProperty = { - label: string - id: string - type?: string -} - -export type Interface = { - __type: __Type -} - -export type __Type = { - kind?: __TypeKind - name?: string - description?: string - fields: __Field[] - ofType?: { name?: string; fields: __Field[] } -} - -export type __TypeKind = - | 'SCALAR' - | 'OBJECT' - | 'INTERFACE' - | 'UNION' - | 'ENUM' - | 'INPUT_OBJECT' - | 'LIST' - | 'NON_NULL' - -export type __Field = { - name: string - type: __Type - isDeprecated: boolean - description?: string -} - -export type Option = { id: string; label: string } - -export type Options = { text: Option[]; number: Option[] } diff --git a/packages/lighthouse/CHANGELOG.md b/packages/lighthouse/CHANGELOG.md deleted file mode 100644 index af6d6dbf39..0000000000 --- a/packages/lighthouse/CHANGELOG.md +++ /dev/null @@ -1,153 +0,0 @@ -# Change Log - -## 9.0.0-canary.115 - -## 9.0.0-canary.114 - -## 9.0.0-canary.113 - -## 9.0.0-canary.112 - -## 9.0.0-canary.111 - -## 9.0.0-canary.110 - -## 9.0.0-canary.109 - -## 9.0.0-canary.108 - -## 9.0.0-canary.107 - -## 9.0.0-canary.106 - -## 9.0.0-canary.105 - -## 9.0.0-canary.104 - -## 9.0.0-canary.103 - -## 6.0.0 - -### Patch Changes - -- [#1821](https://github.com/graphcommerce-org/graphcommerce/pull/1821) [`1abc50a21`](https://github.com/graphcommerce-org/graphcommerce/commit/1abc50a21103270fad04e4a9ea892ee1e75233e9) - Upgrade packages to latest version ([@paales](https://github.com/paales)) - -## 5.1.0 - -### Patch Changes - -- [#1752](https://github.com/graphcommerce-org/graphcommerce/pull/1752) [`2a6a4d9ec`](https://github.com/graphcommerce-org/graphcommerce/commit/2a6a4d9ecfa1b58a66ba9b9d00016d6feda9aa95) - Updated dependencies to latest versions, except for nextjs; Solve tons of peer dependency issues. - - - Updated the @mui/material package - - Removed dependencies on react-hook-form-mui and @playwright/test - - Upgraded dependencies including type-fest and graphql-mesh - - Solved peer dependency issues ([@paales](https://github.com/paales)) - -## 5.0.0 - -### Major Changes - -- [`7592d161c`](https://github.com/graphcommerce-org/graphcommerce/commit/7592d161cef7b42838855f8d9dfe5ecc1063c384) - Bump major version of all packages ([@paales](https://github.com/paales)) - -## 4.0.9 - -### Patch Changes - -- [#1702](https://github.com/graphcommerce-org/graphcommerce/pull/1702) [`abb15ef4a`](https://github.com/graphcommerce-org/graphcommerce/commit/abb15ef4a79b12eddb32cc006e5d1d31dd06ac2d) Thanks [@paales](https://github.com/paales)! - Added canary releases to GraphCommerce - -## 4.0.8 - -### Patch Changes - -- [#1490](https://github.com/graphcommerce-org/graphcommerce/pull/1490) [`d311ef48b`](https://github.com/graphcommerce-org/graphcommerce/commit/d311ef48bb3e97806d992af5516d6b7f183ec9cb) Thanks [@paales](https://github.com/paales)! - upgraded packages - -## 4.0.7 - -### Patch Changes - -- [#1399](https://github.com/graphcommerce-org/graphcommerce/pull/1399) [`da0ae7d02`](https://github.com/graphcommerce-org/graphcommerce/commit/da0ae7d0236e4908ba0bf0fa16656be516e841d4) Thanks [@paales](https://github.com/paales)! - Updated dependencies - -## 4.0.6 - -### Patch Changes - -- [#1378](https://github.com/graphcommerce-org/graphcommerce/pull/1378) [`b610a6e40`](https://github.com/graphcommerce-org/graphcommerce/commit/b610a6e4049e8c9e8b5d2aeff31b8e1bfc24abe5) Thanks [@paales](https://github.com/paales)! - Pin all versions internally so we can’t end up in an unfixable state for the user - -## 4.0.5 - -### Patch Changes - -- [#1369](https://github.com/graphcommerce-org/graphcommerce/pull/1369) [`ae6449502`](https://github.com/graphcommerce-org/graphcommerce/commit/ae64495024a455bbe5188588604368c1542840c9) Thanks [@paales](https://github.com/paales)! - Upgraded dependencies - -## 4.0.4 - -### Patch Changes - -- [#1307](https://github.com/ho-nl/m2-pwa/pull/1307) [`bd10506d3`](https://github.com/ho-nl/m2-pwa/commit/bd10506d32fdbc91d01dadc29a12ebd1e0943655) Thanks [@paales](https://github.com/paales)! - All default exports are now named exports internally and all `index.tsx` are renamed to the component name. - -* [#1307](https://github.com/ho-nl/m2-pwa/pull/1307) [`27cb1f2d8`](https://github.com/ho-nl/m2-pwa/commit/27cb1f2d8dbfb8f1b301ce56fb6a2b6c1fc6a5ef) Thanks [@paales](https://github.com/paales)! - upgrade dependencies - -## 4.0.3 - -### Patch Changes - -- [`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96) Thanks [@paales](https://github.com/paales)! - made packages public - -## 4.0.2 - -### Patch Changes - -- [#1276](https://github.com/ho-nl/m2-pwa/pull/1276) [`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2) Thanks [@paales](https://github.com/paales)! - We've moved lots of internal packages from `dependencies` to `peerDependencies`. The result of this is that there will be significantly less duplicate packages in the node_modules folders. - -* [#1276](https://github.com/ho-nl/m2-pwa/pull/1276) [`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d) Thanks [@paales](https://github.com/paales)! - Upgraded to [NextJS 12.1](https://nextjs.org/blog/next-12-1)! This is just for compatibility, but we'll be implementing [On-demand Incremental Static Regeneration](https://nextjs.org/blog/next-12-1#on-demand-incremental-static-regeneration-beta) soon. - - This will greatly reduce the requirement to rebuid stuff and we'll add a management UI on the frontend to be able to revalidate pages manually. - -## 4.0.1 - -### Patch Changes - -- [`0cbaa878b`](https://github.com/ho-nl/m2-pwa/commit/0cbaa878b8a844d5abbeb1797b625a33130e6514) Thanks [@paales](https://github.com/paales)! - Added homepage and repository package.json files, so that the packages link to back to the website and repository - -## 4.0.0 - -### Major Changes - -- [#1258](https://github.com/ho-nl/m2-pwa/pull/1258) [`ad36382a4`](https://github.com/ho-nl/m2-pwa/commit/ad36382a4d55d83d9e47b7eb6a02671a2a631a05) Thanks [@paales](https://github.com/paales)! - Upgraded to Material UI 5 - -All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [3.0.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/lighthouse@3.0.0...@graphcommerce/lighthouse@3.0.1) (2021-09-27) - -**Note:** Version bump only for package @graphcommerce/lighthouse - -# 3.0.0 (2021-09-27) - -### Bug Fixes - -- ignore md files from triggering version updates ([4f98392](https://github.com/ho-nl/m2-pwa/commit/4f9839250b3a32d3070da5290e5efcc5e2243fba)) - -### Features - -- **playwright:** added new playwright package to enable browser testing ([6f49ec7](https://github.com/ho-nl/m2-pwa/commit/6f49ec7595563775b96ebf21c27e39da1282e8d9)) -- renamed all packages to use [@graphcommerce](https://github.com/graphcommerce) instead of [@reachdigital](https://github.com/reachdigital) ([491e4ce](https://github.com/ho-nl/m2-pwa/commit/491e4cec9a2686472dac36b79f999257c0811ffe)) -- split into packages ([2ee7fd6](https://github.com/ho-nl/m2-pwa/commit/2ee7fd6c0056f467d114f04d92c6c0ddf622d151)) -- upgrade to node 14 ([d079a75](https://github.com/ho-nl/m2-pwa/commit/d079a751e9bfd8dc7f5009d2c9f31c336a0c96ab)) - -### BREAKING CHANGES - -- huge folder structure refactor, please read README to reinstall - -# Change Log - -All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.101.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/lighthouse@2.100.10...@graphcommerce/lighthouse@2.101.0) (2021-07-26) - -### Bug Fixes - -- ignore md files from triggering version updates ([4f98392](https://github.com/ho-nl/m2-pwa/commit/4f9839250b3a32d3070da5290e5efcc5e2243fba)) - -### Features - -- **playwright:** added new playwright package to enable browser testing ([6f49ec7](https://github.com/ho-nl/m2-pwa/commit/6f49ec7595563775b96ebf21c27e39da1282e8d9)) diff --git a/packages/lighthouse/lighthouse.ts b/packages/lighthouse/lighthouse.ts deleted file mode 100644 index 9465ec2624..0000000000 --- a/packages/lighthouse/lighthouse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { promises as fs } from 'fs' -import type { PrerenderManifest } from 'next/dist/build' -import lighthouse from './lighthouserc.json' - -async function main() { - const file: PrerenderManifest = JSON.parse( - await fs.readFile('.next/prerender-manifest.json', 'utf-8'), - ) - - const urls = {} - Object.entries(file.routes).forEach(([path, ssgRoute]) => { - if (!urls[ssgRoute.srcRoute || path]) urls[ssgRoute.srcRoute || path] = path - }) - - const newUrls = Object.values(urls).map((url) => `__LHCI_BASE_URL__${url}`) - lighthouse.ci.collect.url = newUrls.sort() - - await fs.writeFile('./lighthouserc.json', `${JSON.stringify(lighthouse, null, ' ')}\n`) -} - -main().catch(console.error) diff --git a/packages/lighthouse/lighthouserc.json b/packages/lighthouse/lighthouserc.json deleted file mode 100644 index e6b5c9fabf..0000000000 --- a/packages/lighthouse/lighthouserc.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "ci": { - "collect": { - "numberOfRuns": 3, - "url": ["__LHCI_BASE_URL__/", "__LHCI_BASE_URL__/account/signin"] - }, - "assert": { - "preset": "lighthouse:recommended", - "assertions": { - "html-has-lang": "off", - "color-contrast": "off", - "is-crawlable": "off", - "tap-targets": "off", - "mainthread-work-breakdown": "off", - "max-potential-fid": "off", - "uses-long-cache-ttl": "off", - "canonical": "off", - "image-size-responsive": "off", - "meta-description": "off" - } - }, - "upload": { - "target": "temporary-public-storage" - }, - "server": {}, - "wizard": {} - } -} diff --git a/packages/lighthouse/package.json b/packages/lighthouse/package.json deleted file mode 100644 index 9ebf476f87..0000000000 --- a/packages/lighthouse/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "@graphcommerce/lighthouse", - "homepage": "https://www.graphcommerce.org/", - "repository": "github:graphcommerce-org/graphcommerce", - "version": "9.0.0-canary.115", - "private": true, - "sideEffects": false, - "prettier": "@graphcommerce/prettier-config-pwa", - "eslintConfig": { - "extends": "@graphcommerce/eslint-config-pwa", - "parserOptions": { - "project": "./tsconfig.json" - } - }, - "peerDependencies": { - "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.115", - "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.115", - "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.115", - "next": "*" - } -} diff --git a/packages/lighthouse/tsconfig.json b/packages/lighthouse/tsconfig.json deleted file mode 100644 index 7398153dd6..0000000000 --- a/packages/lighthouse/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "exclude": ["**/node_modules", "**/.*/"], - "include": ["**/*.ts", "**/*.tsx"], - "extends": "@graphcommerce/typescript-config-pwa/nextjs.json" -} diff --git a/packages/lingui-next/document/index.ts b/packages/lingui-next/document/index.ts deleted file mode 100644 index 814f1ffcf7..0000000000 --- a/packages/lingui-next/document/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './withLingui' diff --git a/packages/magento-cart-items/components/CartItems/CartItems.tsx b/packages/magento-cart-items/components/CartItems/CartItems.tsx deleted file mode 100644 index 5d36a5034c..0000000000 --- a/packages/magento-cart-items/components/CartItems/CartItems.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import type { TypeRenderer } from '@graphcommerce/next-ui' -import { RenderType } from '@graphcommerce/next-ui' -import { Box } from '@mui/material' -import type { CartItemsFragment } from '../../Api/CartItems.gql' - -export type CartItemRenderer = TypeRenderer[0]>> - -export type CartProps = { renderer: CartItemRenderer } & CartItemsFragment - -/** @deprecated Replace with CartItemsActionCards */ -export function CartItems(props: CartProps) { - const { renderer, items, id } = props - - return ( - <> - {items?.map((item) => { - if (!item?.uid || !id) return null - return ( - - - - ) - })} - - ) -} diff --git a/packages/magento-cart-items/components/SelectedCustomizableOptions/index.ts b/packages/magento-cart-items/components/SelectedCustomizableOptions/index.ts deleted file mode 100644 index 3a4ad34509..0000000000 --- a/packages/magento-cart-items/components/SelectedCustomizableOptions/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './SelectedCustomizableOption.gql' -export * from './SelectedCustomizableOptions' diff --git a/packages/magento-payment-adyen/hooks/adyenHppExpandMethods.ts b/packages/magento-payment-adyen/hooks/adyenHppExpandMethods.ts index 872707b58c..34676dd5da 100644 --- a/packages/magento-payment-adyen/hooks/adyenHppExpandMethods.ts +++ b/packages/magento-payment-adyen/hooks/adyenHppExpandMethods.ts @@ -1,9 +1,7 @@ import type { ExpandPaymentMethods } from '@graphcommerce/magento-cart-payment-method' +import { nonNullable } from '@graphcommerce/next-ui' import { UseAdyenPaymentMethodsDocument } from './UseAdyenPaymentMethods.gql' -export const nonNullable = (value: T): value is NonNullable => - value !== null && value !== undefined - export const adyenHppExpandMethods: ExpandPaymentMethods = async (available, context) => { if (!context.id) return [] diff --git a/packages/magento-product/components/ProductPageGallery/ProductImage.tsx b/packages/magento-product/components/ProductPageGallery/ProductImage.tsx deleted file mode 100644 index 50e319e1ba..0000000000 --- a/packages/magento-product/components/ProductPageGallery/ProductImage.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { Image } from '@graphcommerce/image' -import type { ProductImageFragment } from './ProductImage.gql' - -export function ProductImage(props: ProductImageFragment) { - const { url, label } = props - - if (!url) return null - - return {label -} diff --git a/packages/magento-product/components/ProductPageGallery/ProductVideo.tsx b/packages/magento-product/components/ProductPageGallery/ProductVideo.tsx deleted file mode 100644 index b74f8fa68f..0000000000 --- a/packages/magento-product/components/ProductPageGallery/ProductVideo.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import type { ProductVideoFragment } from './ProductVideo.gql' - -export function ProductVideo(props: ProductVideoFragment) { - const { video_content } = props - - if (!video_content?.video_url) return null - - // eslint-disable-next-line jsx-a11y/media-has-caption - return