Skip to content

Commit

Permalink
Merge branch 'develop' into feature/CXSPA-8997
Browse files Browse the repository at this point in the history
  • Loading branch information
petarmarkov9449 authored Jan 27, 2025
2 parents 52922ce + 288ed01 commit 765fd33
Show file tree
Hide file tree
Showing 3,506 changed files with 108,956 additions and 40,845 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
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
32 changes: 18 additions & 14 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",
"@angular-eslint/prefer-standalone": "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.

15 changes: 12 additions & 3 deletions core-libs/setup/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@ const { defaultTransformerOptions } = require('jest-preset-angular/presets');
/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
module.exports = {
preset: 'jest-preset-angular',
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths || {}, {
prefix: '<rootDir>/',
}),
moduleNameMapper: {
...pathsToModuleNameMapper(compilerOptions.paths || {}, {
prefix: '<rootDir>/',
}),
// mapping required to use `beasties` from node modules that has proper ES module format
// instead of the version internalized by the Angular Team which file format is not supported
// by Jest.
// for more, see: https://github.com/angular/angular-cli/pull/28228
// and: https://github.com/angular/angular-cli/pull/28726
'^../third_party/beasties/index.js$':
'<rootDir>/../../node_modules/beasties',
},
setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
transform: {
'^.+\\.(ts|js|mjs|html|svg)$': [
Expand Down
16 changes: 8 additions & 8 deletions core-libs/setup/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spartacus/setup",
"version": "2211.32.0",
"version": "2211.35.0",
"description": "Includes features that makes Spartacus and it's setup easier and streamlined.",
"keywords": [
"spartacus",
Expand All @@ -19,15 +19,15 @@
"tslib": "^2.8.1"
},
"peerDependencies": {
"@angular/core": "^17.0.5",
"@angular/ssr": "^17.0.5",
"@spartacus/cart": "2211.32.0",
"@spartacus/core": "2211.32.0",
"@spartacus/order": "2211.32.0",
"@spartacus/user": "2211.32.0"
"@angular/core": "^19.0.3",
"@angular/ssr": "^19.0.4",
"@spartacus/cart": "2211.35.0",
"@spartacus/core": "2211.35.0",
"@spartacus/order": "2211.35.0",
"@spartacus/user": "2211.35.0"
},
"optionalDependencies": {
"@angular/platform-server": "^17.0.5",
"@angular/platform-server": "^19.0.3",
"express": "^4.21.2"
},
"publishConfig": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { CommonEngineOptions, CommonEngineRenderOptions } from '@angular/ssr';
import {
CommonEngineOptions,
CommonEngineRenderOptions,
} from '@angular/ssr/node';
import { NgSetupOptions } from '../engine/ng-express-engine';
import {
OptimizedSsrEngine,
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-beasties-container><head></head><body><cx-token ng-version="19.0.3" 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-beasties-container><head></head><body><cx-mock ng-version="19.0.3" ng-server-context="ssr">some template</cx-mock></body></html>"`;
8 changes: 7 additions & 1 deletion core-libs/setup/ssr/engine/cx-common-engine.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import { PROPAGATE_ERROR_TO_SERVER } from '../error-handling/error-response/prop
import { CxCommonEngine } from './cx-common-engine';

// Test how the CxCommonEngine handles successful server-side rendering
@Component({ selector: 'cx-mock', template: 'some template' })
@Component({
selector: 'cx-mock',
template: 'some template',
standalone: false,
})
export class SuccessComponent {}

@NgModule({
Expand All @@ -22,6 +26,7 @@ export class SuccessServerModule {}
@Component({
selector: 'cx-response',
template: ``,
standalone: false,
})
export class WithPropagatedErrorComponent {
constructor() {
Expand All @@ -43,6 +48,7 @@ export const SOME_TOKEN = new InjectionToken<string>('SOME_TOKEN');
@Component({
selector: 'cx-token',
template: `message:{{ someToken }}`,
standalone: false,
})
export class TokenComponent {
someToken = inject(SOME_TOKEN);
Expand Down
2 changes: 1 addition & 1 deletion core-libs/setup/ssr/engine/cx-common-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
CommonEngine,
CommonEngineOptions,
CommonEngineRenderOptions,
} from '@angular/ssr';
} from '@angular/ssr/node';
import { PROPAGATE_ERROR_TO_SERVER } from '../error-handling/error-response/propagate-error-to-server';

/**
Expand Down
14 changes: 12 additions & 2 deletions core-libs/setup/ssr/engine/ng-express-engine.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ import { ngExpressEngine } from './ng-express-engine';
* - https://github.com/angular/universal/blob/e798d256de5e4377b704e63d993dc56ea35df97d/modules/express-engine/spec/mock.server.module.ts
*
*/
@Component({ selector: 'cx-mock', template: 'some template' })
@Component({
selector: 'cx-mock',
template: 'some template',
standalone: false,
})
export class MockComponent {}

/**
Expand Down Expand Up @@ -57,7 +61,11 @@ export class MockServerModule {}
* - https://github.com/angular/universal/blob/e798d256de5e4377b704e63d993dc56ea35df97d/modules/express-engine/spec/mock.server.module.ts
*
*/
@Component({ selector: 'cx-request', template: `url:{{ _req.url }}` })
@Component({
selector: 'cx-request',
template: `url:{{ _req.url }}`,
standalone: false,
})
export class RequestComponent {
constructor(@Inject(REQUEST) public readonly _req: any) {}
}
Expand Down Expand Up @@ -94,6 +102,7 @@ export class RequestServerModule {}
@Component({
selector: 'cx-response',
template: `statusCode:{{ _res.statusCode }}`,
standalone: false,
})
export class ResponseComponent {
constructor(@Inject(RESPONSE) public readonly _res: any) {}
Expand Down Expand Up @@ -144,6 +153,7 @@ export const SOME_TOKEN = new InjectionToken<string>('SOME_TOKEN');
@Component({
selector: 'cx-token',
template: `message:{{ _someToken.message }}`,
standalone: false,
})
export class TokenComponent {
constructor(@Inject(SOME_TOKEN) public readonly _someToken: any) {}
Expand Down
5 changes: 4 additions & 1 deletion core-libs/setup/ssr/engine/ng-express-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
*/

import { StaticProvider } from '@angular/core';
import { CommonEngineOptions, CommonEngineRenderOptions } from '@angular/ssr';
import {
CommonEngineOptions,
CommonEngineRenderOptions,
} from '@angular/ssr/node';
import { Request, Response } from 'express';
import { REQUEST, RESPONSE } from '../tokens/express.tokens';
import { CxCommonEngine } from './cx-common-engine';
Expand Down
5 changes: 4 additions & 1 deletion core-libs/setup/ssr/optimized-engine/rendering-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ export class RenderingCache {
if (this.options?.cacheSize) {
this.renders.delete(key);
if (this.renders.size >= this.options.cacheSize) {
this.renders.delete(this.renders.keys().next().value);
const oldestKey = this.renders.keys().next().value;
if (oldestKey !== undefined) {
this.renders.delete(oldestKey);
}
}
}
// cache only if shouldCacheRenderingResult return true
Expand Down
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
Loading

0 comments on commit 765fd33

Please sign in to comment.