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

Feature/template extensibility #1162

Conversation

bfeister
Copy link
Collaborator

@bfeister bfeister commented Apr 28, 2023

Description

This PR highlights recent changes in the Template Extensibility feature's API. The current (WIP) API Docs for this feature can be found here:

API Docs

Here is an example MVP (minimum viable project) which includes some default / required files

image

Add this in your package.json to make it work

image

"Extendable" projects (retail-react-app is the first of this kind) can ensure normal resolution via ccExtensibility: { extendable: ['my-extendable-project'] }. This is needed to prevent pwa-kit-dev from requiring static values in it's webpack.config.js, these would make it impossible for us to add new extendable templates of our own (and the same is true for customers) without releasing a new version of the SDKs.

image

The end result of this project looks like this (note the brand-logo.svg icon is changed, the Hero message is changed, and there is a new route /my-new-route

image

image

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • (change1)

How to Test-Drive This PR

  • git clone git@github.com:SalesforceCommerceCloud/pwa-kit.git
  • git checkout feature/template-extensibility-algo-refactor
  • npm ci from pwa-kit root
  • cd packages/my-extended-retail-app
  • npm start

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

yunakim714 and others added 30 commits March 27, 2023 14:06
…-rehaul

* feature/template-extensibility:
  drop unnecessary pages/product-detail override
  updates from underlying template-retail-react-app
  add missing useToast (bad merge)
  add missing node engines
  update spike project's engines / regen v3 lockfiles
  resolve merge conflict
  merge conflict

# Conflicts:
#	packages/spike-extendend-retail-app/pwa-kit/overrides/app/components/header/index.jsx
#	packages/spike-extendend-retail-app/pwa-kit/overrides/app/pages/product-detail/index.jsx
…-rehaul

* feature/template-extensibility:
  [Spike]Replace watch with nodemon (#1146)
  Fix Page Designer ImageWithText Link component (#1092) (#1148)
  Upgrade deprecated dependencies (#1124)
  Restart login flow if refresh_token is invalid (#1135)
  Move some util to site-utils to avoid circular imports (#1133)
  Restore old file name. (#1140)
  Update eslint configuration (#1129)
  CI: clarify the environment variables (#1127)
  Remove react-query-devtools from production build (#1121)
  Update lerna.json (#1118)
  Parallelize lighthouse ci (#1126)
  Increase test timeouts only on CI env (#1123)
  Remove unused `request` deprecated dependency. (#1125)
  Upgrade msw to latest (#1100)
  Add mergeBasket hook (#1114)
  [V3][Hooks Integration 🪝] Manually update cache for ShopperCustomer (#1113)
  dont use callback on mutateAsync (#1119)
  2-spaces not 4-spaces (#1117)

# Conflicts:
#	packages/internal-lib-build/package-lock.json
#	packages/pwa-kit-dev/package-lock.json
#	packages/pwa-kit-react-sdk/package-lock.json
#	packages/pwa-kit-runtime/package-lock.json
#	packages/pwa-kit-runtime/package.json
@bfeister bfeister force-pushed the feature/template-extensibility-algo-refactor branch from cd6f80c to eafa3b1 Compare May 10, 2023 23:24
bfeister and others added 17 commits May 10, 2023 17:25
* v3:
  [v3] Add Convenience Components (#1183)
  Update commerce-sdk-react README (#1176)
  Fix missing commerce-sdk-react logout call (#1180)

# Conflicts:
#	packages/template-retail-react-app/app/components/_app/index.jsx
#	packages/template-retail-react-app/app/pages/product-list/index.jsx
…ly from app (#1202)

* Remove Einstein proxy and send Einstein events directly from app

* Update ssrParameters
)

* Replace ExtendsCircularImportsPlugin with OverridesResolverPlugin

* fix filepath problem

---------

Co-authored-by: Brian Feister <bfeister@salesforce.com>
* fix duplicate lilbs in bundle

* fix app/static pathing for non-extensible builds

* oof, fix extensible app/static filepaths

* Resolve conflicting npm deps via `resolve.alias`

* add missing worker/main.js

* cleanup unused imports

* WIP, add list of original overridable deps

* prevent template extensibility vendor.js from treating baseline route files as deps in vendor.js

* fix irrelevant bundlesize declaration to pass CI

* drop test:max-file-size test from my-extended-retail-app
Co-authored-by: Brian Feister <47546998+bfeister@users.noreply.github.com>
* develop: (34 commits)
  [Phased Launch] Call Session bridge after login (#1220)
  [v3] Add multi-site suffix to auth token keys (#1208)
  Footer: fix hydration error with the locale dropdown (#1210)
  remove unused peerDependency @chakra-ui/system (#1212)
  @W-12582733: Expose env vars endpoint for E2E smoke tests (#1207)
  Upgrade to React 18 (#1166)
  Remove v3 branch name related actions (#1206)
  add test to reach test coverage threshold
  remove commerce-api folder
  Feature: Extract einstein RefArch-specific values to constant (#1200)
  Bump version number to 2.7.1 and update changelogs (#1197)
  store usid in cookies (#1193)
  make sure static files are copied on dev environment (#1196)
  [WIP] PWA Kit 2.7.1 release (#1181)
  [V2] Internal lib build typescript dev dependency (#1194)
  [V2] Re-generate lock files and fix hook lib tests (#1186)
  Add additional properties to ShopperLogin test types (#1185)
  Revert 2.7.0 branch to prep for 2.7.1 changes (#1182)
  #1174 Replace invalid value for wrap property (#1179)
  Add a redirect to login page after user signs out from checkout page (#1172)
  ...

# Conflicts:
#	package-lock.json
#	packages/commerce-sdk-react/CHANGELOG.md
#	packages/commerce-sdk-react/package-lock.json
#	packages/internal-lib-build/package-lock.json
#	packages/pwa-kit-create-app/package-lock.json
#	packages/pwa-kit-dev/package-lock.json
#	packages/pwa-kit-dev/package.json
#	packages/pwa-kit-react-sdk/package-lock.json
#	packages/pwa-kit-runtime/package-lock.json
#	packages/template-mrt-reference-app/package-lock.json
#	packages/template-retail-react-app/app/components/confirmation-modal/index.test.js
#	packages/template-retail-react-app/app/components/footer/index.jsx
#	packages/template-retail-react-app/app/components/header/index.jsx
#	packages/template-retail-react-app/app/components/list-menu/index.test.js
#	packages/template-retail-react-app/app/components/product-scroller/index.test.js
#	packages/template-retail-react-app/app/components/product-view-modal/index.test.js
#	packages/template-retail-react-app/app/components/search/index.test.js
#	packages/template-retail-react-app/app/hoc/with-registration/index.test.js
#	packages/template-retail-react-app/app/hooks/use-add-to-cart-modal.js
#	packages/template-retail-react-app/app/hooks/use-auth-modal.test.js
#	packages/template-retail-react-app/app/hooks/use-currency.test.js
#	packages/template-retail-react-app/app/hooks/use-multi-site.test.js
#	packages/template-retail-react-app/app/hooks/use-navigation.test.js
#	packages/template-retail-react-app/app/pages/account/addresses.test.js
#	packages/template-retail-react-app/app/pages/account/index.jsx
#	packages/template-retail-react-app/app/pages/account/wishlist/partials/wishlist-primary-action.test.js
#	packages/template-retail-react-app/app/pages/cart/index.test.js
#	packages/template-retail-react-app/app/pages/cart/partials/cart-secondary-button-group.test.js
#	packages/template-retail-react-app/app/pages/checkout/index.test.js
#	packages/template-retail-react-app/app/pages/checkout/partials/contact-info.jsx
#	packages/template-retail-react-app/app/pages/checkout/partials/contact-info.test.js
#	packages/template-retail-react-app/app/pages/home/index.test.js
#	packages/template-retail-react-app/app/pages/product-list/partials/empty-results.jsx
#	packages/template-retail-react-app/app/pages/product-list/partials/page-header.jsx
#	packages/template-retail-react-app/app/pages/registration/index.test.jsx
#	packages/template-retail-react-app/app/utils/site-utils.js
#	packages/template-retail-react-app/package-lock.json
#	packages/template-typescript-minimal/package-lock.json
#	packages/test-commerce-sdk-react/package-lock.json
@bfeister bfeister changed the base branch from develop to feature/template-extensibility May 23, 2023 21:15
…xtensibility-algo-refactor

* feature/template-extensibility:
  lockfiles from reaact18 / chakra2
  remove demo extensible app in light of soon-to-be-merged PR from @bendvc

# Conflicts:
#	packages/pwa-kit-dev/package-lock.json
@bfeister
Copy link
Collaborator Author

YOLO. We will fix the few remaining issues where we stitch all of this together in feature/template-extensibility (so this PR is no longer going to develop

@bfeister bfeister merged commit 851366a into feature/template-extensibility May 23, 2023
bfeister added a commit that referenced this pull request May 23, 2023
…ility-support-new

* feature/template-extensibility:
  Feature/template extensibility (#1162)
  lockfiles from reaact18 / chakra2
  remove demo extensible app in light of soon-to-be-merged PR from @bendvc

# Conflicts:
#	packages/commerce-sdk-react/package-lock.json
#	packages/pwa-kit-create-app/assets/bootstrap/js/.gitignore
#	packages/pwa-kit-create-app/assets/bootstrap/js/babel.config.js
#	packages/pwa-kit-create-app/assets/bootstrap/js/overrides/app/main.jsx
#	packages/pwa-kit-create-app/assets/bootstrap/js/overrides/app/ssr.js
#	packages/pwa-kit-create-app/assets/bootstrap/js/overrides/app/static/img/hero.png
#	packages/pwa-kit-create-app/assets/bootstrap/js/overrides/app/static/manifest.json.hbs
#	packages/pwa-kit-create-app/assets/bootstrap/js/overrides/app/static/robots.txt
#	packages/pwa-kit-create-app/package-lock.json
#	packages/pwa-kit-react-sdk/package-lock.json
#	packages/template-retail-react-app/app/pages/home/index.test.js
#	packages/template-retail-react-app/package-lock.json
#	packages/template-retail-react-app/package.json
bfeister added a commit that referenced this pull request May 23, 2023
…tion-script

* generator/extensibility-support-new:
  Feature/template extensibility (#1162)
  lockfiles from reaact18 / chakra2
  remove demo extensible app in light of soon-to-be-merged PR from @bendvc

# Conflicts:
#	packages/template-retail-react-app/app/pages/home/index.test.js
@bfeister bfeister mentioned this pull request May 24, 2023
12 tasks
bfeister added a commit that referenced this pull request May 24, 2023
…react-app

* feature/template-extensibility: (38 commits)
  support windows file paths
  Feature/template extensibility (#1162)
  lockfiles from reaact18 / chakra2
  remove demo extensible app in light of soon-to-be-merged PR from @bendvc
  [Phased Launch] Call Session bridge after login (#1220)
  [v3] Add multi-site suffix to auth token keys (#1208)
  Footer: fix hydration error with the locale dropdown (#1210)
  remove unused peerDependency @chakra-ui/system (#1212)
  @W-12582733: Expose env vars endpoint for E2E smoke tests (#1207)
  Upgrade to React 18 (#1166)
  Remove v3 branch name related actions (#1206)
  add test to reach test coverage threshold
  remove commerce-api folder
  Feature: Extract einstein RefArch-specific values to constant (#1200)
  Bump version number to 2.7.1 and update changelogs (#1197)
  store usid in cookies (#1193)
  make sure static files are copied on dev environment (#1196)
  [WIP] PWA Kit 2.7.1 release (#1181)
  [V2] Internal lib build typescript dev dependency (#1194)
  [V2] Re-generate lock files and fix hook lib tests (#1186)
  ...

# Conflicts:
#	packages/my-extended-retail-app/config/default.js
#	packages/my-extended-retail-app/config/sites.js
#	packages/my-extended-retail-app/package-lock.json
#	packages/my-extended-retail-app/package.json
#	packages/my-extended-retail-app/pwa-kit-overrides/app/assets/svg/brand-logo.svg
#	packages/my-extended-retail-app/pwa-kit-overrides/app/components/_app-config/index.jsx
#	packages/my-extended-retail-app/pwa-kit-overrides/app/components/_app/index.jsx
#	packages/my-extended-retail-app/pwa-kit-overrides/app/pages/home/index.jsx
#	packages/my-extended-retail-app/pwa-kit-overrides/app/routes.jsx
#	packages/my-extended-retail-app/pwa-kit-overrides/app/ssr.js
#	packages/my-extended-retail-app/pwa-kit-overrides/app/static/ico/favicon.ico
#	packages/my-extended-retail-app/pwa-kit-overrides/app/static/img/global/app-icon-192.png
#	packages/my-extended-retail-app/pwa-kit-overrides/app/static/img/global/app-icon-512.png
#	packages/my-extended-retail-app/pwa-kit-overrides/app/static/img/global/apple-touch-icon.png
#	packages/pwa-kit-dev/bin/pwa-kit-dev.js
#	packages/pwa-kit-dev/package-lock.json
#	packages/pwa-kit-dev/package.json
#	packages/pwa-kit-dev/src/configs/webpack/config.js
#	packages/template-retail-react-app/app/components/confirmation-modal/index.test.js
#	packages/template-retail-react-app/app/components/footer/index.jsx
#	packages/template-retail-react-app/app/components/header/index.jsx
#	packages/template-retail-react-app/app/components/list-menu/index.test.js
#	packages/template-retail-react-app/app/components/product-scroller/index.test.js
#	packages/template-retail-react-app/app/components/product-view-modal/index.test.js
#	packages/template-retail-react-app/app/components/search/index.test.js
#	packages/template-retail-react-app/app/hoc/with-registration/index.test.js
#	packages/template-retail-react-app/app/hooks/use-add-to-cart-modal.js
#	packages/template-retail-react-app/app/hooks/use-auth-modal.test.js
#	packages/template-retail-react-app/app/hooks/use-currency.test.js
#	packages/template-retail-react-app/app/hooks/use-multi-site.test.js
#	packages/template-retail-react-app/app/hooks/use-navigation.test.js
#	packages/template-retail-react-app/app/pages/account/addresses.test.js
#	packages/template-retail-react-app/app/pages/account/index.jsx
#	packages/template-retail-react-app/app/pages/account/wishlist/index.test.js
#	packages/template-retail-react-app/app/pages/account/wishlist/partials/wishlist-primary-action.test.js
#	packages/template-retail-react-app/app/pages/cart/index.test.js
#	packages/template-retail-react-app/app/pages/cart/partials/cart-secondary-button-group.test.js
#	packages/template-retail-react-app/app/pages/checkout/index.test.js
#	packages/template-retail-react-app/app/pages/checkout/partials/contact-info.jsx
#	packages/template-retail-react-app/app/pages/checkout/partials/contact-info.test.js
#	packages/template-retail-react-app/app/pages/home/index.test.js
#	packages/template-retail-react-app/app/pages/product-list/partials/empty-results.jsx
#	packages/template-retail-react-app/app/pages/product-list/partials/page-header.jsx
#	packages/template-retail-react-app/app/pages/registration/index.test.jsx
#	packages/template-retail-react-app/app/utils/site-utils.js
#	packages/template-retail-react-app/package-lock.json
#	packages/template-retail-react-app/package.json
bfeister added a commit that referenced this pull request May 24, 2023
* committing early progress, local npm repo requires it

* commit for local npm

* getting local npm working

* Cannot get property `main` of undefined + can't follow glob pattern `app/static` fixes

* Working now (side-loading from node_modules/retail-react-app) next step: overrides working

* fix broken WIP bit

* Working example of overrides

* remove system dependent lookup

* WIP, working server side now, broken client side (bundle/development/vendor.js throws an error)

* WIP, fix broken webpack dev server 404ing on `mobify/bundle/development/**/*` files

* fix broken header menu state

* cleanup

* make paths non-absolute as interim solution (so others can check out / run the POC)

* fix webpack module pathing

* fix `react-intl` webpack loading failure, restore more of baseline template now that things are working

* remove product detail page override

* Make overrideables (files like `_app-config`, `_app` etc. dynamic) + reduce filesystem lookups for performance

* commit WIP to share

* WIP algorithim for `file/path(.)(/index)(js|jsx|ts|tsx)

* clean up / simplify

* working now! hardcoded for just icons/index.jsx override

* cleanup

* Icons working with magic local (*) and base template (^) directives

* Remove dependency on hardcoded `icons/index.jsx` path

* minor cleanup

* YES! freaking works... fixed imports so that magic characters work properly

* remove most of the unnecessary overrides

* minor cleanup

* progress on debugging double-request processing in webpack

* fix helper function that was returning `undefined` as a value in regex

* Early WIP toward consolidating 3 plugins into one. Regex check returning at line 317, but shouldn't be

* add regex of path where filename is NOT included

* forgot to commit plugin file

* comment out `resource.createData.resource` which seems unnecessary

* add social icons to overrides

* fix bad icon pathing (svg spritemaps), removed the unneeded `template-retail-react-app` path pushed to regex map, add WIP hashmap for optimizing lookups from _og_overrides, added `(svg|jpg|jpeg)` extensions to regex

* Fix `pwa-kit-dev` paths that didn't know about `overrides` in build pipeline

* add the whole `template-retail-react-app` under `app` dir to stress test performance with high number of file overrides

* fix bad upstream merge changes

* fix bad upstream merge resolutions

* Add missing template files

* Add back missing `scripts` in package.json after bad merge

* more fixes for out of sync package / lockfiles

* add missing pwa-kit packages

* Fix regex matching patterns (#1057)

* resolve package lock errors

* clean console logs and code

* more cleanup, remove duplicate items in overrideregex

* upgrade minimatch version, match all file extensions, match with no file extension

* fix dependency dupes

* Remove all console logs / cleanup / unnecessary code

* fix some problems with final cleanup

* merge

* remove stress test files post-merge

* added pdp page override with small customization

* add constants file to spike project and tweak overrides values

* Fix bug where `<path>/dir/index.(js|jsx|etc)` was being picked up by template extensibility, but `<path>/dir/non-index-name.(js|jsx|etc)` was not

* fix package.json scripts

* fix falsy value defaulting causing errors in `path.join` fix broken `npm run push`

* delete `build/loadable-stat.json` from git, gitignore should work from there

* fix some file pathing issues in how SDK looks up default / universal / project components

* Perf enhancements, don't use regex all (.*) for module replacement, reduce conditional logic execution

* minor code style tweak

* cleanup

* fix conflicts

* fix package lockfiles that were out of sync

* Revert "fix package lockfiles that were out of sync"

This reverts commit 7f3c364.

* fix out of sync lockfiles

* merge conflict

* resolve merge conflict

* update spike project's engines / regen v3 lockfiles

* add missing node engines

* add missing useToast (bad merge)

* updates from underlying template-retail-react-app

* drop unnecessary pages/product-detail override

* migrate to new directory

* remove unnecessary directory nesting, remove unnecessary files for "minimum file project"

* add example of extending routes non-destructively, add example of quickly toggling some base constant values (e.g. categories shown on home page)

* Update example route

* add some demo examples of overrides

* commit package name change

* fix bad merge conflict

* bring back deleted package lockfiles

* regen package lockfiles

* remove demo extensible app in light of soon-to-be-merged PR from @bendvc

* lockfiles from reaact18 / chakra2

* Feature/template extensibility (#1162)

* initial work on moving code to use resolver

* fix getoverridepath and break on ^ imports

* add todos and comments

* rewrite requestcontext.request for path with caret

* perform overrideshashmap lookup for relative import

* progress

* progress

* regenerate lock files

* fix dupe useToast

* progress on making `charles-solution` work

* initial pass at migration to `resolver.getHook('resolve').tapAsync` working, TODO next... cleanup

* restore icons file and add extensible text to home

* add some comments and construct hashmap in new plugin

* working glob sync lookup??

* resolve lookup when there is no extension

* add component slot for testing

* fix some lookup errors

* cleanup

* rewrite requests coming from underlying template

* cleanup

* rename plugin file

* remove unnecessary build files

* rename to overrides

* fix lookup errors

* fix some broken upstream changes, eslint fixes

* Bring back the deleted package.json

* Install new eslint plugin

* No more relative imports in retail-react-app

* Create .prettierrc.yaml

* restore other deleted package lockfiles

* fix some eslint issues

* remove `^` imports and begin migrating logic away from previous API. TODO: get webpack to resolve `retail-react-app` base import path from within `template-retail-react-app`

* short circuit plugin temporarily, get webpack `alias` working for template to resolve self-referencing `retail-react-app` imports

* fix unreachable condition

* wow... freaking works 🚀

* cleanup, get `template-retail-react-app` working again

* cleanup

* Create .eslintrc.js

* fix routes.jsx which no longer pulled relative template

* make routes.jsx more concise

* update lockfiles

* add jsconfig.json for IDEs to have magic `retail-react-app` be discoverable

* more cleanup

* change package.json key from `mobify` => `ccExtensibility`

* cleanup

* Final cleanup, remove console.logs, make `extendable` dynamic for internal file resolution in `template-retail-react-app` (and future projects), remove some non-required files,

* fix straggler non-dynamic filepath

* cleanup

* remove code that shouldn't be in v3+

* sync package.json deps in extended example project

* cleanup / pr feedback

* pr feedback, great catch @kevinxh

* fix problem with bad copy from underlying template file

* pr feedback / cleanup

* cleanup

Co-authored-by: Kevin He <kevin.he@salesforce.com>

* Update package-lock.json

* WIP

* drop unneeded complexity

* lockfiles

* moving toward an array of `alias`es

* Refactor template extensibility functionality to use `resolve.alias` + greatly reduce code footprint + make leading slash optional in `ccExtensibility.overridesDir`

* add brand-logo with no clash for server side viewBox

* add `request-processor.js` (required for worker.js to load) and fix bad extensibility path loading in `build-dev-server.js`

* lint fix

* fix failing pwa-kit-react-sdk tests

* cleanup

* lint:fix

* fix failing tests in CI re: `TextDecoder is not defined`

* take 2 attempting to fix TextDecoder global in jest

* fix jest module mapper

* fix jest moduleMapper config

* REALLY fix jest moduleNameMapper config for new pathing + fix node `util` global TextDecoder is not defined in jest

* add brand-logo

* remove previously added `AbovePDP` Template Hook component

* replay #1128 from bad merge

* eslint:fix for `retail-react-app` base paths

* de-duplicate deps in bundle

* fix path defaulting, don't pass nullish value to path.resolve

* improve pathing for overridesDir in pwa-kit-dev webapack config + add missing worker/main.js

* fix pathing

* fix pathing issue that was mysteriously UNFIXED

* fix `worker.js` path

* fix app/static pathing in non-extensible builds

* [Extensibility] Remove Einstein proxy and send Einstein events directly from app (#1202)

* Remove Einstein proxy and send Einstein events directly from app

* Update ssrParameters

* Replace ExtendsCircularImportsPlugin with OverridesResolverPlugin (#1211)

* Replace ExtendsCircularImportsPlugin with OverridesResolverPlugin

* fix filepath problem

---------

Co-authored-by: Brian Feister <bfeister@salesforce.com>

* remove irrelevant bundlesize check to pass CI

* Fix `vendor.js` inclusion of `retail-react-app` files (#1198)

* fix duplicate lilbs in bundle

* fix app/static pathing for non-extensible builds

* oof, fix extensible app/static filepaths

* Resolve conflicting npm deps via `resolve.alias`

* add missing worker/main.js

* cleanup unused imports

* WIP, add list of original overridable deps

* prevent template extensibility vendor.js from treating baseline route files as deps in vendor.js

* fix irrelevant bundlesize declaration to pass CI

* drop test:max-file-size test from my-extended-retail-app

* replace relative with absolute path fetchTranslations (#1215)

Co-authored-by: Brian Feister <47546998+bfeister@users.noreply.github.com>

* Refactor for unit testing, fix pathing issue from old version of file parsing algoritihim

* fix merge conflict resolution

* remove template extensible demo in prep for @bendvc's pr for generator work

* regen lockfiles for react 18 changes

* fix linting

---------

Co-authored-by: yunakim714 <yunakim@salesforce.com>
Co-authored-by: Vincent Marta <vmarta@salesforce.com>
Co-authored-by: Kevin He <kevin.he@salesforce.com>
Co-authored-by: vcua-mobify <vcua@salesforce.com>
Co-authored-by: vcua-mobify <47404250+vcua-mobify@users.noreply.github.com>
Co-authored-by: Alex Vuong <52219283+alexvuong@users.noreply.github.com>
Co-authored-by: Alex Vuong <alex.vuong@salesforce.com>

* support windows file paths

* fix failing tests

* fix merge resolution

---------

Co-authored-by: Ben Chypak <bchypak@salesforce.com>
Co-authored-by: yunakim714 <yunakim@salesforce.com>
Co-authored-by: Yuna Kim <84923642+yunakim714@users.noreply.github.com>
Co-authored-by: Vincent Marta <vmarta@salesforce.com>
Co-authored-by: Kevin He <kevin.he@salesforce.com>
Co-authored-by: vcua-mobify <vcua@salesforce.com>
Co-authored-by: vcua-mobify <47404250+vcua-mobify@users.noreply.github.com>
Co-authored-by: Alex Vuong <52219283+alexvuong@users.noreply.github.com>
Co-authored-by: Alex Vuong <alex.vuong@salesforce.com>
bendvc added a commit that referenced this pull request May 26, 2023
…1205)

* merge conflict

* resolve merge conflict

* update spike project's engines / regen v3 lockfiles

* regenerate lock files

* add missing node engines

* add missing useToast (bad merge)

* updates from underlying template-retail-react-app

* drop unnecessary pages/product-detail override

* fix dupe useToast

* progress on making `charles-solution` work

* initial pass at migration to `resolver.getHook('resolve').tapAsync` working, TODO next... cleanup

* restore icons file and add extensible text to home

* add some comments and construct hashmap in new plugin

* working glob sync lookup??

* resolve lookup when there is no extension

* add component slot for testing

* fix some lookup errors

* migrate to new directory

* remove unnecessary directory nesting, remove unnecessary files for "minimum file project"

* add example of extending routes non-destructively, add example of quickly toggling some base constant values (e.g. categories shown on home page)

* Update example route

* add some demo examples of overrides

* cleanup

* commit package name change

* rewrite requests coming from underlying template

* cleanup

* rename plugin file

* remove unnecessary build files

* rename to overrides

* fix lookup errors

* fix some broken upstream changes, eslint fixes

* fix bad merge conflict

* Bring back the deleted package.json

* Install new eslint plugin

* No more relative imports in retail-react-app

* Create .prettierrc.yaml

* restore other deleted package lockfiles

* fix some eslint issues

* remove `^` imports and begin migrating logic away from previous API. TODO: get webpack to resolve `retail-react-app` base import path from within `template-retail-react-app`

* bring back deleted package lockfiles

* short circuit plugin temporarily, get webpack `alias` working for template to resolve self-referencing `retail-react-app` imports

* fix unreachable condition

* wow... freaking works 🚀

* cleanup, get `template-retail-react-app` working again

* cleanup

* Create .eslintrc.js

* fix routes.jsx which no longer pulled relative template

* make routes.jsx more concise

* update lockfiles

* add jsconfig.json for IDEs to have magic `retail-react-app` be discoverable

* more cleanup

* change package.json key from `mobify` => `ccExtensibility`

* cleanup

* Final cleanup, remove console.logs, make `extendable` dynamic for internal file resolution in `template-retail-react-app` (and future projects), remove some non-required files,

* fix straggler non-dynamic filepath

* cleanup

* remove code that shouldn't be in v3+

* sync package.json deps in extended example project

* cleanup / pr feedback

* pr feedback, great catch @kevinxh

* fix problem with bad copy from underlying template file

* pr feedback / cleanup

* cleanup

Co-authored-by: Kevin He <kevin.he@salesforce.com>

* Update package-lock.json

* WIP

* drop unneeded complexity

* lockfiles

* moving toward an array of `alias`es

* Refactor template extensibility functionality to use `resolve.alias` + greatly reduce code footprint + make leading slash optional in `ccExtensibility.overridesDir`

* add brand-logo with no clash for server side viewBox

* add `request-processor.js` (required for worker.js to load) and fix bad extensibility path loading in `build-dev-server.js`

* lint fix

* fix failing pwa-kit-react-sdk tests

* cleanup

* regen package lockfiles

* lint:fix

* fix failing tests in CI re: `TextDecoder is not defined`

* take 2 attempting to fix TextDecoder global in jest

* fix jest module mapper

* fix jest moduleMapper config

* REALLY fix jest moduleNameMapper config for new pathing + fix node `util` global TextDecoder is not defined in jest

* add brand-logo

* remove previously added `AbovePDP` Template Hook component

* replay #1128 from bad merge

* eslint:fix for `retail-react-app` base paths

* de-duplicate deps in bundle

* fix path defaulting, don't pass nullish value to path.resolve

* improve pathing for overridesDir in pwa-kit-dev webapack config + add missing worker/main.js

* fix pathing

* fix pathing issue that was mysteriously UNFIXED

* fix `worker.js` path

* fix app/static pathing in non-extensible builds

* Bump version to 3.0.0-dev.0

* Fixup dependencies in `template-retail-react-app`

* Create boostrap to replace `my-extended-retail-app`

* Update generator to support extensible projects (rough implementation)

* Create boostrap to replace `my-extended-retail-app`*

* Ensure that translations are chunked

* Remove `my-extended-retail-app` as it is not required

* Fix lint errors

* Fix lint errors

* Add Handlebars and update package.json files

* Fix bootstrap folder organization

* Make template public

* Fix default overrides folder

* Bump to 3.0.0-dev.0 to align with develop

* Initial generator refactor

* Fix version fetching

* Attempt to fix version fetching for extensibility

* Another attempt at fixing the version

* Eek another attempt

* Bad code completion suggestion

* Fix some template keys

* Fix version number

* Update create-mobify-app.js

* Fix template keys in override assets

* Update create-mobify-app.js

* [Extensibility] Remove Einstein proxy and send Einstein events directly from app (#1202)

* Remove Einstein proxy and send Einstein events directly from app

* Update ssrParameters

* Add context

* Fix template key

* Update package.json.hbs

* Add handlebars json helper

* Disabled html encoding for json objects in templates

* Fix formatting in scripts

* Allow demo to use extensibility

* Slugify name

* Move boostrap folder

* Setting up for bootstrap file reuse

* debugging

* Update create-mobify-app.js

* Testing with postGenerate hook

* debugging

* Simplify template sources

* Fix template keys yet again

* Replace ExtendsCircularImportsPlugin with OverridesResolverPlugin (#1211)

* Replace ExtendsCircularImportsPlugin with OverridesResolverPlugin

* fix filepath problem

---------

Co-authored-by: Brian Feister <bfeister@salesforce.com>

* Update routes.jsx.hbs

* Update create-mobify-app.js

* Fix things

* Fix filter

* Fix preset validation

* Update create-mobify-app.js

* Update create-mobify-app.js

* Clean up

* remove irrelevant bundlesize check to pass CI

* Fix `vendor.js` inclusion of `retail-react-app` files (#1198)

* fix duplicate lilbs in bundle

* fix app/static pathing for non-extensible builds

* oof, fix extensible app/static filepaths

* Resolve conflicting npm deps via `resolve.alias`

* add missing worker/main.js

* cleanup unused imports

* WIP, add list of original overridable deps

* prevent template extensibility vendor.js from treating baseline route files as deps in vendor.js

* fix irrelevant bundlesize declaration to pass CI

* drop test:max-file-size test from my-extended-retail-app

* replace relative with absolute path fetchTranslations (#1215)

Co-authored-by: Brian Feister <47546998+bfeister@users.noreply.github.com>

* More refactoring

* Update create-mobify-app.js

* Add template level file assets

* debugging

* Update create-mobify-app.js

* Fix templates

* Fix manifest template keys

* Rearrange deps

* Better handling of objects in hbs templates

* Remove hbs json helper

* Fix missing comma

* More handlebars fixes

* Escape scripts

* make tempalte scripts work with handlebars escaping

* Delete my-exended-template after merging

* Refactor for unit testing, fix pathing issue from old version of file parsing algoritihim

* More clean up

* Remove console log

* preset changes

* Linting, and change test-project name

* Function renames etc

* debugging

* Update create-mobify-app.js

* Fix project answers merge

* Fix CI test 🤞🏻

* Update deps in attempt to fix tests on CI

* Lint

* More dep shuffling

* Remove debugger

* More dep wrangling

* Don't use peer deps like I was

* Another iteration of dep organization

* Clean up hbs templates

* Update licences

* remove demo extensible app in light of soon-to-be-merged PR from @bendvc

* lockfiles from reaact18 / chakra2

* fix merge conflict resolution

* remove template extensible demo in prep for @bendvc's pr for generator work

* regen lockfiles for react 18 changes

* fix linting

* update package-lock files

* Fix imports

* Add missing deps

* Feature/template extensibility (#1162)

* initial work on moving code to use resolver

* fix getoverridepath and break on ^ imports

* add todos and comments

* rewrite requestcontext.request for path with caret

* perform overrideshashmap lookup for relative import

* progress

* progress

* regenerate lock files

* fix dupe useToast

* progress on making `charles-solution` work

* initial pass at migration to `resolver.getHook('resolve').tapAsync` working, TODO next... cleanup

* restore icons file and add extensible text to home

* add some comments and construct hashmap in new plugin

* working glob sync lookup??

* resolve lookup when there is no extension

* add component slot for testing

* fix some lookup errors

* cleanup

* rewrite requests coming from underlying template

* cleanup

* rename plugin file

* remove unnecessary build files

* rename to overrides

* fix lookup errors

* fix some broken upstream changes, eslint fixes

* Bring back the deleted package.json

* Install new eslint plugin

* No more relative imports in retail-react-app

* Create .prettierrc.yaml

* restore other deleted package lockfiles

* fix some eslint issues

* remove `^` imports and begin migrating logic away from previous API. TODO: get webpack to resolve `retail-react-app` base import path from within `template-retail-react-app`

* short circuit plugin temporarily, get webpack `alias` working for template to resolve self-referencing `retail-react-app` imports

* fix unreachable condition

* wow... freaking works 🚀

* cleanup, get `template-retail-react-app` working again

* cleanup

* Create .eslintrc.js

* fix routes.jsx which no longer pulled relative template

* make routes.jsx more concise

* update lockfiles

* add jsconfig.json for IDEs to have magic `retail-react-app` be discoverable

* more cleanup

* change package.json key from `mobify` => `ccExtensibility`

* cleanup

* Final cleanup, remove console.logs, make `extendable` dynamic for internal file resolution in `template-retail-react-app` (and future projects), remove some non-required files,

* fix straggler non-dynamic filepath

* cleanup

* remove code that shouldn't be in v3+

* sync package.json deps in extended example project

* cleanup / pr feedback

* pr feedback, great catch @kevinxh

* fix problem with bad copy from underlying template file

* pr feedback / cleanup

* cleanup

Co-authored-by: Kevin He <kevin.he@salesforce.com>

* Update package-lock.json

* WIP

* drop unneeded complexity

* lockfiles

* moving toward an array of `alias`es

* Refactor template extensibility functionality to use `resolve.alias` + greatly reduce code footprint + make leading slash optional in `ccExtensibility.overridesDir`

* add brand-logo with no clash for server side viewBox

* add `request-processor.js` (required for worker.js to load) and fix bad extensibility path loading in `build-dev-server.js`

* lint fix

* fix failing pwa-kit-react-sdk tests

* cleanup

* lint:fix

* fix failing tests in CI re: `TextDecoder is not defined`

* take 2 attempting to fix TextDecoder global in jest

* fix jest module mapper

* fix jest moduleMapper config

* REALLY fix jest moduleNameMapper config for new pathing + fix node `util` global TextDecoder is not defined in jest

* add brand-logo

* remove previously added `AbovePDP` Template Hook component

* replay #1128 from bad merge

* eslint:fix for `retail-react-app` base paths

* de-duplicate deps in bundle

* fix path defaulting, don't pass nullish value to path.resolve

* improve pathing for overridesDir in pwa-kit-dev webapack config + add missing worker/main.js

* fix pathing

* fix pathing issue that was mysteriously UNFIXED

* fix `worker.js` path

* fix app/static pathing in non-extensible builds

* [Extensibility] Remove Einstein proxy and send Einstein events directly from app (#1202)

* Remove Einstein proxy and send Einstein events directly from app

* Update ssrParameters

* Replace ExtendsCircularImportsPlugin with OverridesResolverPlugin (#1211)

* Replace ExtendsCircularImportsPlugin with OverridesResolverPlugin

* fix filepath problem

---------

Co-authored-by: Brian Feister <bfeister@salesforce.com>

* remove irrelevant bundlesize check to pass CI

* Fix `vendor.js` inclusion of `retail-react-app` files (#1198)

* fix duplicate lilbs in bundle

* fix app/static pathing for non-extensible builds

* oof, fix extensible app/static filepaths

* Resolve conflicting npm deps via `resolve.alias`

* add missing worker/main.js

* cleanup unused imports

* WIP, add list of original overridable deps

* prevent template extensibility vendor.js from treating baseline route files as deps in vendor.js

* fix irrelevant bundlesize declaration to pass CI

* drop test:max-file-size test from my-extended-retail-app

* replace relative with absolute path fetchTranslations (#1215)

Co-authored-by: Brian Feister <47546998+bfeister@users.noreply.github.com>

* Refactor for unit testing, fix pathing issue from old version of file parsing algoritihim

* fix merge conflict resolution

* remove template extensible demo in prep for @bendvc's pr for generator work

* regen lockfiles for react 18 changes

* fix linting

---------

Co-authored-by: yunakim714 <yunakim@salesforce.com>
Co-authored-by: Vincent Marta <vmarta@salesforce.com>
Co-authored-by: Kevin He <kevin.he@salesforce.com>
Co-authored-by: vcua-mobify <vcua@salesforce.com>
Co-authored-by: vcua-mobify <47404250+vcua-mobify@users.noreply.github.com>
Co-authored-by: Alex Vuong <52219283+alexvuong@users.noreply.github.com>
Co-authored-by: Alex Vuong <alex.vuong@salesforce.com>

* Update packages/pwa-kit-create-app/scripts/create-mobify-app.js

Co-authored-by: Vincent Marta <vmarta@salesforce.com>

* Fix CI workflow project reference

* Update config.js

* support windows file paths

* Lint

* Fix issue with failed tests because of react query dev tools

* Extract default messages script (#1216)

* create extract default messages script to work on both base and overrides projects

---------

Co-authored-by: Brian Feister <bfeister@salesforce.com>
Co-authored-by: Brian Feister <47546998+bfeister@users.noreply.github.com>

* Add typescript extensions (#1223)

* add typescript extensions

* fix failing tests

* Update `extract-default-translations` script for extensibility

* debugging

* Update create-mobify-app.js

* Fix regex

* First pass copying translations

* Update create-mobify-app.js

* Update create-mobify-app.js

* Update create-mobify-app.js

* Update create-mobify-app.js

* Refactor copy assets work

* Remove debugger directive

* Regenerate package-lock files

* Fix lint errors on generated projects

* Update create-mobify-app.js

* Fix some dep versions

* Update create-mobify-app.js

* Update package.json

* Fix lint script so it works with windows

* Regenerate package-lock files and remove my-generated-app again

* Lint

* mv doesnt work the same on windows as unix

* Same

* Revert suggested change.

* Add basic eslintignore

* Update bundle size limits

* Missing dep.

---------

Co-authored-by: Brian Feister <bfeister@salesforce.com>
Co-authored-by: yunakim714 <yunakim@salesforce.com>
Co-authored-by: Vincent Marta <vmarta@salesforce.com>
Co-authored-by: Brian Feister <47546998+bfeister@users.noreply.github.com>
Co-authored-by: Kevin He <kevin.he@salesforce.com>
Co-authored-by: vcua-mobify <vcua@salesforce.com>
Co-authored-by: vcua-mobify <47404250+vcua-mobify@users.noreply.github.com>
Co-authored-by: Alex Vuong <52219283+alexvuong@users.noreply.github.com>
Co-authored-by: Alex Vuong <alex.vuong@salesforce.com>
bendvc added a commit that referenced this pull request May 29, 2023
* more fixes for out of sync package / lockfiles

* add missing pwa-kit packages

* Fix regex matching patterns (#1057)

* resolve package lock errors

* clean console logs and code

* more cleanup, remove duplicate items in overrideregex

* upgrade minimatch version, match all file extensions, match with no file extension

* fix dependency dupes

* Remove all console logs / cleanup / unnecessary code

* fix some problems with final cleanup

* merge

* remove stress test files post-merge

* added pdp page override with small customization

* add constants file to spike project and tweak overrides values

* Fix bug where `<path>/dir/index.(js|jsx|etc)` was being picked up by template extensibility, but `<path>/dir/non-index-name.(js|jsx|etc)` was not

* fix package.json scripts

* fix falsy value defaulting causing errors in `path.join` fix broken `npm run push`

* delete `build/loadable-stat.json` from git, gitignore should work from there

* fix some file pathing issues in how SDK looks up default / universal / project components

* Perf enhancements, don't use regex all (.*) for module replacement, reduce conditional logic execution

* minor code style tweak

* cleanup

* initial work on moving code to use resolver

* fix getoverridepath and break on ^ imports

* add todos and comments

* rewrite requestcontext.request for path with caret

* perform overrideshashmap lookup for relative import

* progress

* fix conflicts

* fix package lockfiles that were out of sync

* Revert "fix package lockfiles that were out of sync"

This reverts commit 7f3c364.

* progress

* fix out of sync lockfiles

* merge conflict

* resolve merge conflict

* update spike project's engines / regen v3 lockfiles

* regenerate lock files

* add missing node engines

* add missing useToast (bad merge)

* updates from underlying template-retail-react-app

* drop unnecessary pages/product-detail override

* fix dupe useToast

* progress on making `charles-solution` work

* initial pass at migration to `resolver.getHook('resolve').tapAsync` working, TODO next... cleanup

* restore icons file and add extensible text to home

* add some comments and construct hashmap in new plugin

* working glob sync lookup??

* resolve lookup when there is no extension

* add component slot for testing

* fix some lookup errors

* migrate to new directory

* remove unnecessary directory nesting, remove unnecessary files for "minimum file project"

* add example of extending routes non-destructively, add example of quickly toggling some base constant values (e.g. categories shown on home page)

* Update example route

* add some demo examples of overrides

* cleanup

* commit package name change

* rewrite requests coming from underlying template

* cleanup

* rename plugin file

* remove unnecessary build files

* rename to overrides

* fix lookup errors

* fix some broken upstream changes, eslint fixes

* fix bad merge conflict

* Bring back the deleted package.json

* Install new eslint plugin

* No more relative imports in retail-react-app

* Create .prettierrc.yaml

* restore other deleted package lockfiles

* fix some eslint issues

* remove `^` imports and begin migrating logic away from previous API. TODO: get webpack to resolve `retail-react-app` base import path from within `template-retail-react-app`

* bring back deleted package lockfiles

* short circuit plugin temporarily, get webpack `alias` working for template to resolve self-referencing `retail-react-app` imports

* fix unreachable condition

* wow... freaking works 🚀

* cleanup, get `template-retail-react-app` working again

* cleanup

* Create .eslintrc.js

* fix routes.jsx which no longer pulled relative template

* make routes.jsx more concise

* update lockfiles

* add jsconfig.json for IDEs to have magic `retail-react-app` be discoverable

* more cleanup

* change package.json key from `mobify` => `ccExtensibility`

* cleanup

* Final cleanup, remove console.logs, make `extendable` dynamic for internal file resolution in `template-retail-react-app` (and future projects), remove some non-required files,

* fix straggler non-dynamic filepath

* cleanup

* remove code that shouldn't be in v3+

* bump-version script ignores the retail-react-app

* See if this `--pre-dist-tag` works as expected

* Clean up code

* Add todo

* sync package.json deps in extended example project

* cleanup / pr feedback

* Update npm scripts

* Disable `npm install` step

* List the packages' versions for easy review

* Fix bug with versioning the root package file

* A bit of refactoring

* Some clean up

* pr feedback, great catch @kevinxh

* fix problem with bad copy from underlying template file

* pr feedback / cleanup

* cleanup

Co-authored-by: Kevin He <kevin.he@salesforce.com>

* Update package-lock.json

* WIP

* drop unneeded complexity

* lockfiles

* moving toward an array of `alias`es

* Generator: try downloading retail-react-app@latest from npm

* Some refactoring

* Refactor template extensibility functionality to use `resolve.alias` + greatly reduce code footprint + make leading slash optional in `ccExtensibility.overridesDir`

* Tweak the versioning logic

* These are optional options

* Use a new npm tag for testing purpose

* add brand-logo with no clash for server side viewBox

* add `request-processor.js` (required for worker.js to load) and fix bad extensibility path loading in `build-dev-server.js`

* Add some comments

* Install shelljs

* retail-react-app: version updates scoped to this directory only

* Update versioning logic in the root

* retail-react-app: simplify the versioning logic

* fake sdk release v3

* fake release of retail-react-app v1

* lint fix

* fix failing pwa-kit-react-sdk tests

* cleanup

* regen package lockfiles

* lint:fix

* Explore publishing certain packages only

* Revert "fake release of retail-react-app v1"

This reverts commit f8dcaa0.

* Revert "fake sdk release v3"

This reverts commit 3aad2da.

* fix failing tests in CI re: `TextDecoder is not defined`

* take 2 attempting to fix TextDecoder global in jest

* fix jest module mapper

* fix jest moduleMapper config

* REALLY fix jest moduleNameMapper config for new pathing + fix node `util` global TextDecoder is not defined in jest

* add brand-logo

* remove previously added `AbovePDP` Template Hook component

* replay #1128 from bad merge

* eslint:fix for `retail-react-app` base paths

* de-duplicate deps in bundle

* fix path defaulting, don't pass nullish value to path.resolve

* improve pathing for overridesDir in pwa-kit-dev webapack config + add missing worker/main.js

* fix pathing

* fix pathing issue that was mysteriously UNFIXED

* fix `worker.js` path

* Now also increment the pre-release version of the templates

* Now allows for publishing one package only to npm

* fix app/static pathing in non-extensible builds

* Make sure Lerna uses the exact versions (without carrot)

* Update package.json

* What I expect to see from Ben's work

* Some refactoring

* Scale to multiple independent packages

* Make sure version updates are synced throughout

* Some refactoring

* Remove commented lines

* No need to do version-pinning ourselves

Because we now call `lerna version --exact`.

* Add eslint and prettier

* Move script to allow reuse by future templates

* [Extensibility] Remove Einstein proxy and send Einstein events directly from app (#1202)

* Remove Einstein proxy and send Einstein events directly from app

* Update ssrParameters

* Replace ExtendsCircularImportsPlugin with OverridesResolverPlugin (#1211)

* Replace ExtendsCircularImportsPlugin with OverridesResolverPlugin

* fix filepath problem

---------

Co-authored-by: Brian Feister <bfeister@salesforce.com>

* Move `npm install` to the publishing step

* Update console log

* Prep for fixing a bug

* Updating a package version checks deps in other packages

* remove irrelevant bundlesize check to pass CI

* Extract shared util functions

* Consistency: add newline to EOF

* Get the name of the current package

* Fix `vendor.js` inclusion of `retail-react-app` files (#1198)

* fix duplicate lilbs in bundle

* fix app/static pathing for non-extensible builds

* oof, fix extensible app/static filepaths

* Resolve conflicting npm deps via `resolve.alias`

* add missing worker/main.js

* cleanup unused imports

* WIP, add list of original overridable deps

* prevent template extensibility vendor.js from treating baseline route files as deps in vendor.js

* fix irrelevant bundlesize declaration to pass CI

* drop test:max-file-size test from my-extended-retail-app

* replace relative with absolute path fetchTranslations (#1215)

Co-authored-by: Brian Feister <47546998+bfeister@users.noreply.github.com>

* For now, make this package private

It's going to be deleted anyways in the near-future.

* Iterate over the other packages only

* Exclude these npm scripts from the smoke test

* Handle scenario of an SDK package with independent version

* Refactor for unit testing, fix pathing issue from old version of file parsing algoritihim

* Add a 'sync' version of the script

* Tweak conditions

* Some refactoring

* Some refactoring

* Script to run a local npm registry

* Add todos for bug fixes

* Verify where the npm registry is

* Ignore this linting error

* Update regex

* Add comments

* Checks for clean working tree

* Handle uncommitted changes

* Make sure to update the package lock files

* If error, make sure to still clean up

* Install from the root

* Some refactoring

* No longer needing this install step

Now that we've run install in earlier steps.

* For safety

* If not on CI, make sure to publish to local npm

In order to avoid accidental publishing to remote npm registry.

* Only exit if there's an error

* remove demo extensible app in light of soon-to-be-merged PR from @bendvc

* lockfiles from reaact18 / chakra2

* Feature/template extensibility (#1162)

* initial work on moving code to use resolver

* fix getoverridepath and break on ^ imports

* add todos and comments

* rewrite requestcontext.request for path with caret

* perform overrideshashmap lookup for relative import

* progress

* progress

* regenerate lock files

* fix dupe useToast

* progress on making `charles-solution` work

* initial pass at migration to `resolver.getHook('resolve').tapAsync` working, TODO next... cleanup

* restore icons file and add extensible text to home

* add some comments and construct hashmap in new plugin

* working glob sync lookup??

* resolve lookup when there is no extension

* add component slot for testing

* fix some lookup errors

* cleanup

* rewrite requests coming from underlying template

* cleanup

* rename plugin file

* remove unnecessary build files

* rename to overrides

* fix lookup errors

* fix some broken upstream changes, eslint fixes

* Bring back the deleted package.json

* Install new eslint plugin

* No more relative imports in retail-react-app

* Create .prettierrc.yaml

* restore other deleted package lockfiles

* fix some eslint issues

* remove `^` imports and begin migrating logic away from previous API. TODO: get webpack to resolve `retail-react-app` base import path from within `template-retail-react-app`

* short circuit plugin temporarily, get webpack `alias` working for template to resolve self-referencing `retail-react-app` imports

* fix unreachable condition

* wow... freaking works 🚀

* cleanup, get `template-retail-react-app` working again

* cleanup

* Create .eslintrc.js

* fix routes.jsx which no longer pulled relative template

* make routes.jsx more concise

* update lockfiles

* add jsconfig.json for IDEs to have magic `retail-react-app` be discoverable

* more cleanup

* change package.json key from `mobify` => `ccExtensibility`

* cleanup

* Final cleanup, remove console.logs, make `extendable` dynamic for internal file resolution in `template-retail-react-app` (and future projects), remove some non-required files,

* fix straggler non-dynamic filepath

* cleanup

* remove code that shouldn't be in v3+

* sync package.json deps in extended example project

* cleanup / pr feedback

* pr feedback, great catch @kevinxh

* fix problem with bad copy from underlying template file

* pr feedback / cleanup

* cleanup

Co-authored-by: Kevin He <kevin.he@salesforce.com>

* Update package-lock.json

* WIP

* drop unneeded complexity

* lockfiles

* moving toward an array of `alias`es

* Refactor template extensibility functionality to use `resolve.alias` + greatly reduce code footprint + make leading slash optional in `ccExtensibility.overridesDir`

* add brand-logo with no clash for server side viewBox

* add `request-processor.js` (required for worker.js to load) and fix bad extensibility path loading in `build-dev-server.js`

* lint fix

* fix failing pwa-kit-react-sdk tests

* cleanup

* lint:fix

* fix failing tests in CI re: `TextDecoder is not defined`

* take 2 attempting to fix TextDecoder global in jest

* fix jest module mapper

* fix jest moduleMapper config

* REALLY fix jest moduleNameMapper config for new pathing + fix node `util` global TextDecoder is not defined in jest

* add brand-logo

* remove previously added `AbovePDP` Template Hook component

* replay #1128 from bad merge

* eslint:fix for `retail-react-app` base paths

* de-duplicate deps in bundle

* fix path defaulting, don't pass nullish value to path.resolve

* improve pathing for overridesDir in pwa-kit-dev webapack config + add missing worker/main.js

* fix pathing

* fix pathing issue that was mysteriously UNFIXED

* fix `worker.js` path

* fix app/static pathing in non-extensible builds

* [Extensibility] Remove Einstein proxy and send Einstein events directly from app (#1202)

* Remove Einstein proxy and send Einstein events directly from app

* Update ssrParameters

* Replace ExtendsCircularImportsPlugin with OverridesResolverPlugin (#1211)

* Replace ExtendsCircularImportsPlugin with OverridesResolverPlugin

* fix filepath problem

---------

Co-authored-by: Brian Feister <bfeister@salesforce.com>

* remove irrelevant bundlesize check to pass CI

* Fix `vendor.js` inclusion of `retail-react-app` files (#1198)

* fix duplicate lilbs in bundle

* fix app/static pathing for non-extensible builds

* oof, fix extensible app/static filepaths

* Resolve conflicting npm deps via `resolve.alias`

* add missing worker/main.js

* cleanup unused imports

* WIP, add list of original overridable deps

* prevent template extensibility vendor.js from treating baseline route files as deps in vendor.js

* fix irrelevant bundlesize declaration to pass CI

* drop test:max-file-size test from my-extended-retail-app

* replace relative with absolute path fetchTranslations (#1215)

Co-authored-by: Brian Feister <47546998+bfeister@users.noreply.github.com>

* Refactor for unit testing, fix pathing issue from old version of file parsing algoritihim

* fix merge conflict resolution

* remove template extensible demo in prep for @bendvc's pr for generator work

* regen lockfiles for react 18 changes

* fix linting

---------

Co-authored-by: yunakim714 <yunakim@salesforce.com>
Co-authored-by: Vincent Marta <vmarta@salesforce.com>
Co-authored-by: Kevin He <kevin.he@salesforce.com>
Co-authored-by: vcua-mobify <vcua@salesforce.com>
Co-authored-by: vcua-mobify <47404250+vcua-mobify@users.noreply.github.com>
Co-authored-by: Alex Vuong <52219283+alexvuong@users.noreply.github.com>
Co-authored-by: Alex Vuong <alex.vuong@salesforce.com>

* support windows file paths

* Remove package

* Make sure versions are all 3.0.0-dev

* Update package lock files

* Follow up to recent merge conflicts

* Revert these changes to the generator

* Fix issue with failed tests because of react query dev tools

* Let the output of `npm version` pass through

* Revert "Let the output of `npm version` pass through"

This reverts commit 33b3058.

* Make sure to `npm install` after updating dependencies

* Prepare to consolidate all of the versioning scripts

And move them to the root of monorepo.

* Move the rest of scripts into the monorepo root

* commerce-sdk-react now has its own version

* Use correct package name

* Add todos

* Reconsider where to do `npm install`

* Clean up

* Remove todo

* Remove unused dependency

* Some code cleanup

* Move the versioning scripts into their own folder

* Delete run-local-npm.js

---------

Co-authored-by: Brian Feister <bfeister@salesforce.com>
Co-authored-by: yunakim714 <yunakim@salesforce.com>
Co-authored-by: Yuna Kim <84923642+yunakim714@users.noreply.github.com>
Co-authored-by: Brian Feister <47546998+bfeister@users.noreply.github.com>
Co-authored-by: Kevin He <kevin.he@salesforce.com>
Co-authored-by: vcua-mobify <vcua@salesforce.com>
Co-authored-by: vcua-mobify <47404250+vcua-mobify@users.noreply.github.com>
Co-authored-by: Alex Vuong <52219283+alexvuong@users.noreply.github.com>
Co-authored-by: Alex Vuong <alex.vuong@salesforce.com>
Co-authored-by: Ben Chypak <bchypak@salesforce.com>
bfeister added a commit that referenced this pull request May 30, 2023
* rewrite requestcontext.request for path with caret

* perform overrideshashmap lookup for relative import

* progress

* fix conflicts

* fix package lockfiles that were out of sync

* Revert "fix package lockfiles that were out of sync"

This reverts commit 7f3c364.

* progress

* fix out of sync lockfiles

* merge conflict

* resolve merge conflict

* update spike project's engines / regen v3 lockfiles

* regenerate lock files

* add missing node engines

* add missing useToast (bad merge)

* updates from underlying template-retail-react-app

* drop unnecessary pages/product-detail override

* fix dupe useToast

* progress on making `charles-solution` work

* initial pass at migration to `resolver.getHook('resolve').tapAsync` working, TODO next... cleanup

* restore icons file and add extensible text to home

* add some comments and construct hashmap in new plugin

* working glob sync lookup??

* resolve lookup when there is no extension

* add component slot for testing

* fix some lookup errors

* migrate to new directory

* remove unnecessary directory nesting, remove unnecessary files for "minimum file project"

* add example of extending routes non-destructively, add example of quickly toggling some base constant values (e.g. categories shown on home page)

* Update example route

* add some demo examples of overrides

* cleanup

* commit package name change

* rewrite requests coming from underlying template

* cleanup

* rename plugin file

* remove unnecessary build files

* rename to overrides

* fix lookup errors

* fix some broken upstream changes, eslint fixes

* fix bad merge conflict

* Bring back the deleted package.json

* Install new eslint plugin

* No more relative imports in retail-react-app

* Create .prettierrc.yaml

* restore other deleted package lockfiles

* fix some eslint issues

* remove `^` imports and begin migrating logic away from previous API. TODO: get webpack to resolve `retail-react-app` base import path from within `template-retail-react-app`

* bring back deleted package lockfiles

* short circuit plugin temporarily, get webpack `alias` working for template to resolve self-referencing `retail-react-app` imports

* fix unreachable condition

* wow... freaking works 🚀

* cleanup, get `template-retail-react-app` working again

* cleanup

* Create .eslintrc.js

* fix routes.jsx which no longer pulled relative template

* make routes.jsx more concise

* update lockfiles

* add jsconfig.json for IDEs to have magic `retail-react-app` be discoverable

* more cleanup

* change package.json key from `mobify` => `ccExtensibility`

* cleanup

* Final cleanup, remove console.logs, make `extendable` dynamic for internal file resolution in `template-retail-react-app` (and future projects), remove some non-required files,

* fix straggler non-dynamic filepath

* cleanup

* remove code that shouldn't be in v3+

* bump-version script ignores the retail-react-app

* See if this `--pre-dist-tag` works as expected

* Clean up code

* Add todo

* sync package.json deps in extended example project

* cleanup / pr feedback

* Update npm scripts

* Disable `npm install` step

* List the packages' versions for easy review

* Fix bug with versioning the root package file

* A bit of refactoring

* Some clean up

* pr feedback, great catch @kevinxh

* fix problem with bad copy from underlying template file

* pr feedback / cleanup

* cleanup

Co-authored-by: Kevin He <kevin.he@salesforce.com>

* Update package-lock.json

* WIP

* drop unneeded complexity

* lockfiles

* moving toward an array of `alias`es

* Generator: try downloading retail-react-app@latest from npm

* Some refactoring

* Refactor template extensibility functionality to use `resolve.alias` + greatly reduce code footprint + make leading slash optional in `ccExtensibility.overridesDir`

* Tweak the versioning logic

* These are optional options

* Use a new npm tag for testing purpose

* add brand-logo with no clash for server side viewBox

* add `request-processor.js` (required for worker.js to load) and fix bad extensibility path loading in `build-dev-server.js`

* Add some comments

* Install shelljs

* retail-react-app: version updates scoped to this directory only

* Update versioning logic in the root

* retail-react-app: simplify the versioning logic

* fake sdk release v3

* fake release of retail-react-app v1

* lint fix

* fix failing pwa-kit-react-sdk tests

* cleanup

* regen package lockfiles

* lint:fix

* Explore publishing certain packages only

* Revert "fake release of retail-react-app v1"

This reverts commit f8dcaa0.

* Revert "fake sdk release v3"

This reverts commit 3aad2da.

* fix failing tests in CI re: `TextDecoder is not defined`

* take 2 attempting to fix TextDecoder global in jest

* fix jest module mapper

* fix jest moduleMapper config

* REALLY fix jest moduleNameMapper config for new pathing + fix node `util` global TextDecoder is not defined in jest

* add brand-logo

* remove previously added `AbovePDP` Template Hook component

* replay #1128 from bad merge

* eslint:fix for `retail-react-app` base paths

* de-duplicate deps in bundle

* fix path defaulting, don't pass nullish value to path.resolve

* improve pathing for overridesDir in pwa-kit-dev webapack config + add missing worker/main.js

* fix pathing

* fix pathing issue that was mysteriously UNFIXED

* fix `worker.js` path

* Now also increment the pre-release version of the templates

* Now allows for publishing one package only to npm

* fix app/static pathing in non-extensible builds

* Make sure Lerna uses the exact versions (without carrot)

* Update package.json

* What I expect to see from Ben's work

* Some refactoring

* Scale to multiple independent packages

* Make sure version updates are synced throughout

* Some refactoring

* Remove commented lines

* No need to do version-pinning ourselves

Because we now call `lerna version --exact`.

* Add eslint and prettier

* Move script to allow reuse by future templates

* [Extensibility] Remove Einstein proxy and send Einstein events directly from app (#1202)

* Remove Einstein proxy and send Einstein events directly from app

* Update ssrParameters

* Replace ExtendsCircularImportsPlugin with OverridesResolverPlugin (#1211)

* Replace ExtendsCircularImportsPlugin with OverridesResolverPlugin

* fix filepath problem

---------

Co-authored-by: Brian Feister <bfeister@salesforce.com>

* Move `npm install` to the publishing step

* Update console log

* Prep for fixing a bug

* Updating a package version checks deps in other packages

* remove irrelevant bundlesize check to pass CI

* Extract shared util functions

* Consistency: add newline to EOF

* Get the name of the current package

* Fix `vendor.js` inclusion of `retail-react-app` files (#1198)

* fix duplicate lilbs in bundle

* fix app/static pathing for non-extensible builds

* oof, fix extensible app/static filepaths

* Resolve conflicting npm deps via `resolve.alias`

* add missing worker/main.js

* cleanup unused imports

* WIP, add list of original overridable deps

* prevent template extensibility vendor.js from treating baseline route files as deps in vendor.js

* fix irrelevant bundlesize declaration to pass CI

* drop test:max-file-size test from my-extended-retail-app

* replace relative with absolute path fetchTranslations (#1215)

Co-authored-by: Brian Feister <47546998+bfeister@users.noreply.github.com>

* For now, make this package private

It's going to be deleted anyways in the near-future.

* Iterate over the other packages only

* Exclude these npm scripts from the smoke test

* Handle scenario of an SDK package with independent version

* Refactor for unit testing, fix pathing issue from old version of file parsing algoritihim

* Add a 'sync' version of the script

* Tweak conditions

* Some refactoring

* Some refactoring

* Script to run a local npm registry

* Add todos for bug fixes

* Verify where the npm registry is

* Ignore this linting error

* Update regex

* Add comments

* Checks for clean working tree

* Handle uncommitted changes

* Make sure to update the package lock files

* If error, make sure to still clean up

* Install from the root

* Some refactoring

* No longer needing this install step

Now that we've run install in earlier steps.

* For safety

* If not on CI, make sure to publish to local npm

In order to avoid accidental publishing to remote npm registry.

* Only exit if there's an error

* remove demo extensible app in light of soon-to-be-merged PR from @bendvc

* lockfiles from reaact18 / chakra2

* Feature/template extensibility (#1162)

* initial work on moving code to use resolver

* fix getoverridepath and break on ^ imports

* add todos and comments

* rewrite requestcontext.request for path with caret

* perform overrideshashmap lookup for relative import

* progress

* progress

* regenerate lock files

* fix dupe useToast

* progress on making `charles-solution` work

* initial pass at migration to `resolver.getHook('resolve').tapAsync` working, TODO next... cleanup

* restore icons file and add extensible text to home

* add some comments and construct hashmap in new plugin

* working glob sync lookup??

* resolve lookup when there is no extension

* add component slot for testing

* fix some lookup errors

* cleanup

* rewrite requests coming from underlying template

* cleanup

* rename plugin file

* remove unnecessary build files

* rename to overrides

* fix lookup errors

* fix some broken upstream changes, eslint fixes

* Bring back the deleted package.json

* Install new eslint plugin

* No more relative imports in retail-react-app

* Create .prettierrc.yaml

* restore other deleted package lockfiles

* fix some eslint issues

* remove `^` imports and begin migrating logic away from previous API. TODO: get webpack to resolve `retail-react-app` base import path from within `template-retail-react-app`

* short circuit plugin temporarily, get webpack `alias` working for template to resolve self-referencing `retail-react-app` imports

* fix unreachable condition

* wow... freaking works 🚀

* cleanup, get `template-retail-react-app` working again

* cleanup

* Create .eslintrc.js

* fix routes.jsx which no longer pulled relative template

* make routes.jsx more concise

* update lockfiles

* add jsconfig.json for IDEs to have magic `retail-react-app` be discoverable

* more cleanup

* change package.json key from `mobify` => `ccExtensibility`

* cleanup

* Final cleanup, remove console.logs, make `extendable` dynamic for internal file resolution in `template-retail-react-app` (and future projects), remove some non-required files,

* fix straggler non-dynamic filepath

* cleanup

* remove code that shouldn't be in v3+

* sync package.json deps in extended example project

* cleanup / pr feedback

* pr feedback, great catch @kevinxh

* fix problem with bad copy from underlying template file

* pr feedback / cleanup

* cleanup

Co-authored-by: Kevin He <kevin.he@salesforce.com>

* Update package-lock.json

* WIP

* drop unneeded complexity

* lockfiles

* moving toward an array of `alias`es

* Refactor template extensibility functionality to use `resolve.alias` + greatly reduce code footprint + make leading slash optional in `ccExtensibility.overridesDir`

* add brand-logo with no clash for server side viewBox

* add `request-processor.js` (required for worker.js to load) and fix bad extensibility path loading in `build-dev-server.js`

* lint fix

* fix failing pwa-kit-react-sdk tests

* cleanup

* lint:fix

* fix failing tests in CI re: `TextDecoder is not defined`

* take 2 attempting to fix TextDecoder global in jest

* fix jest module mapper

* fix jest moduleMapper config

* REALLY fix jest moduleNameMapper config for new pathing + fix node `util` global TextDecoder is not defined in jest

* add brand-logo

* remove previously added `AbovePDP` Template Hook component

* replay #1128 from bad merge

* eslint:fix for `retail-react-app` base paths

* de-duplicate deps in bundle

* fix path defaulting, don't pass nullish value to path.resolve

* improve pathing for overridesDir in pwa-kit-dev webapack config + add missing worker/main.js

* fix pathing

* fix pathing issue that was mysteriously UNFIXED

* fix `worker.js` path

* fix app/static pathing in non-extensible builds

* [Extensibility] Remove Einstein proxy and send Einstein events directly from app (#1202)

* Remove Einstein proxy and send Einstein events directly from app

* Update ssrParameters

* Replace ExtendsCircularImportsPlugin with OverridesResolverPlugin (#1211)

* Replace ExtendsCircularImportsPlugin with OverridesResolverPlugin

* fix filepath problem

---------

Co-authored-by: Brian Feister <bfeister@salesforce.com>

* remove irrelevant bundlesize check to pass CI

* Fix `vendor.js` inclusion of `retail-react-app` files (#1198)

* fix duplicate lilbs in bundle

* fix app/static pathing for non-extensible builds

* oof, fix extensible app/static filepaths

* Resolve conflicting npm deps via `resolve.alias`

* add missing worker/main.js

* cleanup unused imports

* WIP, add list of original overridable deps

* prevent template extensibility vendor.js from treating baseline route files as deps in vendor.js

* fix irrelevant bundlesize declaration to pass CI

* drop test:max-file-size test from my-extended-retail-app

* replace relative with absolute path fetchTranslations (#1215)

Co-authored-by: Brian Feister <47546998+bfeister@users.noreply.github.com>

* Refactor for unit testing, fix pathing issue from old version of file parsing algoritihim

* fix merge conflict resolution

* remove template extensible demo in prep for @bendvc's pr for generator work

* regen lockfiles for react 18 changes

* fix linting

---------

Co-authored-by: yunakim714 <yunakim@salesforce.com>
Co-authored-by: Vincent Marta <vmarta@salesforce.com>
Co-authored-by: Kevin He <kevin.he@salesforce.com>
Co-authored-by: vcua-mobify <vcua@salesforce.com>
Co-authored-by: vcua-mobify <47404250+vcua-mobify@users.noreply.github.com>
Co-authored-by: Alex Vuong <52219283+alexvuong@users.noreply.github.com>
Co-authored-by: Alex Vuong <alex.vuong@salesforce.com>

* support windows file paths

* Remove package

* Make sure versions are all 3.0.0-dev

* Update package lock files

* Follow up to recent merge conflicts

* Revert these changes to the generator

* Fix issue with failed tests because of react query dev tools

* Let the output of `npm version` pass through

* Revert "Let the output of `npm version` pass through"

This reverts commit 33b3058.

* Make sure to `npm install` after updating dependencies

* Prepare to consolidate all of the versioning scripts

And move them to the root of monorepo.

* Move the rest of scripts into the monorepo root

* commerce-sdk-react now has its own version

* Use correct package name

* Add todos

* Reconsider where to do `npm install`

* Clean up

* Remove todo

* Remove unused dependency

* Some code cleanup

* Move the versioning scripts into their own folder

* Namespace all public packages with '@salesforce'

* Point to @salesforce/commerce-sdk-react

* Point to @salesforce/pwa-kit-dev

* Point to @salesforce/pwa-kit-react-sdk

* Point to @salesforce/pwa-kit-runtime

* Point to @salesforce/pwa-kit-create-app

* Update package locks

* Linting fix

* commerce-sdk-react@1.0.0-dev

* retail-react-app@1.0.0-dev

* Update `bin` field

* Update action.yml

* Fix source for templates on npm

* Comment out the check-dependencies.js for now

* Update "extendable" value

* Lint

* Fix jest module mapper

* Fix retail test app using wrong source and id

* Handle salesforce namespace in package name

* Add '@salesforce' to the prefix

---------

Co-authored-by: yunakim714 <yunakim@salesforce.com>
Co-authored-by: Brian Feister <bfeister@salesforce.com>
Co-authored-by: Brian Feister <47546998+bfeister@users.noreply.github.com>
Co-authored-by: Kevin He <kevin.he@salesforce.com>
Co-authored-by: vcua-mobify <vcua@salesforce.com>
Co-authored-by: vcua-mobify <47404250+vcua-mobify@users.noreply.github.com>
Co-authored-by: Alex Vuong <52219283+alexvuong@users.noreply.github.com>
Co-authored-by: Alex Vuong <alex.vuong@salesforce.com>
Co-authored-by: Ben Chypak <bchypak@salesforce.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants