UI Components powered by Angular and Ant Design
All components should have their own NgModule where they are declared and all dependencies imported.
Main development should be done via Storybook.
All component behavior from Tech Specs must be unit tested.
Main component styles should be in <component-name>.component.less file.
Optionally component may have theme styles that include Ant Design specific files
with customized theme from libs/styles/src/lib/themes/default/theme.less
and file should be named <component-name>.component.theme.less.
nx build <lib-name>NOTE: Before running any tests - make sure to cleanup dist folder!
nx test <lib-name>nx lint <lib-name>npm run stylelintNOTE: Before running any storybooks - make sure to cleanup libs from dist folder!
Serve:
nx run <lib-name>:storybookBuild:
nx run <lib-name>:build-storybookNOTE: Before running any storybooks - make sure to cleanup libs from dist folder!
Serve:
nx run storybook:serveBuild:
nx run storybook:compileAll components are classified according to Atomic Design into the following (form lowest to highest):
- Atom
 - Molecule
 - Organism
 
NOTE: Components with lower level cannot depend on components with higher level.
For this every component library should have associated ONE level tag:
level:atomlevel:moleculelevel:organism
type:*Describes the library typetype:component-serviceComponent with service librarytype:componentComponent librarytype:serviceServices librarytype:styleStyles librarytype:utilHelper utilities librarytype:metaMeta package that does not get deployed to NPM (internal infra)
level:*Describes the component type according to the Atomic Design frameworklevel:atomlevel:moleculelevel:organism
pkg:*Describes the package typepkg:primarypkg:extension
Every new library should be generated via NX CLI with @nx/angular:library schematic:
nx g @nx/angular:library <lib-name> --publishable --import-path @spryker/<lib-name> --tags level:<level>,type:<type>,pkg:<pkg>NOTE: When library is generated please do the following:
- In 
tsconfig.base.json- remove newly generated path 
paths[@spryker/<lib-name>]: 
"paths": { - "@spryker/<lib-name>": [ "libs/<lib-name>/src/index.ts" ] }
 - remove newly generated path 
 - In 
tsconfig.json- add the following to the 
references: 
{ "path": "./libs/<lib-name>/tsconfig.json" }, - add the following to the 
 - In 
libs/<lib-name>/.eslintrc.json- remove following section:
 
"extends": [ "plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates" ],
 - In 
libs/<lib-name>/jest.config.ts- remove following sections:
 
"transform": { ... }, "transformIgnorePatterns": [ ... ], "snapshotSerializers": [ ... ]
- add the following 
globals 
globals: { 'ts-jest': { tsconfig: '<rootDir>/tsconfig.spec.json', stringifyContentPathRegex: '\\.(html|svg)$', }, },
 - In 
libs/<lib-name>/ng-package.json- add 
styleIncludePathstolibfor theme imports (if needed): 
"lib": { ..., "styleIncludePaths": ["../styles/src/lib"] }
 - add 
 - In 
libs/<lib-name>/package.json- add 
publishConfigprop withaccess=publicvalue: 
"publishConfig": { "access": "public" },
 - add 
 - In 
libs/<lib-name>/tsconfig.json- remove following sections:
 
"compilerOptions": { ... }, "angularCompilerOptions": { ... }
- add reference to prod config
 
"references": [ ..., { "path": "./tsconfig.lib.prod.json" }, ]
 - In 
libs/<lib-name>/tsconfig.lib.prod.json- remove following section:
 
"angularCompilerOptions": { "compilationMode": "partial" }
 - In 
lib/<lib-name>/src/test-setup.ts- add global setup import:
 
import '../../../config/test-setup';
 - In 
lib/<lib-name>/src/project.json- add 
stylesasimplicitDependencies 
"implicitDependencies": ["styles"],
 - add 
 
Every new component should be generated via NX CLI with @schematics/angular:component schematic:
nx g @schematics/angular:component --name=<component-name> --project=<lib-name>Storybook setup should be added via NX CLI with @nx/storybook:configuration schematic:
nx g @nx/storybook:configuration --name=<lib-name>NOTE: Do the following updates after command above:
- 
In
<lib-name>/.storybook/tsconfig.json:- replace 
"include"array with (add"../../locale/data/**/src/index.ts"to array if using localization): 
"include": ["../src/**/*", "*.js"]
 - replace 
 - 
