-
Repository Structure: This project maintains a single main branch:
master- Main development branch for the JavaScript SDK
-
Contribution Process: All changes must be submitted via pull request after forking the repository
-
Branch Strategy: Create feature branches from the
masterbranch
- Node.js: Version 20 (currently used for building)
- npm: Latest stable version
- Git: For version control
- Fork and clone the repository:
git clone https://github.com/your-username/js-sdk.git
cd js-sdk- Install dependencies:
npm install- Start development environment:
npm run demoThis starts both the Express server (localhost:8888) and BrowserSync (localhost:3000) for live development.
Every commit must meet these requirements:
- Stable State: Each commit should leave the codebase in a working, stable state
- ESLint Compliance: Code must pass ESLint checks without errors if the code in the files passed them before your modifications
- Build Success: All build scripts must complete without errors
- Demo Functionality: Changes must not break existing demo cases
- Browser Compatibility: Ensure compatibility with supported browsers (>1%, last 2 versions, not IE ≤9)
The project uses ESLint with the following key rules:
- Indentation: 4 spaces
- Semicolons: Always required
- Modern JavaScript: Use
constwhen variables aren't reassigned - Code Quality:
- Maximum function depth: 4 levels
- Maximum function parameters: 4
- Avoid magic numbers (except -1, 0, 1, 2)
When contributing code, follow these principles:
- Make the smallest reasonable changes to get to the desired outcome
- Prefer simple, clean, maintainable solutions over clever or complex ones, even if the latter are more concise or performant. Readability and maintainability are primary concerns
- Match the style and formatting of surrounding code when modifying existing files, even if it differs from standard style guides. Consistency within a file is more important than strict adherence to external standards
# Check code style (project should have this command)
npm run lint
# Build project to verify no errors
npm run build
# Check specific file with targeted linting
npx eslint modules/integrator.jsImportant: Because we still have many existing lint issues in the codebase, you should use targeted linting to check only the files you've modified. There should be no more lint issues after your changes than there were before. If a file passed lint before your modification, it must pass lint after your modification in every commit.
Example of checking a specific file:
# Check only the file you modified
npx eslint modules/extensions/fields/YourNewExtension.js
# Check multiple specific files
npx eslint modules/integrator.js modules/ams.jsFollow our commit message format:
Title: Brief description in imperative mood (under 70 characters)
Body:
Explain WHY the changes are needed (4-5 sentences max).
Reference relevant issues, meetings, or discussions.
Keep lines under 70 characters for readability.
You are writing this text for a reviewer. Don't make his life hard.
For implementation details see [ISSUE-NUMBER].
Title:
- Use English and imperative language ("Add feature" not "Added feature")
- Answer "WHAT?" - describe what the commit does
- Keep under 70 characters
- No issue numbers in the title
Body:
- Explain "WHY?" - provide context for the changes
- Reference issues, emails, or meetings with specific identifiers
- Use professional, neutral language
- Break lines at ~70 characters
- Include 4-5 sentences maximum
Example Good Commit:
Add autocomplete dropdown keyboard navigation support
Enable users to navigate address suggestions using keyboard inputs
to improve accessibility compliance and user experience. Users can
now use Tab, Enter, and arrow keys to interact with suggestions
without requiring mouse input.
This change addresses accessibility requirements outlined in WCAG 2.1
guidelines and moves the solution towards better EAA compatibility.
For implementation details see SDK-123. Related accessibility
requirements documented in SDK-456.
- Vague titles like "fixed stuff" or "updates"
- Multiple unrelated changes in one commit
- Missing context about why changes were made
- Unprofessional language or jokes
- Lines exceeding 70 characters
- Mixing different types of changes (bug fixes + new features + refactoring)
- Adding fixes for previous commits. Just amend previous commits yourself. Please.
- Too much text
- Technical details of the implementation, unless they are not understandable from reading the code
- Changing semver in package.json. We do it ourself, when we release.
The project uses Webpack and Babel for building:
# Full production build
npm run build
# Build styles only
npm run build-styles
# Development server with live reload
npm run demo- Start demo environment:
npm run demo-
Test various use cases:
- Navigate to
localhost:8888 - Test the comprehensive example at
/use-cases/example/ - Verify miniconfig and test scenarios
- Test with different API keys and configurations
- Navigate to
-
Cross-browser testing:
- Test in supported browsers
- Verify polyfill functionality in older browsers
- Check responsive behavior
- Test SDK integration with the Shopware 6 example
- Verify all services work together (AMS, email, phone, person)
- Test various configuration combinations
When creating new modules:
- Follow existing patterns in
modules/directory - Extend the base component from
modules/components/base.js - Use the extension system for field and validation logic
- Implement proper error handling and user feedback
For new field or validation extensions:
- Field extensions go in
modules/extensions/fields/ - Follow naming convention:
[FieldName]Extension.js - Implement required interface methods
When modifying UI components:
- Use Mustache templating for dynamic content
- Follow SCSS structure in
themes/directory - Maintain theme compatibility across different implementations
- Test with various CSS frameworks
For changes that might break existing integrations:
- Document breaking changes clearly in commit messages and in the PR message
- Provide migration guide when applicable
- Consider backward compatibility options
- Update demo cases to reflect new usage patterns
Before submitting your PR:
- ✅ All commits follow the message guidelines above
- ✅ Code passes ESLint without errors
- ✅ All build scripts complete successfully
- ✅ Demo environment works correctly
- ✅ Feature branch created from
masterbranch - ✅ Browser compatibility verified across supported browsers
- ✅ Integration tested with demo cases
Include in your PR description:
## Summary
Brief description of changes
## Changes Made
- List specific changes
- Include any new features or fixes
## Testing
- [ ] Manual testing in demo environment
- [ ] Cross-browser compatibility verified
- [ ] Integration testing completed
- [ ] No breaking changes to existing APIs
## Related Issues
Reference any related GitHub issuesUse this checklist for each commit:
- Commit has clear, imperative title under 70 characters
- Body explains business reason/context for changes
- Professional language used throughout
- Lines broken at ~70 characters for readability
- References to relevant issues/meetings included
- Code follows ESLint configuration
- Build scripts complete without errors
- Demo cases still function correctly
- Changes are logically grouped (not mixing unrelated modifications)
- No fixes for previous commits in new commits
- Browser compatibility maintained
If you're unsure about any of these requirements or need clarification on the commit message format, please ask in the issue comments before starting work. For technical questions about the SDK architecture or integration patterns, contact:
- Technical Support: support@endereco.de
- GitHub Issues: https://github.com/Endereco/js-sdk/issues
We're happy to provide guidance to ensure your contribution meets our standards and integrates well with the existing codebase.
Note: These guidelines ensure code quality, maintainability, and a clear project history. Following them helps reviewers understand your changes and makes the SDK easier to maintain long-term.