Skip to content

Commit

Permalink
Merge branch 'develop' into feature/GH-12789
Browse files Browse the repository at this point in the history
  • Loading branch information
Platonn authored Jun 18, 2021
2 parents 59b031e + d9842af commit 0c2235b
Show file tree
Hide file tree
Showing 39 changed files with 300 additions and 51 deletions.
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@
"args": ["add", "@spartacus/schematics@latest"],
"console": "integratedTerminal",
"outFiles": ["${workspaceFolder}/**/*.js"]
},

// to debug a schematics Jest test, make sure that a spec.ts file is currently opened.
{
"type": "node",
"request": "launch",
"name": "Debug project/schematics Jest test",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"${fileBasenameNoExtension}",
"--config",
"projects/schematics/jest.schematics.config.js"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true
}
]
}
38 changes: 36 additions & 2 deletions docs/migration/4_0.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,40 @@ Lib: @spartacus/core
Class: UserAddressService
Change: Two new required constructor parameters `userAddressConnector: UserAddressConnector` and `command: CommandService`
## New Checkout Library
Spartacus 4.0 introduces the checkout library. The checkout related code is moved out of `@spartacus/core` and `@spartacus/storefrontlib` into one of the checkout lib's entry points. The checkout library is split into these entry points:
```
@spartacus/checkout/assets
( checkout related i18n keys are moved here )

@spartacus/checkout/components
( checkout related UI codee is moved here. This includes components, guards and ui services )

@spartacus/checkout/core
The checkout facade API implementation are moved here, as well as connectors, event builder, event listener, models, other services, and state management.

@spartacus/checkout/occ
The checkout related OCC code is moved here. This includes the checkout related adapters and converters.

@spartacus/checkout/root
The root entry point is, by convention, meant to always be eager loaded. It contains the config, events, facades, http interceptors and models.

@spartacus/checkout/styles
The checkout related scss styles are moved here.

```
Most of the code is moved unchanged, but some classes required changes after they were moved. See the section below for the list:
## (start) Changes in the classes carried over to the @spartacus/checkout lib
### CheckoutEventModule
Class: CheckoutEventModule
Change: One new required constructor parameters `_checkoutEventListener: CheckoutEventListener`
### PaymentFormComponent
Class: PaymentFormComponent
Changes:
- PaymentFormComponent does not implement `OnDestroy` anymore
- method `ngOnDestroy()` removed.
Expand Down Expand Up @@ -619,6 +645,10 @@ The display of the guest checkout button relies on the presence of the `forced`
- `platformId` is now required constructor dependency.
### ProductListComponentService
- `ProductListComponentService` now also requires `ViewConfig`.
- The `defaultPageSize` property was removed. To modify default page size use `provideConfig(<ViewConfig>{ view: { defaultPageSize: <your_default_page_size_value }})` in module.
### Product configurator
`ConfiguratorCartEntryInfoComponent` now also requires `CommonConfiguratorUtilsService`.
Expand Down Expand Up @@ -717,6 +747,10 @@ What was removed:
- configuration (`storageSync` from `StateConfig`)
- default config and default keys (`defaultStateConfig`, `DEFAULT_LOCAL_STORAGE_KEY` and `DEFAULT_SESSION_STORAGE_KEY`)
### DefaultScrollConfig
- `defaultScrollConfig` was renamed to `defaultViewConfig`
### LanguageService
- `LanguageService` no longer uses `WindowRef`. The language initialization from the state was moved to `LanguageInitializer`.
Expand Down
2 changes: 1 addition & 1 deletion feature-libs/asm/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
2 changes: 1 addition & 1 deletion feature-libs/cart/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
2 changes: 1 addition & 1 deletion feature-libs/checkout/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
2 changes: 1 addition & 1 deletion feature-libs/organization/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},

Expand Down
2 changes: 1 addition & 1 deletion feature-libs/product/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
2 changes: 1 addition & 1 deletion feature-libs/qualtrics/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
2 changes: 1 addition & 1 deletion feature-libs/smartedit/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
2 changes: 1 addition & 1 deletion feature-libs/storefinder/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
2 changes: 1 addition & 1 deletion feature-libs/tracking/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
2 changes: 1 addition & 1 deletion feature-libs/user/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
2 changes: 1 addition & 1 deletion integration-libs/cdc/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
2 changes: 1 addition & 1 deletion integration-libs/cds/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
2 changes: 1 addition & 1 deletion projects/schematics/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
}
},
collectCoverage: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ import { UNIT_USER_LIST_COMPONENT_MIGRATION } from './data/unit-user-list.compon
import { USER_ADDRESS_SERVICE_MIGRATION } from './data/user-address-service.migration';
import { USER_GROUP_USER_LIST_COMPONENT_MIGRATION } from './data/user-group-user-list.component.migration';
import { WINDOW_REF_MIGRATION } from './data/window-ref.migration';
import { PRODUCT_LIST_COMPONENT_SERVICE_MIGRATION } from './data/product-list-component.service.migration';