Change extension from
*.tsinto*.jsfor all files in the<lib-name>/.storybookfolder - 
Add
import '../../../.storybook/preview';to the<lib-name>/.storybook/preview.js - 
In
<lib-name>/.storybook/main.js:- 
Replace the whole:
const rootMain = require('../../../.storybook/main'); module.exports = { ...rootMain, webpackFinal: async (config, { configType }) => { // apply any global webpack configs that might have been specified in .storybook/main.js if (rootMain.webpackFinal) { config = await rootMain.webpackFinal(config, { configType }); } // add your own webpack tweaks if needed return config; }, stories: ['../**/*.@(mdx|stories.@(ts))'], };
 
 - 
 - 
In
libs/<lib-name>/tsconfig.json:- add reference to prod config
 
"references": [ ..., { "path": "./.storybook/tsconfig.json" }, ]
 - 
In
lib/<lib-name>/src/project.json- add new configs for 
targetssection 
"targets": { ..., "storybook": { "executor": "@storybook/angular:start-storybook", "options": { "port": 4400, "configDir": "libs/<lib-name>/.storybook", "browserTarget": "<lib-name>:build-storybook", "compodoc": true, "compodocArgs": ["-e", "json", "-d", "dist"], "enableProdMode": false, "styles": [".storybook/styles.less"] }, "configurations": { "ci": { "quiet": true } } }, "build-storybook": { "executor": "@storybook/angular:build-storybook", "outputs": ["{options.outputPath}"], "options": { "outputDir": "dist/storybook/<lib-name>", "configDir": "libs/<lib-name>/.storybook", "browserTarget": "<lib-name>:build-storybook", "compodoc": true, "compodocArgs": ["-e", "json", "-d", "dist"], "enableProdMode": false, "styles": [".storybook/styles.less"] }, "configurations": { "ci": { "quiet": true } } }, },
 - add new configs for 
 
Generate stories for library module via NX CLI with @nx/angular:stories schematic:
nx g @nx/angular:stories --name=<lib-name>NOTE: NgModules of the library should declare components for which stories should be generated.
This command can be re-run many times - it will only generate missing stories and keep existing ones untouched.
Generate stories for components via NX CLI with @nx/angular:component-story schematic:
nx g @nx/angular:component-story --project-path libs/<lib-name> --component-path src/lib/<lib-name> --component-name <ComponentName> --component-file-name <name.component>The localization is provided from each package directly for the package.
The location of i18n files are in: libs/<lib-name>/src/i18n/.
Then each specific language is placed in its own file (ex. en.ts or de.ts)
and MUST default export an interface I18nLocaleDataPackage from package locale.
All the i18n files are then aggregated into a main package locale during a build phase.
As all separate i18n files are aggregated in single locale package
it's important to understand how to release it correctly
(read about Release process).
The changes in separate i18n files will only trigger publishing of their package
but the main locale package will not be published.
In order to publish locale package - go to it's
main entry point file
and update the Locale Version number in the comment at the top.
All commit messages should follow conventional commits specification.
To perform commit you can use a tool that replaces git commit command - npm run ct/yarn ct.
All project files are formatted via prettier.
To perform full project format run:
npm run formatTo perform format check run:
npm run format:checkReleasing and versioning is done fully automatic using lerna.
This is the reason why commits according to conventional changelog is crucial.
All releases are done by merging/pushing to release branches via Travis CI.
During the release:
- git tags are created
 - package versions updated
 - package changelogs updated
 - packages published to NPM registry
 
These are the release branches (git branch => @npm tag):
master=>@latestnext=>@nextbeta=>@betaalpha=>@alpharc=>@rc
Sometimes publishing to NPM may fail due to several reasons:
- NPM services experience outages
 - Configuration of certain packages prevent them from being published by NPM (ex. public access is not explicitly set)
 
This may result in some or all packages not published even when version and changelogs were updated and pushed back to git.
In this case you need to:
- Make sure that the issue that prevented packages from publishing is resolved
 - Merge the branch that failed into related 
recoverybranch (add to name prefixrepublish/) 
Recovery branches for republishing:
master=>republish/masternext=>republish/nextbeta=>republish/betaalpha=>republish/alpharc=>republish/rc
After branch is pushed to CI it will attempt to find unpublished packages in NPM and try to publish them again with the same versions.
For contribution guidelines, see Code contribution guide.