Skip to content

Commit

Permalink
Merge branch 'develop' into feature/CXSPA-8968
Browse files Browse the repository at this point in the history
  • Loading branch information
Larisa-Staroverova committed Jan 22, 2025
2 parents 04b2e7a + 7bdeb74 commit a57843b
Show file tree
Hide file tree
Showing 2,610 changed files with 92,584 additions and 29,361 deletions.
3 changes: 2 additions & 1 deletion .env-cmdrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"CX_BASE_URL": "https://api.cg79x9wuu9-eccommerc1-p1-public.model-t.myhybris.cloud"
},
"cds": {
"CX_CDS": "true"
"CX_CDS": "true",
"CX_SCI": "false"
},
"lighthouse": {
"CX_BASE_URL": "https://api.spartacus.rocks"
Expand Down
30 changes: 17 additions & 13 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,39 @@
"./tools/eslint-plugins/legacy-ng-cli-compat",
"./tools/eslint-plugins/legacy-ng-cli-compat--formatting-add-on"
],
"plugins": ["deprecation", "@typescript-eslint", "@nx"],
"plugins": ["deprecation", "@typescript-eslint", "@nx", "@stylistic/ts"],
"rules": {
"@angular-eslint/no-host-metadata-property": "off",
"@typescript-eslint/no-empty-interface": "off",
"deprecation/deprecation": "warn",
"prefer-arrow/prefer-arrow-functions": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/naming-convention": "off",
"space-before-function-paren": "off",
"@angular-eslint/no-input-rename": "off",
"curly": "off",
"no-var": "off",
"@typescript-eslint/ban-types": "off",
"jsdoc/newline-after-description": "off",
"no-shadow": "off",
"@typescript-eslint/no-shadow": "off",
"@typescript-eslint/no-unused-expressions": "off",
"@typescript-eslint/member-ordering": "off",
"arrow-body-style": "off",
"object-shorthand": "off",
"@typescript-eslint/prefer-for-of": "off",
"jsdoc/no-types": "off",
"no-fallthrough": "off",
"prefer-const": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/consistent-type-assertions": "off",
"@angular-eslint/use-lifecycle-interface": "error",
"@typescript-eslint/quotes": "off",
"@stylistic/ts/quotes": "off",
"@stylistic/ts/member-delimiter-style": [
"error",
{
"multiline": {
"delimiter": "semi",
"requireLast": true
},
"singleline": {
"delimiter": "semi",
"requireLast": false
}
}
],
"@stylistic/ts/semi": ["error", "always"],
"@stylistic/ts/type-annotation-spacing": "error",
"@angular-eslint/component-selector": [
"error",
{
Expand All @@ -58,7 +63,6 @@
}
],
"@typescript-eslint/consistent-type-definitions": "off",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
Expand Down
7 changes: 4 additions & 3 deletions .github/api-extractor-action/src/api-extractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,10 @@ async function copyApiExtractorConfig(targetDir: string): Promise<void> {
*
* @returns object with name and the newName
*/
function updateNameInPackageJson(
path: string
): { name: string; newName: string } {
function updateNameInPackageJson(path: string): {
name: string;
newName: string;
} {
const packageContent = JSON.parse(fs.readFileSync(path, 'utf-8'));
const name: string = packageContent.name;
const newName = name.replace(/\//g, '_').replace(/\_/, '/');
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,5 @@ Thumbs.db
**/git-ignore

.nx/cache
.nx/workspace-data

4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ feature-libs/smartedit/assets/webApplicationInjector.js
**/*.yml
coverage

/.nx/cache
/.nx/cache
/.nx/workspace-data
projects/storefrontstyles/vendor/**/*.scss
10 changes: 8 additions & 2 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@
"margin-inline"
],
"declaration-property-value-disallowed-list": {
"text-align": ["right", "left"]
"text-align": [
"right",
"left"
]
},
"scss/comment-no-loud": true
}
},
"ignoreFiles": [
"projects/storefrontstyles/vendor/**/*.scss"
]
}
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,3 @@ Many improvements are coming! All tasks will be posted to our GitHub issue track

Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the [LICENSE](LICENSE) file.

6 changes: 3 additions & 3 deletions core-libs/setup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
"tslib": "^2.8.1"
},
"peerDependencies": {
"@angular/core": "^17.0.5",
"@angular/ssr": "^17.0.5",
"@angular/core": "^18.2.9",
"@angular/ssr": "^18.2.9",
"@spartacus/cart": "2211.32.0",
"@spartacus/core": "2211.32.0",
"@spartacus/order": "2211.32.0",
"@spartacus/user": "2211.32.0"
},
"optionalDependencies": {
"@angular/platform-server": "^17.0.5",
"@angular/platform-server": "^18.2.9",
"express": "^4.21.2"
},
"publishConfig": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ exports[`CxCommonEngine should handle APP_INITIALIZER errors the standard Angula

exports[`CxCommonEngine should handle errors propagated from SSR 1`] = `"test error"`;

exports[`CxCommonEngine should not override providers passed to options 1`] = `"<html data-critters-container><head></head><body><cx-token ng-version="17.0.5" ng-server-context="ssr">message:test</cx-token></body></html>"`;
exports[`CxCommonEngine should not override providers passed to options 1`] = `"<html data-critters-container><head></head><body><cx-token ng-version="18.2.9" ng-server-context="ssr">message:test</cx-token></body></html>"`;

exports[`CxCommonEngine should return html if no errors 1`] = `"<html data-critters-container><head></head><body><cx-mock ng-version="17.0.5" ng-server-context="ssr">some template</cx-mock></body></html>"`;
exports[`CxCommonEngine should return html if no errors 1`] = `"<html data-critters-container><head></head><body><cx-mock ng-version="18.2.9" ng-server-context="ssr">some template</cx-mock></body></html>"`;
40 changes: 40 additions & 0 deletions docs/libs/creating-lib.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,46 @@ There are couple of required changes to make sure schematics will work properly
- `projects/storefrontapp/tsconfig.server.json`,
- `projects/storefrontapp/tsconfig.app.prod.json`
- add new feature lib schema.json elements in schematics folder - `feature-libs\<lib-name>\schematics\add-<lib-name>\schema.json` where the `lib-name` is the name of the new library
- if the library includes several features and some of them should be installed by default, add them to the `default` array (for 'no-interactive' mode) and add them `checked: true` flag (for interactive prompt). Please note the `Feature1` in the following example:
```json
{
"$schema": "http://json-schema.org/schema",
"id": "ExampleSchematics",
"title": "Example Schematics",
"type": "object",
"properties": {
"features": {
"type": "array",
"uniqueItems": true,
"default": ["Feature1"],
"items": {
"enum": [
"Feature1",
"Feature2",
],
"type": "string"
},
"x-prompt": {
"message": "Which features would you like to set up?",
"type": "list",
"items": [
{
"value": "Feature1",
"label": "Feature 1",
"checked": true
},
{
"value": "Feature2",
"label": "Feature 2",
},
]
}
},
...
}
}
```
Values from `x-prompt.items` with `checked: true` should reflect the features that will be installed by default in 'no-interactive' mode (`default` array).
- add new feature chain method to 'shouldAddFeature' and function to add it - `feature-libs\<lib-name>\schematics\add-<lib-name>\index.ts` where the `lib-name` is the name of the new library
- create new feature lib module in - `projects/storefrontapp/src/app/spartacus/features`
- create your schematics configuration in e.g. `projects/schematics/src/shared/lib-configs/asm-schematics-config.ts` and add it to the `projects/schematics/src/shared/schematics-config-mappings.ts` file.
Expand Down
76 changes: 76 additions & 0 deletions docs/migration/2211_ng18/bootstrap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Spartacus migration - Bootstrap

1. Uninstall Bootstrap
If the bootstrap package is still installed in your project, uninstall it to avoid conflicts. Use
the following command:
```npm uninstall bootstrap```
2. Update `styles.scss`
Modify the `styles.scss` file to integrate Spartacus styles along with Bootstrap. Proper import order is critical for
styles to be applied correctly.
### Steps to Update:
1. Place the following import for styles-config at the top of the file:
```@import 'styles-config';```
2. Add Spartacus core styles first. Importing Spartacus styles before Bootstrap ensures core styles load as a
priority.
3. Follow this by importing Bootstrap styles using the Bootstrap copy provided by Spartacus. Ensure the order of
Bootstrap imports matches the sequence below for consistency.
4. Conclude with the Spartacus index styles.


Final file structure should look like this:

```styles.scss
// ORDER IMPORTANT: Spartacus core first
@import '@spartacus/styles/scss/core';

// ORDER IMPORTANT: Bootstrap next
@import '@spartacus/styles/vendor/bootstrap/scss/reboot';
@import '@spartacus/styles/vendor/bootstrap/scss/type';
@import '@spartacus/styles/vendor/bootstrap/scss/grid';
@import '@spartacus/styles/vendor/bootstrap/scss/utilities';
@import '@spartacus/styles/vendor/bootstrap/scss/transitions';
@import '@spartacus/styles/vendor/bootstrap/scss/dropdown';
@import '@spartacus/styles/vendor/bootstrap/scss/card';
@import '@spartacus/styles/vendor/bootstrap/scss/nav';
@import '@spartacus/styles/vendor/bootstrap/scss/buttons';
@import '@spartacus/styles/vendor/bootstrap/scss/forms';
@import '@spartacus/styles/vendor/bootstrap/scss/custom-forms';
@import '@spartacus/styles/vendor/bootstrap/scss/modal';
@import '@spartacus/styles/vendor/bootstrap/scss/close';
@import '@spartacus/styles/vendor/bootstrap/scss/alert';
@import '@spartacus/styles/vendor/bootstrap/scss/tooltip';

@import '@spartacus/styles/index';
```
3. Individual imports.
If your application directly imports specific Bootstrap classes in any of your stylesheets, replace those imports with the corresponding Spartacus imports. For example:
```
// Original import
@import '~bootstrap/scss/reboot';
// Replace with
@import '@spartacus/styles/vendor/bootstrap/scss/reboot';
```

4. Some libraries have stopped importing Bootstrap-related styles. Instead, these styles should now be imported directly within the application. For example, the lib-cart.scss file should include the following imports:
```scss
// original imports
@import '../styles-config';
@import '@spartacus/cart';
// new imports
@import '@spartacus/styles/vendor/bootstrap/scss/functions';
@import '@spartacus/styles/vendor/bootstrap/scss/variables';
@import '@spartacus/styles/vendor/bootstrap/scss/_mixins';
```
Affected libraries:
- cart
- checkout
- organization
- pick-up-in-store
- product
- product-multi-dimensional
- qualtrics
- quote
- storefinder
- epd-visualization
- opf
38 changes: 38 additions & 0 deletions docs/migration/2211_ng18/migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# (EARLY NOTES) Migrating a custom app to use Spartacus with Angular v18

Before upgrading Spartacus to the new version with Angular 18, you need to first:
- upgrade to the latest 2211.x of Spartacus
- upgrade Angular to version v18

## Update Angular to 17 and 18

### Update Angular to 17 and 3rd party deps to be compatible with Angular 18

Follow the [Angular guidelines for upgrading from v17 to v18](https://angular.dev/update-guide?v=17.0-18.0&l=3) and bump the Angular version locally, and update other 3rd party dependencies from Angular ecosystem to versions compatible with Angular 18 (e.g. `@ng-select/ng-select@13`, `@ngrx/store@18`, `ngx-infinite-scroll@18`):

```bash
ng update @angular/core@18 @angular/cli@18 @ng-select/ng-select@13 @ngrx/store@18 ngx-infinite-scroll@18 --force
git add .
git commit -m "update angular 18 and 3rd party deps angular 18 compatible"
```
Note: Do not select `use-application-builder` migration when migrating to Angular 18. Applications created before SPA 2211.19 doesn't support this builder. Applications created starting from 2211.19 already supports it.

### Run Spartacus update

After successfully updating the application to Angular 18, execute this command to initiate the Spartacus update process.

```bash
ng update @spartacus/schematics@latest
```

### Adjust Angular configuration

Due to changes in Angular's application builder, for applications created starting from SPA 2211.19, you need to adjust the `angular.json` file to generate the `index.html` file in the `dist` folder. This is required for CCv2 to map `OCC_BACKEND_BASE_URL_VALUE` and `MEDIA_BACKEND_BASE_URL_VALUE` meta tags to the correct values. Unfortunately, this will contribute to pre-rendering to not work properly (which is a known issue)

```diff
- "index": "src/index.html"
+ "index": {
+ "input": "src/index.html",
+ "output": "index.html"
+ }
```
5 changes: 5 additions & 0 deletions docs/migration/2211_ng18/typescript-manual.doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changes in feature lib order

## MyAccountV2OrderHistoryService

Method `getOrderDetails` has been removed. Instead directly use `getOrderDetailsV2`.
16 changes: 16 additions & 0 deletions feature-libs/asm/assets/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,20 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { asmTranslationsEn } from './translations/translations';

export * from './translations/translations';

/**
* @deprecated Please use **specific language** translations (suffixed with language code) instead,
* like in the following example:
* ```diff
* i18n: {
* - resources: asmTranslations
* + resources: { en: asmTranslationsEn }
* }
* ```
*/
export const asmTranslations = {
en: asmTranslationsEn,
};
Loading

0 comments on commit a57843b

Please sign in to comment.