Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix vendor.js inclusion of retail-react-app files #1198

Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 99 additions & 99 deletions packages/my-extended-retail-app/package.json
Original file line number Diff line number Diff line change
@@ -1,102 +1,102 @@
{
"name": "my-extended-retail-app",
"version": "2.8.0-dev",
"license": "See license in LICENSE",
"engines": {
"node": "^16.0.0 || ^18.0.0",
"npm": "^7.0.0 || ^8.0.0 || ^9.0.0"
"name": "my-extended-retail-app",
"version": "2.8.0-dev",
"license": "See license in LICENSE",
"engines": {
"node": "^16.0.0 || ^18.0.0",
"npm": "^7.0.0 || ^8.0.0 || ^9.0.0"
},
"ccExtensibility": {
"extends": "retail-react-app",
"overridesDir": "pwa-kit-overrides"
},
"devDependencies": {
"@chakra-ui/icons": "^1.1.7",
"@chakra-ui/react": "^1.8.9",
"@chakra-ui/skip-nav": "^1.2.6",
"@chakra-ui/system": "^1.12.1",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@formatjs/cli": "^6.0.4",
"@lhci/cli": "^0.11.0",
"@loadable/component": "^5.15.3",
"@peculiar/webcrypto": "^1.4.2",
"@tanstack/react-query": "^4.0.10",
"@tanstack/react-query-devtools": "^4.29.1",
"@testing-library/dom": "^9.0.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^11.2.7",
"@testing-library/react-hooks": "^7.0.2",
"@testing-library/user-event": "^12.8.3",
"base64-arraybuffer": "^0.2.0",
"bundlesize2": "^0.0.31",
"card-validator": "^8.1.1",
"commerce-sdk-react-preview": "^2.8.0-dev",
"cross-env": "^5.2.1",
"cross-fetch": "^3.1.5",
"focus-visible": "^5.2.0",
"framer-motion": "^3.10.6",
"full-icu": "^1.5.0",
"helmet": "^4.6.0",
"jest-fetch-mock": "^2.1.2",
"js-cookie": "^3.0.1",
"jsonwebtoken": "^9.0.0",
"jwt-decode": "^3.1.2",
"lodash": "^4.17.21",
"msw": "^1.2.1",
"nanoid": "^3.3.4",
"njwt": "^1.2.0",
"prop-types": "^15.8.1",
"pwa-kit-dev": "2.8.0-dev",
"pwa-kit-react-sdk": "2.8.0-dev",
"pwa-kit-runtime": "2.8.0-dev",
"query-string": "^7.1.3",
"raf": "^3.4.1",
"randomstring": "^1.2.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-helmet": "^6.1.0",
"react-hook-form": "^6.15.8",
"react-intl": "^5.25.1",
"react-router-dom": "^5.3.4",
"retail-react-app": "2.8.0-dev"
},
"peerDependencies": {
"@chakra-ui/system": "^1.12.1"
},
kevinxh marked this conversation as resolved.
Show resolved Hide resolved
"scripts": {
"analyze-build": "cross-env MOBIFY_ANALYZE=true npm run build",
"build-translations": "npm run extract-default-translations && npm run compile-translations",
"compile-translations": "formatjs compile-folder --ast app/translations app/translations/compiled",
"compile-translations:pseudo": "formatjs compile --ast app/translations/en-US.json --out-file app/translations/compiled/en-XB.json --pseudo-locale en-XB",
"extract-default-translations": "formatjs extract 'app/**/*.{js,jsx}' --out-file app/translations/en-US.json --id-interpolation-pattern [sha512:contenthash:base64:6]",
"format": "pwa-kit-dev format \"**/*.{js,jsx}\"",
"lint": "pwa-kit-dev lint \"**/*.{js,jsx}\"",
"lint:fix": "npm run lint -- --fix",
"build": "npm run build-translations && pwa-kit-dev build",
"push": "npm run build && pwa-kit-dev push",
"save-credentials": "pwa-kit-dev save-credentials",
"start": "cross-env NODE_ICU_DATA=node_modules/full-icu pwa-kit-dev start",
"start:inspect": "npm run start -- --inspect",
"start:pseudolocale": "npm run extract-default-translations && npm run compile-translations:pseudo && cross-env USE_PSEUDOLOCALE=true npm run start",
"tail-logs": "pwa-kit-dev tail-logs",
"test": "pwa-kit-dev test",
"test:lighthouse": "cross-env NODE_ENV=production lhci autorun --config=tests/lighthouserc.js",
"test:max-file-size": "npm run build && bundlesize"
},
"bundlesize": [
{
"path": "build/main.js",
"maxSize": "42 kB"
},
"ccExtensibility": {
"extends": "retail-react-app",
"overridesDir": "pwa-kit-overrides"
},
"devDependencies": {
"@chakra-ui/icons": "^1.1.7",
"@chakra-ui/react": "^1.8.9",
"@chakra-ui/skip-nav": "^1.2.6",
"@chakra-ui/system": "^1.12.1",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@formatjs/cli": "^6.0.4",
"@lhci/cli": "^0.11.0",
"@loadable/component": "^5.15.3",
"@peculiar/webcrypto": "^1.4.2",
"@tanstack/react-query": "^4.0.10",
"@tanstack/react-query-devtools": "^4.29.1",
"@testing-library/dom": "^9.0.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^11.2.7",
"@testing-library/react-hooks": "^7.0.2",
"@testing-library/user-event": "^12.8.3",
"base64-arraybuffer": "^0.2.0",
"bundlesize2": "^0.0.31",
"card-validator": "^8.1.1",
"commerce-sdk-react-preview": "^2.8.0-dev",
"cross-env": "^5.2.1",
"cross-fetch": "^3.1.5",
"focus-visible": "^5.2.0",
"framer-motion": "^3.10.6",
"full-icu": "^1.5.0",
"helmet": "^4.6.0",
"jest-fetch-mock": "^2.1.2",
"js-cookie": "^3.0.1",
"jsonwebtoken": "^9.0.0",
"jwt-decode": "^3.1.2",
"lodash": "^4.17.21",
"msw": "^1.2.1",
"nanoid": "^3.3.4",
"njwt": "^1.2.0",
"prop-types": "^15.8.1",
"pwa-kit-dev": "2.8.0-dev",
"pwa-kit-react-sdk": "2.8.0-dev",
"pwa-kit-runtime": "2.8.0-dev",
"query-string": "^7.1.3",
"raf": "^3.4.1",
"randomstring": "^1.2.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-helmet": "^6.1.0",
"react-hook-form": "^6.15.8",
"react-intl": "^5.25.1",
"react-router-dom": "^5.3.4",
"retail-react-app": "2.8.0-dev"
},
"peerDependencies": {
"@chakra-ui/system": "^1.12.1"
},
"scripts": {
"analyze-build": "cross-env MOBIFY_ANALYZE=true npm run build",
"build-translations": "npm run extract-default-translations && npm run compile-translations",
"compile-translations": "formatjs compile-folder --ast app/translations app/translations/compiled",
"compile-translations:pseudo": "formatjs compile --ast app/translations/en-US.json --out-file app/translations/compiled/en-XB.json --pseudo-locale en-XB",
"extract-default-translations": "formatjs extract 'app/**/*.{js,jsx}' --out-file app/translations/en-US.json --id-interpolation-pattern [sha512:contenthash:base64:6]",
"format": "pwa-kit-dev format \"**/*.{js,jsx}\"",
"lint": "pwa-kit-dev lint \"**/*.{js,jsx}\"",
"lint:fix": "npm run lint -- --fix",
"build": "npm run build-translations && pwa-kit-dev build",
"push": "npm run build && pwa-kit-dev push",
"save-credentials": "pwa-kit-dev save-credentials",
"start": "cross-env NODE_ICU_DATA=node_modules/full-icu pwa-kit-dev start",
"start:inspect": "npm run start -- --inspect",
"start:pseudolocale": "npm run extract-default-translations && npm run compile-translations:pseudo && cross-env USE_PSEUDOLOCALE=true npm run start",
"tail-logs": "pwa-kit-dev tail-logs",
"test": "pwa-kit-dev test",
"test:lighthouse": "cross-env NODE_ENV=production lhci autorun --config=tests/lighthouserc.js",
"test:max-file-size": "npm run build && bundlesize"
},
"bundlesize": [
{
"path": "build/main.js",
"maxSize": "55 kB"
},
{
"path": "build/vendor.js",
"maxSize": "275 kB"
}
],
"browserslist": [
"iOS >= 9.0",
"Android >= 4.4.4",
"last 4 ChromeAndroid versions"
]
{
"path": "build/vendor.js",
"maxSize": "320 kB"
bfeister marked this conversation as resolved.
Show resolved Hide resolved
}
],
"browserslist": [
"iOS >= 9.0",
"Android >= 4.4.4",
"last 4 ChromeAndroid versions"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,7 @@ import {useIntl, FormattedMessage} from 'react-intl'
import {useLocation} from 'react-router-dom'

// Components
import {
Box,
Button,
SimpleGrid,
HStack,
VStack,
Text,
Flex,
Stack,
Container,
Link
} from '@chakra-ui/react'
import {Box, Button, SimpleGrid, Stack, Link} from '@chakra-ui/react'
bfeister marked this conversation as resolved.
Show resolved Hide resolved

// Project Components
import Hero from 'retail-react-app/app/components/hero'
Expand All @@ -30,7 +19,6 @@ import ProductScroller from 'retail-react-app/app/components/product-scroller'

// Others
import {getAssetUrl} from 'pwa-kit-react-sdk/ssr/universal/utils'
import {heroFeatures, features} from 'retail-react-app/app/pages/home/data'

//Hooks
import useEinstein from 'retail-react-app/app/hooks/use-einstein'
Expand Down
36 changes: 36 additions & 0 deletions packages/my-extended-retail-app/worker/main.js
Copy link
Collaborator

@adamraya adamraya May 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing we copying the same worker code from template-retail-react-app to here to avoid seeing the 404 error, right? Should this file also be extendable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bendvc has included worker in #1205. I don't know, do we want that to be extensible?

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (c) 2023, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

/* global workbox, DEBUG */
/* istanbul ignore file */
/**
* This is your project's Service Worker. For information on customizing your
* Service Worker, see:
*
* - https://developers.google.com/web/fundamentals/primers/service-workers/
* - https://developers.google.com/web/tools/workbox/
*/

self.importScripts('https://storage.googleapis.com/workbox-cdn/releases/3.6.1/workbox-sw.js')

workbox.setConfig({debug: DEBUG})

// Place your Workbox route configurations here, eg:
// workbox.routing.registerRoute(...)

// Never cache dev-server internals.
workbox.routing.registerRoute(
/^http:\/\/localhost:3000\/__mrt/,
new workbox.strategies.NetworkOnly()
)

// Minimum viable configuration to get offline mode.
workbox.routing.registerRoute(/^http:\/\/localhost:3000/, new workbox.strategies.NetworkFirst())
workbox.routing.registerRoute(
/^https:\/\/.+\.mobify-storefront.com/,
new workbox.strategies.NetworkFirst()
)
Loading