export const CONSTRUCTOR_DEPRECATION_DATA: ConstructorDeprecation[] = [
UNIT_CHILDREN_COMPONENT_MIGRATION,
Expand Down Expand Up @@ -195,6 +196,7 @@ export const CONSTRUCTOR_DEPRECATION_DATA: ConstructorDeprecation[] = [
AUTH_REDIRECT_SERVICE_MIGRATION,
PROTECTED_ROUTES_SERVICE_MIGRATION,
PRODUCT_LIST_ITEM_COMPONENT_MIGRATION,
PRODUCT_LIST_COMPONENT_SERVICE_MIGRATION,
PRODUCT_GRID_ITEM_COMPONENT_MIGRATION,
CART_ITEM_COMPONENT_MIGRATION,
CONFIGURATOR_CART_ENTRY_INFO_COMPONENT_MIGRATION,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import {
ACTIVATED_ROUTE,
ANGULAR_ROUTER,
CURRENCY_SERVICE,
LANGUAGE_SERVICE,
PRODUCT_LIST_COMPONENT_SERVICE,
PRODUCT_SEARCH_SERVICE,
ROUTER,
ROUTING_SERVICE,
SPARTACUS_CORE,
SPARTACUS_STOREFRONTLIB,
VIEW_CONFIG,
} from '../../../../shared/constants';
import { ConstructorDeprecation } from '../../../../shared/utils/file-utils';

export const PRODUCT_LIST_COMPONENT_SERVICE_MIGRATION: ConstructorDeprecation = {
// projects/storefrontlib/src/cms-components/product/product-list/container/product-list-component.service.ts
class: PRODUCT_LIST_COMPONENT_SERVICE,
importPath: SPARTACUS_STOREFRONTLIB,
deprecatedParams: [
{
className: PRODUCT_SEARCH_SERVICE,
importPath: SPARTACUS_CORE,
},
{
className: ROUTING_SERVICE,
importPath: SPARTACUS_CORE,
},
{
className: ACTIVATED_ROUTE,
importPath: ANGULAR_ROUTER,
},
{
className: CURRENCY_SERVICE,
importPath: SPARTACUS_CORE,
},
{
className: LANGUAGE_SERVICE,
importPath: SPARTACUS_CORE,
},
{
className: ROUTER,
importPath: ANGULAR_ROUTER,
},
],
addParams: [
{
className: VIEW_CONFIG,
importPath: SPARTACUS_STOREFRONTLIB,
},
],
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {
DEFAULT_PAGE_SIZE,
PRODUCT_LIST_COMPONENT_SERVICE,
SPARTACUS_STOREFRONTLIB,
} from '../../../../shared/constants';
import { MethodPropertyDeprecation } from '../../../../shared/utils/file-utils';

// projects/storefrontlib/src/cms-components/product/product-list/container/product-list-component.service.ts

export const PRODUCT_LIST_COMPONENT_SERVICE_MIGRATION: MethodPropertyDeprecation[] = [
{
class: PRODUCT_LIST_COMPONENT_SERVICE,
importPath: SPARTACUS_STOREFRONTLIB,
deprecatedNode: DEFAULT_PAGE_SIZE,
comment: `Property '${DEFAULT_PAGE_SIZE}' was removed, to modify default page size use 'view.defaultPageSize' configuration property.`,
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
} from './data/occ-endpoints.service.migration';
import { ORDER_DETAIL_ITEMS_COMPONENT_MIGRATION } from './data/order-detail-items.component.migration';
import { PAGE_EVENT_BUILDER_MIGRATION } from './data/page-event.builder.ts.migration';
import { PRODUCT_LIST_COMPONENT_SERVICE_MIGRATION } from './data/product-list-component.service.migration';
import { ROUTING_SERVICE_MIGRATION } from './data/routing.service.ts.migration';
import { SELECTIVE_CART_SERVICE_MIGRATION } from './data/selective-cart.service.migration';

Expand All @@ -43,6 +44,7 @@ export const METHOD_PROPERTY_DATA: MethodPropertyDeprecation[] = [
...ORDER_DETAIL_ITEMS_COMPONENT_MIGRATION,
...ROUTING_SERVICE_MIGRATION,
...CONFIGURATOR_GROUP_MENU_COMPONENT_MIGRATION,
...PRODUCT_LIST_COMPONENT_SERVICE_MIGRATION,
];

export function migrate(): Rule {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ import { Rule, Tree } from '@angular-devkit/schematics';
import { RenamedSymbol } from '../../../shared/utils/file-utils';
import { migrateRenamedSymbols } from '../../mechanism/rename-symbol/rename-symbol';

export const RENAMED_SYMBOLS_DATA: RenamedSymbol[] = [];
export const RENAMED_SYMBOLS_DATA: RenamedSymbol[] = [
// projects/storefrontlib/src/cms-components/product/config/default-view-config.ts
{
previousNode: 'defaultScrollConfig',
previousImportPath: '@spartacus/storefront',
newNode: 'defaultViewConfig',
},
];

export function migrate(): Rule {
return (tree: Tree) => {
Expand Down
Loading

0 comments on commit 0c2235b

Please sign in to comment.